From 12d4254ae1c4eb1f63aa0f0076ddedd3cd9146c8 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Fri, 20 Oct 2017 23:54:40 +0200 Subject: [PATCH] gnrc: nib: DEBUG fix --- sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c | 3 +-- sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c | 7 +++---- sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c | 2 -- .../gnrc/network_layer/ipv6/nib/_nib-internal.c | 2 -- .../gnrc/network_layer/ipv6/nib/_nib-router.c | 2 -- sys/net/gnrc/network_layer/ipv6/nib/nib.c | 16 +++++++--------- 6 files changed, 11 insertions(+), 21 deletions(-) diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c index 6ebfeb1a5f..7c2c339455 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6ln.c @@ -24,9 +24,8 @@ #include "debug.h" #if GNRC_IPV6_NIB_CONF_6LN -#if ENABLE_DEBUG + static char addr_str[IPV6_ADDR_MAX_STR_LEN]; -#endif extern void _handle_search_rtr(gnrc_netif_t *netif); diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c index 69ea79d2c3..094a9deef0 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c @@ -23,9 +23,8 @@ #include "debug.h" #if GNRC_IPV6_NIB_CONF_6LR -#if ENABLE_DEBUG + static char addr_str[IPV6_ADDR_MAX_STR_LEN]; -#endif static uint8_t _update_nce_ar_state(const sixlowpan_nd_opt_ar_t *aro, _nib_onl_entry_t *nce) @@ -38,12 +37,12 @@ static uint8_t _update_nce_ar_state(const sixlowpan_nd_opt_ar_t *aro, _set_ar_state(nce, GNRC_IPV6_NIB_NC_INFO_AR_STATE_REGISTERED); DEBUG("nib: Successfully registered %s\n", - ipv6_addr_to_str(addr_str, &ipv6->src, sizeof(addr_str))); + ipv6_addr_to_str(addr_str, &nce->ipv6, sizeof(addr_str))); return SIXLOWPAN_ND_STATUS_SUCCESS; } else { DEBUG("nib: Could not register %s, neighbor cache was full\n", - ipv6_addr_to_str(addr_str, &ipv6->src, sizeof(addr_str))); + ipv6_addr_to_str(addr_str, &nce->ipv6, sizeof(addr_str))); return SIXLOWPAN_ND_STATUS_NC_FULL; } } diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c index ea8010d6f6..92c944faa0 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c @@ -28,9 +28,7 @@ #define ENABLE_DEBUG (0) #include "debug.h" -#if ENABLE_DEBUG static char addr_str[IPV6_ADDR_MAX_STR_LEN]; -#endif /** * @brief Determines supposed link-layer address from interface and option diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c index 34296ab74b..2abccee60b 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c @@ -42,9 +42,7 @@ static _nib_dr_entry_t _def_routers[GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF]; static _nib_abr_entry_t _abrs[GNRC_IPV6_NIB_ABR_NUMOF]; #endif /* GNRC_IPV6_NIB_CONF_MULTIHOP_P6C */ -#if ENABLE_DEBUG static char addr_str[IPV6_ADDR_MAX_STR_LEN]; -#endif mutex_t _nib_mutex = MUTEX_INIT; evtimer_msg_t _nib_evtimer; diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c index cc43b0fefd..3ed1f8edc6 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-router.c @@ -27,9 +27,7 @@ #include "debug.h" #if GNRC_IPV6_NIB_CONF_ROUTER -#if ENABLE_DEBUG static char addr_str[IPV6_ADDR_MAX_STR_LEN]; -#endif static void _snd_ra(gnrc_netif_t *netif, const ipv6_addr_t *dst, bool final, _nib_abr_entry_t *abr); diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index 1bc68b09e7..d9f010479b 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -39,9 +39,7 @@ #include "xtimer.h" #endif -#if ENABLE_DEBUG static char addr_str[IPV6_ADDR_MAX_STR_LEN]; -#endif #if GNRC_IPV6_NIB_CONF_QUEUE_PKT static gnrc_pktqueue_t _queue_pool[GNRC_IPV6_NIB_NUMOF]; @@ -418,8 +416,8 @@ static void _handle_rtr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, netif->pid); DEBUG(" - IP Hop Limit: %u (should be 255)\n", ipv6->hl); DEBUG(" - ICMP code: %u (should be 0)\n", rtr_sol->code); - DEBUG(" - ICMP length: %u (should > %u)\n", icmpv6_len, - sizeof(ndp_rtr_sol_t)); + DEBUG(" - ICMP length: %u (should > %u)\n", (unsigned)icmpv6_len, + (unsigned)sizeof(ndp_rtr_sol_t)); return; } /* pre-check option length */ @@ -529,7 +527,7 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, DEBUG(" - IP Hop Limit: %u (should be 255)\n", ipv6->hl); DEBUG(" - ICMP code: %u (should be 0)\n", rtr_adv->code); DEBUG(" - ICMP length: %u (should > %u)\n", (unsigned)icmpv6_len, - sizeof(ndp_rtr_adv_t)); + (unsigned)sizeof(ndp_rtr_adv_t)); DEBUG(" - Source address: %s (should be link-local)\n", ipv6_addr_to_str(addr_str, &ipv6->src, sizeof(addr_str))); DEBUG(" - Router lifetime: %u (should be <= 9000 on non-6LN)\n", @@ -793,8 +791,8 @@ static void _handle_nbr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, DEBUG("nib: Received neighbor solicitation is invalid. Discarding silently\n"); DEBUG(" - IP Hop Limit: %u (should be 255)\n", ipv6->hl); DEBUG(" - ICMP code: %u (should be 0)\n", nbr_sol->code); - DEBUG(" - ICMP length: %u (should > %u)\n", icmpv6_len, - sizeof(ndp_nbr_sol_t)); + DEBUG(" - ICMP length: %u (should > %u)\n", (unsigned)icmpv6_len, + (unsigned)sizeof(ndp_nbr_sol_t)); DEBUG(" - Target address: %s (should not be multicast)\n", ipv6_addr_to_str(addr_str, &nbr_sol->tgt, sizeof(addr_str))); DEBUG(" - Source address: %s\n", @@ -905,8 +903,8 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, DEBUG("nib: Received neighbor advertisement is invalid. Discarding silently\n"); DEBUG(" - IP Hop Limit: %u (should be 255)\n", ipv6->hl); DEBUG(" - ICMP code: %u (should be 0)\n", nbr_adv->code); - DEBUG(" - ICMP length: %u (should > %u)\n", icmpv6_len, - sizeof(ndp_nbr_adv_t)); + DEBUG(" - ICMP length: %u (should > %u)\n", (unsigned)icmpv6_len, + (unsigned)sizeof(ndp_nbr_adv_t)); DEBUG(" - Target address: %s (should not be multicast)\n", ipv6_addr_to_str(addr_str, &nbr_adv->tgt, sizeof(addr_str))); DEBUG(" - Destination address: %s\n",