mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-08 20:28:43 +00:00
Partial import reload looks working
This commit is contained in:
parent
21e7d9c5c3
commit
f9e46a8e31
@ -496,7 +496,6 @@ trie_add_prefix(struct f_trie *t, const net_addr *net, uint l, uint h)
|
||||
static int
|
||||
trie_match_net4(const struct f_trie *t, ip4_addr px, uint plen)
|
||||
{
|
||||
log("net4 compare");
|
||||
if (plen == 0)
|
||||
return t->zero;
|
||||
|
||||
@ -533,7 +532,6 @@ trie_match_net4(const struct f_trie *t, ip4_addr px, uint plen)
|
||||
static int
|
||||
trie_match_net6(const struct f_trie *t, ip6_addr px, uint plen)
|
||||
{
|
||||
log("net6 compare");
|
||||
if (plen == 0)
|
||||
return t->zero;
|
||||
|
||||
@ -579,7 +577,6 @@ trie_match_net6(const struct f_trie *t, ip6_addr px, uint plen)
|
||||
int
|
||||
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)
|
||||
{
|
||||
case NET_IP4:
|
||||
|
30
nest/proto.c
30
nest/proto.c
@ -58,6 +58,8 @@ static void channel_stop_export(struct channel *c);
|
||||
static void channel_export_stopped(struct rt_export_request *req);
|
||||
static void channel_refeed_stopped(struct rt_export_request *req);
|
||||
static void channel_check_stopped(struct channel *c);
|
||||
static void channel_reload_in_done(struct channel_import_request *cir);
|
||||
static void channel_request_partial_reload(struct channel *c, struct channel_import_request *cir);
|
||||
|
||||
static inline int proto_is_done(struct proto *p)
|
||||
{ return (p->proto_state == PS_DOWN) && proto_is_inactive(p); }
|
||||
@ -355,7 +357,15 @@ channel_roa_in_changed(struct settle *se)
|
||||
struct channel *c = s->c;
|
||||
|
||||
CD(c, "Reload triggered by RPKI change");
|
||||
channel_request_reload(c);
|
||||
|
||||
struct channel_import_request *cir = lp_alloc(s->trie->lp, sizeof *cir);
|
||||
*cir = (struct channel_import_request) {
|
||||
.trie = s->trie,
|
||||
};
|
||||
if (s->trie)
|
||||
cir->done = channel_reload_in_done;
|
||||
|
||||
channel_request_partial_reload(c, cir);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -558,10 +568,6 @@ channel_start_import(struct channel *c)
|
||||
.dump_req = channel_dump_import_req,
|
||||
.log_state_change = channel_import_log_state_change,
|
||||
.preimport = channel_preimport,
|
||||
.prefilter = {
|
||||
.mode = c->out_subprefix ? TE_ADDR_IN : TE_ADDR_NONE,
|
||||
.addr = c->out_subprefix,
|
||||
},
|
||||
};
|
||||
|
||||
ASSERT(c->channel_state == CS_UP);
|
||||
@ -775,12 +781,8 @@ channel_import_prefilter(const struct rt_prefilter *p, const net_addr *n)
|
||||
ASSERT_DIE(c->importing);
|
||||
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))
|
||||
{
|
||||
log(L_TRACE "Export this one");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
log(L_TRACE "%N filtered out of import", n);
|
||||
return 0;
|
||||
@ -838,7 +840,6 @@ channel_feed_end(struct channel *c)
|
||||
void
|
||||
channel_schedule_reload(struct channel *c, struct channel_import_request *cir)
|
||||
{
|
||||
log(L_TRACE "channel_schedule_reload %i %i",cir, (cir && cir->trie));
|
||||
ASSERT(c->in_req.hook);
|
||||
int no_trie = 0;
|
||||
if (cir)
|
||||
@ -1129,6 +1130,12 @@ channel_stop_export(struct channel *c)
|
||||
rt_stop_export(&c->out_req, channel_export_stopped);
|
||||
}
|
||||
|
||||
static void
|
||||
channel_import_request_done_dynamic(struct channel_import_request *req)
|
||||
{
|
||||
mb_free(req);
|
||||
}
|
||||
|
||||
static void
|
||||
channel_request_reload(struct channel *c)
|
||||
{
|
||||
@ -1140,6 +1147,7 @@ channel_request_reload(struct channel *c)
|
||||
if ((c->in_keep & RIK_PREFILTER) == RIK_PREFILTER) {
|
||||
struct channel_import_request* cir = mb_alloc(c->proto->pool, sizeof *cir);;
|
||||
cir->trie = NULL;
|
||||
cir->done = channel_import_request_done_dynamic;
|
||||
channel_schedule_reload(c, cir);
|
||||
}
|
||||
else
|
||||
@ -1156,7 +1164,7 @@ channel_request_partial_reload(struct channel *c, struct channel_import_request
|
||||
|
||||
if ((c->in_keep & RIK_PREFILTER) == RIK_PREFILTER)
|
||||
channel_schedule_reload(c, cir);
|
||||
/* TODO*/
|
||||
/* TODO */
|
||||
else
|
||||
CD(c, "Partial import reload requested, but with ric cosi");
|
||||
/*c->proto->reload_routes(c);
|
||||
|
@ -4402,7 +4402,6 @@ rt_process_feed(struct rt_table_export_hook *c, rt_feed_block *b)
|
||||
static void
|
||||
rt_feed_by_fib(void *data)
|
||||
{
|
||||
log(L_TRACE "rt_feed_by_fib_function - here filtering starts");
|
||||
struct rt_table_export_hook *c = data;
|
||||
struct fib_iterator *fit = &c->feed_fit;
|
||||
rt_feed_block block = {};
|
||||
@ -4416,10 +4415,8 @@ rt_feed_by_fib(void *data)
|
||||
{
|
||||
if (rt_prefilter_net(&c->h.req->prefilter, n->n.addr))
|
||||
{
|
||||
log("route passed");
|
||||
if (!rt_prepare_feed(c, n, &block))
|
||||
{
|
||||
log("inside ifs");
|
||||
FIB_ITERATE_PUT(fit);
|
||||
RT_UNLOCK(tab);
|
||||
rt_process_feed(c, &block);
|
||||
|
Loading…
Reference in New Issue
Block a user