summaryrefslogtreecommitdiff
path: root/nest/rt-table.c
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2016-04-08 13:08:03 +0200
committerJan Moskyto Matejka <mq@ucw.cz>2016-04-08 13:09:06 +0200
commit2003a1840731bd57365876e48c96c5a1ea0348cb (patch)
treec473a93f4027ea2706ccac3502ccef36736fbb6d /nest/rt-table.c
parent4bdf1881dc6230b742d7efcaad8eeac4ed25f445 (diff)
Route update: move table lookup from protocols into rte_update2().
Many protocols do almost the same when creating a rte_update request before calling rte_update2(). This commit should simplify the protocol side of the route-creation routine.
Diffstat (limited to 'nest/rt-table.c')
-rw-r--r--nest/rt-table.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/nest/rt-table.c b/nest/rt-table.c
index 03ab3b92..9614d9ef 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -1267,19 +1267,23 @@ rte_unhide_dummy_routes(net *net, rte **dummy)
*/
void
-rte_update2(struct channel *c, net *net, rte *new, struct rte_src *src)
+rte_update2(struct channel *c, net_addr *n, rte *new, struct rte_src *src)
{
struct proto *p = c->proto;
struct proto_stats *stats = &c->stats;
struct filter *filter = c->in_filter;
ea_list *tmpa = NULL;
rte *dummy = NULL;
+ net *nn;
ASSERT(c->channel_state == CS_UP);
rte_update_lock();
if (new)
{
+ nn = net_get(c->table, n);
+
+ new->net = nn;
new->sender = c;
if (!new->pref)
@@ -1333,7 +1337,7 @@ rte_update2(struct channel *c, net *net, rte *new, struct rte_src *src)
{
stats->imp_withdraws_received++;
- if (!net || !src)
+ if (!(nn = net_find(c->table, n)) || !src)
{
stats->imp_withdraws_ignored++;
rte_update_unlock();
@@ -1342,9 +1346,9 @@ rte_update2(struct channel *c, net *net, rte *new, struct rte_src *src)
}
recalc:
- rte_hide_dummy_routes(net, &dummy);
- rte_recalculate(c, net, new, src);
- rte_unhide_dummy_routes(net, &dummy);
+ rte_hide_dummy_routes(nn, &dummy);
+ rte_recalculate(c, nn, new, src);
+ rte_unhide_dummy_routes(nn, &dummy);
rte_update_unlock();
return;