]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Internal route tables have a reduced cleanup routine
authorMaria Matejka <mq@ucw.cz>
Mon, 19 Apr 2021 13:13:20 +0000 (15:13 +0200)
committerMaria Matejka <mq@ucw.cz>
Mon, 19 Apr 2021 13:14:55 +0000 (15:14 +0200)
This fixes an internal table cleanup bug introduced
in ff397df7edcbe7a8abca5b419729b9c64c063847.

nest/route.h
nest/rt-table.c

index 2393fdc3137b2f13c5a7289177a99d46d1886a64..f5fc9e31217c593feabcdad6e6ea081d4b8d79e8 100644 (file)
@@ -164,6 +164,9 @@ typedef struct rtable {
   int pipe_busy;                       /* Pipe loop detection */
   int use_count;                       /* Number of protocols using this table */
   u32 rt_count;                                /* Number of routes in the table */
+
+  byte internal;                       /* Internal table of a protocol */
+
   struct hmap id_map;
   struct hostcache *hostcache;
   struct rtable_config *config;                /* Configuration of this table */
index d2fc9c651854b15d66866a1bf7800651dde513fd..13209dd7c7c44603f33d5bfbf2c8c27788cafb55 100644 (file)
@@ -1880,6 +1880,9 @@ rt_free(resource *_r)
   DBG("Deleting routing table %s\n", r->name);
   ASSERT_DIE(r->use_count == 0);
 
+  if (r->internal)
+    return;
+
   r->config->table = NULL;
   rem_node(&r->n);
 
@@ -1931,7 +1934,7 @@ rt_setup(pool *pp, struct rtable_config *cf)
 
   fib_init(&t->fib, p, t->addr_type, sizeof(net), OFFSETOF(net, n), 0, NULL);
 
-  if (!cf->internal)
+  if (!(t->internal = cf->internal))
   {
     init_list(&t->channels);
     hmap_init(&t->id_map, p, 1024);