From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B56AC43387 for ; Wed, 16 Jan 2019 09:47:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 14E542086D for ; Wed, 16 Jan 2019 09:47:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391858AbfAPJrU (ORCPT ); Wed, 16 Jan 2019 04:47:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54946 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731998AbfAPJrT (ORCPT ); Wed, 16 Jan 2019 04:47:19 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3C7D9C056797; Wed, 16 Jan 2019 09:47:19 +0000 (UTC) Received: from localhost.localdomain (unknown [10.32.181.77]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16D865D967; Wed, 16 Jan 2019 09:47:14 +0000 (UTC) Message-ID: <568fc3d4505d6a1725a4e1e59f43f0af0ac10f8c.camel@redhat.com> Subject: Re: [PATCH net] net: ip6_gre: use erspan key field for tunnel lookup From: Davide Caratti To: Lorenzo Bianconi , davem@davemloft.net Cc: netdev@vger.kernel.org, u9012063@gmail.com In-Reply-To: <044b51ecc8d0bc21faf8755e2f3014e8b65d71ec.1547569872.git.lorenzo.bianconi@redhat.com> References: <044b51ecc8d0bc21faf8755e2f3014e8b65d71ec.1547569872.git.lorenzo.bianconi@redhat.com> Organization: red hat Content-Type: text/plain; charset="UTF-8" Date: Wed, 16 Jan 2019 10:47:14 +0100 Mime-Version: 1.0 User-Agent: Evolution 3.30.3 (3.30.3-1.fc29) Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 16 Jan 2019 09:47:19 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, 2019-01-15 at 17:43 +0100, Lorenzo Bianconi wrote: > Use ERSPAN key header field as tunnel key in gre_parse_header routine > since ERSPAN protocol sets the key field of the external GRE header to > 0 resulting in a possible tunnel lookup fail. > In addition remove key field parsing in erspan_rcv and ip6erspan_rcv > > Fixes: 5a963eb61b7c ("ip6_gre: Add ERSPAN native tunnel support") > Signed-off-by: Lorenzo Bianconi > --- > net/ipv4/gre_demux.c | 14 ++++++++++++++ > net/ipv4/ip_gre.c | 4 ---- > net/ipv6/ip6_gre.c | 1 - > 3 files changed, 14 insertions(+), 5 deletions(-) > > diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c > index a4bf22ee3aed..ee09d657606e 100644 > --- a/net/ipv4/gre_demux.c > +++ b/net/ipv4/gre_demux.c > @@ -25,6 +25,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -119,6 +120,19 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi, > hdr_len += 4; > } > tpi->hdr_len = hdr_len; > + > + /* ERSPAN ver 1 and 2 protocol sets GRE key field > + * to 0 and sets the configured key in the > + * inner erspan header field > + */ > + if (tpi->proto == htons(ETH_P_ERSPAN) || > + tpi->proto == htons(ETH_P_ERSPAN2)) { > + struct erspan_base_hdr *ershdr; > + > + ershdr = (struct erspan_base_hdr *)options; > + tpi->key = cpu_to_be32(get_session_id(ershdr)); > + } > + hi Lorenzo, are we sure that 'ershdr' is in the linear part of skb? if not, we might need a call to pskb_may_pull() here. thanks! -- davide