diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2017-08-31 21:13:23 -0300 |
|---|---|---|
| committer | Renato Westphal <renato@opensourcerouting.org> | 2017-08-31 22:14:48 -0300 |
| commit | 8ba5bd58aa7bb8de6c18dd4ebddecf142ae4012e (patch) | |
| tree | f9d5bda18164138e56abdf00be787facd66e5f2c /zebra/rt_netlink.c | |
| parent | a3d18ce6b0810ad91e3d99bcb86e56cb6d6903a0 (diff) | |
zebra: allow blackhole routes from the kernel to be deleted
Fixes the following bug:
% ip -6 route add unreachable 4000::/64
% ip -6 route del unreachable 4000::/64
% vtysh -c "show ipv6 route"
[snip]
K>* 4000::/64 [0/1024] unreachable (ICMP unreachable)
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'zebra/rt_netlink.c')
| -rw-r--r-- | zebra/rt_netlink.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index c58a7aa2fa..f05025e630 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -491,17 +491,26 @@ static int netlink_route_change_read_unicast(struct sockaddr_nl *snl, size_t sz = (afi == AFI_IP) ? 4 : 16; memset(&nh, 0, sizeof(nh)); - if (index && !gate) - nh.type = NEXTHOP_TYPE_IFINDEX; - else if (index && gate) - nh.type = (afi == AFI_IP) - ? NEXTHOP_TYPE_IPV4_IFINDEX - : NEXTHOP_TYPE_IPV6_IFINDEX; - else if (!index && gate) - nh.type = (afi == AFI_IP) ? NEXTHOP_TYPE_IPV4 + if (bh_type == BLACKHOLE_UNSPEC) { + if (index && !gate) + nh.type = NEXTHOP_TYPE_IFINDEX; + else if (index && gate) + nh.type = + (afi == AFI_IP) + ? NEXTHOP_TYPE_IPV4_IFINDEX + : NEXTHOP_TYPE_IPV6_IFINDEX; + else if (!index && gate) + nh.type = (afi == AFI_IP) + ? NEXTHOP_TYPE_IPV4 : NEXTHOP_TYPE_IPV6; - else + else { + nh.type = NEXTHOP_TYPE_BLACKHOLE; + nh.bh_type = BLACKHOLE_UNSPEC; + } + } else { nh.type = NEXTHOP_TYPE_BLACKHOLE; + nh.bh_type = bh_type; + } nh.ifindex = index; if (gate) memcpy(&nh.gate, gate, sz); |
