]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Move the interfaces locking domain from attrs to rtable stable-v3.1
authorIgor Putovny <igor.putovny@nic.cz>
Thu, 9 Oct 2025 14:08:47 +0000 (16:08 +0200)
committerMaria Matejka <mq@ucw.cz>
Tue, 4 Nov 2025 11:46:06 +0000 (12:46 +0100)
The interface table domain level has been "attrs" due to limitations
imposed in the early stages of development when all operations on
routing tables, most notably next hop resolution, were done with the
table locked.

Another possible problem was accessing the BGP listen socket structures
which are on the "rtable" level.

Yet, with the introduction of the "service" level and stabilization of
other structures, the interface table domain level does not need to be
at "attrs" anymore, and therefore we may simply move it to "rtable"
as it is actually the right place for that.

This collision also caused problems with external resource locks which
are at the "attrs" level, causing a crash in interface reconfiguration
of RIP, Babel and OSPF, when the routines tried to acquire a resource
lock with the interface table being locked. Due to a lack of autotests
for interface reconfiguration, we missed this problem in BIRD 3.

This fixes #305.

nest/iface.c
nest/neighbor.c

index 4782b3efa1c3a38a80fe72244057526d1709c3aa..06606d134c27093e306a1c101bc9c2de5c459e0b 100644 (file)
 #include "conf/conf.h"
 #include "sysdep/unix/krt.h"
 
-DOMAIN(attrs) iface_domain;
+DOMAIN(rtable) iface_domain;
 
-#define IFACE_LOCK     LOCK_DOMAIN(attrs, iface_domain)
-#define IFACE_UNLOCK   UNLOCK_DOMAIN(attrs, iface_domain)
-#define IFACE_ASSERT_LOCKED    ASSERT_DIE(DOMAIN_IS_LOCKED(attrs, iface_domain))
+#define IFACE_LOCK     LOCK_DOMAIN(rtable, iface_domain)
+#define IFACE_UNLOCK   UNLOCK_DOMAIN(rtable, iface_domain)
+#define IFACE_ASSERT_LOCKED    ASSERT_DIE(DOMAIN_IS_LOCKED(rtable, iface_domain))
 
 static TLIST_LIST(ifsub) iface_sub_list;
 static slab *iface_sub_slab;
@@ -1030,10 +1030,10 @@ if_choose_router_id(struct iface_patt *mask, u32 old_id)
 void
 if_init(void)
 {
-  iface_domain = DOMAIN_NEW(attrs);
+  iface_domain = DOMAIN_NEW(rtable);
 
   IFACE_LOCK;
-  if_pool = rp_new(&root_pool, iface_domain.attrs, "Interfaces");
+  if_pool = rp_new(&root_pool, iface_domain.rtable, "Interfaces");
   init_list(&global_iface_list);
   iface_sub_slab = sl_new(if_pool, sizeof(struct iface_notification));
   strcpy(default_vrf.name, "default");
index 6a8c9e2530ad7f1fb7833ce5a398dbfb624ca528..fbc21132762d984dc667c7b6f1e596bfd911ce73 100644 (file)
@@ -67,11 +67,11 @@ void ifa_unlink(struct ifa *);
 
 extern list global_iface_list;
 
-extern DOMAIN(attrs) iface_domain;
+extern DOMAIN(rtable) iface_domain;
 
-#define IFACE_LOCK     LOCK_DOMAIN(attrs, iface_domain)
-#define IFACE_UNLOCK   UNLOCK_DOMAIN(attrs, iface_domain)
-#define IFACE_ASSERT_LOCKED    ASSERT_DIE(DOMAIN_IS_LOCKED(attrs, iface_domain))
+#define IFACE_LOCK     LOCK_DOMAIN(rtable, iface_domain)
+#define IFACE_UNLOCK   UNLOCK_DOMAIN(rtable, iface_domain)
+#define IFACE_ASSERT_LOCKED    ASSERT_DIE(DOMAIN_IS_LOCKED(rtable, iface_domain))
 
 static inline uint
 neigh_hash(struct proto *p, ip_addr a, struct iface *i)