Merge pull request #1396 from pablocorbalan/fix-ndp-icmp-log

Print IPv6 addresses properly in ICMPv6 and NDP debug messages
This commit is contained in:
Simon Duquennoy 2015-11-25 22:06:28 +01:00
commit ddb6e4b3d7
3 changed files with 28 additions and 28 deletions

View file

@ -276,7 +276,7 @@ uip_ds6_prefix_add(uip_ipaddr_t *ipaddr, uint8_t ipaddrlen,
} }
PRINTF("Adding prefix "); PRINTF("Adding prefix ");
PRINT6ADDR(&locprefix->ipaddr); PRINT6ADDR(&locprefix->ipaddr);
PRINTF("length %u, vlifetime%lu\n", ipaddrlen, interval); PRINTF("length %u, vlifetime %lu\n", ipaddrlen, interval);
return locprefix; return locprefix;
} }
return NULL; return NULL;
@ -598,7 +598,7 @@ uip_ds6_dad(uip_ds6_addr_t *addr)
* If we arrive here it means DAD succeeded, otherwise the dad process * If we arrive here it means DAD succeeded, otherwise the dad process
* would have been interrupted in ds6_dad_ns/na_input * would have been interrupted in ds6_dad_ns/na_input
*/ */
PRINTF("DAD succeeded, ipaddr:"); PRINTF("DAD succeeded, ipaddr: ");
PRINT6ADDR(&addr->ipaddr); PRINT6ADDR(&addr->ipaddr);
PRINTF("\n"); PRINTF("\n");

View file

