0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-01-05 08:31:53 +00:00

Partial import reload looks working for cli

This commit is contained in:
Katerina Kubecova 2023-10-12 15:18:42 +02:00
parent 10bf227de7
commit 21e7d9c5c3
3 changed files with 21 additions and 12 deletions

View File

@ -496,6 +496,7 @@ trie_add_prefix(struct f_trie *t, const net_addr *net, uint l, uint h)
static int static int
trie_match_net4(const struct f_trie *t, ip4_addr px, uint plen) trie_match_net4(const struct f_trie *t, ip4_addr px, uint plen)
{ {
log("net4 compare");
if (plen == 0) if (plen == 0)
return t->zero; return t->zero;
@ -532,6 +533,7 @@ trie_match_net4(const struct f_trie *t, ip4_addr px, uint plen)
static int static int
trie_match_net6(const struct f_trie *t, ip6_addr px, uint plen) trie_match_net6(const struct f_trie *t, ip6_addr px, uint plen)
{ {
log("net6 compare");
if (plen == 0) if (plen == 0)
return t->zero; return t->zero;
@ -577,6 +579,7 @@ trie_match_net6(const struct f_trie *t, ip6_addr px, uint plen)
int int
trie_match_net(const struct f_trie *t, const net_addr *n) trie_match_net(const struct f_trie *t, const net_addr *n)
{ {
log(L_DEBUG "trie match net - types %i %i", t->ipv4, n->type);
switch (n->type) switch (n->type)
{ {
case NET_IP4: case NET_IP4:

View File

@ -754,7 +754,7 @@ channel_refeed_prefilter(const struct rt_prefilter *p, const net_addr *n)
SKIP_BACK(struct channel, refeed_req, SKIP_BACK(struct channel, refeed_req,
SKIP_BACK(struct rt_export_request, prefilter, p) SKIP_BACK(struct rt_export_request, prefilter, p)
); );
ASSERT_DIE(c->refeeding);
for (struct channel_feeding_request *cfr = c->refeeding; cfr; cfr = cfr->next) for (struct channel_feeding_request *cfr = c->refeeding; cfr; cfr = cfr->next)
if (!cfr->trie || trie_match_net(cfr->trie, n)) if (!cfr->trie || trie_match_net(cfr->trie, n))
{ {
@ -772,12 +772,16 @@ channel_import_prefilter(const struct rt_prefilter *p, const net_addr *n)
SKIP_BACK(struct channel, reload_req, SKIP_BACK(struct channel, reload_req,
SKIP_BACK(struct rt_export_request, prefilter, p) SKIP_BACK(struct rt_export_request, prefilter, p)
); );
ASSERT_DIE(c->importing);
for (struct channel_import_request *cir = c->importing; cir; cir = cir->next) for (struct channel_import_request *cir = c->importing; cir; cir = cir->next)
{
log(L_DEBUG "in for cycle %x %x", cir->trie, cir->trie->root);
if (!cir->trie || trie_match_net(cir->trie, n)) if (!cir->trie || trie_match_net(cir->trie, n))
{ {
log(L_TRACE "Export this one"); log(L_TRACE "Export this one");
return 1; return 1;
} }
}
log(L_TRACE "%N filtered out of import", n); log(L_TRACE "%N filtered out of import", n);
return 0; return 0;
} }
@ -839,22 +843,24 @@ channel_schedule_reload(struct channel *c, struct channel_import_request *cir)
int no_trie = 0; int no_trie = 0;
if (cir) if (cir)
{ {
struct channel_import_request* last = c->import_pending; cir->next = c->import_pending;
while (last) c->import_pending = cir;
{
if (!last->trie)
no_trie = 1;
last = last->next;
}
last = cir;
no_trie = !last->trie;
} }
if (c->reload_req.hook) if (c->reload_req.hook)
{ {
CD(c, "Reload triggered before the previous one has finished"); CD(c, "Reload triggered before the previous one has finished");
c->reload_pending = 1; c->reload_pending = 1;
return; return;
} }
struct channel_import_request *last = cir;
while (last)
{
if (!last->trie)
no_trie = 1;
last = last->next;
}
c->importing = c->import_pending; c->importing = c->import_pending;
c->import_pending = NULL; c->import_pending = NULL;

View File

@ -2212,7 +2212,6 @@ rt_table_export_start_feed(struct rtable_private *tab, struct rt_table_export_ho
{ {
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;
log("Hook is %x", hook);
/* stats zeroed by mb_allocz */ /* stats zeroed by mb_allocz */
switch (req->prefilter.mode) switch (req->prefilter.mode)
{ {
@ -2230,7 +2229,6 @@ rt_table_export_start_feed(struct rtable_private *tab, struct rt_table_export_ho
case TE_ADDR_NONE: case TE_ADDR_NONE:
case TE_ADDR_TRIE: case TE_ADDR_TRIE:
case TE_ADDR_HOOK: case TE_ADDR_HOOK:
log(L_TRACE "hook - we will feed by fib, not trie?");
FIB_ITERATE_INIT(&hook->feed_fit, &tab->fib); FIB_ITERATE_INIT(&hook->feed_fit, &tab->fib);
hook->h.event.hook = rt_feed_by_fib; hook->h.event.hook = rt_feed_by_fib;
break; break;
@ -4418,8 +4416,10 @@ rt_feed_by_fib(void *data)
{ {
if (rt_prefilter_net(&c->h.req->prefilter, n->n.addr)) if (rt_prefilter_net(&c->h.req->prefilter, n->n.addr))
{ {
log("route passed");
if (!rt_prepare_feed(c, n, &block)) if (!rt_prepare_feed(c, n, &block))
{ {
log("inside ifs");
FIB_ITERATE_PUT(fit); FIB_ITERATE_PUT(fit);
RT_UNLOCK(tab); RT_UNLOCK(tab);
rt_process_feed(c, &block); rt_process_feed(c, &block);