Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3524409pxb; Mon, 24 Jan 2022 11:22:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJycMW6XBveD/R5qw08/WT92l6W5tRZWi6CDwkrEGCKTXdkPCHu5YqU8YaP3QSKE1XcFPwcT X-Received: by 2002:aa7:988b:0:b0:4c8:b982:d4fa with SMTP id r11-20020aa7988b000000b004c8b982d4famr7770268pfl.14.1643052168987; Mon, 24 Jan 2022 11:22:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643052168; cv=none; d=google.com; s=arc-20160816; b=n2PTy2x8Ti90VZNQD1yMZ4jbqpW9ODt9BdDGMbkHHw9drdDDdYQSmUCObpW1sUCwjF u52PjN6Ds3X8bONPPgjIPOX+7fdg40GGu3301uTZDhtrX/QjJUvRV6JCRUagRkb49n6v ToKocWqIVAnH9EmqNl/4TpzjO/oFE0PsE8hxPxMMuq3IIsmjHT6fhptsJ9KTBo86Jh2i FnN5OywK00jLxWBsL/Ivc6obGUL3zHgWEBmjKy0UcfazePYoOdIytvNQYUDDWSyYY6p5 GDe0deOtl7zeo1VVd72i6ZL2LGN1lUpGjaeihKOUKn55sRsEsJtAp3+xnMUu1dpojf2A yO+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id :sender:hmm_source_type:hmm_attache_num:hmm_source_ip; bh=RLllkIaJu40CvrOhr3TEezqWSUQioFkqbgq6Pxf7u5k=; b=xJhGP456z880hV5q6HnBPE732o87R1Fd4ahsCvhH6O+NcvOwAlC/M4m3aKWDeIRx2/ umNg99DxHu89cmIiHJelBeGarGKPSlH0TCnqQwObOogi3vHLg39jb59iXbNwI8nZUqRH RzSIpXvlmM9dL7dJrfmfxw31e330TShE3MXAHTchKnZsG07zR9+Lg/aX3D5u1mp3r49a DqxJUjlzIjUhxGzrHZBQXWMOrpK79O81YdRmWrR8Kq3qQfh1yJhwLptw3fr55BK/IsQn 0WXeD9TNxoGSQ6TPqrFb7aqgt1kYb56QRZjTdOQwjxIhobYl2C3tTogHpwdl7GH4AbwL 9F2A== 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 v9si12745176plp.304.2022.01.24.11.22.35; Mon, 24 Jan 2022 11:22:48 -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 S238833AbiAXOes (ORCPT + 99 others); Mon, 24 Jan 2022 09:34:48 -0500 Received: from prt-mail.chinatelecom.cn ([42.123.76.222]:58734 "EHLO chinatelecom.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237779AbiAXOer (ORCPT ); Mon, 24 Jan 2022 09:34:47 -0500 HMM_SOURCE_IP: 172.18.0.218:37604.302679515 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-112.38.63.33 (unknown [172.18.0.218]) by chinatelecom.cn (HERMES) with SMTP id 7E99928009A; Mon, 24 Jan 2022 22:34:35 +0800 (CST) X-189-SAVE-TO-SEND: sunshouxin@chinatelecom.cn Received: from ([172.18.0.218]) by app0025 with ESMTP id 7f167e02474647c4a9bfcfb9959c7b6e for nikolay@nvidia.com; Mon, 24 Jan 2022 22:34:39 CST X-Transaction-ID: 7f167e02474647c4a9bfcfb9959c7b6e X-Real-From: sunshouxin@chinatelecom.cn X-Receive-IP: 172.18.0.218 X-MEDUSA-Status: 0 Sender: sunshouxin@chinatelecom.cn Message-ID: Date: Mon, 24 Jan 2022 22:34:32 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v7] net: bonding: Add support for IPV6 ns/na to balance-alb/balance-tlb mode To: Nikolay Aleksandrov , 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, huyd12@chinatelecom.cn References: <20220121082243.88155-1-sunshouxin@chinatelecom.cn> From: =?UTF-8?B?5a2Z5a6I6ZGr?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2022/1/21 16:52, Nikolay Aleksandrov 写道: > On 21/01/2022 10:22, Sun Shouxin wrote: >> 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 | 36 ++++++++++++++++++++++++++++++++++ >> 1 file changed, 36 insertions(+) >> > Hi, > A few comments below, Thanks your comment, I'll adjust it and send out V8 soon. > >> diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c >> index 533e476988f2..82b7071840b1 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* > comments should have spaces, /* text */ > >> +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; >> + >> + if (skb->protocol == htons(ETH_P_IPV6)) { > You can drop this test if you re-arrange the cases in the caller. More below. > >> + ip6hdr = ipv6_hdr(skb); >> + if (ip6hdr->nexthdr == IPPROTO_ICMPV6) { >> + hdr = icmp6_hdr(skb); > You have to use pskb_may_pull here, only the IPv6 header is pulled by the caller > and certain to be in the linear part. Also you have to change one of the callers, > more below. > >> + if (__alb_determine_nd(hdr)) >> + return true; > you can do directly return __alb_determine_nd(hdr) here. > >> + } >> + } >> + >> + return false; >> +} >> + >> /************************ exported alb functions ************************/ >> >> int bond_alb_initialize(struct bonding *bond, int rlb_enabled) >> @@ -1350,6 +1378,9 @@ struct slave *bond_xmit_tlb_slave_get(struct bonding *bond,> switch (skb->protocol) { >> case htons(ETH_P_IP): >> case htons(ETH_P_IPV6): >> + if (alb_determine_nd(skb, bond)) >> + break; >> + > You can drop the IPv6 test in alb_determine_nd() if you re-arrange the cases here. > Something like: > case htons(ETH_P_IPV6): > if (alb_determine_nd(skb, bond)) > break; > fallthrough; > case htons(ETH_P_IP): > > You should also use pskb_may_pull to make sure the IPv6 header is in the linear part > and can be accessed. > >> 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: 79e06c4c4950be2abd8ca5d2428a8c915aa62c24 > Thanks, > Nik >