]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Fixed default table configuration
authorMaria Matejka <mq@ucw.cz>
Thu, 9 Mar 2023 15:34:17 +0000 (16:34 +0100)
committerMaria Matejka <mq@ucw.cz>
Tue, 4 Apr 2023 15:00:58 +0000 (17:00 +0200)
When changing default table behavior, I missed that it enabled to
configure multiple master4 and master6 tables. Now BIRD recognizes it
and fails properly.

nest/rt-table.c

index 218fcbe7895ba832c19a7ece983a7d64fd099a74..4c71663b99f19e10a803dd4f76d5268f8bee2956 100644 (file)
@@ -3939,6 +3939,7 @@ rt_new_default_table(struct symbol *s)
   for (uint addr_type = 0; addr_type < NET_MAX; addr_type++)
     if (s == new_config->def_tables[addr_type])
     {
+      ASSERT_DIE(!s->table);
       s->table = rt_new_table(s, addr_type);
       return;
     }
@@ -3962,6 +3963,9 @@ rt_get_default_table(struct config *cf, uint addr_type)
 struct rtable_config *
 rt_new_table(struct symbol *s, uint addr_type)
 {
+  if (s->table)
+    cf_error("Duplicate configuration of table %s", s->name);
+
   struct rtable_config *c = cfg_allocz(sizeof(struct rtable_config));
 
   if (s == new_config->def_tables[addr_type])