diff --git a/nest/config.Y b/nest/config.Y index bb1b6f33..15df18c2 100644 --- a/nest/config.Y +++ b/nest/config.Y @@ -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); diff --git a/nest/proto.c b/nest/proto.c index f61a49e8..45a031b1 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -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); diff --git a/nest/rt-table.c b/nest/rt-table.c index e9302437..0a66b305 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -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 diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c index 9bd117d3..f83664b6 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -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) diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index 3b1b8314..cb80d8ef 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -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; diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h index 4fffac12..aebd04d7 100644 --- a/proto/ospf/ospf.h +++ b/proto/ospf/ospf.h @@ -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 */ diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index 8eec6e97..145f749b 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -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) { diff --git a/proto/pipe/pipe.c b/proto/pipe/pipe.c index cd2b3c9b..3f27a9be 100644 --- a/proto/pipe/pipe.c +++ b/proto/pipe/pipe.c @@ -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) { diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 66f43f37..733b65c2 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -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; diff --git a/proto/rip/rip.h b/proto/rip/rip.h index cab5deb8..941efb85 100644 --- a/proto/rip/rip.h +++ b/proto/rip/rip.h @@ -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 diff --git a/proto/static/static.c b/proto/static/static.c index 97e7b255..a9e2721f 100644 --- a/proto/static/static.c +++ b/proto/static/static.c @@ -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);