bgpd move nexthop connected magic to kroute

2022-08-23 Thread Claudio Jeker
The RDE does some magic dance around connected networks and their gateway which should be done in kroute.c instead. At least then both functions doing gateway lookups do this magic in the same .c file. It also makes the RDE code a simpler which is good. The RDE actually no longer uses this informat

Re: rpki-client: check absence of SIA extension in rsc.c

2022-08-19 Thread Claudio Jeker
On Fri, Aug 19, 2022 at 05:03:30PM +0200, Theo Buehler wrote: > This implements this bit from section 2 (also mentioned in section 5) of > the latest RSC draft: > > because RSCs MUST NOT be distributed through the >global RPKI Repository system, the Subject Information Access

Re: rpki-client: disallow inherit in ROA EE IP Resources extension

2022-08-19 Thread Claudio Jeker
On Sat, Aug 13, 2022 at 04:51:05PM +0200, Theo Buehler wrote: > On Fri, Aug 12, 2022 at 09:59:11PM +0200, Theo Buehler wrote: > > On Wed, Aug 10, 2022 at 06:16:30PM +0200, Theo Buehler wrote: > > > On Wed, Aug 10, 2022 at 03:10:19PM +, Job Snijders wrote: > > > > Hi all, > > > > > > > > An err

bgpd fix nexthop lookup for connected networks

2022-08-19 Thread Claudio Jeker
When implementing knexthop_true_nexthop() to do the lookup from BGP nexthop to the true nexthop used by the FIB I forgot to handle connected networks properly. For connected networks and connected nexthops the BGP exit nexthop is equal to the true nexthop used by the FIB since the nexthop is direc

Re: all architectures: put clockframe definition in frame.h?

2022-08-18 Thread Claudio Jeker
On Thu, Aug 18, 2022 at 10:32:36PM -0500, Scott Cheloha wrote: > Hi, > > clockframe is sometimes defined in cpu.h, sometimes in frame.h, and > sometimes defined once each in both header files. > > Can we put the clockframe definitions in frame.h? Always? It is, at > least ostensibly, a "frame".

bgpd, uninitalised check in kroute_insert()

2022-08-18 Thread Claudio Jeker
Noticed while compling with gcc. In kroute_insert() the check for possible multipath routes is: if (krm == NULL) kr_redistribute(IMSG_NETWORK_ADD, kt, kf); The problem is krm is only set in the IPv4 path but not in the IPv6 one. The diff below fixes this by using a new vari

bgpd more kroute cleanup

2022-08-18 Thread Claudio Jeker
It makes no sense to pass the fd to send_rtmsg() as an argument. The code just passes the fd from the global kr_state. It also makes the code less portable because for linux an mnl handle needs to be passed. By dropping this the code becomes simpler. -- :wq Claudio Index: kroute.c ==

bgpd switch to memxyz() from bxyz()

2022-08-17 Thread Claudio Jeker
I did switch to memset from bzero and from bcopy to memcpy whenever I touched the code but now I just decided to change all users of bcopy(), bzero() and bcmp() to use memcpy(), memset() and memcmp(). None of the bcopy() users had overlapping memory regions so memcpy() should be fine. -- :wq Cla

Re: bgpd kroute includes cleanup

2022-08-17 Thread Claudio Jeker
On Wed, Aug 17, 2022 at 02:48:42PM +0200, Theo Buehler wrote: > On Wed, Aug 17, 2022 at 02:25:51PM +0200, Claudio Jeker wrote: > > Remove some unneeded headers from kroute.c > > Also move sys/tree.h up above the other sys includes. > > err.h was never used, fcntl.h was use

bgpd kroute includes cleanup

2022-08-17 Thread Claudio Jeker
Remove some unneeded headers from kroute.c Also move sys/tree.h up above the other sys includes. -- :wq Claudio Index: kroute.c === RCS file: /cvs/src/usr.sbin/bgpd/kroute.c,v retrieving revision 1.291 diff -u -p -r1.291 kroute.c --

bgpd unroll struct kif_node into struct kif

2022-08-17 Thread Claudio Jeker
The same thing was done for kroute and knexthop. kif can benefit from the same. Diff is mostly mechanical. -- :wq Claudio Index: kroute.c === RCS file: /cvs/src/usr.sbin/bgpd/kroute.c,v retrieving revision 1.290 diff -u -p -r1.290 k

Re: bgpd better nexthop handling

2022-08-15 Thread Claudio Jeker
On Mon, Aug 15, 2022 at 03:00:36PM +0200, Theo Buehler wrote: > On Mon, Aug 15, 2022 at 02:26:32PM +0200, Claudio Jeker wrote: > > On Fri, Aug 12, 2022 at 03:30:16PM +0200, Claudio Jeker wrote: > > > On Fri, Aug 12, 2022 at 03:06:14PM +0200, Theo Buehler wrote: > > > &

Re: bgpd better nexthop handling

