Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp861648ybi; Wed, 19 Jun 2019 09:05:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEHgzOz3X62X3iZAWXu4uxT/54o4uigr10tEGJeHY3ubzEF1Wfx75Q6ITVW1v/uiI+PAZH X-Received: by 2002:aa7:8a95:: with SMTP id a21mr127807455pfc.215.1560960311330; Wed, 19 Jun 2019 09:05:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560960311; cv=none; d=google.com; s=arc-20160816; b=KEKkNtMs/5/J4ya8u4lGThoUReNfwjXnp+SSKEKMaqNWexng7zkCDe0LtublKMqxv1 vAGfCrbWGFTEh5sfhSTjsWwwppJpvEhYqbl6qWWLe3+QakIVvUQCmH9gSzopqY9TQfqa UwL+KbhQWW94PG1RqrFtq7kVjZqBGjEURbBf6aNIh6oWM0vIyRvSZX22QJ5aJa9xt5AZ hHyOF7aZEj/mDiMcQ8J82XvTKTiRWY8KuKJ7m++KXCZbz1lZ3Pw9H5qcopU/AflypePA MG4LzFEHEQKZHY362e6ndAUBvxgepaQWQAsj4Yozs/oOyKj7ojW3o7O9u7Dhc0YGCZ47 uKSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=zgYSYOLHCi26353p8o9QoIhafMMzcpZ7ogtOVmhuDzg=; b=W1FO9ROvvNaCQsYthtaX8C6km26MTCf/k5vreRhONDzxQCjGrp0krLGj9nNvpMXET+ osVCvrz9Ifjp2lcATzkfjcoYqEHu0QXcAIibDqEYvZGzvWmOYJGox78C0Uv83pVe0TVj aNlPU3UOpBoJZCG/KWCKhNBG7cGTdsyl5BkdcP2sjAzu+IhWSEzq4jCs0Ivwt5kfhgXF 6lPoTTQwDSsrYgJMa0lEyFh1DYZeu1aD4IbjkX0c/9etmn1Z89ZG25i0tA+GBgFG0BXc O6/pnnUOa39I4em8HMUUI92qyA87I7DWdkYCTwTl7+S31t9/TuGS1Z5g3PG4RstKCfnU kyGg== 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 p13si3469111pgd.347.2019.06.19.09.04.55; Wed, 19 Jun 2019 09:05:11 -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 S1729825AbfFSQDD (ORCPT + 99 others); Wed, 19 Jun 2019 12:03:03 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:36182 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726332AbfFSQDC (ORCPT ); Wed, 19 Jun 2019 12:03:02 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id D8830DA68DB5B2867508; Thu, 20 Jun 2019 00:02:56 +0800 (CST) Received: from localhost (10.133.213.239) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Thu, 20 Jun 2019 00:02:46 +0800 From: YueHaibing To: , , , , , CC: , , YueHaibing Subject: [PATCH] flow_dissector: Fix vlan header offset in __skb_flow_dissect Date: Thu, 20 Jun 2019 00:01:32 +0800 Message-ID: <20190619160132.38416-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 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 --- 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 415b95f..2a52abb 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -785,6 +785,9 @@ bool __skb_flow_dissect(const struct sk_buff *skb, 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.0