On Fri, Dec 17, 2021 at 06:57:44PM +0100, Alexander wrote: > On 2021-12-17 18:26, Ondrej Zajicek wrote: > > > That is interesting. If i remember correctly, in the past Linux removed > > all secondary addresses (ones from the same net) when the primary > > address > > was removed (so only addresses from other networks were considered > > relevant). > > Perhaps it was long before promote_secondary in sysctl was introduced.
Thanks, didn't know about that sysctl. It seems disabled by default. When enabled, the issue is here as you described. > > So it is possible that Linux promotes an address to > > primary, but does not sent a notification about that. Will check that. > > Unlikely, then bird wouldn't see any addresses at all. This is what happens > on empty interface after adding few addresses and then deleting primary: > > # ip -d mon ad > 2: enp6s20 inet 192.168.111.1/24 scope global enp6s20 > valid_lft forever preferred_lft forever > 2: enp6s20 inet 192.168.111.2/24 scope global secondary enp6s20 > valid_lft forever preferred_lft forever > 2: enp6s20 inet 192.168.111.3/24 scope global secondary enp6s20 > valid_lft forever preferred_lft forever > 2: enp6s20 inet 192.168.111.4/24 scope global secondary enp6s20 > valid_lft forever preferred_lft forever > > # Now deleting primary 192.168.111.1/24 > Deleted 2: enp6s20 inet 192.168.111.1/24 scope global enp6s20 > valid_lft forever preferred_lft forever > 2: enp6s20 inet 192.168.111.2/24 scope global enp6s20 > valid_lft forever preferred_lft forever > > As you could see, primary is deleted but now next existing is announced > without "secondary" flag - I guess the problem is that flags are not checked > on updates thus existing addresses are simply ignored. You are right, BIRD ignored ip address updates that just changed secondary flags. Attached patch should fix that. -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: [email protected]) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
commit b21104c97e59128973501fc23570e2d929f48923 Author: Ondrej Zajicek (work) <[email protected]> Date: Sat Dec 18 00:58:47 2021 +0100 Nest: Do not ignore secondary flag changes in ifa updates Compare all IA_* flags that are set by sysdep iface code. The old code ignores IA_SECONDARY flag when comparing whether iface address updates from kernel changed anything. This is usually not an issue as kernel removes all secondary addresses due to removal of the primary one, but it breaks when sysctl 'promote_secondaries' is enabled and kernel promotes secondary addresses to primary ones. Thanks to 'Alexander' for the bugreport. diff --git a/nest/iface.c b/nest/iface.c index 83a633a3..682340c5 100644 --- a/nest/iface.c +++ b/nest/iface.c @@ -591,7 +591,7 @@ ifa_update(struct ifa *a) if (ipa_equal(b->brd, a->brd) && ipa_equal(b->opposite, a->opposite) && b->scope == a->scope && - !((b->flags ^ a->flags) & IA_PEER)) + !((b->flags ^ a->flags) & (IA_SECONDARY | IA_PEER | IA_HOST))) { b->flags |= IA_UPDATED; return b;
