Skip to content

Commit

Permalink
gnrc_ipv6: don't recurse into receive for encapsulated IPv6
Browse files Browse the repository at this point in the history
`_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.
  • Loading branch information
miri64 committed Nov 8, 2018
1 parent 880b331 commit 160ccbc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

/** @} */

0 comments on commit 160ccbc

Please sign in to comment.