Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3987782pxb; Tue, 25 Jan 2022 00:46:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8DRvS9d9x48SRe2USxK3t0kdKogBbirptnZTHVgPPHZQZWpeOpYw5AiFNUrNXI01cvGNH X-Received: by 2002:a05:6a00:994:b0:4c9:d2a4:c5af with SMTP id u20-20020a056a00099400b004c9d2a4c5afmr6595916pfg.73.1643100417587; Tue, 25 Jan 2022 00:46:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643100417; cv=none; d=google.com; s=arc-20160816; b=dsYICJFNOCwcfla/ENL///nJJspQvNEAVUFtnnMWynBBFqmImMT7CLBHPOioxGCfxu HJJB4zTRc35LiD+tA85cxMBEO/p3uA3N41Qe92oOZuEXZ5TKNac0qSBD/TiTQLXbzpsa IWizPdaeX3YgMb/e2/4b+hi1FVx3crRpGVMW90sGoKbmUmiNErpHCNKVnPrpwvQWAdtA PhIafy6lXQD3N5rmaoTJjMCc/5cOzCCRqhGG1P96YhE+xVtuyLa84hWn8s6bCL1BaHKH mQV/ok9yZ3SkVmnakc8NbIxp0H3TZk4YOWB6dcOsNCEcduBlfrGKyGSbQfAzzs7lCJFP T2xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:sender:hmm_source_type :hmm_attache_num:hmm_source_ip; bh=4F3VvoztBn7GkRJ9Uo1COfxgE2VtYbyv7K4X0BmDTkU=; b=AN4RgV2MUHngQm16exoa2KN8E1sXlzbkyJK2m8yDdoQf40bFrLpkaso/YHKJgPzRD2 Y8ySc3wpViP1NI9eVzRpgRBZc2KN+ePNqmrJy3vQaIoZJTyMgbk2rJzJr3zGcSaNSExU yY0PKrHPJSzc8a1+a5Pg8QPZfLP/CZhp0WR8/PHCX0XOxx6vX/86U9qJi7bz4gJsVKpZ lxnWVL2QlTHP1Ejuo92sSe6G/BAxeFEDhGXm/3PoIq4vqoBfCXtOG6BzNLLljyYT+k0y b37j988y3fR+tK54m7RhENQoimN6uaohuSjeLS8Lsf8ZufAeKKDwpNAxg5YrAaQKHBm4 cJTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r20si13899016pgu.89.2022.01.25.00.46.46; Tue, 25 Jan 2022 00:46:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1319624AbiAYDJQ (ORCPT + 99 others); Mon, 24 Jan 2022 22:09:16 -0500 Received: from prt-mail.chinatelecom.cn ([42.123.76.222]:47534 "EHLO chinatelecom.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S3424066AbiAYCiz (ORCPT ); Mon, 24 Jan 2022 21:38:55 -0500 HMM_SOURCE_IP: 172.18.0.218:35484.1819251938 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-202.80.192.38 (unknown [172.18.0.218]) by chinatelecom.cn (HERMES) with SMTP id 45B41280100; Tue, 25 Jan 2022 10:38:40 +0800 (CST) X-189-SAVE-TO-SEND: sunshouxin@chinatelecom.cn Received: from ([172.18.0.218]) by app0025 with ESMTP id 09c87cdde5144ab48d00bffe4b83c960 for j.vosburgh@gmail.com; Tue, 25 Jan 2022 10:38:44 CST X-Transaction-ID: 09c87cdde5144ab48d00bffe4b83c960 X-Real-From: sunshouxin@chinatelecom.cn X-Receive-IP: 172.18.0.218 X-MEDUSA-Status: 0 Sender: sunshouxin@chinatelecom.cn From: Sun Shouxin To: j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net, davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jay.vosburgh@canonical.com, nikolay@nvidia.com, huyd12@chinatelecom.cn Subject: [PATCH v9] net: bonding: Add support for IPV6 ns/na to balance-alb/balance-tlb mode Date: Mon, 24 Jan 2022 21:37:55 -0500 Message-Id: <20220125023755.94837-1-sunshouxin@chinatelecom.cn> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since ipv6 neighbor solicitation and advertisement messages isn't handled gracefully in bond6 driver, we can see packet drop due to inconsistency between mac address in the option message and source MAC . Another examples is ipv6 neighbor solicitation and advertisement messages from VM via tap attached to host bridge, the src mac might be changed through balance-alb mode, but it is not synced with Link-layer address in the option message. The patch implements bond6's tx handle for ipv6 neighbor solicitation and advertisement messages. Suggested-by: Hu Yadi Acked-by: Jay Vosburgh Signed-off-by: Sun Shouxin --- drivers/net/bonding/bond_alb.c | 38 +++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 533e476988f2..ba7cc1a9bf6c 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c @@ -1269,6 +1269,34 @@ static int alb_set_mac_address(struct bonding *bond, void *addr) return res; } +/* determine if the packet is NA or NS */ +static bool __alb_determine_nd(struct icmp6hdr *hdr) +{ + if (hdr->icmp6_type == NDISC_NEIGHBOUR_ADVERTISEMENT || + hdr->icmp6_type == NDISC_NEIGHBOUR_SOLICITATION) { + return true; + } + + return false; +} + +static bool alb_determine_nd(struct sk_buff *skb, struct bonding *bond) +{ + struct ipv6hdr *ip6hdr; + struct icmp6hdr *hdr; + + ip6hdr = ipv6_hdr(skb); + if (ip6hdr->nexthdr == IPPROTO_ICMPV6) { + if (!pskb_may_pull(skb, sizeof(struct ipv6hdr) + sizeof(struct icmp6hdr))) + return true; + + hdr = icmp6_hdr(skb); + return __alb_determine_nd(hdr); + } + + return false; +} + /************************ exported alb functions ************************/ int bond_alb_initialize(struct bonding *bond, int rlb_enabled) @@ -1348,8 +1376,11 @@ struct slave *bond_xmit_tlb_slave_get(struct bonding *bond, /* Do not TX balance any multicast or broadcast */ if (!is_multicast_ether_addr(eth_data->h_dest)) { switch (skb->protocol) { - case htons(ETH_P_IP): case htons(ETH_P_IPV6): + if (alb_determine_nd(skb, bond)) + break; + fallthrough; + case htons(ETH_P_IP): hash_index = bond_xmit_hash(bond, skb); if (bond->params.tlb_dynamic_lb) { tx_slave = tlb_choose_channel(bond, @@ -1446,6 +1477,11 @@ struct slave *bond_xmit_alb_slave_get(struct bonding *bond, break; } + if (alb_determine_nd(skb, bond)) { + do_tx_balance = false; + break; + } + hash_start = (char *)&ip6hdr->daddr; hash_size = sizeof(ip6hdr->daddr); break; base-commit: dd81e1c7d5fb126e5fbc5c9e334d7b3ec29a16a0 -- 2.27.0