0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-01-15 13:31:54 +00:00

bmp table accesed in event.c after free - or walgrind is saying so

This commit is contained in:
Katerina Kubecova 2024-09-11 11:35:29 +02:00
parent 27478065df
commit afa47859e2
3 changed files with 34 additions and 18 deletions

View File

@ -2915,7 +2915,7 @@ void
protos_attr_field_init(void)
{
log("start of protos_attr_field_init");
int init_length = 16;
int init_length = 32;
proto_state_table = mb_allocz(&root_pool, sizeof(struct proto_attrs));
proto_state_table->attrs = mb_allocz(&root_pool, sizeof(ea_list *_Atomic)*init_length);
proto_state_table->channels_attrs = mb_allocz(&root_pool, sizeof(struct channel_attrs_list) * init_length);

View File

@ -575,7 +575,7 @@ bmp_add_table_exp_req(struct bmp_proto *p, rtable *tab)
return bt;
}
static void
/*static void
bmp_remove_table(struct bmp_proto *p, struct bmp_table *bt)
{
log("removing table - bmp table %x chann %x, (subscr %x uc %x)",bt, bt->channel, &bt->channel->roa_subscriptions, &bt->uc);
@ -590,7 +590,7 @@ bmp_remove_table(struct bmp_proto *p, struct bmp_table *bt)
log("free table %x", bt);
mb_free(bt);
}
}*/
static void
bmp_remove_table_rt(struct bmp_proto *p, struct bmp_table *bt) // still falling in krt routes... The thread synchronization was maybe not needed...
@ -1199,6 +1199,7 @@ bmp_do_pre_policy(void *bt_)
if (r->flags & REF_OBSOLETE)
break;
}
rte new = rte_init_from(r);

View File

@ -392,7 +392,7 @@ krt_got_route(struct krt_proto *p, rte *e, s8 src)
/* The rest is for KRT_SRC_BIRD (or KRT_SRC_UNKNOWN) */
/* Deleting all routes if final flush is requested */
if (p->sync_state == KPS_FLUSHING)
goto delete;
goto done;//delete;
/* We wait for the initial feed to have correct installed state */
if (!p->ready)
@ -706,7 +706,7 @@ krt_rt_notify(struct proto *P, struct channel *ch UNUSED, const net_addr *net,
case KPS_FLUSHING:
/* Drop any incoming route */
krt_replace_rte(p, net, NULL, old ?: new);
//krt_replace_rte(p, net, NULL, old ?: new);
}
}
@ -769,9 +769,9 @@ krt_export_fed(struct channel *C)
break;
case KPS_FLUSHING:
krt_do_scan(p);
krt_cleanup(p);
proto_notify_state(&p->p, PS_DOWN);
//krt_do_scan(p);
//krt_cleanup(p);
//proto_notify_state(&p->p, PS_DOWN);
return;
}
}
@ -886,6 +886,7 @@ krt_start(struct proto *P)
static int
krt_shutdown(struct proto *P)
{
log("krt shutdown");
struct krt_proto *p = (struct krt_proto *) P;
krt_scan_timer_stop(p);
@ -896,26 +897,40 @@ krt_shutdown(struct proto *P)
/* FIXME we should flush routes even when persist during reconfiguration */
if (p->initialized && !KRT_CF->persist && (P->down_code != PDC_CMD_GR_DOWN))
{
rt_export_feeder req; /* init z P->main_channel->table, na export_best */
...;
RT_FEED_WALK(req, f) /* look at rt-show.c for example */
log("start of if");
struct rt_export_feeder req = (struct rt_export_feeder)
{
for (...)
rte *e = &f->block[i];
.name = "shotdown.feeder",
.trace_routes = P->main_channel->debug,
}; /* init z P->main_channel->table, na export_best */
rt_feeder_subscribe(&P->main_channel->table->export_all, &req);//...;
RT_FEED_WALK(&req, f) /* look at rt-show.c for example */
{
for (uint i = 0; i < f->count_routes; i++)
{
rte *e = &f->block[i];
/* check bmap_test(P->main_channel->export_rejected_map, e->id)
* if 0, then never exported (can be skipped)
*/
if (bmap_test(&P->main_channel->export_rejected_map, e->id))
continue;
/* if exported then delete from kernel */
krt_replace_rte(p, net, NULL, old ?: new);
rte new = rte_init_from(e);
krt_replace_rte(p, e->net, NULL, &new);//old ?: new);
}
}
/* put things from krt_export_fed */
krt_do_scan(p);
krt_cleanup(p);
proto_notify_state(&p->p, PS_DOWN);
log("end of if");
}
krt_cleanup(p);
else
krt_cleanup(p);
log("Lets return");
return PS_DOWN;
}