summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2016-05-10 14:21:15 +0200
committerJan Moskyto Matejka <mq@ucw.cz>2016-05-10 14:21:15 +0200
commit92912f063a94bd7c743a25628ca2073380e09ef4 (patch)
treee8328b04713b3004747bcd3160294dd97e16b35e /nest
parenta8caff322f83f1303c408bbefc440aeea9e619a3 (diff)
parent2003a1840731bd57365876e48c96c5a1ea0348cb (diff)
Merge remote-tracking branch 'origin/rte-update' into int-new
Diffstat (limited to 'nest')
-rw-r--r--nest/protocol.h2
-rw-r--r--nest/route.h2
-rw-r--r--nest/rt-dev.c15
-rw-r--r--nest/rt-table.c14
4 files changed, 13 insertions, 20 deletions
diff --git a/nest/protocol.h b/nest/protocol.h
index 61919a54..2d640504 100644
--- a/nest/protocol.h
+++ b/nest/protocol.h
@@ -271,7 +271,7 @@ proto_get_router_id(struct proto_config *pc)
}
/* Moved from route.h to avoid dependency conflicts */
-static inline void rte_update(struct proto *p, net *net, rte *new) { rte_update2(p->main_channel, net, new, p->main_source); }
+static inline void rte_update(struct proto *p, net_addr *n, rte *new) { rte_update2(p->main_channel, n, new, p->main_source); }
extern list proto_list;
diff --git a/nest/route.h b/nest/route.h
index a893841f..08179d73 100644
--- a/nest/route.h
+++ b/nest/route.h
@@ -276,7 +276,7 @@ static inline net *net_get(rtable *tab, const net_addr *addr) { return (net *) f
rte *rte_find(net *net, struct rte_src *src);
rte *rte_get_temp(struct rta *);
-void rte_update2(struct channel *c, net *net, rte *new, struct rte_src *src);
+void rte_update2(struct channel *c, net_addr *n, rte *new, struct rte_src *src);
/* rte_update() moved to protocol.h to avoid dependency conflicts */
void rte_discard(rtable *tab, rte *old);
int rt_examine(rtable *t, net_addr *a, struct proto *p, struct filter *filter);
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);
}
}
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;