2022-08-15 Thread Claudio Jeker
On Fri, Aug 12, 2022 at 03:30:16PM +0200, Claudio Jeker wrote: > On Fri, Aug 12, 2022 at 03:06:14PM +0200, Theo Buehler wrote: > > On Fri, Aug 12, 2022 at 12:43:09PM +0200, Claudio Jeker wrote: > > > There is currently a race in bgpd when multiple nexthop become invalid at > &

httpd, use proper type for clt_descreq and clt_descresp

2022-08-15 Thread Claudio Jeker
There is no need to use void * for clt_descreq and clt_descresp. The only thing these point to are struct http_descriptor. So make them struct http_descriptor pointers. This kills a typecast in server_fcgi.c. -- :wq Claudio Index: httpd.h =

switch tcpbench to use TCP_INFO instead of kvm

2022-08-13 Thread Claudio Jeker
This diff changes tcpbench to use the TCP_INFO getsockopt to fetch all the extra information instead of kvm. The variable names change because of this. -- :wq Claudio Index: Makefile === RCS file: /cvs/src/usr.bin/tcpbench/Makefile,

Re: bgpd better nexthop handling

2022-08-12 Thread Claudio Jeker
On Fri, Aug 12, 2022 at 03:06:14PM +0200, Theo Buehler wrote: > On Fri, Aug 12, 2022 at 12:43:09PM +0200, Claudio Jeker wrote: > > There is currently a race in bgpd when multiple nexthop become invalid at > > the same time. The problem is that the decision process may select an

Re: bgplgd(8) handle timeout more gracefully

2022-08-12 Thread Claudio Jeker
On Fri, Aug 12, 2022 at 03:16:36PM +0200, Theo Buehler wrote: > On Fri, Aug 12, 2022 at 12:53:59PM +0200, Claudio Jeker wrote: > > After all this slowcgi timeout fixing, here a similar thing for bgplgd(8). > > If the timeout fires, kill the bgpctl command first with SIGTERM then w

bgplgd(8) handle timeout more gracefully

2022-08-12 Thread Claudio Jeker
After all this slowcgi timeout fixing, here a similar thing for bgplgd(8). If the timeout fires, kill the bgpctl command first with SIGTERM then with SIGKILL. If the kill fails, close and cleanup the connection. I also reduced the timeout to a more reasonable 30sec. Lets see how that goes. This wil

bgpd better nexthop handling

2022-08-12 Thread Claudio Jeker
There is currently a race in bgpd when multiple nexthop become invalid at the same time. The problem is that the decision process may select an alternative path that also has a no longer valid nexthop but the process that does all the adjustments did not reach that prefix yet. The main issue here i

Re: httpd server_fcgi_read vs HEAD requests

2022-08-11 Thread Claudio Jeker
On Thu, Aug 11, 2022 at 08:41:43PM +0200, Omar Polo wrote: > On 2022/08/11 19:37:08 +0200, Claudio Jeker wrote: > > Reading through the fcgi code of httpd I wonder if HEAD requests are > > handled correctly. In server_fcgi_read() the function just returns when it > > hits the

httpd server_fcgi_read vs HEAD requests

2022-08-11 Thread Claudio Jeker
Reading through the fcgi code of httpd I wonder if HEAD requests are handled correctly. In server_fcgi_read() the function just returns when it hits the HEAD case but I think this is not correct since it does not drain the clt_srvevb buffer and it kind of ignores possible padding bytes. I think wh

Re: slowcgi, httpd and fastcgi abnormal termination

2022-08-11 Thread Claudio Jeker
On Thu, Aug 11, 2022 at 11:49:12AM +0200, Florian Obser wrote: > On 2022-08-11 11:39 +02, Claudio Jeker wrote: > > On Wed, Aug 10, 2022 at 09:45:44PM +0200, Omar Polo wrote: > >> On 2022/08/10 15:07:15 +0200, Claudio Jeker wrote: > >> > On Sun, Aug 07, 2022 at 11:

Re: slowcgi, httpd and fastcgi abnormal termination

2022-08-11 Thread Claudio Jeker
On Wed, Aug 10, 2022 at 09:45:44PM +0200, Omar Polo wrote: > On 2022/08/10 15:07:15 +0200, Claudio Jeker wrote: > > On Sun, Aug 07, 2022 at 11:10:22AM +0200, Omar Polo wrote: > > > blob - ddf83f965d0e6a99ada695694bea77b775bae2aa > > > blob + 1d577ba63efca

Re: bgpd: inverted NULL check in krVPN6_change()

2022-08-10 Thread Claudio Jeker
On Wed, Aug 10, 2022 at 03:59:12PM +0200, Theo Buehler wrote: > The below matches the VPN4 code and makes more sense given that we deref > kr6 in the else block. > > Index: kroute.c > === > RCS file: /cvs/src/usr.sbin/bgpd/kroute.c,v

Re: slowcgi, httpd and fastcgi abnormal termination

