diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2015-12-21 03:27:41 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2015-12-21 03:33:18 +0100 |
commit | 23c212e7f1e80a3c6b88b49918972bc28375bd51 (patch) | |
tree | e2e162e5f3454ba1213435acf5980bbc4e4ed5d3 /lib/printf.c | |
parent | e92a4b855f668e8ac685ad79c288ff182ebd110b (diff) |
Follow-up work on integration
Diffstat (limited to 'lib/printf.c')
-rw-r--r-- | lib/printf.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/printf.c b/lib/printf.c index 9db5363b..071fc953 100644 --- a/lib/printf.c +++ b/lib/printf.c @@ -292,9 +292,13 @@ int bvsnprintf(char *buf, int size, const char *fmt, va_list args) case 'I': { ip_addr a = va_arg(args, ip_addr); if (flags & SPECIAL) - ipa_ntox(a, ipbuf); + ip6_ntox(ipa_to_ip6(a), ipbuf); else { - ipa_ntop(a, ipbuf); + // XXXX better IPv4 / IPv6 distinction + if (ipa_is_ip4(a)) + ip4_ntop(ipa_to_ip4(a), ipbuf); + else + ip6_ntop(ipa_to_ip6(a), ipbuf); if (field_width == 1) field_width = (ipa_is_ip4(a) ? IP4_MAX_TEXT_LENGTH : IP6_MAX_TEXT_LENGTH); } @@ -319,11 +323,7 @@ int bvsnprintf(char *buf, int size, const char *fmt, va_list args) /* Router/Network ID - essentially IPv4 address in u32 value */ case 'R': x = va_arg(args, u32); - bsprintf(ipbuf, "%d.%d.%d.%d", - ((x >> 24) & 0xff), - ((x >> 16) & 0xff), - ((x >> 8) & 0xff), - (x & 0xff)); + ip4_ntop(ip4_from_u32(x), ipbuf); s = ipbuf; goto str; |