tc_init.9: misc. cleanup

2023-03-28 Thread Scott Cheloha
I would like to spruce up this manpage. - Try to describe what kern_tc.c does more completely and a bit more plainly. - Mention *all* the requirements. Try to describe the rollover margin in plainer language. - Revise field descriptions for struct timecounter. No need to mention fields

Re: mg: fix tagfile parsing

2023-03-28 Thread Omar Polo
On 2023/03/28 22:25:42 +0200, Theo Buehler wrote: > Contrary to what I convinced op@ to be the case, duplicate tags may exist > in legitimate tags files. So we should ignore duplicates rather than > erroring on them. This fixes parsing the /var/db/libc.tags file. > > $ grep -wc ^memcpy

mg: fix tagfile parsing

2023-03-28 Thread Theo Buehler
Contrary to what I convinced op@ to be the case, duplicate tags may exist in legitimate tags files. So we should ignore duplicates rather than erroring on them. This fixes parsing the /var/db/libc.tags file. $ grep -wc ^memcpy /var/db/libc.tags 2 Index: tags.c

mg: don't load tags files lazily

2023-03-28 Thread Omar Polo
tagsvisit (aka `visit-tags-table') records the path to the tags file which is lazily opened upon find-tags (aka M-.). visit-tags-table tries also to be smart and checks that the argument is really a file using a stat + access dance, and loadtags() which will be called way later just opens the

Re: bgpd trigger error on pt_fill abuse

2023-03-28 Thread Theo Buehler
On Tue, Mar 28, 2023 at 06:49:38PM +0200, Claudio Jeker wrote: > I almost stepped into this trap and tried to pt_ref the static memory > returned by pt_fill(). That wont work so better make the code explode. > By setting the refcnt to USHRT_MAX a following pr_ref() call will fail. > Since pt_alloc

bgpd trigger error on pt_fill abuse

2023-03-28 Thread Claudio Jeker
I almost stepped into this trap and tried to pt_ref the static memory returned by pt_fill(). That wont work so better make the code explode. By setting the refcnt to USHRT_MAX a following pr_ref() call will fail. Since pt_alloc copies the passed data structure reset the refcnt to 0 there. I think

Re: bgpd rework how prefixes are written

2023-03-28 Thread Claudio Jeker
On Tue, Mar 28, 2023 at 05:02:26PM +0200, Theo Buehler wrote: > On Tue, Mar 28, 2023 at 03:35:46PM +0200, Claudio Jeker wrote: > > This diff moves prefix_write to rde_prefix.c and renames it to pt_write. > > The function now takes a struct pt_entry * as argument and with this the > > extra

Re: bgpd rework how prefixes are written

2023-03-28 Thread Theo Buehler
On Tue, Mar 28, 2023 at 03:35:46PM +0200, Claudio Jeker wrote: > This diff moves prefix_write to rde_prefix.c and renames it to pt_write. > The function now takes a struct pt_entry * as argument and with this the > extra indirection via pt_getaddr() falls away. I'm ok with this, although it's not

Re: [patch] usr.bin/mg/region.c: Set default shell path if SHELL is NULL

2023-03-28 Thread Todd C . Miller
On Tue, 28 Mar 2023 16:19:42 +0200, Omar Polo wrote: > sigh... forgot to advance the pointer after strrchr otherwise argv[0] > would have been /ksh instead of "ksh". OK millert@ for this version. - todd

Re: [patch] usr.bin/mg/region.c: Set default shell path if SHELL is NULL

2023-03-28 Thread Omar Polo
On 2023/03/28 10:21:59 +0200, Omar Polo wrote: > On 2023/03/27 18:58:07 -0600, Todd C. Miller wrote: > > It might be best to use the basename of the actual shell for argv[0]. > > Our ksh for instance has slightly different behavior when invoked > > as sh. > > like this? :) > > (need an

bgpd rework how prefixes are written

2023-03-28 Thread Claudio Jeker
This diff moves prefix_write to rde_prefix.c and renames it to pt_write. The function now takes a struct pt_entry * as argument and with this the extra indirection via pt_getaddr() falls away. -- :wq Claudio Index: mrt.c === RCS

Re: isakmpd: avoid double free

2023-03-28 Thread Jonathan Gray
On Tue, Mar 28, 2023 at 09:08:22AM +0200, Theo Buehler wrote: > Fixed the same problem in iked/dh.c r1.31: > > In the unlikely event that EC_KEY_check_key() fails, dh_init() fails and > group_free() is called, which will EC_KEY_free(group-ec) a second time. ok jsg@ > > Index: dh.c >

Re: bgpd more cleanup of pt_entry

2023-03-28 Thread Theo Buehler
On Tue, Mar 28, 2023 at 02:19:46PM +0200, Claudio Jeker wrote: > Now that the accounting in bgpctl is fixed we can move some structs from > rde.h into rde_prefix.c and hide them from everyone else. > Also cleanup the AID_PTSIZE define it is only used in one place now. ok tb

bgpd more cleanup of pt_entry

2023-03-28 Thread Claudio Jeker
Now that the accounting in bgpctl is fixed we can move some structs from rde.h into rde_prefix.c and hide them from everyone else. Also cleanup the AID_PTSIZE define it is only used in one place now. -- :wq Claudio Index: bgpd.h

Re: bgpd rtr recalculation semaphor

2023-03-28 Thread Theo Buehler
On Tue, Mar 28, 2023 at 11:48:07AM +0200, Claudio Jeker wrote: > When an RTR session updates the data it happens between CACHE_RESPONSE and > END_OF_DATA PDUs. When an END_OF_DATA PDU is received the various sources > are merged into one table and sent to the RDE. > Now since bgpd supports

Re: TLS 1.3 ClientHello and Windows 11

2023-03-28 Thread t...@openbsd.org
On Tue, Mar 28, 2023 at 10:17:17AM +, Gerhard Roth wrote: > I stumbled upon a problem that xfreerdp couldn't connect to Windows 11 > servers with NLA and TLS 1.3. This can also be reproduced with > > # openssl -tls1_3 -connect :3389 > > Here openssl will fail with a "tlsv1 alert

bgpd change pt accounting

2023-03-28 Thread Claudio Jeker
Make bgpctl less depend on bgpd internals. Track the size of memory used by prefixes explicitly. This will allow to move the various pt_entry structs out of rde.h. -- :wq Claudio Index: bgpctl/bgpctl.h === RCS file:

TLS 1.3 ClientHello and Windows 11

2023-03-28 Thread Gerhard Roth
I stumbled upon a problem that xfreerdp couldn't connect to Windows 11 servers with NLA and TLS 1.3. This can also be reproduced with # openssl -tls1_3 -connect :3389 Here openssl will fail with a "tlsv1 alert internal error" instead of blocking in "read R BLOCK". So I played around

Re: bgpd mrt use ibuf instead of fixed buffer

2023-03-28 Thread Theo Buehler
On Tue, Mar 28, 2023 at 11:33:11AM +0200, Claudio Jeker wrote: > On Tue, Mar 28, 2023 at 11:00:37AM +0200, Theo Buehler wrote: > > On Tue, Mar 28, 2023 at 10:35:34AM +0200, Claudio Jeker wrote: > > > Switch mrt_dump_entry_v2() to use a dynamic ibuf for the prefix and > > > switch the order of

bgpd rtr recalculation semaphor

2023-03-28 Thread Claudio Jeker
When an RTR session updates the data it happens between CACHE_RESPONSE and END_OF_DATA PDUs. When an END_OF_DATA PDU is received the various sources are merged into one table and sent to the RDE. Now since bgpd supports multiple RTR servers it is possible that two servers run updates roughly at

Re: bgpd mrt use ibuf instead of fixed buffer

2023-03-28 Thread Claudio Jeker
On Tue, Mar 28, 2023 at 11:00:37AM +0200, Theo Buehler wrote: > On Tue, Mar 28, 2023 at 10:35:34AM +0200, Claudio Jeker wrote: > > Switch mrt_dump_entry_v2() to use a dynamic ibuf for the prefix and > > switch the order of operation so that the memmove() of pbuf is no longer > > needed. Using a

Re: [patch] usr.bin/mg/region.c: Set default shell path if SHELL is NULL

2023-03-28 Thread lux
On Tue, 2023-03-28 at 11:22 +0200, Omar Polo wrote: > On 2023/03/28 17:02:18 +0800, lux wrote: > > On Mon, 2023-03-27 at 18:58 -0600, Todd C.Miller wrote: > > > > > > > -   _exit(1); > > > > -   if (path == NULL) > > > > _exit(1); > > > >  

Re: [patch] usr.bin/mg/region.c: Set default shell path if SHELL is NULL

2023-03-28 Thread Omar Polo
On 2023/03/28 17:02:18 +0800, lux wrote: > On Mon, 2023-03-27 at 18:58 -0600, Todd C.Miller wrote: > > > > > -   _exit(1); > > > -   if (path == NULL) > > > _exit(1); > > >   > > Hi, `pipeio' looks like a common function, so maby called in

Re: [patch] usr.bin/mg/region.c: Set default shell path if SHELL is NULL

2023-03-28 Thread lux
On Mon, 2023-03-27 at 18:58 -0600, Todd C.Miller wrote: > > > -   _exit(1); > > -   if (path == NULL) > > _exit(1); > >   Hi, `pipeio' looks like a common function, so maby called in others code, checking the path is NULL is a safe check,

Re: bgpd mrt use ibuf instead of fixed buffer

2023-03-28 Thread Theo Buehler
On Tue, Mar 28, 2023 at 10:35:34AM +0200, Claudio Jeker wrote: > Switch mrt_dump_entry_v2() to use a dynamic ibuf for the prefix and > switch the order of operation so that the memmove() of pbuf is no longer > needed. Using a static buffer is problematic when flowspec support is > added since

bgpd mrt use ibuf instead of fixed buffer

2023-03-28 Thread Claudio Jeker
Switch mrt_dump_entry_v2() to use a dynamic ibuf for the prefix and switch the order of operation so that the memmove() of pbuf is no longer needed. Using a static buffer is problematic when flowspec support is added since flowspec "prefixes" can be more than 255 bytes long. -- :wq Claudio

Re: [patch] usr.bin/mg/region.c: Set default shell path if SHELL is NULL

2023-03-28 Thread Omar Polo
On 2023/03/27 18:58:07 -0600, Todd C. Miller wrote: > On Mon, 27 Mar 2023 20:06:30 +0200, Omar Polo wrote: > > > Is _PATH_BSHELL portable though? I can see a few stuff that uses it > > (vi among others) but I'm not sure. > > The paths.h header is a BSD invention, though it may be present on >

Re: bgpd role mini cleanup

2023-03-28 Thread Theo Buehler
On Tue, Mar 28, 2023 at 10:17:28AM +0200, Claudio Jeker wrote: > I think flipping the logic around makes the statements easier to read. > Also we may need to add an extra role for siblings which behave like > customers (using the downstream algorithm result). Makes sense, ok > > -- > :wq

bgpd role mini cleanup

2023-03-28 Thread Claudio Jeker
I think flipping the logic around makes the statements easier to read. Also we may need to add an extra role for siblings which behave like customers (using the downstream algorithm result). -- :wq Claudio Index: rde.c === RCS

isakmpd: avoid double free

2023-03-28 Thread Theo Buehler
Fixed the same problem in iked/dh.c r1.31: In the unlikely event that EC_KEY_check_key() fails, dh_init() fails and group_free() is called, which will EC_KEY_free(group-ec) a second time. Index: dh.c === RCS file:

Re: [patch] usr.bin/mg/region.c: Set default shell path if SHELL is NULL

2023-03-28 Thread lux
On Mon, 2023-03-27 at 20:06 +0200, Omar Polo wrote: Hello, thank you for your correction. > > if (dup2(s[1], STDERR_FILENO) == -1) > -   _exit(1); > -   if (path == NULL) > _exit(1); But, I think the condition that path is