Skip to content

Commit

Permalink
tunneling: Calculate and update packet l4_offset in tunnel push.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Zoltán Balogh <[email protected]>
Co-authored-by: Zoltán Balogh <[email protected]>
Signed-off-by: Joe Stringer <[email protected]>
  • Loading branch information
2 people authored and joestringer committed Jul 19, 2017
1 parent 86bfb29 commit ce8bbd3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/netdev-native-tnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit ce8bbd3

Please sign in to comment.