2022-08-10 Thread Claudio Jeker
On Sun, Aug 07, 2022 at 11:10:22AM +0200, Omar Polo wrote: > I'm not sure httpd(8) handles correctly when the fastcgi application > (e.g. slowcgi) closes the connection prematurely. > > To verify it, I'm playing with three simple CGI scripts running under > slowcgi with a very low timeout (-t2).

bgpd more nexthop cleanup

2022-08-10 Thread Claudio Jeker
This is more of what I just did in other places. Use direct assignment instead of memcpy(), remove double bzero() calls, switch to memset() and order struct kroute_nexthop in a more sensible way. There should be no behaviour change from all this. -- :wq Claudio Index: bgpd.h

fix bgpctl show network header

2022-08-10 Thread Claudio Jeker
bgpctl show network uses the same data handler as bgpctl show fib. I increased the space between destination and gateway for IPv6 for the latter but forgot to adjust the former. Before: flags: S = Static flags prio destination gateway S0 10.2.3.0/24 0.0.0.0 A

Re: rpki-client: decrease how long to wait for the remote peer to send IO

2022-08-10 Thread Claudio Jeker
On Wed, Aug 10, 2022 at 02:17:53AM +, Job Snijders wrote: > Dear all, > > I like to run rpki-client very often, and not be bogged down with > non-responsive respositories. If a repository is uncommunicative, > rpki-client as-is will try other transports, or come back later (because > of a next

bgpd fix bgpctl show network

2022-08-10 Thread Claudio Jeker
When introducing prefix_nhvalid(p) the code in network_dump_upcall() was not correctly adjusted: Before: if (prefix_nexthop(p) == NULL || prefix_nexthop(p)->state != NEXTHOP_REACH) kf.nexthop.aid = kf.prefix.aid; else kf.nexthop = prefix_

Re: Use SMR instead of SRP list in rtsock.c

2022-08-10 Thread Claudio Jeker
On Fri, Jul 01, 2022 at 04:03:21PM +, Visa Hankala wrote: > On Fri, Jul 01, 2022 at 09:59:11AM +0200, Claudio Jeker wrote: > > On Thu, Jun 30, 2022 at 03:46:35PM +, Visa Hankala wrote: > > > On Thu, Jun 30, 2022 at 11:51:52AM +0200, Claudio Jeker wrote: > > > &

Re: nd6: Constify sockaddr pointer arguments in nd6_*() functions

2022-08-09 Thread Claudio Jeker
On Tue, Aug 09, 2022 at 08:42:37AM +, Klemens Nanni wrote: > All of them are passed to inspect/copy out fields, none of the functions > writes to the struct. > > This makes it easier to argue about code (in MP context). > > For this to work, ifa_ifwithaddr(), ifa_ifwithdstaddr() and > ifaof_i

Re: Consistency and cleanup in /share/misc/airport

2022-08-06 Thread Claudio Jeker
On Sat, Aug 06, 2022 at 10:45:35PM +0200, Thomas Wager wrote: > On Sun, 2022-07-31 at 13:11 +0200, Thomas Wager wrote: > > On Sat, 2022-07-30 at 22:44 +0100, Stuart Henderson wrote: > > > Due to the rule for this file mentioned in the header, I think you'll > > > need to find a developer who has be

Re: net*: Add *toc*() helpers to const-convert between AF specific and generic structs

2022-08-05 Thread Claudio Jeker
On Fri, Aug 05, 2022 at 02:51:14PM +, Klemens Nanni wrote: > On Fri, Aug 05, 2022 at 08:08:17AM -0600, Theo de Raadt wrote: > > I struggle to see any value of this concept: If you put a cast in-line > > in the code, as a coder you can know what it means. But if you abstract > > the typecast t

Re: parallel divert packet soreceive

2022-08-04 Thread Claudio Jeker
On Thu, Aug 04, 2022 at 01:42:48PM +0200, Alexander Bluhm wrote: > On Thu, Aug 04, 2022 at 02:18:49AM +0300, Vitaliy Makkoveev wrote: > > Also, I like to have exclusive layer locks like `tcp_lock???, > > `udp_lock???, etc.. And take them with shared netlock held as the > > first step of inet socket

Re: rpki-client unveil main process

2022-08-04 Thread Claudio Jeker
On Thu, Aug 04, 2022 at 12:24:03PM +0200, Theo Buehler wrote: > On Thu, Aug 04, 2022 at 12:11:45PM +0200, Claudio Jeker wrote: > > This diff adds unveil to the main process. This is done after all files > > from the command line have been read. Both for regular and -f mode. > &g

rpki-client unveil main process

2022-08-04 Thread Claudio Jeker
This diff adds unveil to the main process. This is done after all files from the command line have been read. Both for regular and -f mode. Once the args have been read the process can limit the access to the cachedir and the output dir. In -f mode only read access to the cachdir is required. In re

Re: bgpd force fib sync in fetchtable

2022-08-02 Thread Claudio Jeker
On Tue, Aug 02, 2022 at 12:58:13PM +0100, Stuart Henderson wrote: > On 2022/08/02 12:34, Claudio Jeker wrote: > > On startup we load the routing table in bgpd and at that moment a cleanup > > of old bgpd routes should happen. I noticed this is not the case because > > fib_s

Re: openrsync: add --contimeout

2022-08-02 Thread Claudio Jeker
On Tue, Aug 02, 2022 at 12:42:26PM +, Job Snijders wrote: > Hi all, > > This adds '--contimeout' to rsync(1) > > $ time openrsync --contimeout=5 -rt rsync://203.119.21.1/test /tmp/k > openrsync: warning: connect timeout: 203.119.21.1, 203.119.21.1 > openrsync: error: cannot connect to host: 2

Re: rpki-client: add connect() MAX_CONTIMEOUT for rsync/rrdp

2022-08-02 Thread Claudio Jeker
On Tue, Aug 02, 2022 at 01:42:43PM +, Job Snijders wrote: > Hi, > > We were doing a lot of waiting in connect() for some (currently) broken > repositories. Move on with life after MAX_CONTIMEOUT seconds. > > This changeset reduces the real time spent fetching the RIPE TAL (with > hot cache) f

Re: bgpd force fib sync in fetchtable

2022-08-02 Thread Claudio Jeker
On Tue, Aug 02, 2022 at 01:44:42PM +0200, Theo Buehler wrote: > On Tue, Aug 02, 2022 at 12:34:40PM +0200, Claudio Jeker wrote: > > On startup we load the routing table in bgpd and at that moment a cleanup > > of old bgpd routes should happen. I noticed this is not the case because

bgpd force fib sync in fetchtable

2022-08-02 Thread Claudio Jeker
On startup we load the routing table in bgpd and at that moment a cleanup of old bgpd routes should happen. I noticed this is not the case because fib_sync is not set and so send_rtmsg() just returns. I think we need to force fib_sync in fetchtable() to make sure the cleanup happens correctly. OK?

Re: interface media without netlock

2022-07-31 Thread Claudio Jeker
On Sun, Jul 31, 2022 at 12:24:01PM +0100, Stuart Henderson wrote: > On 2022/07/28 13:30, Alexander Bluhm wrote: > > Problem is that smtpd(8) periodically checks media status. > > Really?! I bet it is the other simple protocol daemon, snmpd(8) -- :wq Claudio

Re: bgpd more kroute refactor

2022-07-28 Thread Claudio Jeker
On Thu, Jul 28, 2022 at 03:09:18PM +0200, Theo Buehler wrote: > On Thu, Jul 28, 2022 at 12:48:05PM +0200, Claudio Jeker wrote: > > Next step on the epic saga of cleaning up kroute.c > > > > Refactor kroute_remove() so that a struct kroute_full can be passed to the > &g

bgpd more kroute refactor

2022-07-28 Thread Claudio Jeker
Next step on the epic saga of cleaning up kroute.c Refactor kroute_remove() so that a struct kroute_full can be passed to the function. It updates the struct kroute_full with the route that got removed. I split the code into kroute[46]_remove() to make kroute_remove() less cluttered. The return v

bgpd remove F_DOWN flag

2022-07-28 Thread Claudio Jeker
When the bgpctl show fib diff is committed nothing uses F_DOWN anymore. Remove the flag and reshuffle some of the other flags to group them a bit better. -- :wq Claudio Index: bgpd.h === RCS file: /cvs/src/usr.sbin/bgpd/bgpd.h,v ret

adjust bgpctl show fib formatting

2022-07-28 Thread Claudio Jeker
This adjusts the output of bgpctl show fib. It removes the F_DOWN check since kroutes no longer track this. And it changes the flag printing code to reserve the space needed so that adjusting the flags does not break the output. Last but not least increase the size of destination and gateway to 32b

Re: bgpd another try at F_KERNEL removal

2022-07-27 Thread Claudio Jeker
On Wed, Jul 27, 2022 at 06:36:22PM +0200, Theo Buehler wrote: > On Wed, Jul 27, 2022 at 05:41:11PM +0200, Claudio Jeker wrote: > > My last try was not successful because kr_tofull() did not return RTP_MINE > > and so some checks for RTP_MINE instead of F_KERNEL did not work. >

bgpd another try at F_KERNEL removal

2022-07-27 Thread Claudio Jeker
My last try was not successful because kr_tofull() did not return RTP_MINE and so some checks for RTP_MINE instead of F_KERNEL did not work. This diff does two things. It replaces the F_KERNEL checks with !F_BGPD checks. F_KERNEL and F_BGPD are mutual exclusive. On top of that keep kr->priority at

Re: bgpd simplify kroute nexthop handling

2022-07-26 Thread Claudio Jeker
On Tue, Jul 26, 2022 at 05:35:47PM +0200, Theo Buehler wrote: > On Tue, Jul 26, 2022 at 05:17:23PM +0200, Claudio Jeker wrote: > > On Tue, Jul 26, 2022 at 03:51:40PM +0200, Theo Buehler wrote: > > > On Tue, Jul 26, 2022 at 03:09:37PM +0200, Claudio Jeker wrote: > > > &g

Re: bgpd simplify kroute nexthop handling

2022-07-26 Thread Claudio Jeker
On Tue, Jul 26, 2022 at 03:51:40PM +0200, Theo Buehler wrote: > On Tue, Jul 26, 2022 at 03:09:37PM +0200, Claudio Jeker wrote: > > This is another step in the epic kroute rework. > > > > Interfaces (kif) come with a list of kroutes attached to them which are > > only

bgpd simplify kroute nexthop handling

2022-07-26 Thread Claudio Jeker
This is another step in the epic kroute rework. Interfaces (kif) come with a list of kroutes attached to them which are only used to track the interface state and to fiddle with nexthop states. Now these lists are not really needed. One can just validate the nexthops without losing any relevant in

bgpd: fix nexthop state bug in decision process

2022-07-25 Thread Claudio Jeker
The nexthop validation or actually invalidation is buggy in bgpd since revision 1.90 of rde_decide.c. When I removed re->active and replaced it with a value that is calculated on the spot I did not realize that this calculation depends on the current nexthop state and not on the state used on the p

bgpd nexthop check

2022-07-23 Thread Claudio Jeker
Change the logic and name of bgpd_filternexthop(). This function applies the 'nexthop qualify via' config setting. Instead of telling if the route is filtered (true) or not (false) flip the logic around and rename the function to bgpd_oknexthop(). Also flip the internal logic around to simplify the

Re: nd6: Zap nd6_recalc_reachtm_interval indirection

2022-07-22 Thread Claudio Jeker
On Fri, Jul 22, 2022 at 12:18:34PM +, Klemens Nanni wrote: > Only used once, so use the macro directly like ND6_SLOWTIMER_INTERVAL > is used in many places. > > OK? Is that a value that should be adjustable? > diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c > index ff679bcb151..3decec9

bgpd kroute F_KERNEL flag

2022-07-22 Thread Claudio Jeker
There is no need to use F_KERNEL to tag routes from the kernel. All this can be done by priority (RTP_MINE vs anything else). The conversion is simple in most cases. In kr_fib_delete() and kr_fib_change() check if the route is a bgpd owned route and in that case remove the F_BGPD_INSERTED flag. Th

bgpd, relax setting rde evaluate all and add-path send

2022-07-21 Thread Claudio Jeker
rde evaluate all and add-path send do not really work together. add-path will evaluate extra paths (if plus is used) and so it implies a mode of `rde evaluate all`. I added the exclusion mainly to make it clear that the two don't really mix. After a request from Pier Carlo Chiodi on OpenBGPD-porta

Re: bgpd, refactor kroute_insert

2022-07-21 Thread Claudio Jeker
On Thu, Jul 21, 2022 at 12:03:27PM +0200, Theo Buehler wrote: > On Thu, Jul 21, 2022 at 11:10:41AM +0200, Claudio Jeker wrote: > > On Wed, Jul 20, 2022 at 12:28:25PM +0200, Claudio Jeker wrote: > > > On Wed, Jul 20, 2022 at 10:56:29AM +0200, Claudio Jeker wrote: >

Re: bgpd, refactor kroute_insert

2022-07-21 Thread Claudio Jeker
On Wed, Jul 20, 2022 at 12:28:25PM +0200, Claudio Jeker wrote: > On Wed, Jul 20, 2022 at 10:56:29AM +0200, Claudio Jeker wrote: > > This diff moves kroute_insert to use struct kroute_full and do the > > allocation for struct kroute / kroute6 inside kroute_insert. This removes >

Re: vsw.4: mention veb next to bridge

2022-07-21 Thread Claudio Jeker
On Wed, Jul 20, 2022 at 05:27:51PM -0700, Chris Cappuccio wrote: > Klemens Nanni [k...@openbsd.org] wrote: > > veb(4) works just fine in this setup, so don't give the impression only > > bridge(4) would work. > > > > In related items, is it time to tedu bridge(4) and vether(4) ? Is there > anythi

bgpd, network code cleanup

2022-07-20 Thread Claudio Jeker
The it's just a rtlabel refcount leak diff turned into a somewhat larger diff. First I noticed that expand_networks() was not used for l3vpns which will cause problems down the line. So alter expand_networks to also handle l3vpn network settings. Then I looked at kr_net_reload() and kr_net_find()

Re: bgpd, refactor kroute_insert

2022-07-20 Thread Claudio Jeker
On Wed, Jul 20, 2022 at 10:56:29AM +0200, Claudio Jeker wrote: > This diff moves kroute_insert to use struct kroute_full and do the > allocation for struct kroute / kroute6 inside kroute_insert. This removes > a lot of similar code all over kroute.c. While doing that also convert > kr_

Re: bgpd, plug rtlabel refcount leak on network statements

2022-07-20 Thread Claudio Jeker
On Wed, Jul 20, 2022 at 11:00:00AM +0200, Theo Buehler wrote: > On Wed, Jul 20, 2022 at 10:35:10AM +0200, Claudio Jeker wrote: > > Found while working on kroute code. The network structs needs to release > > the rtlabel reference before being freed. > > Don't expand_ne

bgpd, refactor kroute_insert

2022-07-20 Thread Claudio Jeker
This diff moves kroute_insert to use struct kroute_full and do the allocation for struct kroute / kroute6 inside kroute_insert. This removes a lot of similar code all over kroute.c. While doing that also convert kr_redistribute() to use struct kroute_full and kill the code duplication there as well

bgpd, plug rtlabel refcount leak on network statements

2022-07-20 Thread Claudio Jeker
Found while working on kroute code. The network structs needs to release the rtlabel reference before being freed. -- :wq Claudio Index: config.c === RCS file: /cvs/src/usr.sbin/bgpd/config.c,v retrieving revision 1.102 diff -u -p -

Re: bgpd aspath_extract overflow check

2022-07-19 Thread Claudio Jeker
On Tue, Jul 19, 2022 at 12:31:47PM +0200, Theo Buehler wrote: > On Tue, Jul 19, 2022 at 11:43:25AM +0200, Claudio Jeker wrote: > > aspath_extract() should do at least a minimal overflow check and not > > access memory after the segment. Can't use fatalx here because bgpct

bgpd name struct kroute_full vars kf

2022-07-19 Thread Claudio Jeker
Use kf for all struct kroute_full variables in bgpd. This makes the code more consistent. -- :wq Claudio Index: kroute.c === RCS file: /cvs/src/usr.sbin/bgpd/kroute.c,v retrieving revision 1.273 diff -u -p -r1.273 kroute.c --- krout

bgpd aspath_extract overflow check

2022-07-19 Thread Claudio Jeker
aspath_extract() should do at least a minimal overflow check and not access memory after the segment. Can't use fatalx here because bgpctl also uses this function. Instead return 0, that is an invalid ASN. No code will check the return value but that is fine since all callers ensure that pos does n

bgpd less chatter on rde exit

2022-07-18 Thread Claudio Jeker
Noticed the other day, when the RDE dies the session engine may log the "Can't send message %u to RDE, ctl pipe closed" multiple times because the queue is still processed. Since this error only happens after a "SE: Lost connection to RDE" error it does not anything to the crash log. This is why t

Re: bgpd decision process and bad dmetric

2022-07-16 Thread Claudio Jeker
On Sat, Jul 16, 2022 at 01:51:58PM +0200, Theo Buehler wrote: > On Sat, Jul 16, 2022 at 12:41:07PM +0200, Claudio Jeker wrote: > > I deployed bgpd on one of more core routers and triggered the fatal > > "bad dmetric in decision process" from time to time. > >

bgpd decision process and bad dmetric

2022-07-16 Thread Claudio Jeker
I deployed bgpd on one of more core routers and triggered the fatal "bad dmetric in decision process" from time to time. I realized after a longer debugging session that one reason this happens is when nexthops become valid. The state change affects all prefixes at once but then they are reevaluat

OpenBGPD 7.5 released

2022-07-15 Thread Claudio Jeker
We have released OpenBGPD 7.5, which will be arriving in the OpenBGPD directory of your local OpenBSD mirror soon. This release includes the following changes to the previous release: * Implement RFC 9234 - Route Leak Prevention and Detection Using Roles in UPDATE and OPEN Messages.

bgpd more IPv6 scope_id love

2022-07-14 Thread Claudio Jeker
Noticed while syncing code. I missed some scope_id assignments and checks in a few places. - VPN6 missed all of it - in kr_redistribute6() the copy is not really needed since link local address can not be redistributed (I still added it though) - kroute6_compare() do actually compare the scope_i

Re: ifconfig description for wireguard peers

2022-07-14 Thread Claudio Jeker
On Thu, Jul 14, 2022 at 10:51:42AM +0200, Stefan Sperling wrote: > On Wed, Jul 13, 2022 at 05:13:49PM +, Mikolaj Kucharski wrote: > > On Wed, Jul 13, 2022 at 05:43:59PM +0100, Stuart Henderson wrote: > > > > > > > > Not sure how to handle long output in different way. If you don't > > > > spec

Re: bgpd document add-path send

2022-07-12 Thread Claudio Jeker
On Mon, Jul 11, 2022 at 08:18:07PM +0100, Stuart Henderson wrote: > On 2022/07/11 19:12, Claudio Jeker wrote: > > This is my try at documenting the just added add-path bits. > > > > -- > > :wq Claudio > > > > +per prefix. > > +Which paths are sen

bgpd document add-path send

2022-07-11 Thread Claudio Jeker
This is my try at documenting the just added add-path bits. -- :wq Claudio Index: bgpd.8 === RCS file: /cvs/src/usr.sbin/bgpd/bgpd.8,v retrieving revision 1.74 diff -u -p -r1.74 bgpd.8 --- bgpd.8 28 Jun 2022 11:52:24 -

bgpd: add add-path send support

2022-07-08 Thread Claudio Jeker
Add the missing bits for add-path send support. The config options allows for a fair amount of configuration and not all have been tested: announce add-path send best [ plus X ] announce add-path send ecmp [ plus X ] [ max Y ] announce add-path send as-wide-best [ plus X ] [

Re: bgpctl adjust AID loops a bit

2022-07-08 Thread Claudio Jeker
On Fri, Jul 08, 2022 at 05:15:49PM +0200, Theo Buehler wrote: > On Fri, Jul 08, 2022 at 05:04:05PM +0200, Claudio Jeker wrote: > > I noticed that some of the loops over all AID (address identifiers) start > > at 0 but they should use AID_MIN. This is not a general rule and I >

bgpctl adjust AID loops a bit

2022-07-08 Thread Claudio Jeker
I noticed that some of the loops over all AID (address identifiers) start at 0 but they should use AID_MIN. This is not a general rule and I actually skipped one of the for loops because I think there 0 is actually better. In the cases I fixed it is known that only known AID and not AID_UNSPEC are

bgpd: initial local path_id support for Adj-RIB-Out

2022-07-08 Thread Claudio Jeker
This diff adds the required plumbing to support local path_ids in the output path. Mainly it extends prefix_adjout_update() to do the right thing. Since in normal mode of operation path_id_tx does not matter and only on prefix is in the Adj-RIB-Out the code uses prefix_adjout_lookup() to locate the

bgpd: assign local path_id to all prefixes

2022-07-07 Thread Claudio Jeker
This diff is assigning a local path_id to all prefixes. This path_id will be used for sending out add-path updates. Since the RFC specifies that the path_id has no meaning we assing the path_ids randomly. They just need to be unique per rib entry. Now this code assigne the path_id in the Adj-RIB-In

Re: bgpd: refactor update generation a bit

2022-07-06 Thread Claudio Jeker
On Wed, Jul 06, 2022 at 06:15:45PM +0200, Theo Buehler wrote: > On Wed, Jul 06, 2022 at 05:07:45PM +0200, Claudio Jeker wrote: > > This diff changes various loops which call into up_generate_update() so > > that all these loops call the same function peer_generate_update() which

bgpd: refactor update generation a bit

2022-07-06 Thread Claudio Jeker
This diff changes various loops which call into up_generate_update() so that all these loops call the same function peer_generate_update() which then calls up_generate_update(). This is a step to add an alternative path to generate updates for add-path send support without altering many code-paths.

Re: ts(1): make timespec-handling code more obvious

2022-07-06 Thread Claudio Jeker
On Tue, Jul 05, 2022 at 07:04:49AM -0500, Scott Cheloha wrote: > On Tue, Jul 05, 2022 at 11:53:26AM +0200, Claudio Jeker wrote: > > On Tue, Jul 05, 2022 at 11:34:21AM +, Job Snijders wrote: > > > On Tue, Jul 05, 2022 at 11:08:13AM +0200, Claudio Jeker wrote: > > > &

Re: ts(1): make timespec-handling code more obvious

2022-07-05 Thread Claudio Jeker
On Tue, Jul 05, 2022 at 11:34:21AM +, Job Snijders wrote: > On Tue, Jul 05, 2022 at 11:08:13AM +0200, Claudio Jeker wrote: > > On Mon, Jul 04, 2022 at 05:10:05PM -0500, Scott Cheloha wrote: > > > On Mon, Jul 04, 2022 at 11:15:24PM +0200, Claudio Jeker wrote: > > > &

Re: ts(1): make timespec-handling code more obvious

2022-07-05 Thread Claudio Jeker
On Mon, Jul 04, 2022 at 05:10:05PM -0500, Scott Cheloha wrote: > On Mon, Jul 04, 2022 at 11:15:24PM +0200, Claudio Jeker wrote: > > On Mon, Jul 04, 2022 at 01:28:12PM -0500, Scott Cheloha wrote: > > > Hi, > > > > > > Couple things: > > > > > &g

Re: ts(1): make timespec-handling code more obvious

2022-07-04 Thread Claudio Jeker
On Mon, Jul 04, 2022 at 01:28:12PM -0500, Scott Cheloha wrote: > Hi, > > Couple things: > > - Use additional timespec variables to make our intent more obvious. > > Add "elapsed", "utc_offset", and "utc_start". > > "roff" is a confusing name, "utc_offset" is better. > > Yes, I know the c

Re: Use SMR instead of SRP list in rtsock.c

2022-07-01 Thread Claudio Jeker
On Thu, Jun 30, 2022 at 03:46:35PM +, Visa Hankala wrote: > On Thu, Jun 30, 2022 at 11:51:52AM +0200, Claudio Jeker wrote: > > After discussing this with mpi@ and jmatthew@ we came to the conclusion > > that we need to smr_barrier() before refcnt_finalize() to ensure that no &

one send_rtmsg is enough for bgpd

2022-06-30 Thread Claudio Jeker
Implement send_rtmsg() using kroute_full and just use one version of this magical code. I use struct sockaddr_storage for all sockaddrs added to ensure that there is a) enough space and b) that ROUNDUP() does not cause the system to pass uninitialized stack memory to the kernel. I tested IPv4 and

