From: Ondrej Zajicek (work) Date: Thu, 31 Oct 2019 00:26:40 +0000 (+0100) Subject: Nest: Use 'old' route from export table X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=623e41cc5003811d3d82d92f8bb863dc06ef17b1;p=thirdparty%2Fbird.git 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. --- diff --git a/nest/route.h b/nest/route.h index cbc84934a..510c661a3 100644 --- a/nest/route.h +++ b/nest/route.h @@ -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); diff --git a/nest/rt-table.c b/nest/rt-table.c index 5d4a0ef26..fe402cbab 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -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;