From 0c6e6b7ba4e0f2de8b5d80cd41adeb0a32fd8169 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Fri, 28 Aug 2015 14:43:49 +0200 Subject: [PATCH] gnrc_ipv6: add comment why *netapi_dispatch_receive is not possible --- sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c b/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c index 5e429a2baad6..0940ae555aea 100644 --- a/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c +++ b/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c @@ -133,8 +133,11 @@ void gnrc_ipv6_demux(kernel_pid_t iface, gnrc_pktsnip_t *pkt, uint8_t nh) return; } - gnrc_pktbuf_hold(pkt, receiver_num - 1); - /* IPv6 is not interested anymore so `- 1` */ + gnrc_pktbuf_hold(pkt, receiver_num - 1); /* IPv6 is not interested anymore so `- 1` */ + + /* XXX can't use gnrc_netapi_dispatch_receive() twice here since a call to that function + * implicitly hands all rights to the packet to one of the receiving threads. As a result, + * the second call to gnrc_netapi_dispatch_receive() would be invalid */ _dispatch_rcv_pkt(pkt->type, GNRC_NETREG_DEMUX_CTX_ALL, pkt); _dispatch_rcv_pkt(GNRC_NETTYPE_IPV6, nh, pkt); }