Re: Use SMR instead of SRP list in rtsock.c

2022-06-30 Thread Claudio Jeker
On Thu, Jun 30, 2022 at 03:21:40PM +0300, Vitaliy Makkoveev wrote: > On Thu, Jun 30, 2022 at 11:56:55AM +0200, Claudio Jeker wrote: > > On Thu, Jun 30, 2022 at 12:34:33PM +0300, Vitaliy Makkoveev wrote: > > > On Thu, Jun 30, 2022 at 11:08:48AM +0200, Claudio Jeker wrote: > >

Re: TSO Large Send Offloading for ix(4)

2022-06-30 Thread Claudio Jeker
On Wed, Jun 29, 2022 at 02:24:35PM +0200, Jan Klemkow wrote: > Hi, > > This diff introduces the sending side of TSO to our TCP/IP stack. > If the hardware has TSO capabilities tcp_output() will send huge TCP > segments down the stack to the interface. ip{6}_output() will ignore > the size is grea

Re: Use SMR instead of SRP list in rtsock.c

2022-06-30 Thread Claudio Jeker
On Thu, Jun 30, 2022 at 12:34:33PM +0300, Vitaliy Makkoveev wrote: > On Thu, Jun 30, 2022 at 11:08:48AM +0200, Claudio Jeker wrote: > > This diff converts the SRP list to a SMR list in rtsock.c > > SRP is a bit strange with how it works and the SMR code is a bit easier to > >

