]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Allows importing 'onlink' routes.
authorOndrej Zajicek <santiago@crfreenet.org>
Tue, 20 Oct 2009 17:04:28 +0000 (19:04 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Tue, 20 Oct 2009 17:04:28 +0000 (19:04 +0200)
sysdep/linux/netlink/netlink.c

index 9f839af00f243440e4f02f9e44d6ee7cb768d5df..03d43884aece776acb7444d4cab1322178137bcf 100644 (file)
@@ -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