Commit fad04c75 authored by Ondřej Zajíček's avatar Ondřej Zajíček

Fixes problems with kernel routes multiple routing tables.

Temporary dummy routes created by a kernel protocol during routing table
scan get mixed with real routes propagated from another kernel protocol
through a pipe.
parent f623ab98
...@@ -906,6 +906,26 @@ rte_update_unlock(void) ...@@ -906,6 +906,26 @@ rte_update_unlock(void)
lp_flush(rte_update_pool); lp_flush(rte_update_pool);
} }
static inline void
rte_hide_dummy_routes(net *net, rte **dummy)
{
if (net->routes && net->routes->attrs->source == RTS_DUMMY)
{
*dummy = net->routes;
net->routes = (*dummy)->next;
}
}
static inline void
rte_unhide_dummy_routes(net *net, rte **dummy)
{
if (*dummy)
{
(*dummy)->next = net->routes;
net->routes = *dummy;
}
}
/** /**
* rte_update - enter a new update to a routing table * rte_update - enter a new update to a routing table
* @table: table to be updated * @table: table to be updated
...@@ -955,6 +975,7 @@ rte_update2(struct announce_hook *ah, net *net, rte *new, struct proto *src) ...@@ -955,6 +975,7 @@ rte_update2(struct announce_hook *ah, net *net, rte *new, struct proto *src)
struct proto_stats *stats = ah->stats; struct proto_stats *stats = ah->stats;
struct filter *filter = ah->in_filter; struct filter *filter = ah->in_filter;
ea_list *tmpa = NULL; ea_list *tmpa = NULL;
rte *dummy = NULL;
rte_update_lock(); rte_update_lock();
if (new) if (new)
...@@ -1010,14 +1031,18 @@ rte_update2(struct announce_hook *ah, net *net, rte *new, struct proto *src) ...@@ -1010,14 +1031,18 @@ rte_update2(struct announce_hook *ah, net *net, rte *new, struct proto *src)
else else
stats->imp_withdraws_received++; stats->imp_withdraws_received++;
recalc:
rte_hide_dummy_routes(net, &dummy);
rte_recalculate(ah, net, new, tmpa, src); rte_recalculate(ah, net, new, tmpa, src);
rte_unhide_dummy_routes(net, &dummy);
rte_update_unlock(); rte_update_unlock();
return; return;
drop: drop:
rte_free(new); rte_free(new);
rte_recalculate(ah, net, NULL, NULL, src); new = NULL;
rte_update_unlock(); tmpa = NULL;
goto recalc;
} }
/* Independent call to rte_announce(), used from next hop /* Independent call to rte_announce(), used from next hop
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment