0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-12 22:28:44 +00:00

Nest: Use 'old' route from export table

When export table is enabled for channel, then use routes from
export table as 'old' for rt_notify() notifications.
This commit is contained in:
Ondrej Zajicek (work) 2019-10-31 01:26:40 +01:00
parent ee147fc1a5
commit 623e41cc50
2 changed files with 12 additions and 4 deletions

View File

@ -329,7 +329,7 @@ int rte_update_in(struct channel *c, const net_addr *n, rte *new, struct rte_src
int rt_reload_channel(struct channel *c);
void rt_reload_channel_abort(struct channel *c);
void rt_prune_sync(rtable *t, int all);
int rte_update_out(struct channel *c, const net_addr *n, rte *new, rte *old0, int refeed);
int rte_update_out(struct channel *c, const net_addr *n, rte *new, rte *old0, rte **old_free, int refeed);
struct rtable_config *rt_new_table(struct symbol *s, uint addr_type);
void cmd_show_table_stats(struct rtable_config *tab);

View File

@ -565,6 +565,7 @@ do_rt_notify(struct channel *c, net *net, rte *new, rte *old, ea_list *tmpa, int
{
struct proto *p = c->proto;
struct proto_stats *stats = &c->stats;
rte *old_free = NULL;
/*
* First, apply export limit.
@ -611,9 +612,13 @@ do_rt_notify(struct channel *c, net *net, rte *new, rte *old, ea_list *tmpa, int
}
}
if (c->out_table && !rte_update_out(c, net->n.addr, new, old, refeed))
if (c->out_table && !rte_update_out(c, net->n.addr, new, old, &old_free, refeed))
return;
/* Use route from export_table as old */
if (old_free)
old = old_free;
if (new)
stats->exp_updates_accepted++;
else
@ -648,6 +653,9 @@ do_rt_notify(struct channel *c, net *net, rte *new, rte *old, ea_list *tmpa, int
}
else
p->rt_notify(p, c, net, new, old, new->attrs->eattrs);
if (old_free)
rte_free(old_free);
}
static void
@ -2578,7 +2586,7 @@ rt_prune_sync(rtable *t, int all)
*/
int
rte_update_out(struct channel *c, const net_addr *n, rte *new, rte *old0, int refeed)
rte_update_out(struct channel *c, const net_addr *n, rte *new, rte *old0, rte **old_free, int refeed)
{
struct rtable *tab = c->out_table;
struct rte_src *src;
@ -2621,8 +2629,8 @@ rte_update_out(struct channel *c, const net_addr *n, rte *new, rte *old0, int re
}
/* Remove the old rte */
*old_free = old;
*pos = old->next;
rte_free_quick(old);
tab->route_count--;
break;