aboutsummaryrefslogtreecommitdiff
path: root/lib/packets.h
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2011-12-26 17:33:03 -0800
committerJesse Gross <jesse@nicira.com>2011-12-27 11:16:25 -0800
commit71225d423b845d957f1feab55623ecf7afb39a0c (patch)
tree168df8acf43823a8047abbe25dc36d2226a36d92 /lib/packets.h
parent4fa126216803df65814fa5f69b12a66b2541f808 (diff)
packet: Match userspace and kernel definition of ICMP header.
Current userspace considers an ICMP header to be 4 bytes consisting of the type, code, and checksum. The kernel considers it to be 8 bytes because it also counts the two data fields that contain type-specific information (and are always present). Since flow extract will zero out headers that are not completely present this means that an ICMP packet that has a header of 5-7 bytes will be interpreted differently by userspace and kernel. This fixes the problem by adopting the kernel's version of the ICMP header in userspace. Signed-off-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'lib/packets.h')
-rw-r--r--lib/packets.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/packets.h b/lib/packets.h
index 439a7dd0..f23b0383 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -331,11 +331,23 @@ struct ip_header {
};
BUILD_ASSERT_DECL(IP_HEADER_LEN == sizeof(struct ip_header));
-#define ICMP_HEADER_LEN 4
+#define ICMP_HEADER_LEN 8
struct icmp_header {
uint8_t icmp_type;
uint8_t icmp_code;
ovs_be16 icmp_csum;
+ union {
+ struct {
+ ovs_be16 id;
+ ovs_be16 seq;
+ } echo;
+ struct {
+ ovs_be16 empty;
+ ovs_be16 mtu;
+ } frag;
+ ovs_be32 gateway;
+ } icmp_fields;
+ uint8_t icmp_data[0];
};
BUILD_ASSERT_DECL(ICMP_HEADER_LEN == sizeof(struct icmp_header));