From: Katerina Kubecova Date: Wed, 25 Oct 2023 10:18:19 +0000 (+0200) Subject: partial import seems working X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1eaf7213b69591e4a4ee3318033dc61b6472fef8;p=thirdparty%2Fbird.git partial import seems working --- diff --git a/nest/config.Y b/nest/config.Y index 15df18c26..3d0b5a203 100644 --- a/nest/config.Y +++ b/nest/config.Y @@ -110,14 +110,12 @@ proto_postconfig(void) static inline void proto_call_cmd_reload(struct proto_spec ps, int dir, const struct f_trie *trie) { - log("Start of cmd reload"); struct proto_reload_request *prr = cfg_alloc(sizeof *prr); *prr = (struct proto_reload_request) { .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 45a031b1f..857d27e45 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -90,7 +90,6 @@ 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 +107,6 @@ 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,7 +253,6 @@ 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; @@ -293,7 +290,6 @@ 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; } @@ -313,12 +309,10 @@ 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 @@ -369,7 +363,6 @@ 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, @@ -394,7 +387,6 @@ 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); @@ -414,7 +406,6 @@ 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) { @@ -483,7 +474,6 @@ 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 @@ -589,7 +579,6 @@ 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 @@ -651,7 +640,6 @@ 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 @@ -727,7 +715,6 @@ 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); } @@ -735,7 +722,6 @@ 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) { @@ -763,7 +749,6 @@ log("you got here! why not to log? channel_init_feeding"); } rt_request_export(c->table, &c->refeed_req); - log("you got here! why not to log? channel_init_feeding done"); } static int @@ -813,7 +798,6 @@ 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 && @@ -857,14 +841,12 @@ 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) @@ -903,7 +885,6 @@ log("you got here! why not to log? protoadd channel_schedule_reload"); } rt_request_export(c->table, &c->reload_req); - log("you got here! why not to log? protoadd channel_schedule_reload end"); } static void @@ -1114,7 +1095,6 @@ 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")); @@ -1169,15 +1149,14 @@ 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; if ((c->in_keep & RIK_PREFILTER) == RIK_PREFILTER) channel_schedule_reload(c, cir); - else - c->proto->reload_routes(c, cir); + else if (! c->proto->reload_routes(c, cir)) + bug( "Partial reload was refused. Maybe you tried partial reload on bgp?"); } static void @@ -1187,7 +1166,6 @@ 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); @@ -1784,7 +1762,6 @@ 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 @@ -2473,7 +2450,6 @@ 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 @@ -2828,8 +2804,6 @@ proto_cmd_reload(struct proto *p, uintptr_t _prr, int cnt UNUSED) 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 0a66b3054..2a1c991f5 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -2211,7 +2211,6 @@ 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 */ @@ -2252,9 +2251,8 @@ log("you are here! why not to log? rt_table_export_start_feed"); struct rt_pending_export *rpe = rt_last_export(hook->table); req_trace(req, D_STATES, "Export initialized, last export %p (%lu)", rpe, rpe ? rpe->seq : 0); 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 @@ -4435,7 +4433,6 @@ 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 f83664b60..f397e5ccd 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -1565,12 +1565,11 @@ 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) return 1; - if (cir) + if (cir) { if (cir->trie) { diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index cb80d8efe..32beb21e8 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -436,7 +436,6 @@ 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) { cir->next = p->cir; p->cir = cir; diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index 145f749b6..3528b25df 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -633,7 +633,6 @@ ospf_rt_spfa(struct ospf_area *oa) add_head(&oa->cand, &oa->rt->cn); DBG("RT LSA: rt: %R, id: %R, type: %u\n", oa->rt->lsa.rt, oa->rt->lsa.id, oa->rt->lsa_type); - while (!EMPTY_LIST(oa->cand)) { @@ -2022,7 +2021,7 @@ rt_sync(struct ospf_proto *p) struct channel_import_request *cir = p->cir; p->cir = NULL; - + DBG("Now syncing my rt table with nest's\n"); FIB_ITERATE_INIT(&fit, fib); again1: @@ -2129,7 +2128,7 @@ again1: } } FIB_ITERATE_END; - + while(cir) { struct channel_import_request *next = cir->next; diff --git a/proto/pipe/pipe.c b/proto/pipe/pipe.c index 3f27a9bee..cd2b3c9b1 100644 --- a/proto/pipe/pipe.c +++ b/proto/pipe/pipe.c @@ -107,7 +107,6 @@ 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 733b65c2e..2acad3a52 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -967,7 +967,7 @@ rip_timer(timer *t) TRACE(D_EVENTS, "Main timer fired"); FIB_ITERATE_INIT(&fit, &p->rtable); - + struct channel_import_request *cir = p->cir; p->cir = NULL; @@ -1169,7 +1169,6 @@ 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) { cir->next = p->cir; p->cir = cir; diff --git a/proto/static/static.c b/proto/static/static.c index a9e2721f1..bd5b2848a 100644 --- a/proto/static/static.c +++ b/proto/static/static.c @@ -187,7 +187,7 @@ static_mark_partial(struct static_proto *p, struct channel_import_request *cir) if (!ev_active(p->event)) ev_schedule(p->event); - + cir->done(cir); } @@ -418,7 +418,6 @@ 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);