]> git.puffer.fish Git - mirror/frr.git/commitdiff
babeld: install directly connected IPv4 as such
authorDavid Lamparter <equinox@opensourcerouting.org>
Tue, 13 Jun 2017 07:45:16 +0000 (09:45 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 13 Jun 2017 07:45:16 +0000 (09:45 +0200)
babeld would install "1.2.3.4 on eth0" as "1.2.3.4 via 1.2.3.4 on eth0".
Remove the superfluous nexthop and send to zebra as directly-connected
route.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
babeld/kernel.c

index fa06f80a5b07d0dc8705b1c5742b652694eb4ac9..26860f3bae6ede6fa59ab44ad1b4acbe1b424e88 100644 (file)
@@ -177,7 +177,12 @@ kernel_route_v4(int add,
         api.nexthop_num = 1;
         api.nexthop = &nexthop_pointer;
         nexthop.ifindex = ifindex;
-        nexthop.type = NEXTHOP_TYPE_IPV4_IFINDEX;
+        if (IPV4_ADDR_SAME (&nexthop.gate.ipv4, &quagga_prefix.u.prefix4) &&
+                quagga_prefix.prefixlen == 32) {
+            nexthop.type = NEXTHOP_TYPE_IFINDEX;
+        } else {
+            nexthop.type = NEXTHOP_TYPE_IPV4_IFINDEX;
+        }
         SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
         api.metric = metric;
     }
@@ -227,6 +232,7 @@ kernel_route_v6(int add, const unsigned char *pref, unsigned short plen,
         api.nexthop_num = 1;
         api.nexthop = &nexthop_pointer;
         nexthop.ifindex = ifindex;
+        /* difference to IPv4: always leave the linklocal as nexthop */
         nexthop.type = NEXTHOP_TYPE_IPV6_IFINDEX;
         SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
         api.metric = metric;