]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Partial import reload looks working for cli
authorKaterina Kubecova <katerina.kubecova@nic.cz>
Thu, 12 Oct 2023 13:18:42 +0000 (15:18 +0200)
committerKaterina Kubecova <katerina.kubecova@nic.cz>
Thu, 12 Oct 2023 13:18:42 +0000 (15:18 +0200)
filter/trie.c
nest/proto.c
nest/rt-table.c

index 12ba0b82b10bf4b89c760f8efbe751d12a5bc0dc..0bfbfdd64ec7f25025b9ee873df2f9574c3e3f82 100644 (file)
@@ -496,6 +496,7 @@ trie_add_prefix(struct f_trie *t, const net_addr *net, uint l, uint h)
 static int
 trie_match_net4(const struct f_trie *t, ip4_addr px, uint plen)
 {
+  log("net4 compare");
   if (plen == 0)
     return t->zero;
 
@@ -532,6 +533,7 @@ trie_match_net4(const struct f_trie *t, ip4_addr px, uint plen)
 static int
 trie_match_net6(const struct f_trie *t, ip6_addr px, uint plen)
 {
+  log("net6 compare");
   if (plen == 0)
     return t->zero;
 
@@ -577,6 +579,7 @@ trie_match_net6(const struct f_trie *t, ip6_addr px, uint plen)
 int
 trie_match_net(const struct f_trie *t, const net_addr *n)
 {
+  log(L_DEBUG "trie match net - types %i %i", t->ipv4, n->type);
   switch (n->type)
   {
   case NET_IP4:
index 318aaac458c3c7ae9356f48fc87edf41988fdb69..34cbbfcbef1585d71dd493233abfacfcb7319fd5 100644 (file)
@@ -754,7 +754,7 @@ channel_refeed_prefilter(const struct rt_prefilter *p, const net_addr *n)
     SKIP_BACK(struct channel, refeed_req,
        SKIP_BACK(struct rt_export_request, prefilter, p)
        );
-
+  ASSERT_DIE(c->refeeding);
   for (struct channel_feeding_request *cfr = c->refeeding; cfr; cfr = cfr->next)
     if (!cfr->trie || trie_match_net(cfr->trie, n))
     {
@@ -772,12 +772,16 @@ channel_import_prefilter(const struct rt_prefilter *p, const net_addr *n)
     SKIP_BACK(struct channel, reload_req,
        SKIP_BACK(struct rt_export_request, prefilter, p)
        );
+  ASSERT_DIE(c->importing);
   for (struct channel_import_request *cir = c->importing; cir; cir = cir->next)
+  {
+    log(L_DEBUG "in for cycle %x %x", cir->trie, cir->trie->root);
     if (!cir->trie || trie_match_net(cir->trie, n))
      {
       log(L_TRACE "Export this one");
       return 1;
      }
+  }
   log(L_TRACE "%N filtered out of import", n);
   return 0;
 }
@@ -839,22 +843,24 @@ channel_schedule_reload(struct channel *c, struct channel_import_request *cir)
   int no_trie = 0;
   if (cir)
   {
-    struct channel_import_request* last = c->import_pending;
-    while (last)
-    {
-      if (!last->trie)
-        no_trie = 1;
-      last = last->next;
-    }
-    last = cir;
-    no_trie = !last->trie;
+    cir->next = c->import_pending;
+    c->import_pending = cir;
   }
+  
   if (c->reload_req.hook) 
   {
     CD(c, "Reload triggered before the previous one has finished");
     c->reload_pending = 1;
     return;
   }
+  struct channel_import_request *last = cir;
+  while (last)
+  {
+    if (!last->trie)
+      no_trie = 1;
+    last = last->next;
+  }
+  
   c->importing = c->import_pending;
   c->import_pending = NULL;
 
index 5cf7b2ee6ac8d95c4f5dfeab3b6333a4eece8c2d..668ee747c7fc364be88a019c457ceaeaf4277653 100644 (file)
@@ -2212,7 +2212,6 @@ rt_table_export_start_feed(struct rtable_private *tab, struct rt_table_export_ho
 {
   struct rt_exporter *re = &tab->exporter.e;
   struct rt_export_request *req = hook->h.req;
-  log("Hook is %x", hook);
   /* stats zeroed by mb_allocz */
   switch (req->prefilter.mode)
   {
@@ -2230,7 +2229,6 @@ rt_table_export_start_feed(struct rtable_private *tab, struct rt_table_export_ho
     case TE_ADDR_NONE:
     case TE_ADDR_TRIE:
     case TE_ADDR_HOOK:
-      log(L_TRACE "hook - we will feed by fib, not trie?");
       FIB_ITERATE_INIT(&hook->feed_fit, &tab->fib);
       hook->h.event.hook = rt_feed_by_fib;
       break;
@@ -4418,8 +4416,10 @@ rt_feed_by_fib(void *data)
     {
       if (rt_prefilter_net(&c->h.req->prefilter, n->n.addr))
       {
+        log("route passed");
        if (!rt_prepare_feed(c, n, &block))
        {
+         log("inside ifs");
          FIB_ITERATE_PUT(fit);
          RT_UNLOCK(tab);
          rt_process_feed(c, &block);