diff options
author | Stephen Worley <sworley@nvidia.com> | 2021-03-02 17:50:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-02 17:50:46 +0100 |
commit | b1077f0fa270808a2c0b9100bcaea920f6bf942a (patch) | |
tree | 4f15e25f9fa669f1955bda103a83aa0ae0939ca3 /zebra/rt_netlink.c | |
parent | Merge pull request #8150 from pguibert6WIND/ecomm_seq_0_possible (diff) | |
parent | zebra: don't use kernel nexthops for blackhole routes (diff) | |
download | frr-b1077f0fa270808a2c0b9100bcaea920f6bf942a.tar.xz frr-b1077f0fa270808a2c0b9100bcaea920f6bf942a.zip |
Merge pull request #8152 from idryzhov/fix-zebra-blackhole
zebra: don't use kernel nexthops for blackhole routes
Diffstat (limited to 'zebra/rt_netlink.c')
-rw-r--r-- | zebra/rt_netlink.c | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 99cb82e22..93961686f 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1767,6 +1767,33 @@ ssize_t netlink_route_multipath_msg_encode(int cmd, nl_attr_nest_end(&req->n, nest); } + /* + * Always install blackhole routes without using nexthops, because of + * the following kernel problems: + * 1. Kernel nexthops don't suport unreachable/prohibit route types. + * 2. Blackhole kernel nexthops are deleted when loopback is down. + */ + nexthop = dplane_ctx_get_ng(ctx)->nexthop; + if (nexthop) { + if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) + nexthop = nexthop->resolved; + + if (nexthop->type == NEXTHOP_TYPE_BLACKHOLE) { + switch (nexthop->bh_type) { + case BLACKHOLE_ADMINPROHIB: + req->r.rtm_type = RTN_PROHIBIT; + break; + case BLACKHOLE_REJECT: + req->r.rtm_type = RTN_UNREACHABLE; + break; + default: + req->r.rtm_type = RTN_BLACKHOLE; + break; + } + return NLMSG_ALIGN(req->n.nlmsg_len); + } + } + if ((!fpm && kernel_nexthops_supported() && (!proto_nexthops_only() || is_proto_nhg(dplane_ctx_get_nhe_id(ctx), 0))) @@ -1820,27 +1847,6 @@ ssize_t netlink_route_multipath_msg_encode(int cmd, if (nexthop_num == 1) { nexthop_num = 0; for (ALL_NEXTHOPS_PTR(dplane_ctx_get_ng(ctx), nexthop)) { - /* - * So we want to cover 2 types of blackhole - * routes here: - * 1) A normal blackhole route( ala from a static - * install. - * 2) A recursively resolved blackhole route - */ - if (nexthop->type == NEXTHOP_TYPE_BLACKHOLE) { - switch (nexthop->bh_type) { - case BLACKHOLE_ADMINPROHIB: - req->r.rtm_type = RTN_PROHIBIT; - break; - case BLACKHOLE_REJECT: - req->r.rtm_type = RTN_UNREACHABLE; - break; - default: - req->r.rtm_type = RTN_BLACKHOLE; - break; - } - return NLMSG_ALIGN(req->n.nlmsg_len); - } if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) { |