mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-13 22:58:42 +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
|
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;
|
||||||
|
|
||||||
@ -533,7 +532,6 @@ 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;
|
||||||
|
|
||||||
@ -579,7 +577,6 @@ 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:
|
||||||
|
28
nest/proto.c
28
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_export_stopped(struct rt_export_request *req);
|
||||||
static void channel_refeed_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_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)
|
static inline int proto_is_done(struct proto *p)
|
||||||
{ return (p->proto_state == PS_DOWN) && proto_is_inactive(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;
|
struct channel *c = s->c;
|
||||||
|
|
||||||
CD(c, "Reload triggered by RPKI change");
|
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
|
static void
|
||||||
@ -558,10 +568,6 @@ channel_start_import(struct channel *c)
|
|||||||
.dump_req = channel_dump_import_req,
|
.dump_req = channel_dump_import_req,
|
||||||
.log_state_change = channel_import_log_state_change,
|
.log_state_change = channel_import_log_state_change,
|
||||||
.preimport = channel_preimport,
|
.preimport = channel_preimport,
|
||||||
.prefilter = {
|
|
||||||
.mode = c->out_subprefix ? TE_ADDR_IN : TE_ADDR_NONE,
|
|
||||||
.addr = c->out_subprefix,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ASSERT(c->channel_state == CS_UP);
|
ASSERT(c->channel_state == CS_UP);
|
||||||
@ -775,13 +781,9 @@ channel_import_prefilter(const struct rt_prefilter *p, const net_addr *n)
|
|||||||
ASSERT_DIE(c->importing);
|
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");
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
@ -838,7 +840,6 @@ channel_feed_end(struct channel *c)
|
|||||||
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(L_TRACE "channel_schedule_reload %i %i",cir, (cir && cir->trie));
|
|
||||||
ASSERT(c->in_req.hook);
|
ASSERT(c->in_req.hook);
|
||||||
int no_trie = 0;
|
int no_trie = 0;
|
||||||
if (cir)
|
if (cir)
|
||||||
@ -1129,6 +1130,12 @@ channel_stop_export(struct channel *c)
|
|||||||
rt_stop_export(&c->out_req, channel_export_stopped);
|
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
|
static void
|
||||||
channel_request_reload(struct channel *c)
|
channel_request_reload(struct channel *c)
|
||||||
{
|
{
|
||||||
@ -1140,6 +1147,7 @@ channel_request_reload(struct channel *c)
|
|||||||
if ((c->in_keep & RIK_PREFILTER) == RIK_PREFILTER) {
|
if ((c->in_keep & RIK_PREFILTER) == RIK_PREFILTER) {
|
||||||
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;
|
||||||
channel_schedule_reload(c, cir);
|
channel_schedule_reload(c, cir);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4402,7 +4402,6 @@ rt_process_feed(struct rt_table_export_hook *c, rt_feed_block *b)
|
|||||||
static void
|
static void
|
||||||
rt_feed_by_fib(void *data)
|
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 rt_table_export_hook *c = data;
|
||||||
struct fib_iterator *fit = &c->feed_fit;
|
struct fib_iterator *fit = &c->feed_fit;
|
||||||
rt_feed_block block = {};
|
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))
|
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);
|
||||||
|
@ -274,7 +274,6 @@ struct rt_import_request {
|
|||||||
struct rt_import_hook *hook; /* The table part of importer */
|
struct rt_import_hook *hook; /* The table part of importer */
|
||||||
char *name;
|
char *name;
|
||||||
u8 trace_routes;
|
u8 trace_routes;
|
||||||
struct rt_prefilter prefilter;
|
|
||||||
|
|
||||||
event_list *list; /* Where to schedule announce events */
|
event_list *list; /* Where to schedule announce events */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user