miniflow_extract: Properly handle small IP packets.
authorJarno Rajahalme <jrajahalme@nicira.com>
Wed, 5 Nov 2014 18:10:13 +0000 (10:10 -0800)
committerJarno Rajahalme <jrajahalme@nicira.com>
Mon, 10 Nov 2014 21:35:57 +0000 (13:35 -0800)
commitfa8d9001a624d87413ca5e2baa08c22bd553cf10
treefc9a8185e042156572203de91aa5c2158c276b9b
parent34dd0d78d9b30b745c5011020701bf228a63810d
miniflow_extract: Properly handle small IP packets.

Ethernet frames may contain padding after the IP payload.  When
parsing IP packets, check the IP total size (IPv4) or IP payload size
(IPv6) to detect the size of l2 padding.  The l2 padding size is
stored in the ofpbuf to prevent ofpbuf_pull from entering the padding,
as well as to allow ofpbuf_l4_size() to return the size of the IP
payload without the l2 padding.

This helps avoiding parsing truncated transport headers, for example.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/flow.c
lib/ofpbuf.c
lib/ofpbuf.h
tests/ofproto.at