summaryrefslogtreecommitdiff
path: root/lib/netdev-native-tnl.c
diff options
context:
space:
mode:
authorBhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>2018-01-12 17:43:13 +0000
committerBen Pfaff <blp@ovn.org>2018-01-12 13:02:18 -0800
commit1fc2e1bd071445e422e3fbff95f65d298e45073e (patch)
tree5a0ee2caf761e1162290bf3ed31b0cd353614951 /lib/netdev-native-tnl.c
parentffbbb670152d5e2194fe4cb6e1d952af4e8f1624 (diff)
downloadopenvswitch-1fc2e1bd071445e422e3fbff95f65d298e45073e.tar.gz
netdev-native-tnl: Add assertion in vxlan_pop_header.
During tunnel decapsulation the below steps are performed: [1] Tunnel information is populated in packet metadata i.e packet->md->tunnel. [2] Outer header gets popped. [3] Packet is recirculated. For [1] to work, the dp_packet L3 and L4 header offsets should be valid. The offsets in the dp_packet are set as part of miniflow extraction. If offsets are accidentally reset (or) the pop header operation is performed prior to miniflow extraction, step [1] fails silently and creates issues that are harder to debug. Add the assertion to check if the offsets are valid. Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib/netdev-native-tnl.c')
-rw-r--r--lib/netdev-native-tnl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c
index 9ce856798..fb5eab033 100644
--- a/lib/netdev-native-tnl.c
+++ b/lib/netdev-native-tnl.c
@@ -508,6 +508,9 @@ netdev_vxlan_pop_header(struct dp_packet *packet)
ovs_be32 vx_flags;
enum packet_type next_pt = PT_ETH;
+ ovs_assert(packet->l3_ofs > 0);
+ ovs_assert(packet->l4_ofs > 0);
+
pkt_metadata_init_tnl(md);
if (VXLAN_HLEN > dp_packet_l4_size(packet)) {
goto err;