From patchwork Wed Jul 6 17:59:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 645422 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3rl7p34vQ0z9sxS for ; Thu, 7 Jul 2016 04:00:27 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.b=WVP1XS4q; dkim-atps=neutral Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 9668910B29; Wed, 6 Jul 2016 11:00:11 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 0A79910B10 for ; Wed, 6 Jul 2016 11:00:10 -0700 (PDT) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 947B216217D for ; Wed, 6 Jul 2016 12:00:09 -0600 (MDT) X-ASG-Debug-ID: 1467828008-0b323706661734d0001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar6.cudamail.com with ESMTP id BY8VBGfxVi7oqIjb (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 06 Jul 2016 12:00:08 -0600 (MDT) X-Barracuda-Envelope-From: simon.horman@netronome.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO mail-wm0-f52.google.com) (74.125.82.52) by mx1-pf2.cudamail.com with ESMTPS (AES128-SHA encrypted); 6 Jul 2016 18:00:08 -0000 Received-SPF: neutral (mx1-pf2.cudamail.com: 74.125.82.52 is neither permitted nor denied by SPF record at mktomail.com) X-Barracuda-Apparent-Source-IP: 74.125.82.52 X-Barracuda-RBL-IP: 74.125.82.52 Received: by mail-wm0-f52.google.com with SMTP id a66so2821537wme.0 for ; Wed, 06 Jul 2016 11:00:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aWzxZWVeLktpyB/gQO8l4vK4SJQTk/S6/d8T+PmIlOY=; b=WVP1XS4q73yVusDxPAqJqCNDS7S8N6KNDX42tdfvn5ErniTXTxktKWsLlZKPB9I+c6 kZvG1zTSYcStOQuZRP52YIEFwxCreC9ykRRAC0rpHjJm1FCnZVatBmHg7jrf5+GMOwas W2p2cD0rItOMcLqrN7H2YeEZ9ARXd7mi1xx5L09XZ9hi9UiBvViSevZNIeLS3EsZ+XTD t5vNeXgsmX19VKlqasqDvsQ3KgmLqwN2A8v6zfipSQNw4I7qanvpLqETZYBgbG7o/EZE pJ6P5XeAhooUQ6Vr7i1JZUc3kXYJEKByJUpfe4EddSKPdKaxvVF5mts6L8a15hZaTgam pIwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aWzxZWVeLktpyB/gQO8l4vK4SJQTk/S6/d8T+PmIlOY=; b=JnCp7u0iHLZURs0lasTueEVfuaH7iXKLk3vGVb75ksEVD4mrAgBEwjud/wY+b3+E3U l+qOgGEpCb7/u+yBsP7dtLm4g14r2kw0n752nd6yTS8UVxk8oFL5HhSWgXJgZwsRWXZV F9hluH7DtBt1SOKsgGuYkYSTAlEs3Z8nM384UaoYeItlQq28zPsNIjg/qz2klgAOw3HY Y8Vpkw7wvtAxd/oBVxXoFod7wxttmYfb8UFyXFfTFlpwzovIL419kYGmJEK6KMuU7CU9 DNRs2LdIVTcAL5UNtB8vACDha9iaT8dbcPMVUAiFypkdMAvAVyBx/WuQxEfgqST0ZN6+ /RkQ== X-Gm-Message-State: ALyK8tKIOCqVNBkts+rF8xGv8RRLVISwMoCbi4jOKtI78YovlGqbcOef7OcgtzI27Osluuf/ X-Received: by 10.194.67.39 with SMTP id k7mr24442328wjt.23.1467828006521; Wed, 06 Jul 2016 11:00:06 -0700 (PDT) Received: from penelope.isobedori.kobe.vergenet.net (dhcp-077-251-078-056.chello.nl. [77.251.78.56]) by smtp.gmail.com with ESMTPSA id f196sm660539wmg.15.2016.07.06.11.00.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 Jul 2016 11:00:05 -0700 (PDT) X-CudaMail-Envelope-Sender: simon.horman@netronome.com From: Simon Horman To: netdev@vger.kernel.org X-CudaMail-MID: CM-E2-705050671 X-CudaMail-DTE: 070616 X-CudaMail-Originating-IP: 74.125.82.52 Date: Wed, 6 Jul 2016 19:59:53 +0200 X-ASG-Orig-Subj: [##CM-E2-705050671##][PATCH net-next v11 3/6] openvswitch: set skb protocol and mac_len when receiving on internal device Message-Id: <1467827996-32547-4-git-send-email-simon.horman@netronome.com> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 In-Reply-To: <1467827996-32547-1-git-send-email-simon.horman@netronome.com> References: <1467827996-32547-1-git-send-email-simon.horman@netronome.com> X-GBUdb-Analysis: 0, 74.125.82.52, Ugly c=0.389962 p=-0.409091 Source Normal X-MessageSniffer-Rules: 0-0-0-6104-c X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1467828008 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using global scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_SC0_MISMATCH_TO, BSF_SC5_MJ1963, DKIM_SIGNED, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.31064 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 BSF_SC0_MISMATCH_TO Envelope rcpt doesn't match header 0.00 DKIM_SIGNED Domain Keys Identified Mail: message has a signature 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Cc: dev@openvswitch.org Subject: [ovs-dev] [PATCH net-next v11 3/6] openvswitch: set skb protocol and mac_len when receiving on internal device X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" * Set skb protocol based on contents of packet. I have observed this is necessary to get actual protocol of a packet when it is injected into an internal device e.g. by libnet in which case skb protocol will be set to ETH_ALL. * Set the mac_len which has been observed to not be set up correctly when an ARP packet is generated and sent via an openvswitch bridge. My test case is a scenario where there are two open vswtich bridges. One outputs to a tunnel port which egresses on the other. The motivation for this is that support for outputting to layer 3 (non-tap) GRE tunnels as implemented by a subsequent patch depends on protocol and mac_len being set correctly on receive. Signed-off-by: Simon Horman --- v11 * Do not set mac_len. Instead of relying on mac_len follow-up patches now use skb_unset_mac_header() v10 * Set mac_len v9 * New patch --- net/openvswitch/vport-internal_dev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c index 434e04c3a189..32d8e94d9bff 100644 --- a/net/openvswitch/vport-internal_dev.c +++ b/net/openvswitch/vport-internal_dev.c @@ -48,6 +48,9 @@ static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev) { int len, err; + skb->protocol = eth_type_trans(skb, netdev); + skb_push(skb, ETH_HLEN); + len = skb->len; rcu_read_lock(); err = ovs_vport_receive(internal_dev_priv(netdev)->vport, skb, NULL);