0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-03-21 22:07:03 +00:00

not working

This commit is contained in:
Katerina Kubecova 2023-10-25 11:08:13 +02:00
parent eae05c1346
commit 455e7e49c6
11 changed files with 56 additions and 36 deletions

View File

@ -117,7 +117,7 @@ proto_call_cmd_reload(struct proto_spec ps, int dir, const struct f_trie *trie)
.dir = dir, .dir = dir,
.counter =1, .counter =1,
}; };
bug("you got here! why not to log?");
if (trie) if (trie)
{ {
ASSERT_DIE(this_cli->parser_pool == prr->trie->lp); ASSERT_DIE(this_cli->parser_pool == prr->trie->lp);

View 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); struct channel *c = SKIP_BACK(struct channel, out_req, req);
CD(c, "Channel export state changed to %s", rt_export_state_name(state)); 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) switch (state)
{ {
case TES_FEEDING: 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); struct channel *c = SKIP_BACK(struct channel, refeed_req, req);
CD(c, "Channel export state changed to %s", rt_export_state_name(state)); 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) switch (state)
{ {
case TES_FEEDING: case TES_FEEDING:
@ -255,6 +255,7 @@ proto_find_channel_by_name(struct proto *p, const char *n)
struct channel * struct channel *
proto_add_channel(struct proto *p, struct channel_config *cf) 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); struct channel *c = mb_allocz(proto_pool, cf->class->channel_size);
c->name = cf->name; c->name = cf->name;
@ -292,7 +293,7 @@ proto_add_channel(struct proto *p, struct channel_config *cf)
add_tail(&p->channels, &c->n); add_tail(&p->channels, &c->n);
CD(c, "Connected to table %s", c->table->name); CD(c, "Connected to table %s", c->table->name);
log("you got here! why not to log? protoadd channel end");
return c; return c;
} }
@ -312,10 +313,12 @@ proto_remove_channel(struct proto *p UNUSED, struct channel *c)
static void static void
proto_start_channels(struct proto *p) proto_start_channels(struct proto *p)
{ {
log("you are here! why not to log? proto_start_channels");
struct channel *c; struct channel *c;
WALK_LIST(c, p->channels) WALK_LIST(c, p->channels)
if (!c->disabled) if (!c->disabled)
channel_set_state(c, CS_UP); channel_set_state(c, CS_UP);
log("you are here! why not to log? proto_start_channels end");
} }
static void static void
@ -366,6 +369,7 @@ channel_roa_in_changed(struct settle *se)
struct channel *c = s->c; struct channel *c = s->c;
CD(c, "Reload triggered by RPKI change"); 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); struct channel_import_request *cir = lp_alloc(s->trie->lp, sizeof *cir);
*cir = (struct channel_import_request) { *cir = (struct channel_import_request) {
.trie = s->trie, .trie = s->trie,
@ -390,6 +394,7 @@ channel_roa_out_changed(struct settle *se)
struct channel *c = s->c; struct channel *c = s->c;
CD(c, "Feeding triggered by RPKI change"); CD(c, "Feeding triggered by RPKI change");
bug("you got here! why not to log?");
/* Setup feeding request */ /* Setup feeding request */
struct channel_feeding_request *cfr = lp_alloc(s->trie->lp, sizeof *cfr); 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 static void
channel_export_one_roa(struct rt_export_request *req, const net_addr *net, struct rt_pending_export *first) 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); struct roa_subscription *s = SKIP_BACK(struct roa_subscription, req, req);
switch (net->type) 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); add_tail(&c->roa_subscriptions, &s->roa_node);
rt_request_export(tab, &s->req); rt_request_export(tab, &s->req);
bug("you got here! why not to log?");
} }
static void 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); 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); rt_request_import(c->table, &c->in_req);
log("you got here! why not to log? channel_start_import");
} }
static void 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); 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); rt_request_export(c->table, &c->out_req);
log("you got here! why not to log? channel_start_export");
} }
static void static void
@ -718,7 +727,7 @@ channel_refeed_stopped(struct rt_export_request *req)
struct channel *c = SKIP_BACK(struct channel, refeed_req, req); struct channel *c = SKIP_BACK(struct channel, refeed_req, req);
req->hook = NULL; req->hook = NULL;
log("you got here! why not to log? protoadd channel_refeed_stopped");
channel_feed_end(c); channel_feed_end(c);
} }
@ -726,7 +735,7 @@ static void
channel_init_feeding(struct channel *c) channel_init_feeding(struct channel *c)
{ {
int no_trie = 0; 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) for (struct channel_feeding_request *cfrp = c->refeed_pending; cfrp; cfrp = cfrp->next)
if (cfrp->type == CFRT_DIRECT) if (cfrp->type == CFRT_DIRECT)
{ {
@ -754,6 +763,7 @@ channel_init_feeding(struct channel *c)
} }
rt_request_export(c->table, &c->refeed_req); rt_request_export(c->table, &c->refeed_req);
log("you got here! why not to log? channel_init_feeding done");
} }
static int static int
@ -803,6 +813,7 @@ channel_import_prefilter(const struct rt_prefilter *p, const net_addr *n)
static void static void
channel_feed_end(struct channel *c) 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 */ /* Reset export limit if the feed ended with acceptable number of exported routes */
struct limit *l = &c->out_limit; struct limit *l = &c->out_limit;
if (c->refeeding && if (c->refeeding &&
@ -846,12 +857,14 @@ channel_feed_end(struct channel *c)
/* Run the pending batch */ /* Run the pending batch */
if (c->refeed_pending) if (c->refeed_pending)
channel_init_feeding(c); channel_init_feeding(c);
log("you got here! why not to log? channel_feed_end");
} }
/* Called by protocol for reload from in_table */ /* Called by protocol for reload from in_table */
void void
channel_schedule_reload(struct channel *c, struct channel_import_request *cir) 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); ASSERT(c->in_req.hook);
int no_trie = 0; int no_trie = 0;
if (cir) 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); rt_request_export(c->table, &c->reload_req);
log("you got here! why not to log? protoadd channel_schedule_reload end");
} }
static void static void
@ -1100,7 +1114,7 @@ void
channel_request_feeding(struct channel *c, struct channel_feeding_request *cfr) channel_request_feeding(struct channel *c, struct channel_feeding_request *cfr)
{ {
ASSERT_DIE(c->out_req.hook); ASSERT_DIE(c->out_req.hook);
bug("you got here! why not to log?");
CD(c, "Feeding requested (%s)", CD(c, "Feeding requested (%s)",
cfr->type == CFRT_DIRECT ? "direct" : cfr->type == CFRT_DIRECT ? "direct" :
(cfr->trie ? "partial" : "auxiliary")); (cfr->trie ? "partial" : "auxiliary"));
@ -1155,7 +1169,7 @@ channel_request_reload(struct channel *c)
ASSERT(channel_reloadable(c)); ASSERT(channel_reloadable(c));
CD(c, "Reload requested"); CD(c, "Reload requested");
bug("you got here! why not to log?");
struct channel_import_request* cir = mb_alloc(c->proto->pool, sizeof *cir); struct channel_import_request* cir = mb_alloc(c->proto->pool, sizeof *cir);
cir->trie = NULL; cir->trie = NULL;
cir->done = channel_import_request_done_dynamic; 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)); ASSERT(channel_reloadable(c));
CD(c, "Partial import reload requested"); CD(c, "Partial import reload requested");
bug("you got here! why not to log?");
if ((c->in_keep & RIK_PREFILTER) == RIK_PREFILTER) if ((c->in_keep & RIK_PREFILTER) == RIK_PREFILTER)
channel_schedule_reload(c, cir); 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); protos_do_commit(new, old, force_reconfig, type);
log("you are here! why not to log? protos_commit ......................");
} }
static void static void
@ -2457,6 +2473,7 @@ proto_do_up(struct proto *p)
if (p->cf->late_if_feed) if (p->cf->late_if_feed)
iface_subscribe(&p->iface_sub); iface_subscribe(&p->iface_sub);
log("you are here! why not to log? proto_do up end");
} }
static inline void static inline void
@ -2808,12 +2825,11 @@ void
proto_cmd_reload(struct proto *p, uintptr_t _prr, int cnt UNUSED) proto_cmd_reload(struct proto *p, uintptr_t _prr, int cnt UNUSED)
{ {
struct proto_reload_request *prr = (void *) _prr; struct proto_reload_request *prr = (void *) _prr;
if (prr->trie) if (prr->trie)
prr->ev.hook = channel_reload_out_done_main; prr->ev.hook = channel_reload_out_done_main;
struct channel *c; struct channel *c;
log("channel proto_cmd_reload_called"); log("channel proto_cmd_reload_called");
bug("you got here! why not to log?");
if (p->disabled) if (p->disabled)
{ {
cli_msg(-8, "%s: already disabled", p->name); cli_msg(-8, "%s: already disabled", p->name);

View File

@ -2211,6 +2211,7 @@ rt_table_export_start_locked(struct rtable_private *tab, struct rt_export_reques
static void static void
rt_table_export_start_feed(struct rtable_private *tab, struct rt_table_export_hook *hook) 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_exporter *re = &tab->exporter.e;
struct rt_export_request *req = hook->h.req; struct rt_export_request *req = hook->h.req;
/* stats zeroed by mb_allocz */ /* 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); atomic_store_explicit(&hook->last_export, rpe, memory_order_relaxed);
rt_init_export(re, req->hook); rt_init_export(re, req->hook);
log("you are here! why not to log? ..rt_table_export_start_feed");
} }
static void static void
@ -4433,6 +4435,7 @@ rt_feed_by_fib(void *data)
rt_process_feed(c, &block); rt_process_feed(c, &block);
rt_feed_done(&c->h); rt_feed_done(&c->h);
log("you are here! why not to log? rt_feed_by_fib");
} }
static void static void

View 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_proto *p = (void *) C->proto;
struct bgp_channel *c = (void *) C; struct bgp_channel *c = (void *) C;
bug("you got here! why not to log?");
/* Ignore non-BGP channels */ /* Ignore non-BGP channels */
if (C->class != &channel_bgp) if (C->class != &channel_bgp)

View File

@ -436,20 +436,16 @@ static int
ospf_reload_routes(struct channel *C, struct channel_import_request *cir) ospf_reload_routes(struct channel *C, struct channel_import_request *cir)
{ {
struct ospf_proto *p = (struct ospf_proto *) C->proto; struct ospf_proto *p = (struct ospf_proto *) C->proto;
bug("you got here! why not to log?");
if (cir) { 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; cir->next = p->cir;
p->cir = cir; p->cir = cir;
DG_UNLOCK(p->lock);
} }
if (p->calcrt == 2) if (p->calcrt == 2)
{
/*todo*/
return 1; return 1;
}
OSPF_TRACE(D_EVENTS, "Scheduling routing table calculation with route reload"); OSPF_TRACE(D_EVENTS, "Scheduling routing table calculation with route reload");
p->calcrt = 2; p->calcrt = 2;

View File

@ -220,7 +220,6 @@ struct ospf_proto
int calcrt; /* Routing table calculation scheduled? int calcrt; /* Routing table calculation scheduled?
0=no, 1=normal, 2=forced reload */ 0=no, 1=normal, 2=forced reload */
struct channel_import_request *cir; /* Struct with trie for partial 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 iface_list; /* List of OSPF interfaces (struct ospf_iface) */
list area_list; /* List of OSPF areas (struct ospf_area) */ list area_list; /* List of OSPF areas (struct ospf_area) */
int areano; /* Number of area I belong to */ int areano; /* Number of area I belong to */

View File

@ -1699,7 +1699,8 @@ ospf_rt_spf(struct ospf_proto *p)
rt_sync(p); rt_sync(p);
lp_flush(p->nhpool); 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"); OSPF_TRACE(D_EVENTS, "Starting routing table synchronization");
DG_LOCK(attr, p->lock);
struct channel_import_request *cir = p->cir; struct channel_import_request *cir = p->cir;
p->cir = NULL; p->cir = NULL;
DG_UNLOCK(attr, p->lock);
DBG("Now syncing my rt table with nest's\n"); DBG("Now syncing my rt table with nest's\n");
FIB_ITERATE_INIT(&fit, fib); FIB_ITERATE_INIT(&fit, fib);
@ -2131,8 +2130,12 @@ again1:
} }
FIB_ITERATE_END; FIB_ITERATE_END;
if(cir) while(cir)
{
struct channel_import_request *next = cir->next;
cir->done(cir); cir->done(cir);
cir = next;
}
WALK_LIST(oa, p->area_list) WALK_LIST(oa, p->area_list)
{ {

View File

@ -107,6 +107,7 @@ pipe_import_by_refeed_free(struct channel_feeding_request *cfr)
static int static int
pipe_reload_routes(struct channel *C, struct channel_import_request *cir) 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; struct pipe_proto *p = (void *) C->proto;
if (cir && cir->trie) if (cir && cir->trie)
{ {

View File

@ -968,10 +968,8 @@ rip_timer(timer *t)
FIB_ITERATE_INIT(&fit, &p->rtable); FIB_ITERATE_INIT(&fit, &p->rtable);
DG_LOCK(attrs, p->lock);
struct channel_import_request *cir = p->cir; struct channel_import_request *cir = p->cir;
p->cir = NULL; p->cir = NULL;
DG_UNLOCK(attrs, p->lock);
loop: loop:
FIB_ITERATE_START(&p->rtable, &fit, struct rip_entry, en) 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); 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 static inline void
@ -1161,17 +1169,10 @@ static int
rip_reload_routes(struct channel *C, struct channel_import_request *cir) rip_reload_routes(struct channel *C, struct channel_import_request *cir)
{ {
struct rip_proto *p = (struct rip_proto *) C->proto; struct rip_proto *p = (struct rip_proto *) C->proto;
bug("you got here! why not to log?");
if (cir) { 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; cir->next = p->cir;
p->cir = cir; p->cir = cir;
DG_UNLOCK(p->lock);
} }
if (p->rt_reload) if (p->rt_reload)
return 1; return 1;

View File

@ -104,7 +104,6 @@ struct rip_proto
struct tbf log_pkt_tbf; /* TBF for packet messages */ struct tbf log_pkt_tbf; /* TBF for packet messages */
struct tbf log_rte_tbf; /* TBF for RTE messages */ struct tbf log_rte_tbf; /* TBF for RTE messages */
struct channel_import_request *cir; /* Trie for partial reload */ struct channel_import_request *cir; /* Trie for partial reload */
DOMAIN(attrs) lock; /* Lock for partial reload */
}; };
struct rip_iface struct rip_iface

View File

@ -418,6 +418,7 @@ static int
static_reload_routes(struct channel *C, struct channel_import_request *cir) static_reload_routes(struct channel *C, struct channel_import_request *cir)
{ {
struct static_proto *p = (void *) C->proto; struct static_proto *p = (void *) C->proto;
bug("you got here! why not to log?");
TRACE(D_EVENTS, "Scheduling route reload"); TRACE(D_EVENTS, "Scheduling route reload");
if (cir && cir->trie) if (cir && cir->trie)
static_mark_partial(p, cir); static_mark_partial(p, cir);