mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #259 from OlegHahm/ieee802154_frame_byteorder
fixed byte order in network stack
This commit is contained in:
commit
05ececa079
@ -1010,7 +1010,7 @@ int32_t destiny_socket_sendto(int s, const void *buf, uint32_t len, int flags,
|
||||
current_udp_packet->checksum = 0;
|
||||
|
||||
memcpy(payload, buf, len);
|
||||
current_udp_packet->length = UDP_HDR_LEN + len;
|
||||
current_udp_packet->length = HTONS(UDP_HDR_LEN + len);
|
||||
temp_ipv6_header->length = UDP_HDR_LEN + len;
|
||||
|
||||
current_udp_packet->checksum = ~udp_csum(temp_ipv6_header,
|
||||
@ -1018,7 +1018,7 @@ int32_t destiny_socket_sendto(int s, const void *buf, uint32_t len, int flags,
|
||||
|
||||
ipv6_sendto(&to->sin6_addr, IPPROTO_UDP,
|
||||
(uint8_t *)(current_udp_packet),
|
||||
current_udp_packet->length);
|
||||
NTOHS(current_udp_packet->length));
|
||||
return current_udp_packet->length;
|
||||
}
|
||||
else {
|
||||
|
@ -27,12 +27,7 @@ uint8_t ieee802154_frame_init(ieee802154_frame_t *frame, uint8_t *buf)
|
||||
{
|
||||
/* Frame Control Field - 802.15.4 - 2006 - 7.2.1.1 */
|
||||
uint8_t index = 0;
|
||||
|
||||
buf[index] = ((frame->fcf.dest_addr_m << 2) |
|
||||
(frame->fcf.frame_ver << 4) |
|
||||
(frame->fcf.src_addr_m << 6));
|
||||
|
||||
index++;
|
||||
buf[index] = ((frame->fcf.frame_type) |
|
||||
(frame->fcf.sec_enb << 3) |
|
||||
(frame->fcf.frame_pend << 4) |
|
||||
@ -40,14 +35,20 @@ uint8_t ieee802154_frame_init(ieee802154_frame_t *frame, uint8_t *buf)
|
||||
(frame->fcf.panid_comp << 6));
|
||||
index++;
|
||||
|
||||
buf[index] = ((frame->fcf.dest_addr_m << 2) |
|
||||
(frame->fcf.frame_ver << 4) |
|
||||
(frame->fcf.src_addr_m << 6));
|
||||
|
||||
index++;
|
||||
|
||||
/* Sequence Number - 802.15.4 - 2006 - 7.2.1.2 */
|
||||
buf[index] = frame->seq_nr;
|
||||
index++;
|
||||
|
||||
/* Destination PAN Identifier - 802.15.4 - 2006 - 7.2.1.3 */
|
||||
if (frame->fcf.dest_addr_m == 0x02 || frame->fcf.dest_addr_m == 0x03) {
|
||||
buf[index] = ((frame->dest_pan_id >> 8) & 0xff);
|
||||
buf[index + 1] = (frame->dest_pan_id & 0xff);
|
||||
buf[index + 1] = ((frame->dest_pan_id >> 8) & 0xff);
|
||||
buf[index] = (frame->dest_pan_id & 0xff);
|
||||
}
|
||||
|
||||
index += 2;
|
||||
|
@ -174,6 +174,7 @@ void sixlowpan_lowpan_sendto(const ieee_802154_long_t *dest,
|
||||
packet_length = comp_len;
|
||||
}
|
||||
else {
|
||||
ipv6_buf->length = HTONS(ipv6_buf->length);
|
||||
lowpan_ipv6_set_dispatch(data);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user