diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-12-09 12:41:19 -0500 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-12-09 14:39:18 -0500 |
| commit | 0dad8e91b78c5840f52cf9cef438bc5299d43798 (patch) | |
| tree | 30a87204f8c1907dd16f52ad6a573f2bd390f181 /lib/ipaddr.h | |
| parent | 4c5b9faef57ccefc4d3ce4594513e7fb6f974c60 (diff) | |
lib: add ipaddr_isset()
Compare ip address against 0
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/ipaddr.h')
| -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 ec08fc09a2..6bd614044c 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 |