Re: Use SMR instead of SRP list in rtsock.c

2022-06-30 Thread Claudio Jeker
On Thu, Jun 30, 2022 at 11:08:48AM +0200, Claudio Jeker wrote: > This diff converts the SRP list to a SMR list in rtsock.c > SRP is a bit strange with how it works and the SMR code is a bit easier to > understand. Since we can sleep in the SMR_TAILQ_FOREACH() we need to grab > a ref

Use SMR instead of SRP list in rtsock.c

2022-06-30 Thread Claudio Jeker
This diff converts the SRP list to a SMR list in rtsock.c SRP is a bit strange with how it works and the SMR code is a bit easier to understand. Since we can sleep in the SMR_TAILQ_FOREACH() we need to grab a refcount on the route pcb so that we can leave the SMR critical section and then enter the

time pTS(1)d

2022-06-29 Thread Claudio Jeker
So ts(1) with -i or -s prints strange numbers when used with either %T or %s (the current timezone comes into play and you end up in pain). This diff cleans up the code, forces UTC for -i or -s and simplifies a lot of the code. I think with this things like TZ=Canada/Newfoundland ts -s %.T and TZ=

Re: Import ts(1) - a timestamp utility

2022-06-29 Thread Claudio Jeker
On Wed, Jun 29, 2022 at 09:50:39AM +, Job Snijders wrote: > On Wed, Jun 29, 2022 at 09:18:08AM +, Job Snijders wrote: > > Add a '-m' monotonic clock option > > I misunderstood what the moreutils ts -m option was doing, below is a > different version, which is 'resistant' against the wallcl

