summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Worley <sworley@nvidia.com>2021-01-07 21:28:28 +0100
committerStephen Worley <sworley@nvidia.com>2021-02-01 19:32:37 +0100
commite6b00e3fb9d40e33e4d756e5f5ef35b4b4cd07b4 (patch)
treede48cc356dadcf48f3b459e82f9c90a287767842
parentMerge pull request #7972 from donaldsharp/getrusage_data (diff)
downloadfrr-e6b00e3fb9d40e33e4d756e5f5ef35b4b4cd07b4.tar.xz
frr-e6b00e3fb9d40e33e4d756e5f5ef35b4b4cd07b4.zip
pbrd: nht only handle if updates if IPV*_IFINDEX nh
Only handle an interface update in the nexthop tracking code if the nexthop in question was set with an interface to point out of. If the nexthop is GW only, the interface update could be unrelated but have overlapping address space. Let that be handled elsewhere. Ex) ``` 5.5.5.0/30 dev dummyDoof proto kernel scope link src 5.5.5.1 5.5.5.0/24 dev goofDummy proto kernel scope link src 5.5.5.1 [root@alfred frr-2]# ip ro show table 10000 default via 5.5.5.2 dev dummyDoof proto pbr metric 20 [root@alfred frr-2]# ip link set goofDummy down [root@alfred frr-2]# ip ro show table 10000 [root@alfred frr-2]# ip link set goofDummy up [root@alfred frr-2]# ip ro show table 10000 ``` Signed-off-by: Stephen Worley <sworley@nvidia.com>
-rw-r--r--pbrd/pbr_nht.c35
1 files changed, 6 insertions, 29 deletions
diff --git a/pbrd/pbr_nht.c b/pbrd/pbr_nht.c
index 723374d9d..5b79a3d21 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,21 @@ 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;
+ case NEXTHOP_TYPE_IPV4:
+ case NEXTHOP_TYPE_IPV6:
+ goto done;
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));
+ if (pnhc->nexthop.ifindex == pnhi->ifp->ifindex)
+ is_valid = if_is_up(pnhi->ifp);
+ goto done;
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)) {
- is_valid = if_is_up(pnhi->ifp);
- break;
- }
- }
goto done;
}