diff options
| author | Renato Westphal <renato@openbsd.org> | 2017-08-31 20:47:37 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-31 20:47:37 -0300 |
| commit | 99df910d50b340958bdd3dc952cc63199675fac3 (patch) | |
| tree | fe1a3e7c0dffa4a5be66a4745a86f2adca7df74d /zebra/rt_netlink.c | |
| parent | ff228d294813d59ca97b71995aa2d524476c08f0 (diff) | |
| parent | af760ec192d93ece48a1c7b4e5bc4ed4a78507e1 (diff) | |
Merge pull request #1083 from donaldsharp/unreachable
zebra: Allow bh_type to override nexthop selection
Diffstat (limited to 'zebra/rt_netlink.c')
| -rw-r--r-- | zebra/rt_netlink.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 2f03982e42..6c45df8ca2 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -384,16 +384,23 @@ 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 - : NEXTHOP_TYPE_IPV6; - else { + + 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 { + nh.type = NEXTHOP_TYPE_BLACKHOLE; + nh.bh_type = bh_type; + } + } else { nh.type = NEXTHOP_TYPE_BLACKHOLE; nh.bh_type = bh_type; } |
