From: David Lamparter Date: Tue, 13 Jun 2017 07:45:16 +0000 (+0200) Subject: babeld: install directly connected IPv4 as such X-Git-Tag: reindent-master-before~74^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=3565d9ac830cb04d0e5da8ceb8e6e9fdefde788a;p=mirror%2Ffrr.git babeld: install directly connected IPv4 as such 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 --- diff --git a/babeld/kernel.c b/babeld/kernel.c index fa06f80a5b..26860f3bae 100644 --- a/babeld/kernel.c +++ b/babeld/kernel.c @@ -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;