From e361c49f14fab76c9cc02116b10cecd5d2b3f789 Mon Sep 17 00:00:00 2001 From: Yasuyuki Tanaka Date: Mon, 27 Jun 2016 20:57:48 +0200 Subject: [PATCH] RPL non-storing: fix a bug causing an infinite loop It falls into an infinite loop if it goes to the default label in the switch statement of rpl_srh_get_next_hop() or rpl_process_srh_header(). --- core/net/rpl/rpl-ext-header.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/core/net/rpl/rpl-ext-header.c b/core/net/rpl/rpl-ext-header.c index b6d17d4a9..655df1674 100644 --- a/core/net/rpl/rpl-ext-header.c +++ b/core/net/rpl/rpl-ext-header.c @@ -195,12 +195,6 @@ rpl_srh_get_next_hop(uip_ipaddr_t *ipaddr) /* Look for routing header */ while(uip_next_hdr != NULL && *uip_next_hdr != UIP_PROTO_ROUTING) { switch(*uip_next_hdr) { - case UIP_PROTO_TCP: - case UIP_PROTO_UDP: - case UIP_PROTO_ICMP6: - case UIP_PROTO_NONE: - uip_next_hdr = NULL; - break; case UIP_PROTO_HBHO: case UIP_PROTO_DESTO: case UIP_PROTO_FRAG: @@ -211,6 +205,7 @@ rpl_srh_get_next_hop(uip_ipaddr_t *ipaddr) uip_next_hdr = &UIP_EXT_BUF->next; break; default: + uip_next_hdr = NULL; break; } } @@ -249,12 +244,6 @@ rpl_process_srh_header(void) /* Look for routing header */ while(uip_next_hdr != NULL && *uip_next_hdr != UIP_PROTO_ROUTING) { switch(*uip_next_hdr) { - case UIP_PROTO_TCP: - case UIP_PROTO_UDP: - case UIP_PROTO_ICMP6: - case UIP_PROTO_NONE: - uip_next_hdr = NULL; - break; case UIP_PROTO_HBHO: case UIP_PROTO_DESTO: case UIP_PROTO_FRAG: @@ -265,6 +254,7 @@ rpl_process_srh_header(void) uip_next_hdr = &UIP_EXT_BUF->next; break; default: + uip_next_hdr = NULL; break; } }