[riot-notifications] [RIOT-OS/RIOT] gnrc_ipv6_ext_frag: Initial import of IPv6 reassembly (#11596)

Martine Lenders notifications at github.com
Sat Sep 14 10:11:46 CEST 2019


miri64 commented on this pull request.



> +        /* first fragment */
+        uint16_t ipv6_len = byteorder_ntohs(ipv6->len);
+
+        /* not divisible by 8*/
+        if ((pkt->size & 0x7)) {
+            DEBUG("ipv6_ext_frag: fragment length not divisible by 8");
+            goto error_exit;
+        }
+        _set_nh(fh_snip->next, nh);
+        gnrc_pktbuf_remove_snip(pkt, fh_snip);
+        /* TODO: RFC 8200 says "- 8"; determine if `sizeof(ipv6_ext_frag_t)` is
+         * really needed*/
+        rbuf->pkt_len += ipv6_len - pkt->size - sizeof(ipv6_ext_frag_t);
+        if (rbuf->pkt != NULL) {
+            /* first fragment but not first arriving */
+            memcpy(rbuf->pkt->data, pkt->data, pkt->size);

Oh sorry. Must have been the mobile view that confused me. Mhhh.. `rbuf` comes from `gnrc_ipv6_ext_frag_rbuf_get()` which in turn does not initialize `rbuf->pkt`. So there are to cases: Either another fragment was already received (`rbuf->pkt != NULL`), then `rbuf->pkt` was already resized to the appropriate length until the previously received packet at the link you gave and we land here. If it was not (`rbuf->pkt == NULL`) [we just set `rbuf->pkt` to `pkt`](https://github.com/RIOT-OS/RIOT/pull/11596/files#diff-70b063778a3f60ee4d99760ea342b819R221) and don't copy at all.

-- 
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/11596#discussion_r324416831
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190914/d8613a0a/attachment.htm>


More information about the notifications mailing list