diff --git a/core/net/ipv6/uip-icmp6.c b/core/net/ipv6/uip-icmp6.c index e788b6d7f..05fe8c9c6 100644 --- a/core/net/ipv6/uip-icmp6.c +++ b/core/net/ipv6/uip-icmp6.c @@ -119,8 +119,8 @@ uip_icmp6_register_input_handler(uip_icmp6_input_handler_t *handler) list_add(input_handler_list, handler); } /*---------------------------------------------------------------------------*/ -void -uip_icmp6_echo_request_input(void) +static void +echo_request_input(void) { #if UIP_CONF_IPV6_RPL uint8_t temp_ext_len; @@ -318,8 +318,8 @@ uip_icmp6_send(const uip_ipaddr_t *dest, int type, int code, int payload_len) tcpip_ipv6_output(); } /*---------------------------------------------------------------------------*/ -void -uip_icmp6_echo_reply_input(void) +static void +echo_reply_input(void) { int ttl; uip_ipaddr_t sender; @@ -386,6 +386,8 @@ uip_icmp6_echo_reply_input(void) } } } + + uip_len = 0; return; } /*---------------------------------------------------------------------------*/ @@ -405,5 +407,18 @@ uip_icmp6_echo_reply_callback_rm(struct uip_icmp6_echo_reply_notification *n) list_remove(echo_reply_callback_list, n); } /*---------------------------------------------------------------------------*/ +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); +/*---------------------------------------------------------------------------*/ +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); +} +/*---------------------------------------------------------------------------*/ /** @} */ #endif /* UIP_CONF_IPV6 */ diff --git a/core/net/ipv6/uip-icmp6.h b/core/net/ipv6/uip-icmp6.h index 842ae3670..53dfc2315 100644 --- a/core/net/ipv6/uip-icmp6.h +++ b/core/net/ipv6/uip-icmp6.h @@ -109,24 +109,6 @@ typedef struct uip_icmp6_error{ /** \name ICMPv6 RFC4443 Message processing and sending */ /** @{ */ -/** \ - * brief Process an echo request - * - * Perform a few checks, then send an Echo reply. The reply is - * built here. - */ -void -uip_icmp6_echo_request_input(void); - -/** \ - * brief Process an echo reply - * - * Perform a few checks, then call applications to inform that an echo - * reply has been received. - */ -void -uip_icmp6_echo_reply_input(void); - /** * \brief Send an icmpv6 error message * \param type type of the error message @@ -247,6 +229,12 @@ uint8_t uip_icmp6_input(uint8_t type, uint8_t icode); */ void uip_icmp6_register_input_handler(uip_icmp6_input_handler_t *handler); + +/** + * \brief Initialise the uIP ICMPv6 core + */ +void uip_icmp6_init(void); + /** @} */ #endif /*ICMP6_H_*/ diff --git a/core/net/ipv6/uip6.c b/core/net/ipv6/uip6.c index 90708aa27..e515df43b 100644 --- a/core/net/ipv6/uip6.c +++ b/core/net/ipv6/uip6.c @@ -411,6 +411,7 @@ uip_init(void) { uip_ds6_init(); + uip_icmp6_init(); #if UIP_TCP for(c = 0; c < UIP_LISTENPORTS; ++c) {