From 2003a1840731bd57365876e48c96c5a1ea0348cb Mon Sep 17 00:00:00 2001 From: Jan Moskyto Matejka Date: Fri, 8 Apr 2016 13:08:03 +0200 Subject: 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. --- nest/rt-dev.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'nest/rt-dev.c') 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); } } -- cgit v1.2.3