Skip to content

Commit

Permalink
[6LoWPAN] - fix endianness for fragment tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jelledevleeschouwer committed Feb 2, 2017
1 parent 760c1bb commit 976b90c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions modules/pico_6lowpan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1271,8 +1271,8 @@ frag_fill(uint8_t *frag, uint8_t dispatch, uint16_t dgram_size, uint16_t tag, ui
{
frag[0] = (uint8_t)(dispatch | ((uint8_t)short_be(dgram_size) & 0x07));
frag[1] = (uint8_t)(short_be(dgram_size) >> 8);
frag[2] = (uint8_t)(tag);
frag[3] = (uint8_t)(tag >> 8);
frag[2] = (uint8_t)(short_be(tag));
frag[3] = (uint8_t)(short_be(tag) >> 8);
frag[4] = (uint8_t)(dgram_off);
buf_move(frag + offset, buf + copied, copy);
}
Expand Down Expand Up @@ -1565,7 +1565,6 @@ defrag_remove_header(struct pico_frame *f, uint16_t *dgram_size, uint16_t *tag,
*dgram_size = (uint16_t)(((uint16_t)(f->net_hdr[0] & 0x07) << 8) | (uint16_t)f->net_hdr[1]);
*tag = (uint16_t)(((uint16_t)f->net_hdr[2] << 8) | (uint16_t)f->net_hdr[3]);
*off = (uint16_t)((uint16_t)f->net_hdr[4] << 3);
dbg("RECV [0]: %02X [1]: %02X dgram_size: %d off: %d tag: %d\n", f->net_hdr[0], f->net_hdr[1], *dgram_size, *off, *tag);
f->net_len = (uint16_t)(f->net_len - (uint16_t)size);
f->len = (uint32_t)(f->len - (uint32_t)size);
f->net_hdr += size;
Expand Down
2 changes: 1 addition & 1 deletion test/autotest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
sleep 1
(build/test/picoapp6.elf -6 1,2,1 -a udpecho,::0,6667,) &
sleep 1
build/test/picoapp6.elf -6 2,1,0 -a udpclient,2aaa:abcd:0000:0000:0200:00aa:ab00:0001,6667,6667,1400,100,10, || exit 1
build/test/picoapp6.elf -6 2,1,0 -a udpclient,2aaa:abcd:0000:0000:0200:00aa:ab00:0001,6667,6667,1400,10,1, || exit 1
killall -w picoapp6.elf -s SIGQUIT

echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
Expand Down

0 comments on commit 976b90c

Please sign in to comment.