diff options
| author | Russ White <russ@riw.us> | 2021-02-09 07:37:09 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-09 07:37:09 -0500 |
| commit | d887c7bf04f08b37ec122587f11cd2079cb22bd7 (patch) | |
| tree | 00b7651276d08f6bb5b9f2018afe3d6ad43dbcda /pbrd/pbr_nht.c | |
| parent | a384dd69d8cb34bfa02314ef45ca39368a2d8d51 (diff) | |
| parent | b74a0a33f3734a772b315323ce5265fce4715c58 (diff) | |
Merge pull request #7973 from sworleys/Pbr-More-Fixes
zebra,pbrd,doc: PBR more fixes
Diffstat (limited to 'pbrd/pbr_nht.c')
| -rw-r--r-- | pbrd/pbr_nht.c | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/pbrd/pbr_nht.c b/pbrd/pbr_nht.c index 723374d9d6..7a814bd724 100644 --- a/pbrd/pbr_nht.c +++ b/pbrd/pbr_nht.c @@ -711,7 +711,6 @@ pbr_nht_individual_nexthop_gw_update(struct pbr_nexthop_cache *pnhc, struct pbr_nht_individual *pnhi) { bool is_valid = pnhc->valid; - bool all_done = false; /* * If we have an interface down event, let's note that @@ -723,43 +722,19 @@ pbr_nht_individual_nexthop_gw_update(struct pbr_nexthop_cache *pnhc, * interface event. */ if (!pnhi->nhr && pnhi->ifp) { - struct connected *connected; - struct listnode *node; - struct prefix p; - switch (pnhc->nexthop.type) { case NEXTHOP_TYPE_BLACKHOLE: - all_done = true; - break; - case NEXTHOP_TYPE_IFINDEX: - case NEXTHOP_TYPE_IPV4_IFINDEX: - case NEXTHOP_TYPE_IPV6_IFINDEX: - is_valid = if_is_up(pnhi->ifp); - all_done = true; - break; case NEXTHOP_TYPE_IPV4: - p.family = AF_INET; - p.prefixlen = IPV4_MAX_BITLEN; - p.u.prefix4 = pnhc->nexthop.gate.ipv4; - break; case NEXTHOP_TYPE_IPV6: - p.family = AF_INET6; - p.prefixlen = IPV6_MAX_BITLEN; - memcpy(&p.u.prefix6, &pnhc->nexthop.gate.ipv6, - sizeof(struct in6_addr)); - break; - } - - /* Early exit in a couple of cases. */ - if (all_done) goto done; - - FOR_ALL_INTERFACES_ADDRESSES (pnhi->ifp, connected, node) { - if (prefix_match(connected->address, &p)) { + case NEXTHOP_TYPE_IFINDEX: + case NEXTHOP_TYPE_IPV4_IFINDEX: + case NEXTHOP_TYPE_IPV6_IFINDEX: + if (pnhc->nexthop.ifindex == pnhi->ifp->ifindex) is_valid = if_is_up(pnhi->ifp); - break; - } + goto done; } + goto done; } |
