summaryrefslogtreecommitdiff
path: root/pbrd/pbr_nht.c
diff options
context:
space:
mode:
Diffstat (limited to 'pbrd/pbr_nht.c')
-rw-r--r--pbrd/pbr_nht.c37
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;
}