bgplgd - a JSON frontend to bgpd

2022-06-28 Thread Claudio Jeker
2022 14:43:39 - @@ -0,0 +1,179 @@ +.\" $OpenBSD$ +.\" +.\" Copyright (c) 2021 Claudio Jeker +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyrigh

Re: Remove switch(4) leftovers

2022-06-27 Thread Claudio Jeker
On Mon, Jun 27, 2022 at 01:44:55PM +, Visa Hankala wrote: > Remove some switch(4) leftovers. > > OK? OK claudio > Index: etc/etc.hppa/MAKEDEV.md > === > RCS file: src/etc/etc.hppa/MAKEDEV.md,v > retrieving revision 1.68 > diff

Re: arp getuptime

2022-06-27 Thread Claudio Jeker
On Mon, Jun 27, 2022 at 01:58:11PM +0200, Alexander Bluhm wrote: > Hi, > > Instead of calling getuptime() all the time in ARP code, I would > like to do it only once per function. This should give us a more > consistent time value. > > ok? I would love to see the arp code use rttimer instead of

rtsock change sysctl walker

2022-06-26 Thread Claudio Jeker
Switch the state variables to track the buffer size for the sysctl to size_t and stop using the somewhat strange way of working with the buf limit from starting with a negative w_needed. Just use the less confusing w_needed <= w_given as limit check. -- :wq Claudio Index: net/rtsock.c ==

bgpd, more IPv6 scope_id insanity

2022-06-25 Thread Claudio Jeker
Since 128bit address space is not enough add the extra 32bit scope_id to struct kroute6 so that we can track that as well. With this using link local addresses as nexthops should work again. Also the madness is a little bit less bad since we just copy the scope_id in and out no matter what. -- :w

<    1   2   3   4   5   6   7   8   9   10   >