From patchwork Thu Sep 28 21:48:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Herbert X-Patchwork-Id: 819759 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quantonium-net.20150623.gappssmtp.com header.i=@quantonium-net.20150623.gappssmtp.com header.b="FJYbs3zs"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3y37cF0pX2z9sP1 for ; Fri, 29 Sep 2017 07:48:45 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751548AbdI1Vsn (ORCPT ); Thu, 28 Sep 2017 17:48:43 -0400 Received: from mail-pf0-f176.google.com ([209.85.192.176]:43992 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750977AbdI1Vsm (ORCPT ); Thu, 28 Sep 2017 17:48:42 -0400 Received: by mail-pf0-f176.google.com with SMTP id y29so1509900pff.0 for ; Thu, 28 Sep 2017 14:48:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantonium-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=r7jsxPT7lfI/P2klXaJnLAkSAYXNGIO/Irljg0FscDY=; b=FJYbs3zskEWe7ZVnIFxKx2yxn9xUEYcJ7jqFwTKIgYuF1ce85XPoCdz783fp3Dq4pW 5T8Up1IpukYRskypE5SA56OaRQDU+2mWrPfRyQGqXaA6MUwnn54aW1Hb8WuPrA98buzi HjAvKCzXnJaaW8IrTCTxKlKy71CJ2RycfkCzOnvi3K232ZD4PQebql7fB0jsxyX0BR4X CmsiXk77tP9LRXQoaO8q2uirC48/99ttWm0Gft+R9QoeLOCQn+apEq4ZopMmtDwiXL5O BZhrxgKthFwjEETZHnu08BOGNBDS9ImZrVLbHQ3OuFV4dVXX8Xh71evECNlVpVGCpXMX 96rQ== 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=r7jsxPT7lfI/P2klXaJnLAkSAYXNGIO/Irljg0FscDY=; b=rEVDXCc5BvhKkxi6idZLiOS5pL8w8rhx5LLM+/PCV+eZlmW9jACQKvlsp+5tTUd5jB O8gqu7gZp036AG2FcYRH5rrR6hsrmYWQ7v/YhZqKCN+YNze3Ydr/umIZaGUnxP9kYS1a Q+yX7DxF5rPxt1ZqH9PykhQ1ijRxXRa+eGrRVtsMHcGd2z5E4q5JBdUEEaB6+XRvvfwM 8B37bXQtf/NUnzP4Pza/wd3p9WOsoLuDY1COVp2u7siUi0QleG2z/66qWjcJMlBhjElO cv6VC1Xk6jp6X3E8SaFB8yrf4tiBZpuTRLyb2LoJiQ5FvH6gvC7f9BD+sYclyTZ7tUzB g1RA== X-Gm-Message-State: AHPjjUh6UIqAMUkbsN/TWi/1p1glsfGWBYYpe2P+GTDA78vIdvWrfT0H 3BhtA60PKh5egN/IrAT4k63fc4rj X-Google-Smtp-Source: AOwi7QCr/2VmFEnAEa0uFCiZiBQYoQeNo0+nID0uUIGztr6i7d2aQUvZnkgUo9JPnDjAa3pcpMHgkQ== X-Received: by 10.101.83.4 with SMTP id m4mr5279271pgq.266.1506635321727; Thu, 28 Sep 2017 14:48:41 -0700 (PDT) Received: from localhost.localdomain (67-207-98-108.static.wiline.com. [67.207.98.108]) by smtp.gmail.com with ESMTPSA id f8sm3540310pgs.7.2017.09.28.14.48.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Sep 2017 14:48:40 -0700 (PDT) From: Tom Herbert To: davem@davemloft.net Cc: netdev@vger.kernel.org, rohit@quantonium.net, Tom Herbert Subject: [PATCH v3 net-next 2/8] flow_dissector: Move ETH_P_TEB processing to main switch Date: Thu, 28 Sep 2017 14:48:17 -0700 Message-Id: <20170928214823.2426-2-tom@quantonium.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170928214823.2426-1-tom@quantonium.net> References: <20170928214823.2426-1-tom@quantonium.net> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Support for processing TEB is currently in GRE flow dissection as a special case. This can be moved to be a case the main proto switch in __skb_flow_dissect. Signed-off-by: Tom Herbert --- net/core/flow_dissector.c | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 76f5e5bc3177..c15b41f96cbe 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -282,27 +282,8 @@ __skb_flow_dissect_gre(const struct sk_buff *skb, if (hdr->flags & GRE_SEQ) offset += sizeof(((struct pptp_gre_header *) 0)->seq); - if (gre_ver == 0) { - if (*p_proto == htons(ETH_P_TEB)) { - const struct ethhdr *eth; - struct ethhdr _eth; - - eth = __skb_header_pointer(skb, *p_nhoff + offset, - sizeof(_eth), - data, *p_hlen, &_eth); - if (!eth) - return FLOW_DISSECT_RET_OUT_BAD; - *p_proto = eth->h_proto; - offset += sizeof(*eth); - - /* Cap headers that we access via pointers at the - * end of the Ethernet header as our maximum alignment - * at that point is only 2 bytes. - */ - if (NET_IP_ALIGN) - *p_hlen = *p_nhoff + offset; - } - } else { /* version 1, must be PPTP */ + /* version 1, must be PPTP */ + if (gre_ver == 1) { u8 _ppp_hdr[PPP_HDRLEN]; u8 *ppp_hdr; @@ -595,6 +576,28 @@ bool __skb_flow_dissect(struct sk_buff *skb, break; } + case htons(ETH_P_TEB): { + const struct ethhdr *eth; + struct ethhdr _eth; + + eth = __skb_header_pointer(skb, nhoff, sizeof(_eth), + data, hlen, &_eth); + if (!eth) + goto out_bad; + + proto = eth->h_proto; + nhoff += sizeof(*eth); + + /* Cap headers that we access via pointers at the + * end of the Ethernet header as our maximum alignment + * at that point is only 2 bytes. + */ + if (NET_IP_ALIGN) + hlen = nhoff; + + fdret = FLOW_DISSECT_RET_PROTO_AGAIN; + break; + } case htons(ETH_P_8021AD): case htons(ETH_P_8021Q): { const struct vlan_hdr *vlan;