]> git.puffer.fish Git - matthieu/frr.git/commitdiff
Revert "zebra: use link scope for interface routes"
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 23 Sep 2016 16:11:09 +0000 (12:11 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 23 Sep 2016 16:11:09 +0000 (12:11 -0400)
This reverts commit 72f3a8fb09433ee1e4d079522cd70999bb3b8e79.

zebra/rt_netlink.c
zebra/zebra_rib.c

index 79f20259a10e41d7bf69f482f43ebe53785ea4a1..95c8892979d14367e34792ea1f68bb7a02d518fb 100644 (file)
@@ -2428,7 +2428,7 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
   req.r.rtm_family = family;
   req.r.rtm_dst_len = p->prefixlen;
   req.r.rtm_protocol = RTPROT_ZEBRA;
-  req.r.rtm_scope = RT_SCOPE_LINK;
+  req.r.rtm_scope = RT_SCOPE_UNIVERSE;
 
   if ((rib->flags & ZEBRA_FLAG_BLACKHOLE) || (rib->flags & ZEBRA_FLAG_REJECT))
     discard = 1;
@@ -2508,9 +2508,6 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
       if (cmd == RTM_DELROUTE && !CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
         continue;
 
-      if (nexthop->type != NEXTHOP_TYPE_IFINDEX)
-        req.r.rtm_scope = RT_SCOPE_UNIVERSE;
-
       nexthop_num++;
     }
 
index 775619ac2df6fab48425ae341cf5738caf5b2db5..f57c0b5d678d95936f0e19fff3c0e69909efae92 100644 (file)
@@ -483,16 +483,27 @@ nexthop_active_ipv4 (struct rib *rib, struct nexthop *nexthop, int set,
                          {
                            resolved_hop->type = newhop->type;
                            resolved_hop->gate.ipv4 = newhop->gate.ipv4;
-                           resolved_hop->ifindex = newhop->ifindex;
+
+                           if (newhop->ifindex)
+                             {
+                               resolved_hop->type = NEXTHOP_TYPE_IPV4_IFINDEX;
+                               resolved_hop->ifindex = newhop->ifindex;
+                               if (newhop->flags & NEXTHOP_FLAG_ONLINK)
+                                 resolved_hop->flags |= NEXTHOP_FLAG_ONLINK;
+                             }
                          }
 
-                       /* If the resolving route is an interface route, it
-                        * means the gateway we are looking up is connected
-                        * to that interface. Therefore, the resolved route
-                        * should have the original gateway as nexthop as it
-                        * is directly connected. */
+                       /* If the resolving route is an interface route,
+                        * it means the gateway we are looking up is connected
+                        * to that interface. (The actual network is _not_ onlink).
+                        * Therefore, the resolved route should have the original
+                        * gateway as nexthop as it is directly connected.
+                        *
+                        * On Linux, we have to set the onlink netlink flag because
+                        * otherwise, the kernel won't accept the route. */
                        if (newhop->type == NEXTHOP_TYPE_IFINDEX)
                          {
+                           resolved_hop->flags |= NEXTHOP_FLAG_ONLINK;
                            resolved_hop->type = NEXTHOP_TYPE_IPV4_IFINDEX;
                            resolved_hop->gate.ipv4 = nexthop->gate.ipv4;
                            resolved_hop->ifindex = newhop->ifindex;