@ -128,9 +128,9 @@ echo_request_input(void)
* headers in the request otherwise we need to remove the extension * headers in the request otherwise we need to remove the extension
* headers and change a few fields * headers and change a few fields
*/ */
PRINTF("Received Echo Request from"); PRINTF("Received Echo Request from ");
PRINT6ADDR(&UIP_IP_BUF->srcipaddr); PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
PRINTF("to"); PRINTF(" to ");
PRINT6ADDR(&UIP_IP_BUF->destipaddr); PRINT6ADDR(&UIP_IP_BUF->destipaddr);
PRINTF("\n"); PRINTF("\n");
@ -195,9 +195,9 @@ echo_request_input(void)
UIP_ICMP_BUF->icmpchksum = 0; UIP_ICMP_BUF->icmpchksum = 0;
UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum();
PRINTF("Sending Echo Reply to"); PRINTF("Sending Echo Reply to ");
PRINT6ADDR(&UIP_IP_BUF->destipaddr); PRINT6ADDR(&UIP_IP_BUF->destipaddr);
PRINTF("from"); PRINTF(" from ");
PRINT6ADDR(&UIP_IP_BUF->srcipaddr); PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
PRINTF("\n"); PRINTF("\n");
UIP_STAT(++uip_stat.icmp.sent); UIP_STAT(++uip_stat.icmp.sent);
@ -282,9 +282,9 @@ uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param) {
UIP_STAT(++uip_stat.icmp.sent); UIP_STAT(++uip_stat.icmp.sent);
PRINTF("Sending ICMPv6 ERROR message type %d code %d to", type, code); PRINTF("Sending ICMPv6 ERROR message type %d code %d to ", type, code);
PRINT6ADDR(&UIP_IP_BUF->destipaddr); PRINT6ADDR(&UIP_IP_BUF->destipaddr);
PRINTF("from"); PRINTF(" from ");
PRINT6ADDR(&UIP_IP_BUF->srcipaddr); PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
PRINTF("\n"); PRINTF("\n");
return; return;

View file

@ -165,7 +165,7 @@ ns_input(void)
PRINT6ADDR(&UIP_IP_BUF->srcipaddr); PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
PRINTF(" to "); PRINTF(" to ");
PRINT6ADDR(&UIP_IP_BUF->destipaddr); PRINT6ADDR(&UIP_IP_BUF->destipaddr);
PRINTF(" with target address"); PRINTF(" with target address ");
PRINT6ADDR((uip_ipaddr_t *) (&UIP_ND6_NS_BUF->tgtipaddr)); PRINT6ADDR((uip_ipaddr_t *) (&UIP_ND6_NS_BUF->tgtipaddr));
PRINTF("\n"); PRINTF("\n");
UIP_STAT(++uip_stat.nd6.recv); UIP_STAT(++uip_stat.nd6.recv);
@ -392,11 +392,11 @@ uip_nd6_ns_output(uip_ipaddr_t * src, uip_ipaddr_t * dest, uip_ipaddr_t * tgt)
UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum();
UIP_STAT(++uip_stat.nd6.sent); UIP_STAT(++uip_stat.nd6.sent);
PRINTF("Sending NS to"); PRINTF("Sending NS to ");
PRINT6ADDR(&UIP_IP_BUF->destipaddr); PRINT6ADDR(&UIP_IP_BUF->destipaddr);
PRINTF("from"); PRINTF(" from ");
PRINT6ADDR(&UIP_IP_BUF->srcipaddr); PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
PRINTF("with target address"); PRINTF(" with target address ");
PRINT6ADDR(tgt); PRINT6ADDR(tgt);
PRINTF("\n"); PRINTF("\n");
return; return;
@ -428,11 +428,11 @@ na_input(void)
uint8_t is_solicited; uint8_t is_solicited;
uint8_t is_override; uint8_t is_override;
PRINTF("Received NA from"); PRINTF("Received NA from ");
PRINT6ADDR(&UIP_IP_BUF->srcipaddr); PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
PRINTF("to"); PRINTF(" to ");
PRINT6ADDR(&UIP_IP_BUF->destipaddr); PRINT6ADDR(&UIP_IP_BUF->destipaddr);
PRINTF("with target address"); PRINTF(" with target address ");
PRINT6ADDR((uip_ipaddr_t *) (&UIP_ND6_NA_BUF->tgtipaddr)); PRINT6ADDR((uip_ipaddr_t *) (&UIP_ND6_NA_BUF->tgtipaddr));
PRINTF("\n"); PRINTF("\n");
UIP_STAT(++uip_stat.nd6.recv); UIP_STAT(++uip_stat.nd6.recv);
@ -580,9 +580,9 @@ static void
rs_input(void) rs_input(void)
{ {
PRINTF("Received RS from"); PRINTF("Received RS from ");
PRINT6ADDR(&UIP_IP_BUF->srcipaddr); PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
PRINTF("to"); PRINTF(" to ");
PRINT6ADDR(&UIP_IP_BUF->destipaddr); PRINT6ADDR(&UIP_IP_BUF->destipaddr);
PRINTF("\n"); PRINTF("\n");
UIP_STAT(++uip_stat.nd6.recv); UIP_STAT(++uip_stat.nd6.recv);
@ -761,9 +761,9 @@ uip_nd6_ra_output(uip_ipaddr_t * dest)
UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum();
UIP_STAT(++uip_stat.nd6.sent); UIP_STAT(++uip_stat.nd6.sent);
PRINTF("Sending RA to"); PRINTF("Sending RA to ");
PRINT6ADDR(&UIP_IP_BUF->destipaddr); PRINT6ADDR(&UIP_IP_BUF->destipaddr);
PRINTF("from"); PRINTF(" from ");
PRINT6ADDR(&UIP_IP_BUF->srcipaddr); PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
PRINTF("\n"); PRINTF("\n");
return; return;
@ -803,9 +803,9 @@ uip_nd6_rs_output(void)
UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum();
UIP_STAT(++uip_stat.nd6.sent); UIP_STAT(++uip_stat.nd6.sent);
PRINTF("Sendin RS to"); PRINTF("Sendin RS to ");
PRINT6ADDR(&UIP_IP_BUF->destipaddr); PRINT6ADDR(&UIP_IP_BUF->destipaddr);
PRINTF("from"); PRINTF(" from ");
PRINT6ADDR(&UIP_IP_BUF->srcipaddr); PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
PRINTF("\n"); PRINTF("\n");
return; return;
@ -823,9 +823,9 @@ uip_nd6_rs_output(void)
void void
ra_input(void) ra_input(void)
{ {
PRINTF("Received RA from"); PRINTF("Received RA from ");
PRINT6ADDR(&UIP_IP_BUF->srcipaddr); PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
PRINTF("to"); PRINTF(" to ");
PRINT6ADDR(&UIP_IP_BUF->destipaddr); PRINT6ADDR(&UIP_IP_BUF->destipaddr);
PRINTF("\n"); PRINTF("\n");
UIP_STAT(++uip_stat.nd6.recv); UIP_STAT(++uip_stat.nd6.recv);
@ -922,9 +922,9 @@ ra_input(void)
prefix->isinfinite = 1; prefix->isinfinite = 1;
break; break;
default: default:
PRINTF("Updating timer of prefix"); PRINTF("Updating timer of prefix ");
PRINT6ADDR(&prefix->ipaddr); PRINT6ADDR(&prefix->ipaddr);
PRINTF("new value %lu\n", uip_ntohl(nd6_opt_prefix_info->validlt)); PRINTF(" new value %lu\n", uip_ntohl(nd6_opt_prefix_info->validlt));
stimer_set(&prefix->vlifetime, stimer_set(&prefix->vlifetime,
uip_ntohl(nd6_opt_prefix_info->validlt)); uip_ntohl(nd6_opt_prefix_info->validlt));
prefix->isinfinite = 0; prefix->isinfinite = 0;
@ -947,9 +947,9 @@ ra_input(void)
if((uip_ntohl(nd6_opt_prefix_info->validlt) > 2 * 60 * 60) || if((uip_ntohl(nd6_opt_prefix_info->validlt) > 2 * 60 * 60) ||
(uip_ntohl(nd6_opt_prefix_info->validlt) > (uip_ntohl(nd6_opt_prefix_info->validlt) >
stimer_remaining(&addr->vlifetime))) { stimer_remaining(&addr->vlifetime))) {
PRINTF("Updating timer of address"); PRINTF("Updating timer of address ");
PRINT6ADDR(&addr->ipaddr); PRINT6ADDR(&addr->ipaddr);
PRINTF("new value %lu\n", PRINTF(" new value %lu\n",
uip_ntohl(nd6_opt_prefix_info->validlt)); uip_ntohl(nd6_opt_prefix_info->validlt));
stimer_set(&addr->vlifetime, stimer_set(&addr->vlifetime,
uip_ntohl(nd6_opt_prefix_info->validlt)); uip_ntohl(nd6_opt_prefix_info->validlt));
@ -957,7 +957,7 @@ ra_input(void)
stimer_set(&addr->vlifetime, 2 * 60 * 60); stimer_set(&addr->vlifetime, 2 * 60 * 60);
PRINTF("Updating timer of address "); PRINTF("Updating timer of address ");
PRINT6ADDR(&addr->ipaddr); PRINT6ADDR(&addr->ipaddr);
PRINTF("new value %lu\n", (unsigned long)(2 * 60 * 60)); PRINTF(" new value %lu\n", (unsigned long)(2 * 60 * 60));
} }
addr->isinfinite = 0; addr->isinfinite = 0;
} else { } else {