Merge pull request #5553 from slankdev/slankdev-fix-kernel-route-deletion-on-vrf

zebra: fix kernel-route's deletion on vrf
This commit is contained in:
Donald Sharp 2020-01-06 20:32:16 -05:00 committed by GitHub
commit c4db327d82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -787,34 +787,10 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
} else { } else {
if (!tb[RTA_MULTIPATH]) { if (!tb[RTA_MULTIPATH]) {
struct nexthop nh; struct nexthop nh;
size_t sz = (afi == AFI_IP) ? 4 : 16;
memset(&nh, 0, sizeof(nh)); nh = parse_nexthop_unicast(
if (bh_type == BLACKHOLE_UNSPEC) { ns_id, rtm, tb, bh_type, index, prefsrc,
if (index && !gate) gate, afi, vrf_id);
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 = BLACKHOLE_UNSPEC;
}
} else {
nh.type = NEXTHOP_TYPE_BLACKHOLE;
nh.bh_type = bh_type;
}
nh.ifindex = index;
if (gate)
memcpy(&nh.gate, gate, sz);
rib_delete(afi, SAFI_UNICAST, vrf_id, proto, 0, rib_delete(afi, SAFI_UNICAST, vrf_id, proto, 0,
flags, &p, &src_p, &nh, 0, table, flags, &p, &src_p, &nh, 0, table,
metric, distance, true); metric, distance, true);