minor correction. the diff was tested on current not 8.0. My system is on 8.0 I did full 'cvs up' on /usr/src/usr.sbin/ospf6d and applied your diff on top.
G On 24/11/2026 13:35, Kapetanakis Giannis wrote: > On 24/11/2026 10:31, Claudio Jeker wrote: >> On Thu, Nov 19, 2026 at 05:32:31PM +0200, Kapetanakis Giannis wrote: >>> Hi, >>> >>> Reporting 2 bugs that I had with ospf6d over the last years. >>> From my side it wasn't easy to replicate, so I used Claude for this today. >>> >>> We managed to find a way to replicate the issues. >>> Claude also produced two patches which I've tested and at least didn't >>> reproduce the problem. >>> >>> Tell me if you need more information. >>> >>> regards, >>> >>> G >>> >>> Here is the report by claude: >>> >>> TL;DR >>> ----- >>> >>> ospf6d can install a p2p next hop with the link-local address of a >>> *different* neighbor (right interface, wrong address), which silently >>> blackholes all routes via that neighbor until ospf6d is restarted. >>> >>> Cause: calc_nexthop_lladdr() looks up the neighbor's Link-LSA with our >>> own interface ID instead of the neighbor's (nbr_iface_id), so the >>> lookup always misses on p2p links and falls back to the address of >>> whichever neighbor delivered the Router-LSA. >>> >>> A second, related issue: >>> rt_nexthop_add() merges equal-cost next hops by address only, ignoring >>> the interface. Both date back to 2007/2009, affect ospf6d only, and are >>> reproducible on 8.0. Two small diffs below, tested on 8.0. >>> >> Thanks for the report and suggested diff. I think the diff below is >> better. It keeps the API for calc_nexthop_lladdr and moves the selection >> of the correct rtr_link information into the calc_nexthop_lladdr function. >> >> Transit networks store the DR in the neighbor info while on P2P and >> virtual links the neighbor data is identifying the remote router of the >> link. So in the first case one needs to use the adv_rtr and its interface >> id to find the link LSA while for all others the nbr information needs to >> be used. >> >> The rt_nexthop_add function I swapped the comperison order to be more like >> the kroute code. So first scope then address. >> >> I did not test this yet so I hope you could give this a spin and verify >> that it indeed works as expected. > Hi Claudio, > > I've tested your diff on stock 8.0 ospf6d in my setup and was able to verify > both bugs fixed. > OK by me > > Stock ospf6d, before applying your diff: > > A plain restart produced the mirror case: both p2p neighbors got each other's > link-local address. > > ::172.16.0.111 fe80::215:2cff:fe16:7d00%vlan914 (should be > fe80::208:e3ff:feff:ff24) > ::172.16.176.3 fe80::208:e3ff:feff:ff24%vlan121 (should be > fe80::215:2cff:fe16:7d00) > > With your diff: > > 1. After restarts, every next hop matches the Link-LSA of the neighbor on its > own interface. > > 2. Reproduction for the first issue: > A's new Router-LSA arrived only via B while r2 was blocking A (the > adjacency with A stayed up). > The next hop for A stayed correct: > > (172.16.0.111, 0x2001, 0.0.0.0) cost 65535 has nexthops > [fe80::208:e3ff:feff:ff24%vlan914] > > and r1 gets two distinct next hops: > > (172.16.176.1, 0x2001, 0.0.0.0) cost 65536 has nexthops > [fe80::208:e3ff:feff:ff24%vlan914, fe80::215:2cff:fe16:7d00%vlan121] > > 3. To exercise the rt_nexthop_add() part on its own, I added a second p2p > link between r2 and B (vlan122). > B uses the same link-local address on both links, so r2 had two equal-cost > next hops > with the same address on different interfaces. With your diff the RIB > keeps both, > for B and for the prefixes behind it: > > (172.16.176.3, 0x2001, 0.0.0.0) cost 65535 has nexthops > [fe80::215:2cff:fe16:7d00%vlan122, fe80::215:2cff:fe16:7d00%vlan121] > > ::172.16.176.3 fe80::215:2cff:fe16:7d00%vlan121 Inter-Area > Router 65535 > ::172.16.176.3 fe80::215:2cff:fe16:7d00%vlan122 Inter-Area > Router 65535 > 2001:db8:2c00:6c03::/64 fe80::215:2cff:fe16:7d00%vlan121 Type 1 ext > Network 65536 > 2001:db8:2c00:6c03::/64 fe80::215:2cff:fe16:7d00%vlan122 Type 1 ext > Network 65536 > > My setup only has p2p links, so the transit-network path is not covered by my > tests. > > Two whitespace nits: trailing space at the end of the > "p2p and virtual links use the data from the rtr_link, " comment line, > and a stray space between the tabs in the continuation line in > rt_nexthop_add(). > > Thanks, > > G
