net/sixlowpan: Add htohs() in arguments to debug statements that print IP addresses so that they are all shown in friendlier host order

This commit is contained in:
Anthony Merlino 2017-11-21 11:01:11 -06:00 committed by Gregory Nutt
parent 306bd169f8
commit a645b18860
2 changed files with 19 additions and 15 deletions

View File

@ -301,8 +301,8 @@ static uint8_t compress_tagaddr(FAR const net_ipv6addr_t ipaddr,
#ifdef CONFIG_DEBUG_NET_INFO #ifdef CONFIG_DEBUG_NET_INFO
ninfo("Compressing bitpos=%u addrlen=%u\n", bitpos, macaddr->nv_addrlen); ninfo("Compressing bitpos=%u addrlen=%u\n", bitpos, macaddr->nv_addrlen);
ninfo(" ipaddr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", ninfo(" ipaddr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3], ntohs(ipaddr[0]), ntohs(ipaddr[1]), ntohs(ipaddr[2]), ntohs(ipaddr[3]),
ipaddr[4], ipaddr[5], ipaddr[6], ipaddr[7]); ntohs(ipaddr[4]), ntohs(ipaddr[5]), ntohs(ipaddr[6]), ntohs(ipaddr[7]));
switch (macaddr->nv_addrlen) switch (macaddr->nv_addrlen)
{ {
@ -351,8 +351,9 @@ static uint8_t compress_laddr(FAR const net_ipv6addr_t srcipaddr,
#ifdef CONFIG_DEBUG_NET_INFO #ifdef CONFIG_DEBUG_NET_INFO
ninfo("Compressing bitpos=%u\n", bitpos); ninfo("Compressing bitpos=%u\n", bitpos);
ninfo(" srcipaddr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", ninfo(" srcipaddr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
srcipaddr[0], srcipaddr[1], srcipaddr[2], srcipaddr[3], ntohs(srcipaddr[0]), ntohs(srcipaddr[1]), ntohs(srcipaddr[2]),
srcipaddr[4], srcipaddr[5], srcipaddr[6], srcipaddr[7]); ntohs(srcipaddr[3]), ntohs(srcipaddr[4]), ntohs(srcipaddr[5]),
ntohs(srcipaddr[6]), ntohs(srcipaddr[7]));
switch (macaddr->nv_addrlen) switch (macaddr->nv_addrlen)
{ {
@ -524,8 +525,8 @@ static void uncompress_addr(FAR const struct netdev_varaddr_s *addr,
ninfo("Uncompressing %d + %d ipaddr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", ninfo("Uncompressing %d + %d ipaddr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
prefcount, postcount, prefcount, postcount,
ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3], ntohs(ipaddr[0]), ntohs(ipaddr[1]), ntohs(ipaddr[2]), ntohs(ipaddr[3]),
ipaddr[4], ipaddr[5], ipaddr[6], ipaddr[7]); ntohs(ipaddr[4]), ntohs(ipaddr[5]), ntohs(ipaddr[6]), ntohs(ipaddr[7]));
} }
/**************************************************************************** /****************************************************************************
@ -846,9 +847,10 @@ int sixlowpan_compresshdr_hc06(FAR struct radio_driver_s *radio,
/* Send the full source address ipaddr: SAC = 0, SAM = 00 */ /* Send the full source address ipaddr: SAC = 0, SAM = 00 */
ninfo("Uncompressable srcipaddr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", ninfo("Uncompressable srcipaddr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
ipv6->srcipaddr[0], ipv6->srcipaddr[1], ipv6->srcipaddr[2], ntohs(ipv6->srcipaddr[0]), ntohs(ipv6->srcipaddr[1]),
ipv6->srcipaddr[3], ipv6->srcipaddr[4], ipv6->srcipaddr[5], ntohs(ipv6->srcipaddr[2]), ntohs(ipv6->srcipaddr[3]),
ipv6->srcipaddr[6], ipv6->srcipaddr[7]); ntohs(ipv6->srcipaddr[4]), ntohs(ipv6->srcipaddr[5]),
ntohs(ipv6->srcipaddr[6]), ntohs(ipv6->srcipaddr[7]));
iphc1 |= SIXLOWPAN_IPHC_SAM_128; /* 128-bits */ iphc1 |= SIXLOWPAN_IPHC_SAM_128; /* 128-bits */
memcpy(g_hc06ptr, ipv6->srcipaddr, 16); memcpy(g_hc06ptr, ipv6->srcipaddr, 16);

View File

@ -414,9 +414,10 @@ int sixlowpan_uncompresshdr_hc1(FAR struct radio_driver_s *radio,
} }
ninfo("srcipaddr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", ninfo("srcipaddr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
ipv6->srcipaddr[0], ipv6->srcipaddr[1], ipv6->srcipaddr[2], ntohs(ipv6->srcipaddr[0]), ntohs(ipv6->srcipaddr[1]),
ipv6->srcipaddr[3], ipv6->srcipaddr[4], ipv6->srcipaddr[5], ntohs(ipv6->srcipaddr[2]), ntohs(ipv6->srcipaddr[3]),
ipv6->srcipaddr[6], ipv6->srcipaddr[7]); ntohs(ipv6->srcipaddr[4]), ntohs(ipv6->srcipaddr[5]),
ntohs(ipv6->srcipaddr[6]), ntohs(ipv6->srcipaddr[7]));
if ((hc1[SIXLOWPAN_HC1_ENCODING] & SIXLOWPAN_HC1_DESTADDR_MASK) == if ((hc1[SIXLOWPAN_HC1_ENCODING] & SIXLOWPAN_HC1_DESTADDR_MASK) ==
SIXLOWPAN_HC1_DESTADDR_PCIC) SIXLOWPAN_HC1_DESTADDR_PCIC)
@ -438,9 +439,10 @@ int sixlowpan_uncompresshdr_hc1(FAR struct radio_driver_s *radio,
} }
ninfo("destipaddr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", ninfo("destipaddr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
ipv6->destipaddr[0], ipv6->destipaddr[1], ipv6->destipaddr[2], ntohs(ipv6->destipaddr[0]), ntohs(ipv6->destipaddr[1]),
ipv6->destipaddr[3], ipv6->destipaddr[4], ipv6->destipaddr[5], ntohs(ipv6->destipaddr[2]), ntohs(ipv6->destipaddr[3]),
ipv6->destipaddr[6], ipv6->destipaddr[7]); ntohs(ipv6->destipaddr[4]), ntohs(ipv6->destipaddr[5]),
ntohs(ipv6->destipaddr[6]), ntohs(ipv6->destipaddr[7]));
/* IP length field. */ /* IP length field. */