summaryrefslogtreecommitdiff
path: root/lib/if.c
diff options
context:
space:
mode:
authorGhasem Naddaf <ghasem.naddaf@gmail.com>2019-10-29 11:02:15 -0700
committerGhasem Naddaf <ghasem.naddaf@gmail.com>2019-10-29 11:02:15 -0700
commit457ea8d4bcfce831f083dfc4499ec91a42bd8e40 (patch)
tree8c27f31116e408b512075ef222525dd84fa32847 /lib/if.c
parent37cdb6e91dd8410bb884c15a818a37775e9cd135 (diff)
vrrpd: only count ipv4 addresses on check start
Signed-off-by: Ghasem Naddaf <ghasem.naddaf@gmail.com>
Diffstat (limited to 'lib/if.c')
-rw-r--r--lib/if.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/if.c b/lib/if.c
index 594961d763..7c3606bbbf 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -959,6 +959,20 @@ static int connected_same_prefix(struct prefix *p1, struct prefix *p2)
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)
+{
+ struct listnode *cnode;
+ struct connected *connected;
+ unsigned int cnt = 0;
+
+ for (ALL_LIST_ELEMENTS_RO(ifp->connected, cnode, connected))
+ if (connected->address->family == family)
+ cnt++;
+
+ return cnt;
+}
+
struct connected *connected_lookup_prefix_exact(struct interface *ifp,
struct prefix *p)
{