From 160ccbcf7e023f5c45ed683d25610f1ae490f0e7 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Wed, 24 Oct 2018 18:43:58 +0200 Subject: [PATCH] gnrc_ipv6: don't recurse into receive for encapsulated IPv6 `_decapsulate()` is called by callees of `_receive()` so the call to the latter function within the first creates a recursion we don't want. Using `gnrc_netapi` instead removes that and provides the added benefit that other subscribers to IPv6 are also informed. --- sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c b/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c index f366964cc7..5f91029ec1 100644 --- a/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c +++ b/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c @@ -896,7 +896,10 @@ static void _decapsulate(gnrc_pktsnip_t *pkt) pkt->type = GNRC_NETTYPE_IPV6; - _receive(pkt); + if (gnrc_netapi_dispatch_receive(GNRC_NETTYPE_IPV6, + GNRC_NETREG_DEMUX_CTX_ALL, pkt) == 0) { + gnrc_pktbuf_release(pkt); + } } /** @} */