Skip to content

Commit

Permalink
[ICMPv6] Wrap ICMP DU handler in #if DEBUG
Browse files Browse the repository at this point in the history
Completely disable the handler (even registration) if DEBUG is not
activated.  Rationale: the handler does not add any functionality other
than debugging.

contiki-os#2544
  • Loading branch information
audeoudh committed Dec 5, 2018
1 parent 5e74130 commit 6708fae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/net/ipv6/uip-icmp6.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ uip_icmp6_echo_reply_callback_rm(struct uip_icmp6_echo_reply_notification *n)
}

/*---------------------------------------------------------------------------*/
#if DEBUG & DEBUG_PRINT
static void
destination_unreachable_input(void)
{
Expand Down Expand Up @@ -383,22 +384,27 @@ destination_unreachable_input(void)

return;
}
#endif

/*---------------------------------------------------------------------------*/
UIP_ICMP6_HANDLER(echo_request_handler, ICMP6_ECHO_REQUEST,
UIP_ICMP6_HANDLER_CODE_ANY, echo_request_input);
UIP_ICMP6_HANDLER(echo_reply_handler, ICMP6_ECHO_REPLY,
UIP_ICMP6_HANDLER_CODE_ANY, echo_reply_input);
#if DEBUG & DEBUG_PRINT
UIP_ICMP6_HANDLER(destination_unreachable_handler, ICMP6_DST_UNREACH,
UIP_ICMP6_HANDLER_CODE_ANY, destination_unreachable_input);
#endif
/*---------------------------------------------------------------------------*/
void
uip_icmp6_init()
{
/* Register Echo Request and Reply handlers */
uip_icmp6_register_input_handler(&echo_request_handler);
uip_icmp6_register_input_handler(&echo_reply_handler);
#if DEBUG & DEBUG_PRINT
uip_icmp6_register_input_handler(&destination_unreachable_handler);
#endif
}
/*---------------------------------------------------------------------------*/
/** @} */

0 comments on commit 6708fae

Please sign in to comment.