The system defined ICMPv6 header doesn't have sparse annotation,
so this adds a definition so that endianness can be checked.
Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
uh->udp_csum = htons(0xffff);
}
}
- } else if (proto == IPPROTO_ICMPV6 && l4_size >= sizeof(struct icmp6_hdr)) {
- struct icmp6_hdr *icmp = ofpbuf_l4(packet);
+ } else if (proto == IPPROTO_ICMPV6 &&
+ l4_size >= sizeof(struct icmp6_header)) {
+ struct icmp6_header *icmp = ofpbuf_l4(packet);
icmp->icmp6_cksum = recalc_csum128(icmp->icmp6_cksum, addr, new_addr);
}
ovs_16aligned_be32 ip6f_ident;
};
+#define ICMP6_HEADER_LEN 4
+struct icmp6_header {
+ uint8_t icmp6_type;
+ uint8_t icmp6_code;
+ ovs_be16 icmp6_cksum;
+ uint8_t icmp6_data[0];
+};
+BUILD_ASSERT_DECL(ICMP6_HEADER_LEN == sizeof(struct icmp6_header));
+
/* The IPv6 flow label is in the lower 20 bits of the first 32-bit word. */
#define IPV6_LABEL_MASK 0x000fffff