From patchwork Thu Mar 22 22:07:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 889689 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="nl1pNVbN"; 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 406gxQ0jG6z9s0y for ; Fri, 23 Mar 2018 09:16:26 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 85118F7F; Thu, 22 Mar 2018 22:08:24 +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 25624F71 for ; Thu, 22 Mar 2018 22:08:21 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f67.google.com (mail-pg0-f67.google.com [74.125.83.67]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id D36EF5D3 for ; Thu, 22 Mar 2018 22:08:20 +0000 (UTC) Received: by mail-pg0-f67.google.com with SMTP id g12so3816900pgs.0 for ; Thu, 22 Mar 2018 15:08:20 -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:in-reply-to:references; bh=N41w9QB+HOdw8ZcCMOOioYRR7ktjmnzkQCImEF7jX8k=; b=nl1pNVbNGP+zh52yRK+THCeLZ8b2pEDRUubATpb5FE5fe1ES/62VD+zA9pHrB5AL1x +Ar02CPwd4DgUK1A1GiN37LUIjCICr834p7jI1pRNufs13BABtFquSZGBA2MRE+Vs+5r r1ZtBwNqvz7KvaoeYc17LZ+GRgf0UUKxTA1dMbXgRaAyXXY39ur/gXJqoYqFy7tsIRVC Ey73ddmY7TxVERJPhFHd2LnCgVJupfH71D65KWrraG2yIp/ZXsRUYXJyGgxlnAgebP9t oT+JOe8eHF+ak/vEwXX8EHWoJDRelbcfoHmiu60Hfm+iB/2CDSXt/ki+NY+d4H/FkiHs wzJQ== 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:in-reply-to :references; bh=N41w9QB+HOdw8ZcCMOOioYRR7ktjmnzkQCImEF7jX8k=; b=k/GhqmlmqCBWi+Ta97aHLc3NNKdC5qbcgTl/RZae2asY+RgyRM7EeJqdKlSjqWjV17 zZlQRoDtxXDHCYGo0tjh+bCRrkWLS71HtAGOST30ZxH0sKsZSgDeLfxkETRFLIrjCXuK YNW8/td8+YdMMU9fnkyZ+Ld+EiHVK/vpy9mFJNM4tSDIJbUOLWGNkL1GKiTlUbHTxQUx gCkSygSyyDgfDuaQHd/cpuUqNHPf1qNY0BGfE5uhWDuA9cWPEkb4EYMOIVu96ttuvBsS Ox6K6eDSek7ThfKAmB06imxSWLAFdZP8CddbPON4+I5TfdgOMAhIbZvb4oRDz9ayI4+z 7V4A== X-Gm-Message-State: AElRT7GmPkxLHwetUzViZaGUcsAvMSEUahabj/I5iR41w/kicsqazPTk OEmxkgJdEC9da4zuaQOJnpeRLA== X-Google-Smtp-Source: AG47ELtDsB02iCt3d33M70K8rkS3uaOeaI8c+JtcEXG3v4wsP7eW+WLLu7cFA2OORo0vjNPmK2pMdg== X-Received: by 10.98.49.135 with SMTP id x129mr21748540pfx.75.1521756500056; Thu, 22 Mar 2018 15:08:20 -0700 (PDT) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id 4sm2280775pfn.32.2018.03.22.15.08.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 15:08:19 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 22 Mar 2018 15:07:38 -0700 Message-Id: <1521756461-3870-23-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1521756461-3870-1-git-send-email-gvrose8192@gmail.com> References: <1521756461-3870-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,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 Subject: [ovs-dev] [ERSPAN RFC 22/25] net: erspan: fix metadata extraction 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: William Tu Upstream commit: commit 3df1928302950dfa728ab2eade28eea0da291567 Author: William Tu Date: Mon Feb 5 13:35:34 2018 -0800 net: erspan: fix metadata extraction Commit d350a823020e ("net: erspan: create erspan metadata uapi header") moves the erspan 'version' in front of the 'struct erspan_md2' for later extensibility reason. This breaks the existing erspan metadata extraction code because the erspan_md2 then has a 4-byte offset to between the erspan_metadata and erspan_base_hdr. This patch fixes it. Fixes: 1a66a836da63 ("gre: add collect_md mode to ERSPAN tunnel") Fixes: ef7baf5e083c ("ip6_gre: add ip6 erspan collect_md mode") Fixes: 1d7e2ed22f8d ("net: erspan: refactor existing erspan code") Signed-off-by: William Tu Signed-off-by: David S. Miller This is just the ip_gre portion of this upstream commit. The portions of the upstream commit that went to erpsan.h and ip6_gre.c were folded in during a previous commit to introduce ip6 gre. Cc: William Tu Signed-off-by: Greg Rose --- datapath/linux/compat/ip_gre.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c index f99ef1b..5ebbdb5 100644 --- a/datapath/linux/compat/ip_gre.c +++ b/datapath/linux/compat/ip_gre.c @@ -119,6 +119,7 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, struct ip_tunnel_net *itn; struct ip_tunnel *tunnel; const struct iphdr *iph; + struct erspan_md2 *md2; int ver; int len; @@ -169,8 +170,10 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, tun_id, sizeof(*md)); md = ip_tunnel_info_opts(&tun_dst->u.tun_info); - memcpy(md, pkt_md, sizeof(*md)); md->version = ver; + md2 = &md->u.md2; + memcpy(md2, pkt_md, ver == 1 ? ERSPAN_V1_MDSIZE : + ERSPAN_V2_MDSIZE); info = &tun_dst->u.tun_info; info->key.tun_flags |= TUNNEL_ERSPAN_OPT;