From 856e1ee0d246ec099df4d81164c9b9fde88a52d1 Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Fri, 25 Mar 2016 17:30:50 +0100 Subject: [PATCH 1/2] gnrc ipv6: replace check by assert The existence of netif is mandatory here. --- sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c b/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c index fa70ab10bf..57cc9ca585 100644 --- a/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c +++ b/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c @@ -764,9 +764,8 @@ static void _receive(gnrc_pktsnip_t *pkt) netif = gnrc_pktsnip_search_type(pkt, GNRC_NETTYPE_NETIF); - if (netif != NULL) { - iface = ((gnrc_netif_hdr_t *)netif->data)->if_pid; - } + assert(netif); + iface = ((gnrc_netif_hdr_t *)netif->data)->if_pid; first_ext = pkt; From f15e038efe668387a368082c0f42d2648896d851 Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Tue, 29 Mar 2016 18:42:58 +0200 Subject: [PATCH 2/2] doc: mandatory netif snip for gnrc_ipv6 receive() --- sys/include/net/gnrc/ipv6.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/include/net/gnrc/ipv6.h b/sys/include/net/gnrc/ipv6.h index deb8536f37..03b89cb8aa 100644 --- a/sys/include/net/gnrc/ipv6.h +++ b/sys/include/net/gnrc/ipv6.h @@ -14,7 +14,10 @@ * The IPv6 control thread understands messages of type * * * @ref GNRC_NETAPI_MSG_TYPE_RCV, and - * * @ref GNRC_NETAPI_MSG_TYPE_SND, + * * @ref GNRC_NETAPI_MSG_TYPE_SND. + * + * If the message is of type @ref GNRC_NETAPI_MSG_TYPE_RCV the provided @ref + * gnrc_pktsnip_t must contain a snip of type @ref GNRC_NETTYPE_NETIF. * * @{ *