]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
not working
authorKaterina Kubecova <katerina.kubecova@nic.cz>
Wed, 25 Oct 2023 09:08:13 +0000 (11:08 +0200)
committerKaterina Kubecova <katerina.kubecova@nic.cz>
Wed, 25 Oct 2023 09:08:13 +0000 (11:08 +0200)
nest/config.Y
nest/proto.c
nest/rt-table.c
proto/bgp/bgp.c
proto/ospf/ospf.c
proto/ospf/ospf.h
proto/ospf/rt.c
proto/pipe/pipe.c
proto/rip/rip.c
proto/rip/rip.h
proto/static/static.c

index bb1b6f33571abdd7a064904b6b291dee0b74af5a..15df18c26475f522e870e0d476039ae8858e170a 100644 (file)
@@ -117,7 +117,7 @@ proto_call_cmd_reload(struct proto_spec ps, int dir, const struct f_trie *trie)
     .dir = dir,
     .counter =1,
   };
+ bug("you got here! why not to log?");
   if (trie)
   {
     ASSERT_DIE(this_cli->parser_pool == prr->trie->lp);
index f61a49e8f65ad963b124bb008a198569027db3f5..45a031b1f869d9472783e7f6dea9f5bb7acb16bb 100644 (file)
@@ -90,7 +90,7 @@ channel_export_log_state_change(struct rt_export_request *req, u8 state)
 {
   struct channel *c = SKIP_BACK(struct channel, out_req, req);
   CD(c, "Channel export state changed to %s", rt_export_state_name(state));
-
+log("you are here! why not to log? channel_export_log_state_change");
   switch (state)
   {
     case TES_FEEDING:
@@ -108,7 +108,7 @@ channel_refeed_log_state_change(struct rt_export_request *req, u8 state)
 {
   struct channel *c = SKIP_BACK(struct channel, refeed_req, req);
   CD(c, "Channel export state changed to %s", rt_export_state_name(state));
-
+ log("you are here! why not to log? channel_refeed_log_state");
   switch (state)
   {
     case TES_FEEDING:
@@ -255,6 +255,7 @@ proto_find_channel_by_name(struct proto *p, const char *n)
 struct channel *
 proto_add_channel(struct proto *p, struct channel_config *cf)
 {
+ log("you got here! why not to log? protoadd channel");
   struct channel *c = mb_allocz(proto_pool, cf->class->channel_size);
 
   c->name = cf->name;
@@ -292,7 +293,7 @@ proto_add_channel(struct proto *p, struct channel_config *cf)
   add_tail(&p->channels, &c->n);
 
   CD(c, "Connected to table %s", c->table->name);
-
+  log("you got here! why not to log? protoadd channel end");
   return c;
 }
 
@@ -312,10 +313,12 @@ proto_remove_channel(struct proto *p UNUSED, struct channel *c)
 static void
 proto_start_channels(struct proto *p)
 {
+  log("you are here! why not to log? proto_start_channels");
   struct channel *c;
   WALK_LIST(c, p->channels)
     if (!c->disabled)
       channel_set_state(c, CS_UP);
+  log("you are here! why not to log? proto_start_channels end");
 }
 
 static void
@@ -366,6 +369,7 @@ channel_roa_in_changed(struct settle *se)
   struct channel *c = s->c;
 
   CD(c, "Reload triggered by RPKI change");
+  bug("you got here! why not to log?");
   struct channel_import_request *cir = lp_alloc(s->trie->lp, sizeof *cir);
   *cir = (struct channel_import_request) {
     .trie = s->trie,
@@ -390,6 +394,7 @@ channel_roa_out_changed(struct settle *se)
   struct channel *c = s->c;
 
   CD(c, "Feeding triggered by RPKI change");
+  bug("you got here! why not to log?");
 
   /* Setup feeding request */
   struct channel_feeding_request *cfr = lp_alloc(s->trie->lp, sizeof *cfr);
@@ -409,6 +414,7 @@ channel_roa_out_changed(struct settle *se)
 static void
 channel_export_one_roa(struct rt_export_request *req, const net_addr *net, struct rt_pending_export *first)
 {
+log("you got here! why not to log? channel_export_one_roa");
   struct roa_subscription *s = SKIP_BACK(struct roa_subscription, req, req);
   switch (net->type)
   {
@@ -477,6 +483,7 @@ channel_roa_subscribe(struct channel *c, rtable *tab, int dir)
   };
   add_tail(&c->roa_subscriptions, &s->roa_node);
   rt_request_export(tab, &s->req);
+  bug("you got here! why not to log?");
 }
 
 static void
@@ -582,6 +589,7 @@ channel_start_import(struct channel *c)
 
   DBG("%s.%s: Channel start import req=%p\n", c->proto->name, c->name, &c->in_req);
   rt_request_import(c->table, &c->in_req);
+  log("you got here! why not to log? channel_start_import");
 }
 
 static void
@@ -643,6 +651,7 @@ channel_start_export(struct channel *c)
 
   DBG("%s.%s: Channel start export req=%p\n", c->proto->name, c->name, &c->out_req);
   rt_request_export(c->table, &c->out_req);
+  log("you got here! why not to log? channel_start_export");
 }
 
 static void
@@ -718,7 +727,7 @@ channel_refeed_stopped(struct rt_export_request *req)
   struct channel *c = SKIP_BACK(struct channel, refeed_req, req);
 
   req->hook = NULL;
-
+log("you got here! why not to log? protoadd channel_refeed_stopped");
   channel_feed_end(c);
 }
 
@@ -726,7 +735,7 @@ static void
 channel_init_feeding(struct channel *c)
 {
   int no_trie = 0;
-
+log("you got here! why not to log? channel_init_feeding");
   for (struct channel_feeding_request *cfrp = c->refeed_pending; cfrp; cfrp = cfrp->next)
     if (cfrp->type == CFRT_DIRECT)
     {
@@ -754,6 +763,7 @@ channel_init_feeding(struct channel *c)
   }
 
   rt_request_export(c->table, &c->refeed_req);
+  log("you got here! why not to log? channel_init_feeding done");
 }
 
 static int
@@ -803,6 +813,7 @@ channel_import_prefilter(const struct rt_prefilter *p, const net_addr *n)
 static void
 channel_feed_end(struct channel *c)
 {
+  log("you got here! why not to log? channel_feed_end start");
   /* Reset export limit if the feed ended with acceptable number of exported routes */
   struct limit *l = &c->out_limit;
   if (c->refeeding &&
@@ -846,12 +857,14 @@ channel_feed_end(struct channel *c)
   /* Run the pending batch */
   if (c->refeed_pending)
     channel_init_feeding(c);
+  log("you got here! why not to log? channel_feed_end");
 }
 
 /* Called by protocol for reload from in_table */
 void
 channel_schedule_reload(struct channel *c, struct channel_import_request *cir)
 {
+log("you got here! why not to log? protoadd channel_schedule_reload");
   ASSERT(c->in_req.hook);
   int no_trie = 0;
   if (cir)
@@ -890,6 +903,7 @@ channel_schedule_reload(struct channel *c, struct channel_import_request *cir)
   }
 
   rt_request_export(c->table, &c->reload_req);
+  log("you got here! why not to log? protoadd channel_schedule_reload end");
 }
 
 static void
@@ -1100,7 +1114,7 @@ void
 channel_request_feeding(struct channel *c, struct channel_feeding_request *cfr)
 {
   ASSERT_DIE(c->out_req.hook);
-
+bug("you got here! why not to log?");
   CD(c, "Feeding requested (%s)",
       cfr->type == CFRT_DIRECT ? "direct" :
       (cfr->trie ? "partial" : "auxiliary"));
@@ -1155,7 +1169,7 @@ channel_request_reload(struct channel *c)
   ASSERT(channel_reloadable(c));
 
   CD(c, "Reload requested");
-
+bug("you got here! why not to log?");
   struct channel_import_request* cir = mb_alloc(c->proto->pool, sizeof *cir);
   cir->trie = NULL;
   cir->done = channel_import_request_done_dynamic;
@@ -1173,6 +1187,7 @@ channel_request_partial_reload(struct channel *c, struct channel_import_request
   ASSERT(channel_reloadable(c));
 
   CD(c, "Partial import reload requested");
+  bug("you got here! why not to log?");
 
   if ((c->in_keep & RIK_PREFILTER) == RIK_PREFILTER)
     channel_schedule_reload(c, cir);
@@ -1769,6 +1784,7 @@ protos_commit(struct config *new, struct config *old, int force_reconfig, int ty
   };
 
   protos_do_commit(new, old, force_reconfig, type);
+  log("you are here! why not to log? protos_commit ......................");
 }
 
 static void
@@ -2457,6 +2473,7 @@ proto_do_up(struct proto *p)
 
   if (p->cf->late_if_feed)
     iface_subscribe(&p->iface_sub);
+  log("you are here! why not to log? proto_do up end");
 }
 
 static inline void
@@ -2808,12 +2825,11 @@ void
 proto_cmd_reload(struct proto *p, uintptr_t _prr, int cnt UNUSED)
 {
   struct proto_reload_request *prr = (void *) _prr;
-  
   if (prr->trie)
     prr->ev.hook = channel_reload_out_done_main;
   struct channel *c;
   log("channel proto_cmd_reload_called");
-
+bug("you got here! why not to log?");
   if (p->disabled)
   {
     cli_msg(-8, "%s: already disabled", p->name);
index e93024371de506360b4d410a12c77d11ac781e19..0a66b3054d7d60d37a6eee2e227e4accade3503a 100644 (file)
@@ -2211,6 +2211,7 @@ rt_table_export_start_locked(struct rtable_private *tab, struct rt_export_reques
 static void
 rt_table_export_start_feed(struct rtable_private *tab, struct rt_table_export_hook *hook)
 {
+log("you are here! why not to log? rt_table_export_start_feed");
   struct rt_exporter *re = &tab->exporter.e;
   struct rt_export_request *req = hook->h.req;
   /* stats zeroed by mb_allocz */
@@ -2253,6 +2254,7 @@ rt_table_export_start_feed(struct rtable_private *tab, struct rt_table_export_ho
   atomic_store_explicit(&hook->last_export, rpe, memory_order_relaxed);
   
   rt_init_export(re, req->hook);
+  log("you are here! why not to log? ..rt_table_export_start_feed");
 }
 
 static void
@@ -4433,6 +4435,7 @@ rt_feed_by_fib(void *data)
 
   rt_process_feed(c, &block);
   rt_feed_done(&c->h);
+  log("you are here! why not to log? rt_feed_by_fib");
 }
 
 static void
index 9bd117d30591c5622575f90ac28514bd27f832f3..f83664b6096497f681cceeb42e7ff6cf35a1a134 100644 (file)
@@ -1565,6 +1565,7 @@ bgp_reload_routes(struct channel *C, struct channel_import_request *cir)
 {
   struct bgp_proto *p = (void *) C->proto;
   struct bgp_channel *c = (void *) C;
+  bug("you got here! why not to log?");
 
   /* Ignore non-BGP channels */
   if (C->class != &channel_bgp)
index 3b1b8314e016437e7c0ef40cbbee09d9e44873de..cb80d8efea518de059370733c62550665b04deb2 100644 (file)
@@ -436,20 +436,16 @@ static int
 ospf_reload_routes(struct channel *C, struct channel_import_request *cir)
 {
   struct ospf_proto *p = (struct ospf_proto *) C->proto;
-
+bug("you got here! why not to log?");
   if (cir) {
-    if (p->lock == NULL)
-      {
-        p->lock = DOMAIN_NEW(attrs);
-        DOMAIN_SETUP(attrs, p->lock, "Partial request lock ospf", NULL);
-      }
-    DG_LOCK(p->lock);
     cir->next = p->cir;
     p->cir = cir;
-    DG_UNLOCK(p->lock);
   }
   if (p->calcrt == 2)
+  {
+    /*todo*/
     return 1;
+  }
 
   OSPF_TRACE(D_EVENTS, "Scheduling routing table calculation with route reload");
   p->calcrt = 2;
index 4fffac122e7d44ca02230a7706843dab6a700f3a..aebd04d76326adddf8184bd637ed8a95f6d0b72f 100644 (file)
@@ -220,7 +220,6 @@ struct ospf_proto
   int calcrt;                  /* Routing table calculation scheduled?
                                   0=no, 1=normal, 2=forced reload */
   struct channel_import_request *cir; /* Struct with trie for partial reload */
-  DOMAIN(attrs) lock;  /*nebo struct domain_generic *? *//* Lock for partial reload */
   list iface_list;             /* List of OSPF interfaces (struct ospf_iface) */
   list area_list;              /* List of OSPF areas (struct ospf_area) */
   int areano;                  /* Number of area I belong to */
index 8eec6e97d225d4893e144076c676b4fff56cbc80..145f749b6de2984aebd1b987fefc4bd319aac85b 100644 (file)
@@ -1699,7 +1699,8 @@ ospf_rt_spf(struct ospf_proto *p)
   rt_sync(p);
   lp_flush(p->nhpool);
 
-  p->calcrt = 0;
+  if (p->cir == NULL)
+    p->calcrt = 0;
 }
 
 
@@ -2019,10 +2020,8 @@ rt_sync(struct ospf_proto *p)
 
   OSPF_TRACE(D_EVENTS, "Starting routing table synchronization");
 
-  DG_LOCK(attr, p->lock);
   struct channel_import_request *cir = p->cir;
   p->cir = NULL;
-  DG_UNLOCK(attr, p->lock);
   
   DBG("Now syncing my rt table with nest's\n");
   FIB_ITERATE_INIT(&fit, fib);
@@ -2131,8 +2130,12 @@ again1:
   }
   FIB_ITERATE_END;
   
-  if(cir)
+  while(cir)
+  {
+    struct channel_import_request *next = cir->next;
     cir->done(cir);
+    cir = next;
+  }
 
   WALK_LIST(oa, p->area_list)
   {
index cd2b3c9b1a5058a1011192a9eed1da1be64ccd60..3f27a9beed027c2017d1b9cd64fa1af25f00a880 100644 (file)
@@ -107,6 +107,7 @@ pipe_import_by_refeed_free(struct channel_feeding_request *cfr)
 static int
 pipe_reload_routes(struct channel *C, struct channel_import_request *cir)
 {
+bug("you got here! why not to log?");
   struct pipe_proto *p = (void *) C->proto;
   if (cir && cir->trie)
   {
index 66f43f376dddcf6ceeebc0d1bc7c1151b9aeb317..733b65c2e5bf4663cdf7e6175053c94238c7c1e7 100644 (file)
@@ -968,10 +968,8 @@ rip_timer(timer *t)
 
   FIB_ITERATE_INIT(&fit, &p->rtable);
   
-  DG_LOCK(attrs, p->lock);
   struct channel_import_request *cir = p->cir;
   p->cir = NULL;
-  DG_UNLOCK(attrs, p->lock);
 
   loop:
   FIB_ITERATE_START(&p->rtable, &fit, struct rip_entry, en)
@@ -1054,9 +1052,19 @@ rip_timer(timer *t)
       }
   }
 
-  if (cir)
+  while(cir)
+  {
+    struct channel_import_request *next_cir = cir->next;
     cir->done(cir);
-  tm_start(p->timer, MAX(next - now_, 100 MS));
+    cir = next_cir;
+  }
+  if (p->cir)
+  {
+    p->rt_reload = 1;
+    rip_kick_timer(p);
+  }
+  else
+    tm_start(p->timer, MAX(next - now_, 100 MS));
 }
 
 static inline void
@@ -1161,17 +1169,10 @@ static int
 rip_reload_routes(struct channel *C, struct channel_import_request *cir)
 {
   struct rip_proto *p = (struct rip_proto *) C->proto;
-  
+  bug("you got here! why not to log?");
   if (cir) {
-    if (p->lock==NULL)
-      {
-        p->lock = DOMAIN_NEW(attrs);
-        DOMAIN_SETUP(attrs, p->lock, "Partial request lock rip", NULL);
-      }
-    DG_LOCK(p->lock);
     cir->next = p->cir;
     p->cir = cir;
-    DG_UNLOCK(p->lock);
   }
   if (p->rt_reload)
     return 1;
index cab5deb8b74420b7679e868eb7acb39468928e03..941efb85cc71fe2e0575c05e060124726cb4f6a3 100644 (file)
@@ -104,7 +104,6 @@ struct rip_proto
   struct tbf log_pkt_tbf;              /* TBF for packet messages */
   struct tbf log_rte_tbf;              /* TBF for RTE messages */
   struct channel_import_request *cir;  /* Trie for partial reload */
-  DOMAIN(attrs) lock;          /* Lock for partial reload */
 };
 
 struct rip_iface
index 97e7b255044fa56c53ee601f64cb5b891df78c8d..a9e2721f19961beffd7135775fdf9272d946d4a0 100644 (file)
@@ -418,6 +418,7 @@ static int
 static_reload_routes(struct channel *C, struct channel_import_request *cir)
 {
   struct static_proto *p = (void *) C->proto;
+  bug("you got here! why not to log?");
   TRACE(D_EVENTS, "Scheduling route reload");
   if (cir && cir->trie)
     static_mark_partial(p, cir);