From patchwork Thu Mar 22 22:07:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 889674 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="oRfDP3Mx"; 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 406gpZ6nnwz9s0y for ; Fri, 23 Mar 2018 09:10:30 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 24031EEB; Thu, 22 Mar 2018 22:08:00 +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 B4243E50 for ; Thu, 22 Mar 2018 22:07:56 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 6C9455D4 for ; Thu, 22 Mar 2018 22:07:56 +0000 (UTC) Received: by mail-pf0-f195.google.com with SMTP id m68so3922353pfm.11 for ; Thu, 22 Mar 2018 15:07:56 -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=cq0K+eoCz4Ggq/Xc5ItB3PiYMEjk7H6N0JE92IiH4io=; b=oRfDP3MxDFbaITJj+5q+bjkqtnfazQE9jxwqooTfaUSmdK3duzNHF9omRNB9E2EjKA zepO6t8C3diXZo1/2q0aN532Tg1S4cslnjoKtWVYxYsnMYEEA6dANB6UJSovQp3zmx/u mU1IBu0Q6AXk/NDD54f0BpmPPVEgohvCTxdK+pdwIgy9tN2y2rmljCSq2JgtlmnsMKfU 0RciV9qBzjHkPzHNBJ+jaj8ikS7gJTIL6iMOUYnLpUNzXyeUlwS8RAK1E+nV0UBVwosZ h+gDaiww8KMZMKvwpGUWwmKw5XyMIwcVQOoDMNAkQQFPry84zXuUFJK+nc8AVlLO6MJm OldQ== 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=cq0K+eoCz4Ggq/Xc5ItB3PiYMEjk7H6N0JE92IiH4io=; b=pbVgLohKKa1W2XVsVP5YhZgRcXHBBrKWpkHqa+/tgCRyKrTLT6+abEZradcWSHLVCl hf3g/Xefsl6iUxmra5DJbJV2jOzKq0emd/KIlPcxy9qrDj6gpCAwH20kIUv6bAi1uPir POOX5Aus45Xb1H8EICcklZi+7siNL/roQc+e85OHh0aUBWK3BELRkmAewZs4Jc96xD+3 1kDlDYkaYxqE8YxPnvfz6gL5Tg/5mLtte6CduptI0bKZt1CWn1bPyMBy7GbZLQR595c0 QK1uevJzxvm7EwmdzbYoAHd/9K95o/Uk3XTLENq1Q9bBaS1SxUFkwC11oZnqG9oJkXkG Klqg== X-Gm-Message-State: AElRT7G6rTtOsrcmIJzbGkqZXYxxRhmjL/3sNGYWCoGoCLIOno8uIg+m eL6T0/6eYFnlbNAqy/8Y6lT6AA== X-Google-Smtp-Source: AG47ELsbcxizF62NFU3AU/+XesX3m6x4tQz7Nu+rvZIUvND+ISlZ4pPuyNfPbOKa8xVa1OHvm+iAKg== X-Received: by 10.99.182.73 with SMTP id v9mr18773035pgt.158.1521756475638; Thu, 22 Mar 2018 15:07:55 -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.07.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 15:07:54 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 22 Mar 2018 15:07:22 -0700 Message-Id: <1521756461-3870-7-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 Cc: Xin Long Subject: [ovs-dev] [ERSPAN RFC 06/25] ip_gre: get key from session_id correctly in erspan_rcv 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: Xin Long Upstream commit: commit 935a9749a36828af0e8be224a5cd4bc758112c34 Author: Xin Long Date: Sun Oct 1 22:00:53 2017 +0800 ip_gre: get key from session_id correctly in erspan_rcv erspan only uses the first 10 bits of session_id as the key to look up the tunnel. But in erspan_rcv, it missed 'session_id & ID_MASK' when getting the key from session_id. If any other flag is also set in session_id in a packet, it would fail to find the tunnel due to incorrect key in erspan_rcv. This patch is to add 'session_id & ID_MASK' there and also remove the unnecessary variable session_id. Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN") Signed-off-by: Xin Long Signed-off-by: David S. Miller Cc: Xin Long Signed-off-by: Greg Rose --- datapath/linux/compat/ip_gre.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c index af9fbb3..2fc4659 100644 --- a/datapath/linux/compat/ip_gre.c +++ b/datapath/linux/compat/ip_gre.c @@ -141,7 +141,6 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, struct ip_tunnel *tunnel; struct erspanhdr *ershdr; const struct iphdr *iph; - __be32 session_id; __be32 index; int len; @@ -158,8 +157,7 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, /* The original GRE header does not have key field, * Use ERSPAN 10-bit session ID as key. */ - session_id = cpu_to_be32(ntohs(ershdr->session_id)); - tpi->key = session_id; + tpi->key = cpu_to_be32(ntohs(ershdr->session_id) & ID_MASK); index = ershdr->md.index; tunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, tpi->flags | TUNNEL_KEY,