diff options
Diffstat (limited to 'sysdep/linux/netlink/netlink.c')
-rw-r--r-- | sysdep/linux/netlink/netlink.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/sysdep/linux/netlink/netlink.c b/sysdep/linux/netlink/netlink.c index 6cfb0ba6..f45fe159 100644 --- a/sysdep/linux/netlink/netlink.c +++ b/sysdep/linux/netlink/netlink.c @@ -691,18 +691,34 @@ 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_find2(&p->p, &ra.gw, ifa, 0); - if (ng && ng->scope) - { - if (ng->iface != ifa) - log(L_WARN "KRT: Route with unexpected iface for %I/%d", net->n.prefix, net->n.pxlen); - 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; - } + { + ng = neigh_find2(&p->p, &ra.gw, ifa, 0); + if (ng && ng->scope) + { + if (ng->iface != ifa) + log(L_WARN "KRT: Route with unexpected iface for %I/%d", net->n.prefix, net->n.pxlen); + 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 { |