summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorRavi kumar Veeramally <ravikumar.veeramally@linux.intel.com>2017-01-30 12:30:13 +0200
committerJukka Rissanen <jukka.rissanen@linux.intel.com>2017-02-03 15:59:14 +0200
commitb13f44bcdd578a05adb937287eb4bd8f648201d4 (patch)
tree6e574f3d34ff7c07577af21d3f119c6721f46071 /samples
parent10e5162fc2e51ae3a65148175326a6488a5b55c0 (diff)
net: utils: Add net_addr_ntop() helper function
net_addr_ntop() will convert IPv4|6 address to string form. Renamed existing net_sprint_ip_addr_buf() to net_addr_ntop() and adjusted parameters as per API. Jira: ZEP-1638 Change-Id: Ia497be6bf876ca63b120529acbadcfd9162a96e3 Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Diffstat (limited to 'samples')
-rw-r--r--samples/net/dns_client/src/main.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/samples/net/dns_client/src/main.c b/samples/net/dns_client/src/main.c
index 781a93125..a7d319d13 100644
--- a/samples/net/dns_client/src/main.c
+++ b/samples/net/dns_client/src/main.c
@@ -64,10 +64,6 @@ char *domains[] = {"not_a_real_domain_name",
"www.google.com",
NULL};
-/* from subsys/net/ip/utils.c */
-char *net_sprint_ip_addr_buf(const uint8_t *ip, int ip_len,
- char *buf, int buflen);
-
void run_dns(void)
{
struct dns_context ctx;
@@ -141,11 +137,11 @@ void run_dns(void)
for (i = 0; i < ctx.items; i++) {
#ifdef CONFIG_NET_IPV6
- net_sprint_ip_addr_buf(addresses[i].in6_u.u6_addr8,
- 16, str, sizeof(str));
+ net_addr_ntop(AF_INET6, &addresses[i],
+ str, sizeof(str));
#else
- net_sprint_ip_addr_buf(addresses[i].in4_u.u4_addr8,
- 4, str, sizeof(str));
+ net_addr_ntop(AF_INET, &addresses[i],
+ str, sizeof(str));
#endif
printk("[%s:%d] %s\n", __func__, __LINE__, str);
}