From patchwork Mon Sep 23 17:26:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Zhang X-Patchwork-Id: 1166344 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ryJklr0G"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46cs5P0fYwz9sDB for ; Tue, 24 Sep 2019 16:40:40 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id DFAE7B0B; Tue, 24 Sep 2019 06:40:37 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id B2B80927 for ; Tue, 24 Sep 2019 06:40:36 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id EBA1387D for ; Tue, 24 Sep 2019 06:40:34 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id d22so540389pll.7 for ; Mon, 23 Sep 2019 23:40:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=7r/30GAEJHNWIf9siABn4eULsmaHBkGkRIuG2oxaW5o=; b=ryJklr0GPGLXVzb108EkkZjLLZ4HI00CBqXgT4IKR7eIas2pC6ZXECxZQ1FvXo9RKA STWm55J15fmrikdHh7YWjaFCp8RUf94IYdej+0RtxjqLcavV2ARnJ8GBIjvLDFkPdAlu lEh2PcNAEY+df0WX33Z4Ab+aqm1O9OvwWpTApQ7knqqWdwrJOYsiyTwjZuAfvBiik0ed Na9evm0l4ui0zhuuCITwce9vCQNMcHQsVL5wPHF6plzs5cKyEJca3PVwk0YZB96SHapC 9ipgmqmoAcQbBDl3tGoHbxbsU6SB1WcT0uw5Qq8av/HaVbLl+xNhspwvdiRC/ZXgg/2K TQig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=7r/30GAEJHNWIf9siABn4eULsmaHBkGkRIuG2oxaW5o=; b=Q784YShwazYby5oCuURal0D0xG43+fjl5upTXRsm46wpbYJeACJa6Dx8vuYEsPzRsu rbDso9WSJZX7LORVTHVCZw1jwFTzCfyjUQFOXNLCSV1bXI1QXHdVUixqmyJoNEqzkdhD Wi1Xg2eMyldfzTV1i11IaVtUBTD4qb6kzcQtIMo/d+MxjCzWyof4GbUvl928+BM2SgKo PG4Bn/bnUuYjV9nBWeaux7LUZ2QDSl7mAEZ3Zz8yivSGPeLysOdgrq5P97W7U1VkYwf4 ueIeL4Bkli+RWrVa3R+ebH14T/LG0zGoHXHYBtzMAbejlYDl4sAcI2kKAIdgcU3AFohj fN9w== X-Gm-Message-State: APjAAAWeS90k42s1HoKnEpWyIf3r5JuMrhlVIAGk/wZCxCkSCs9nP787 dJ4s/vMSFRjj3906eX0KE0hJQZAWPQU= X-Google-Smtp-Source: APXvYqwtIJgs92GyIn5K8MIlmw8x2rQ+ZRx2yLVl4nZZTGbvzzc41dUL6d69ygaQ/yDw/BxPf0095g== X-Received: by 2002:a17:902:aa89:: with SMTP id d9mr1306984plr.281.1569307234193; Mon, 23 Sep 2019 23:40:34 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id s97sm771943pjc.4.2019.09.23.23.40.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Sep 2019 23:40:33 -0700 (PDT) From: martinbj2008@gmail.com To: dev@openvswitch.org Date: Tue, 24 Sep 2019 01:26:42 +0800 Message-Id: <1569259602-25568-1-git-send-email-martinbj2008@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00, DATE_IN_PAST_12_24, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Martin Zhang , zhangjunweimartin@didiglobal.com, Dujie Subject: [ovs-dev] [PATCH] odp-util: fill IPv4 ver and head length for tnl_push X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Martin Zhang 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=9.9.9.6)" \ "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=10.97.240.147,dst=10.96.74.33,proto=17,tos=0,ttl=64,frag=0x4000), \ udp(src=0,dst=4789,csum=0x0),vxlan(flags=0x8000000,vni=0x270f)),out_port(3)),4" Signed-off-by: Martin Zhang Signed-off-by: Dujie --- 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];