diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-05-20 03:04:16 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-05-20 03:04:16 +0200 |
commit | c5f7794faa51344e4b83dfd4a1fe83cccb2fa968 (patch) | |
tree | 1bdc7163a0bd1d29ee887891ee822654f8d5d331 /lib/prefix.c | |
parent | Zebra: Static NHT fixes (diff) | |
download | frr-c5f7794faa51344e4b83dfd4a1fe83cccb2fa968.tar.xz frr-c5f7794faa51344e4b83dfd4a1fe83cccb2fa968.zip |
Zebra: Ensure we compare prefix and NHs when checking if NH changed
In nexthop tracking, the code currently compares the nexthop state of the
resolved_route for a prefix with the previous nexthop state. However, if
the resolved route itself changes, we can end up comparing the RIBs of
unrelated prefixes and assuming that nothing has changed. To fix this, we
need to store and compare the new resolved route with the previously
resolved route. If this has changed, assume the NH associated with a route
has changed.
Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by: Vivek Venkataraman <vivek@cumulusnetworks.com>
Diffstat (limited to 'lib/prefix.c')
-rw-r--r-- | lib/prefix.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/prefix.c b/lib/prefix.c index dbfdc8301..739764842 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -278,6 +278,12 @@ prefix_copy (struct prefix *dest, const struct prefix *src) int prefix_same (const struct prefix *p1, const struct prefix *p2) { + if ((p1 && !p2) || (!p1 && p2)) + return 0; + + if (!p1 && !p2) + return 1; + if (p1->family == p2->family && p1->prefixlen == p2->prefixlen) { if (p1->family == AF_INET) |