summaryrefslogtreecommitdiff
path: root/sysdep/linux/netlink
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-10-20 19:04:28 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2009-10-20 19:04:28 +0200
commitbff74c7aa3ce4d407cb18b48c9df7b670c3c7a3d (patch)
tree9acb4e58a931db7e4b575db807c4997b0ccdc697 /sysdep/linux/netlink
parent4cdd078453d585ac97a183ea1f3951d85f1b8784 (diff)
Allows importing 'onlink' routes.
Diffstat (limited to 'sysdep/linux/netlink')
-rw-r--r--sysdep/linux/netlink/netlink.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/sysdep/linux/netlink/netlink.c b/sysdep/linux/netlink/netlink.c
index 9f839af0..03d43884 100644
--- a/sysdep/linux/netlink/netlink.c
+++ b/sysdep/linux/netlink/netlink.c
@@ -682,13 +682,29 @@ nl_parse_route(struct nlmsghdr *h, int scan)
ra.dest = RTD_ROUTER;
memcpy(&ra.gw, RTA_DATA(a[RTA_GATEWAY]), sizeof(ra.gw));
ipa_ntoh(ra.gw);
- ng = neigh_find(&p->p, &ra.gw, 0);
- if (ng && ng->scope)
- ra.iface = ng->iface;
+
+ if (i->rtm_flags & RTNH_F_ONLINK)
+ {
+ /* route with 'onlink' attribute */
+ ra.iface = if_find_by_index(oif);
+ if (ra.iface == NULL)
+ {
+ log(L_WARN "Kernel told us to use unknown interface %u for %I/%d",
+ oif, net->n.prefix, net->n.pxlen);
+ return;
+ }
+ }
else
{
- log(L_WARN "Kernel told us to use non-neighbor %I for %I/%d", ra.gw, net->n.prefix, net->n.pxlen);
- return;
+ /* standard route */
+ ng = neigh_find(&p->p, &ra.gw, 0);
+ if (ng && ng->scope)
+ ra.iface = ng->iface;
+ else
+ {
+ log(L_WARN "Kernel told us to use non-neighbor %I for %I/%d", ra.gw, net->n.prefix, net->n.pxlen);
+ return;
+ }
}
}
else