1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Byte order and rpl problems

This commit is contained in:
Oleg Hahm 2014-02-27 00:49:03 +01:00 committed by Martin Lenders
parent c9e8adc414
commit e2e62596be
3 changed files with 6 additions and 6 deletions

View File

@ -672,7 +672,7 @@ void recv_rtr_adv(void)
ipv6_addr_t abro_addr;
ipv6_buf = ipv6_get_buf();
packet_length = IPV6_HDR_LEN + ipv6_buf->length;
packet_length = IPV6_HDR_LEN + NTOHS(ipv6_buf->length);
icmpv6_opt_hdr_len = RTR_ADV_LEN;
rtr_adv_buf = get_rtr_adv_buf(ipv6_ext_hdr_len);
ipv6_addr_t newaddr;
@ -937,7 +937,7 @@ void recv_nbr_sol(void)
uint8_t send_na = 0;
uint8_t sllao_set = 0;
uint8_t aro_state = NDP_OPT_ARO_STATE_SUCCESS;
uint16_t packet_length = IPV6_HDR_LEN + ipv6_buf->length;
uint16_t packet_length = IPV6_HDR_LEN + NTOHS(ipv6_buf->length);
/* check whick options are set, we need that because an aro
* option condition is that a sllao option is set. thus that we don't

View File

@ -1154,7 +1154,7 @@ uint8_t lowpan_iphc_encoding(int if_id, const uint8_t *dest, int dest_len,
ptr = get_payload_buf(ipv6_ext_hdr_len);
}
*/
memcpy(&ipv6_hdr_fields[hdr_pos], &ptr[IPV6_HDR_LEN], ipv6_buf->length);
memcpy(&ipv6_hdr_fields[hdr_pos], &ptr[IPV6_HDR_LEN], NTOHS(ipv6_buf->length));
comp_len = 2 + hdr_pos + payload_length;

View File

@ -490,7 +490,7 @@ void rpl_process(void)
code = ((uint8_t *)m_recv.content.ptr);
/* differentiate packet types */
ipv6_buf = ipv6_get_buf();
memcpy(&rpl_buffer, ipv6_buf, ipv6_buf->length + IPV6_HDR_LEN);
memcpy(&rpl_buffer, ipv6_buf, NTOHS(ipv6_buf->length) + IPV6_HDR_LEN);
switch (*code) {
case (ICMP_CODE_DIS): {
@ -583,7 +583,7 @@ void recv_rpl_dio(void)
* ipv6_buf->length contains the packet length minus ipv6 and
* icmpv6 header, so only ICMPV6_HDR_LEN remains to be
* subtracted. */
while (len < (ipv6_buf->length - ICMPV6_HDR_LEN)) {
while (len < (NTOHS(ipv6_buf->length) - ICMPV6_HDR_LEN)) {
DEBUG("parsing DIO options\n");
rpl_opt_buf = get_rpl_opt_buf(len);
@ -970,7 +970,7 @@ void rpl_send(ipv6_addr_t *destination, uint8_t *payload, uint16_t p_len, uint8_
}
}
ipv6_send_packet(ipv6_buf);
ipv6_send_packet(ipv6_send_buf);
}
}