diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-12-09 18:41:19 +0100 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-12-09 20:39:18 +0100 |
commit | 0dad8e91b78c5840f52cf9cef438bc5299d43798 (patch) | |
tree | 30a87204f8c1907dd16f52ad6a573f2bd390f181 | |
parent | yang: add org, description data to vrrp model (diff) | |
download | frr-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.h | 6 |
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 |