aboutsummaryrefslogtreecommitdiffstats
path: root/lib/in46_addr.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-08-12 12:46:17 +0200
committerHarald Welte <laforge@gnumonks.org>2017-09-05 22:42:17 +0200
commitb62983d3c3dc7e0f4c5ebbf014a9e02527868cfd (patch)
tree9a49a8b0f093d7bc4c45ac0befc76f1bbaafacfd /lib/in46_addr.c
parent881e97ed00070a0e68382cf86a0e8ea87f6d3cb3 (diff)
lib/in46_addr: Add in46a_ntoa() function, similar to inet_ntoa()
Diffstat (limited to 'lib/in46_addr.c')
-rw-r--r--lib/in46_addr.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/in46_addr.c b/lib/in46_addr.c
index 8f5cc09..4e7cbcd 100644
--- a/lib/in46_addr.c
+++ b/lib/in46_addr.c
@@ -69,6 +69,16 @@ const char *in46a_ntop(const struct in46_addr *in, char *dst, socklen_t dst_size
return inet_ntop(af, (const void *) &in->v4, dst, dst_size);
}
+/* like inet_ntoa() */
+const char *in46a_ntoa(const struct in46_addr *in46)
+{
+ static char addrstr_buf[256];
+ if (in46a_ntop(in46, addrstr_buf, sizeof(addrstr_buf)) < 0)
+ return "INVALID";
+ else
+ return addrstr_buf;
+}
+
/*! Determine if two in46_addr are equal or not
* \returns 1 in case they are equal; 0 otherwise */
int in46a_equal(const struct in46_addr *a, const struct in46_addr *b)