[ovs-dev] [PATCH] odp-util: fill IPv4 ver and head length for tnl_push

martinbj2008 at gmail.com martinbj2008 at gmail.com
Mon Sep 23 17:26:42 UTC 2019

From: Martin Zhang <martinbj2008 at gmail.com>

    When parse tnl_push, if IPv4 is used,
    we forget to fill the ipv4 version and ip header length fields.

    so there is a wrong ip header in the header of "struct ovs_action_push_tnl",
    which will caused wrong packdet sent by dpcl.

    test command:
    ovs-appctl dpctl/add-flow "in_port(1),eth_type(0x0800),ipv4(dst=" \
    "tnl_push(tnl_port(2),header(size=50,type=4,eth(dst=08:00:27:2e:87:0d,src=98:03:9b:c6:d1:7c,dl_type=0x0800), \
    ipv4(src=,dst=,proto=17,tos=0,ttl=64,frag=0x4000), \

Signed-off-by: Martin Zhang <martinbj2008 at gmail.com>
Signed-off-by: Dujie <dujie at didiglobal.com>
 lib/odp-util.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/odp-util.c b/lib/odp-util.c
index 84ea4c1..fe59a56 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -1527,6 +1527,7 @@ ovs_parse_tnl_push(const char *s, struct ovs_action_push_tnl *data)
         put_16aligned_be32(&ip->ip_src, sip);
         put_16aligned_be32(&ip->ip_dst, dip);
         ip->ip_frag_off = htons(ip_frag_off);
+        ip->ip_ihl_ver = IP_IHL_VER(5, 4);
         ip_len = sizeof *ip;
     } else {
         char sip6_s[IPV6_SCAN_LEN + 1];

More information about the dev mailing list