summaryrefslogtreecommitdiff
path: root/nest/rt-dev.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-dev.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-dev.c')
-rw-r--r--nest/rt-dev.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/nest/rt-dev.c b/nest/rt-dev.c
index a996f4fc..098885b9 100644
--- a/nest/rt-dev.c
+++ b/nest/rt-dev.c
@@ -55,24 +55,15 @@ dev_ifa_notify(struct proto *P, uint flags, struct ifa *ad)
if (flags & IF_CHANGE_DOWN)
{
- net *n;
-
DBG("dev_if_notify: %s:%I going down\n", ad->iface->name, ad->ip);
- n = net_find(c->table, &ad->prefix);
- if (!n)
- {
- DBG("dev_if_notify: device shutdown: prefix not found\n");
- return;
- }
/* Use iface ID as local source ID */
struct rte_src *src = rt_get_source(P, ad->iface->index);
- rte_update2(c, n, NULL, src);
+ rte_update2(c, &ad->prefix, NULL, src);
}
else if (flags & IF_CHANGE_UP)
{
rta *a;
- net *n;
rte *e;
DBG("dev_if_notify: %s:%I going up\n", ad->iface->name, ad->ip);
@@ -90,11 +81,9 @@ dev_ifa_notify(struct proto *P, uint flags, struct ifa *ad)
};
a = rta_lookup(&a0);
- n = net_get(c->table, &ad->prefix);
e = rte_get_temp(a);
- e->net = n;
e->pflags = 0;
- rte_update2(c, n, e, src);
+ rte_update2(c, &ad->prefix, e, src);
}
}