Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2021770ybd; Sun, 23 Jun 2019 22:38:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQpUVtCH0oJrTT+ISIeUW2ZLFHEvrf4aR3JozUOludlYwTBWJ3aNSlPuqPEVdmvvnMxHdb X-Received: by 2002:a65:508b:: with SMTP id r11mr29846013pgp.387.1561354737393; Sun, 23 Jun 2019 22:38:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561354737; cv=none; d=google.com; s=arc-20160816; b=mNPChWeu/tJlSh5FRaOX42xCfH6DXFmZQxVOtkDdXJ+rzHt6W+sSuVbNBh9DybppvR w2bJJmdRyNAqIgvFcK1V3/BYLVB/d2Du3eB9b+kTF5+EtPZhqEdiiI3uQlcV+oGXcKaM YHISM+wkyejwJqZUFzYqPfQHB4BX8i+Msrrqf0rh7eQgh6nFcWKoGEtgGRyJDPi4miSA lGf7Z+blMdt0dIU+1tTHQ3PyS9P7fUKe2hU5C91Tr5jw+v4U1vFiwz3dc3Rsr61f2Ppt jcbZ2GcwQxtXopoIWz9Ne4dWDlanFCV8CKDR5T4DRwO4hQM7trsZGQ+cjdV/J4YU71SZ D7cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=T8pYuFQZ6yO0sXOkpwInFX+RgGGX4iH8yqZLuQ1m1tM=; b=B5gqGi5LAZZjqVkQgPe9C7m1u70VBOURSxmo6++y5YrXcEu0QXzNUASQTmz6ZUOcDC 8UEMZ89EBM4lsn3cKMqiS1tu/NHxnTJiJoJhLDJOt7/qPP0gCQCMNOBCIGUOO0y6eYLT CsswmyGASHTpWmkl+W9ghtUCJR+xOHPL9VoySWKgbIC0UU86lbcHVMduvVuOkeNcoLGq Sduxby377AA0/L6gYCGaYM6arMJ6vLrQxTYYkKLg51EybZ/xOWb4tE/YGRZW4ihEOXnu uC10oU7OzB8stJcFIFvC+JQnvWv3Gfyo6wztzcrJZCc2taCW3eQnOT9ni7NdTaKqYp4M /kng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k71si10122912pje.29.2019.06.23.22.38.41; Sun, 23 Jun 2019 22:38:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726791AbfFXEB0 (ORCPT + 99 others); Mon, 24 Jun 2019 00:01:26 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:59142 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725267AbfFXEB0 (ORCPT ); Mon, 24 Jun 2019 00:01:26 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 5AA599E7CDD25E43015C; Mon, 24 Jun 2019 12:01:23 +0800 (CST) Received: from localhost (10.133.213.239) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.439.0; Mon, 24 Jun 2019 12:01:12 +0800 From: YueHaibing To: , , , , , , , CC: , , YueHaibing Subject: [PATCH v2] flow_dissector: Fix vlan header offset in __skb_flow_dissect Date: Mon, 24 Jun 2019 11:49:13 +0800 Message-ID: <20190624034913.40328-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 In-Reply-To: <20190622.161955.2030310177158651781.davem@davemloft.net> References: <20190622.161955.2030310177158651781.davem@davemloft.net> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.133.213.239] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We build vlan on top of bonding interface, which vlan offload is off, bond mode is 802.3ad (LACP) and xmit_hash_policy is BOND_XMIT_POLICY_ENCAP34. __skb_flow_dissect() fails to get information from protocol headers encapsulated within vlan, because 'nhoff' is points to IP header, so bond hashing is based on layer 2 info, which fails to distribute packets across slaves. Fixes: d5709f7ab776 ("flow_dissector: For stripped vlan, get vlan info from skb->vlan_tci") Signed-off-by: YueHaibing --- v2: remove redundant spaces --- net/core/flow_dissector.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 01ad60b..ff85934 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -998,6 +998,9 @@ bool __skb_flow_dissect(const struct net *net, skb && skb_vlan_tag_present(skb)) { proto = skb->protocol; } else { + if (dissector_vlan == FLOW_DISSECTOR_KEY_MAX) + nhoff -= sizeof(*vlan); + vlan = __skb_header_pointer(skb, nhoff, sizeof(_vlan), data, hlen, &_vlan); if (!vlan) { -- 2.7.4