summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2024-05-07 16:57:56 +0200
committerGitHub <noreply@github.com>2024-05-07 16:57:56 +0200
commit5aa4014bbaf976b8f87470b87b042a27aa605c87 (patch)
treedefcf4d4c7acdcef22e388977d521658da010d7d /lib
parentMerge pull request #15945 from anlancs/isisd/fix-topology-algorithm-show (diff)
parentif: fix same connected address (diff)
downloadfrr-5aa4014bbaf976b8f87470b87b042a27aa605c87.tar.xz
frr-5aa4014bbaf976b8f87470b87b042a27aa605c87.zip
Merge pull request #15944 from lsang6WIND/fix-same-prefix
if: fix same connected address
Diffstat (limited to 'lib')
-rw-r--r--lib/if.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/lib/if.c b/lib/if.c
index a8ceac724..bf14baaa5 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -885,21 +885,6 @@ nbr_connected_log(struct nbr_connected *connected, char *str)
zlog_info("%s", logbuf);
}
-/* If two connected address has same prefix return 1. */
-static int connected_same_prefix(const struct prefix *p1,
- const struct prefix *p2)
-{
- if (p1->family == p2->family) {
- if (p1->family == AF_INET
- && IPV4_ADDR_SAME(&p1->u.prefix4, &p2->u.prefix4))
- return 1;
- if (p1->family == AF_INET6
- && IPV6_ADDR_SAME(&p1->u.prefix6, &p2->u.prefix6))
- return 1;
- }
- return 0;
-}
-
/* count the number of connected addresses that are in the given family */
unsigned int connected_count_by_family(struct interface *ifp, int family)
{
@@ -919,7 +904,7 @@ struct connected *connected_lookup_prefix_exact(struct interface *ifp,
struct connected *ifc;
frr_each (if_connected, ifp->connected, ifc) {
- if (connected_same_prefix(ifc->address, p))
+ if (prefix_same(ifc->address, p))
return ifc;
}
return NULL;
@@ -932,7 +917,7 @@ struct connected *connected_delete_by_prefix(struct interface *ifp,
/* In case of same prefix come, replace it with new one. */
frr_each_safe (if_connected, ifp->connected, ifc) {
- if (connected_same_prefix(ifc->address, p)) {
+ if (prefix_same(ifc->address, p)) {
if_connected_del(ifp->connected, ifc);
return ifc;
}