summaryrefslogtreecommitdiff
path: root/lib/ipaddr.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ipaddr.h')
-rw-r--r--lib/ipaddr.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/ipaddr.h b/lib/ipaddr.h
index f4ddadc66e..503431a7c0 100644
--- a/lib/ipaddr.h
+++ b/lib/ipaddr.h
@@ -56,6 +56,9 @@ struct ipaddr {
#define SET_IPADDR_V4(p) (p)->ipa_type = IPADDR_V4
#define SET_IPADDR_V6(p) (p)->ipa_type = IPADDR_V6
+#define IPADDRSZ(p) \
+ IS_IPADDR_V4((p)) ? sizeof(struct in_addr) : sizeof(struct in6_addr)
+
static inline int str2ipaddr(const char *str, struct ipaddr *ip)
{
int ret;