summaryrefslogtreecommitdiff
path: root/nest/rt-dev.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2015-07-18 13:05:05 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2015-07-18 13:05:05 +0200
commitab4da3423d89fb6c60a4137f19c189a8716ecab6 (patch)
treec64766e7100a577507bb7357b5a1356ede93b067 /nest/rt-dev.c
parent8d9eef17713a9b38cd42bd59c4ce76c3ef6c2fc2 (diff)
Direct: Fixes behavior for the same routes on different interfaces
Thanks to Andrew (seti.kr.ua) for the bug report.
Diffstat (limited to 'nest/rt-dev.c')
-rw-r--r--nest/rt-dev.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/nest/rt-dev.c b/nest/rt-dev.c
index 87ffc5ec..f6bc1432 100644
--- a/nest/rt-dev.c
+++ b/nest/rt-dev.c
@@ -51,7 +51,10 @@ dev_ifa_notify(struct proto *p, unsigned c, struct ifa *ad)
DBG("dev_if_notify: device shutdown: prefix not found\n");
return;
}
- rte_update(p, n, NULL);
+
+ /* Use iface ID as local source ID */
+ struct rte_src *src = rt_get_source(p, ad->iface->index);
+ rte_update2(p->main_ahook, n, NULL, src);
}
else if (c & IF_CHANGE_UP)
{
@@ -61,8 +64,11 @@ dev_ifa_notify(struct proto *p, unsigned c, struct ifa *ad)
DBG("dev_if_notify: %s:%I going up\n", ad->iface->name, ad->ip);
+ /* Use iface ID as local source ID */
+ struct rte_src *src = rt_get_source(p, ad->iface->index);
+
rta a0 = {
- .src = p->main_source,
+ .src = src,
.source = RTS_DEVICE,
.scope = SCOPE_UNIVERSE,
.cast = RTC_UNICAST,
@@ -75,7 +81,7 @@ dev_ifa_notify(struct proto *p, unsigned c, struct ifa *ad)
e = rte_get_temp(a);
e->net = n;
e->pflags = 0;
- rte_update(p, n, e);
+ rte_update2(p->main_ahook, n, e, src);
}
}