0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 17:51:53 +00:00

Nest: Use generic rte_announce() also for import tables

Remove special rte_announce_in(), so we can use generic rte_announce()
for bot feed and notifications.
This commit is contained in:
Ondrej Zajicek 2023-08-21 04:17:21 +02:00 committed by Maria Matejka
parent 6e908775cb
commit 2d988f71a5

View File

@ -2148,11 +2148,11 @@ rt_setup(pool *pp, struct rtable_config *cf)
init_list(&t->flowspec_links); init_list(&t->flowspec_links);
init_list(&t->subscribers); init_list(&t->subscribers);
if (!(t->internal = cf->internal))
{
hmap_init(&t->id_map, p, 1024); hmap_init(&t->id_map, p, 1024);
hmap_set(&t->id_map, 0); hmap_set(&t->id_map, 0);
if (!(t->internal = cf->internal))
{
t->rt_event = ev_new_init(p, rt_event, t); t->rt_event = ev_new_init(p, rt_event, t);
t->prune_timer = tm_new_init(p, rt_prune_timer, t, 0, 0); t->prune_timer = tm_new_init(p, rt_prune_timer, t, 0, 0);
t->last_rt_change = t->gc_time = current_time(); t->last_rt_change = t->gc_time = current_time();
@ -3107,25 +3107,15 @@ rte_update_in(struct channel *c, const net_addr *n, rte *new, struct rte_src *sr
/* Remove the old rte */ /* Remove the old rte */
*pos = old->next; *pos = old->next;
rte_free_quick(old);
tab->rt_count--; tab->rt_count--;
break; break;
} }
if (!new) if (!old && !new)
{
if (!old)
goto drop_withdraw; goto drop_withdraw;
if (!net->routes)
fib_delete(&tab->fib, net);
return 1;
}
struct channel_limit *l = &c->rx_limit; struct channel_limit *l = &c->rx_limit;
if (l->action && !old) if (l->action && !old && new)
{ {
if (tab->rt_count >= l->limit) if (tab->rt_count >= l->limit)
channel_notify_limit(c, l, PLD_RX, tab->rt_count); channel_notify_limit(c, l, PLD_RX, tab->rt_count);
@ -3140,6 +3130,8 @@ rte_update_in(struct channel *c, const net_addr *n, rte *new, struct rte_src *sr
} }
} }
if (new)
{
/* Insert the new rte */ /* Insert the new rte */
rte *e = rte_do_cow(new); rte *e = rte_do_cow(new);
e->flags |= REF_COW; e->flags |= REF_COW;
@ -3147,8 +3139,31 @@ rte_update_in(struct channel *c, const net_addr *n, rte *new, struct rte_src *sr
e->sender = c; e->sender = c;
e->lastmod = current_time(); e->lastmod = current_time();
e->next = *pos; e->next = *pos;
*pos = e; *pos = new = e;
tab->rt_count++; tab->rt_count++;
if (!old)
{
new->id = hmap_first_zero(&tab->id_map);
hmap_set(&tab->id_map, new->id);
}
else
new->id = old->id;
}
rte_announce(tab, RA_ANY, net, new, old, NULL, NULL);
if (old)
{
if (!new)
hmap_clear(&tab->id_map, old->id);
rte_free_quick(old);
}
if (!net->routes)
fib_delete(&tab->fib, net);
return 1; return 1;
drop_update: drop_update: