mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 06:23:53 +01:00
fixed #18 for ICMPv6 packets
This commit is contained in:
parent
956f0e8656
commit
21c4bb6aa5
@ -182,7 +182,7 @@ void init_rtr_sol(uint8_t sllao)
|
||||
ipv6_get_saddr(&(ipv6_buf->srcaddr), &(ipv6_buf->destaddr));
|
||||
|
||||
opt_hdr_len = RTR_SOL_LEN;
|
||||
ipv6_buf->length = ICMPV6_HDR_LEN + RTR_SOL_LEN + OPT_STLLAO_MAX_LEN;
|
||||
ipv6_buf->length = HTONS(ICMPV6_HDR_LEN + RTR_SOL_LEN + OPT_STLLAO_MAX_LEN);
|
||||
|
||||
if (sllao == OPT_SLLAO) {
|
||||
opt_stllao_buf = get_opt_stllao_buf(ipv6_ext_hdr_len, opt_hdr_len);
|
||||
@ -445,7 +445,7 @@ void init_rtr_adv(ipv6_addr_t *addr, uint8_t sllao, uint8_t mtu, uint8_t pi,
|
||||
}
|
||||
}
|
||||
|
||||
ipv6_buf->length = packet_length - IPV6_HDR_LEN;
|
||||
ipv6_buf->length = HTONS(packet_length - IPV6_HDR_LEN);
|
||||
|
||||
/* calculate checksum */
|
||||
icmp_buf->checksum = 0;
|
||||
@ -698,7 +698,7 @@ void init_nbr_sol(ipv6_addr_t *src, ipv6_addr_t *dest, ipv6_addr_t *targ,
|
||||
packet_length += OPT_ARO_HDR_LEN;
|
||||
}
|
||||
|
||||
ipv6_buf->length = packet_length - IPV6_HDR_LEN;
|
||||
ipv6_buf->length = HTONS(packet_length - IPV6_HDR_LEN);
|
||||
|
||||
icmp_buf->checksum = 0;
|
||||
icmp_buf->checksum = ~icmpv6_csum(PROTO_NUM_ICMPV6);
|
||||
@ -941,7 +941,7 @@ void init_nbr_adv(ipv6_addr_t *src, ipv6_addr_t *dst, ipv6_addr_t *tgt,
|
||||
packet_length += OPT_ARO_HDR_LEN;
|
||||
}
|
||||
|
||||
ipv6_buf->length = packet_length - IPV6_HDR_LEN;
|
||||
ipv6_buf->length = HTONS(packet_length - IPV6_HDR_LEN);
|
||||
|
||||
icmp_buf->checksum = 0;
|
||||
icmp_buf->checksum = ~icmpv6_csum(PROTO_NUM_ICMPV6);
|
||||
@ -1069,7 +1069,7 @@ uint16_t icmpv6_csum(uint8_t proto)
|
||||
{
|
||||
ipv6_buf = get_ipv6_buf();
|
||||
uint16_t sum;
|
||||
uint16_t len = ipv6_buf->length;
|
||||
uint16_t len = NTOHS(ipv6_buf->length);
|
||||
sum = len + proto;
|
||||
|
||||
sum = csum(sum, (uint8_t *)&ipv6_buf->srcaddr, 2 * sizeof(ipv6_addr_t));
|
||||
@ -1109,7 +1109,7 @@ void init_para_prob(ipv6_addr_t *src, ipv6_addr_t *dest, uint8_t code, uint32_t
|
||||
|
||||
packet_length += min(MTU - packet_length, packet_len);
|
||||
|
||||
ipv6_buf->length = packet_length - IPV6_HDR_LEN;
|
||||
ipv6_buf->length = HTONS(packet_length - IPV6_HDR_LEN);
|
||||
|
||||
icmp_buf->checksum = 0;
|
||||
icmp_buf->checksum = ~icmpv6_csum(PROTO_NUM_ICMPV6);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user