[riot-notifications] [RIOT-OS/RIOT] gnrc_sixlowpan_frag: unroll recursion (#10681)

Martine Lenders notifications at github.com
Mon Jan 7 11:52:22 CET 2019


miri64 commented on this pull request.



>  
 void rbuf_add(gnrc_netif_hdr_t *netif_hdr, gnrc_pktsnip_t *pkt,
               size_t offset, unsigned page)
+{
+    if (_rbuf_add(netif_hdr, pkt, offset, page) == RBUF_ADD_REPEAT) {

No, currently `rbuf_add()` is not called more than twice. While syntactically you are correct, it is dependent on context: The recursive call only happens if there are overlapping fragments in the reassembly buffer

https://github.com/RIOT-OS/RIOT/blob/a87c2c9563320776d3b9bf8247c92787c98d6f83/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c#L113-L124

Since those fragments however are removed in https://github.com/RIOT-OS/RIOT/blob/a87c2c9563320776d3b9bf8247c92787c98d6f83/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c#L116 (and the 6LoWPAN thread we are currently in is the only one adding those fragments) there is no way, the recursion anchors itself here. So a while loop is unnecessary, since `_rbuf_add()` won't return `RBUF_ADD_REPEAT` in the second call.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10681#discussion_r245615762
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190107/fb85ac35/attachment-0001.html>


More information about the notifications mailing list