Skip to content

Commit 6708fae

Browse files
committed
[ICMPv6] Wrap ICMP DU handler in #if DEBUG
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
1 parent 5e74130 commit 6708fae

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/net/ipv6/uip-icmp6.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ uip_icmp6_echo_reply_callback_rm(struct uip_icmp6_echo_reply_notification *n)
355355
}
356356

357357
/*---------------------------------------------------------------------------*/
358+
#if DEBUG & DEBUG_PRINT
358359
static void
359360
destination_unreachable_input(void)
360361
{
@@ -383,22 +384,27 @@ destination_unreachable_input(void)
383384

384385
return;
385386
}
387+
#endif
386388

387389
/*---------------------------------------------------------------------------*/
388390
UIP_ICMP6_HANDLER(echo_request_handler, ICMP6_ECHO_REQUEST,
389391
UIP_ICMP6_HANDLER_CODE_ANY, echo_request_input);
390392
UIP_ICMP6_HANDLER(echo_reply_handler, ICMP6_ECHO_REPLY,
391393
UIP_ICMP6_HANDLER_CODE_ANY, echo_reply_input);
394+
#if DEBUG & DEBUG_PRINT
392395
UIP_ICMP6_HANDLER(destination_unreachable_handler, ICMP6_DST_UNREACH,
393396
UIP_ICMP6_HANDLER_CODE_ANY, destination_unreachable_input);
397+
#endif
394398
/*---------------------------------------------------------------------------*/
395399
void
396400
uip_icmp6_init()
397401
{
398402
/* Register Echo Request and Reply handlers */
399403
uip_icmp6_register_input_handler(&echo_request_handler);
400404
uip_icmp6_register_input_handler(&echo_reply_handler);
405+
#if DEBUG & DEBUG_PRINT
401406
uip_icmp6_register_input_handler(&destination_unreachable_handler);
407+
#endif
402408
}
403409
/*---------------------------------------------------------------------------*/
404410
/** @} */

0 commit comments

Comments
 (0)