diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2017-06-13 09:45:16 +0200 | 
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2017-06-13 09:45:16 +0200 | 
| commit | 3565d9ac830cb04d0e5da8ceb8e6e9fdefde788a (patch) | |
| tree | 32c5767ebcebc3c4be43b79b93ae98bd517f8e0b /babeld/kernel.c | |
| parent | 97bd5c48de49f1a25c6fb979f0ca151412fbd61b (diff) | |
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 <equinox@opensourcerouting.org>
Diffstat (limited to 'babeld/kernel.c')
| -rw-r--r-- | babeld/kernel.c | 8 | 
1 files changed, 7 insertions, 1 deletions
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;  | 
