[ovs-dev,2/5] userspace: return correct ipv6 header len.

Message ID 1520629345-130136-3-git-send-email-u9012063@gmail.com
State Accepted
Headers show
Series
  • Add ERSPAN userspace support.
Related show

Commit Message

William Tu March 9, 2018, 9:02 p.m.
The ipv6 header len might have extension header, but current
code simply returns fixed ipv6 header length 40-byte.

Signed-off-by: William Tu <u9012063@gmail.com>
---
 lib/netdev-native-tnl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ben Pfaff April 5, 2018, 12:06 a.m. | #1
On Fri, Mar 09, 2018 at 01:02:22PM -0800, William Tu wrote:
> The ipv6 header len might have extension header, but current
> code simply returns fixed ipv6 header length 40-byte.
> 
> Signed-off-by: William Tu <u9012063@gmail.com>

This looks like a bug fix.  Is it?  If so, then I guess that it should
be backported.
Ben Pfaff April 5, 2018, 12:28 a.m. | #2
On Wed, Apr 04, 2018 at 05:06:43PM -0700, Ben Pfaff wrote:
> On Fri, Mar 09, 2018 at 01:02:22PM -0800, William Tu wrote:
> > The ipv6 header len might have extension header, but current
> > code simply returns fixed ipv6 header length 40-byte.
> > 
> > Signed-off-by: William Tu <u9012063@gmail.com>
> 
> This looks like a bug fix.  Is it?  If so, then I guess that it should
> be backported.

For now, I applied this to master.  Thank you!

Patch

diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c
index fb5eab033758..c3e698d2e72b 100644
--- a/lib/netdev-native-tnl.c
+++ b/lib/netdev-native-tnl.c
@@ -123,7 +123,7 @@  netdev_tnl_ip_extract_tnl_md(struct dp_packet *packet, struct flow_tnl *tnl,
         tnl->ip_tos = ntohl(tc_flow) >> 20;
         tnl->ip_ttl = ip6->ip6_hlim;
 
-        *hlen += IPV6_HEADER_LEN;
+        *hlen += packet->l4_ofs - packet->l3_ofs;
 
     } else {
         VLOG_WARN_RL(&err_rl, "ipv4 packet has invalid version (%d)",