summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2019-12-09 18:41:19 +0100
committerQuentin Young <qlyoung@cumulusnetworks.com>2019-12-09 20:39:18 +0100
commit0dad8e91b78c5840f52cf9cef438bc5299d43798 (patch)
tree30a87204f8c1907dd16f52ad6a573f2bd390f181
parentyang: add org, description data to vrrp model (diff)
downloadfrr-0dad8e91b78c5840f52cf9cef438bc5299d43798.tar.xz
frr-0dad8e91b78c5840f52cf9cef438bc5299d43798.zip
lib: add ipaddr_isset()
Compare ip address against 0 Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
-rw-r--r--lib/ipaddr.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/ipaddr.h b/lib/ipaddr.h
index ec08fc09a..6bd614044 100644
--- a/lib/ipaddr.h
+++ b/lib/ipaddr.h
@@ -119,6 +119,12 @@ static inline void ipv4_mapped_ipv6_to_ipv4(struct in6_addr *in6,
memcpy(in, (char *)in6 + 12, sizeof(struct in_addr));
}
+static inline bool ipaddr_isset(struct ipaddr *ip)
+{
+ static struct ipaddr a = {};
+ return (0 == memcmp(&a, ip, sizeof(struct ipaddr)));
+}
+
#ifdef __cplusplus
}
#endif