diff mbox

[ovs-dev,v4,2/3] tunneling: Calculate and update packet l4_offset in tunnel push.

Message ID 1500471963-82198-3-git-send-email-sugesh.chandran@intel.com
State Accepted
Headers show

Commit Message

Chandran, Sugesh July 19, 2017, 1:46 p.m. UTC
The following tunnel combine patch series avoids the packets recirculation
after the tunnel push. So it is necessary to populate all relevant packet meta
data fields for the following combined action-set.

Consider a chained tunnel test case shown below,

PKT-IN --> TUNNEL_PUSH --> MOD_PKT_HDR --> TUNNEL_POP

In this eg: the last tunnel_pop operation uses the l4_offset in the packet to
validate the packets. So it must be calculated and updated in the packet before
executing the action. Since there is no recirculation now on, this calculation
is doing as part of tunnel_push.

Signed-off-by: Sugesh Chandran <sugesh.chandran@intel.com>
Signed-off-by: Zoltán Balogh <zoltan.balogh@ericsson.com>
Co-authored-by: Zoltán Balogh <zoltan.balogh@ericsson.com>
---
 lib/netdev-native-tnl.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox

Patch

diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c
index 7f3cf98..5dbf583 100644
--- a/lib/netdev-native-tnl.c
+++ b/lib/netdev-native-tnl.c
@@ -163,12 +163,14 @@  netdev_tnl_push_ip_header(struct dp_packet *packet,
         ip6 = netdev_tnl_ipv6_hdr(eth);
         *ip_tot_size -= IPV6_HEADER_LEN;
         ip6->ip6_plen = htons(*ip_tot_size);
+        packet->l4_ofs = dp_packet_size(packet) - *ip_tot_size;
         return ip6 + 1;
     } else {
         ip = netdev_tnl_ip_hdr(eth);
         ip->ip_tot_len = htons(*ip_tot_size);
         ip->ip_csum = recalc_csum16(ip->ip_csum, 0, ip->ip_tot_len);
         *ip_tot_size -= IP_HEADER_LEN;
+        packet->l4_ofs = dp_packet_size(packet) - *ip_tot_size;
         return ip + 1;
     }
 }