1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 22:43:50 +01:00

gnrc_sixlowpan_frag/rbuf: add offset assertion to rbuf_add()

`gnrc_sixlowpan_frag` internally derives the offset value directly
from the fragment header, so for normal usage within GNRC this
assertion is redundant, but to make the tests of `rbuf_add` 100%
water-tide I added it.
This commit is contained in:
Martine Lenders 2019-01-23 18:09:55 +01:00
parent 6ff06d3f41
commit 7d9ef9f78c

View File

@ -87,11 +87,16 @@ static int _rbuf_add(gnrc_netif_hdr_t *netif_hdr, gnrc_pktsnip_t *pkt,
size_t offset, unsigned page)
{
rbuf_t *entry;
sixlowpan_frag_t *frag = pkt->data;
sixlowpan_frag_n_t *frag = pkt->data;
rbuf_int_t *ptr;
uint8_t *data = ((uint8_t *)pkt->data) + sizeof(sixlowpan_frag_t);
size_t frag_size;
/* check if provided offset is the same as in fragment */
assert(((((frag->disp_size.u8[0] & SIXLOWPAN_FRAG_DISP_MASK) ==
SIXLOWPAN_FRAG_1_DISP)) && (offset == 0)) ||
((((frag->disp_size.u8[0] & SIXLOWPAN_FRAG_DISP_MASK) ==
SIXLOWPAN_FRAG_N_DISP)) && (offset == (frag->offset * 8U))));
rbuf_gc();
entry = _rbuf_get(gnrc_netif_hdr_get_src_addr(netif_hdr), netif_hdr->src_l2addr_len,
gnrc_netif_hdr_get_dst_addr(netif_hdr), netif_hdr->dst_l2addr_len,