Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp427744pxb; Wed, 18 Nov 2020 08:03:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJwBm/jIAlKY/i6/8mstcKctHfqg0npo8VLZsFdhHBirpHHI4egZuE8FhDI6hPhrPyFKXsSB X-Received: by 2002:aa7:dcd6:: with SMTP id w22mr26778373edu.19.1605715411393; Wed, 18 Nov 2020 08:03:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1605715411; cv=pass; d=google.com; s=arc-20160816; b=mL4DaR3Owylv8DBPbPlOGU9rY/swejWVaKvfSVi6w6edczsHF1ABkoVZV9TzY6R1JZ OS1I/svvMkWtK980WHfZwG5Qkvfhqo2kLdxXeqrjQriewmLP+bmE2xO7d+sPHL2rpoPb hSKbVF9KmDe1HudZUoXAUYyTBdCtW6HP58gfJrH2NuAtt721JJXj8l0+Wfb4zklJ14Lg HyEPgxzSi4HLe6y28oaJWCsLBzor6DV12uLupviegEE4nMAgOS5iFpFttKON1NRpa9a+ 897z9J3dg5cJjFI//+koVCdHqF1ZkctfWKoGQ3eMIJRxftbnZqTtfXxI3dyfzbUU5FRM CzFw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:importance:content-transfer-encoding :mime-version:subject:references:in-reply-to:message-id:cc:to:from :date:dkim-signature; bh=r734+KKew+kGS2tJrjpen3pnF+qZa2+AOhj0cSasEhU=; b=qUEOP9Ueacv29fbGUt1zJ4QTWVyIRTXNijZaGz35ntBGWGayElL2ebUab0oQx0O2EC gZAgXCn8Ro2rHB52vsD10TndXEOI7MmOZtigPfUYzbgUwaqaidfnx+S9Ezf1bLT61cLL fFLmKjPkhg48TbrPB2zkDA4IwrLR3ULoT8S+8M8tJuGrkWCt1xr8QYNCPRrT+1qRaXRp 1FIpU1lIzpf5RudD+7tqNSWDmCHhIkKi2GsNBCgKwffzDfJpZAKpiVOM9clDFMN8YK7Q hgOMed3XDXvkxmVvsjbzNW3zEUreGVuG40aJbBN7xXI0DQN9cARuxkgfhSKEnaYobcle k2YQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@shytyi.net header.s=hs header.b="I1xV/Syt"; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); 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 cq11si16246887edb.332.2020.11.18.08.03.03; Wed, 18 Nov 2020 08:03:31 -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; dkim=pass header.i=@shytyi.net header.s=hs header.b="I1xV/Syt"; arc=pass (i=1 spf=pass spfdomain=shytyi.net dkim=pass dkdomain=shytyi.net dmarc=pass fromdomain=shytyi.net>); 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 S1727792AbgKRP55 (ORCPT + 99 others); Wed, 18 Nov 2020 10:57:57 -0500 Received: from sender11-of-o52.zoho.eu ([31.186.226.238]:21365 "EHLO sender11-of-o52.zoho.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726598AbgKRP54 (ORCPT ); Wed, 18 Nov 2020 10:57:56 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1605715025; cv=none; d=zohomail.eu; s=zohoarc; b=WjzgxdOVTogBKmBQjO2meIoe1mDOq7hRrBVkt59W4xfz/5jTVsXzQ1mnTvM0fxNJMZ2ZVo1j/blr4DNzP8hd0Gz7UJoCx15UeRr4yoyvfyiaRfP4/XVleAp6xLqUp6vZjt2ciikyQi2h4WTXX8VihaNJX+ci16vzpDk023brWrU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1605715025; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=r734+KKew+kGS2tJrjpen3pnF+qZa2+AOhj0cSasEhU=; b=bLvYuPB9M9j4eNg1ALkoZPtgTN20oBWWl9BOu6yxPVpmLArfOYV/bf2UkAwmTwpBOOekIoOTHby6wg1+ZuyIBtk7/FkAW/1ATtw8pjGxJG2ruvO6MSQVeWhqdC+qwSV62bFE6ZQIFp5pSWPEekihKO90rlQ9j+W9gS8IufE1hcg= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=shytyi.net; spf=pass smtp.mailfrom=dmytro@shytyi.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1605715025; s=hs; d=shytyi.net; i=dmytro@shytyi.net; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=r734+KKew+kGS2tJrjpen3pnF+qZa2+AOhj0cSasEhU=; b=I1xV/Sytw+s1XvVsI9+t7hdm0eSE2ZpnSTzBmj2i+L1fGItQkbOW5/HvUKLyPStI d/IGg2RxsQTTA5ep6H1yjTiqFpm3TRCUIyjlX6jI1LjgQtl4gR7uX2UE+/u+iETai3y qmFb5kafFN9NKxBRcKWUdhF8wW7ZLtJFuRTIXCWY= Received: from mail.zoho.eu by mx.zoho.eu with SMTP id 1605715018978132.54482825616162; Wed, 18 Nov 2020 16:56:58 +0100 (CET) Date: Wed, 18 Nov 2020 16:56:58 +0100 From: Dmytro Shytyi To: "Jakub Kicinski" Cc: "kuznet" , "yoshfuji" , "liuhangbin" , "davem" , "netdev" , "linux-kernel" Message-ID: <175dc12c4e0.10495546f370275.5966814804122496347@shytyi.net> In-Reply-To: <20201118075027.18083d19@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> References: <175b3433a4c.aea7c06513321.4158329434310691736@shytyi.net> <202011110944.7zNVZmvB-lkp@intel.com> <175bd218cf4.103c639bc117278.4209371191555514829@shytyi.net> <175bf515624.c67e02e8130655.7824060160954233592@shytyi.net> <175c31c6260.10eef97f6180313.755036504412557273@shytyi.net> <20201117124348.132862b1@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> <175db965378.e5454e1c360034.2264030307026794920@shytyi.net> <20201118075027.18083d19@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> Subject: Re: [PATCH net-next V5] net: Variable SLAAC: SLAAC with prefixes of arbitrary length in PIO MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, ---- On Wed, 18 Nov 2020 16:50:27 +0100 Jakub Kicinski wrote ---- > On Wed, 18 Nov 2020 14:41:03 +0100 Dmytro Shytyi wrote: > > > > @@ -2576,9 +2590,42 @@ int addrconf_prefix_rcv_add_addr(struct > > > > u32 addr_flags, bool sllao, bool tokenized, > > > > __u32 valid_lft, u32 prefered_lft) > > > > { > > > > - struct inet6_ifaddr *ifp = ipv6_get_ifaddr(net, addr, dev, 1); > > > > + struct inet6_ifaddr *ifp = NULL; > > > > int create = 0; > > > > > > > > + if ((in6_dev->if_flags & IF_RA_VAR_PLEN) == IF_RA_VAR_PLEN && > > > > + in6_dev->cnf.addr_gen_mode != IN6_ADDR_GEN_MODE_STABLE_PRIVACY) { > > > > + struct inet6_ifaddr *result = NULL; > > > > + struct inet6_ifaddr *result_base = NULL; > > > > + struct in6_addr curr_net_prfx; > > > > + struct in6_addr net_prfx; > > > > + bool prfxs_equal; > > > > + > > > > + result_base = result; > > > > + rcu_read_lock(); > > > > + list_for_each_entry_rcu(ifp, &in6_dev->addr_list, if_list) { > > > > + if (!net_eq(dev_net(ifp->idev->dev), net)) > > > > + continue; > > > > + ipv6_addr_prefix_copy(&net_prfx, &pinfo->prefix, pinfo->prefix_len); > > > > + ipv6_addr_prefix_copy(&curr_net_prfx, &ifp->addr, pinfo->prefix_len); > > > > + prfxs_equal = > > > > + ipv6_prefix_equal(&net_prfx, &curr_net_prfx, pinfo->prefix_len); > > > > + > > > > + if (prfxs_equal && pinfo->prefix_len == ifp->prefix_len) { > > > > + result = ifp; > > > > + in6_ifa_hold(ifp); > > > > + break; > > > > + } > > > > + } > > > > + rcu_read_unlock(); > > > > + if (result_base != result) > > > > + ifp = result; > > > > + else > > > > + ifp = NULL; > > > > > > Could this be a helper of its own? > > > > Explain the thought please. It is not clear for me. > > At the look of it the code under this if statement looks relatively > self-contained, and has quite a few local variables. Rather than making > the surrounding function longer would it be possible to factor it out > into a helper function? > Understood. Thanks. Best regards, Dmytro SHYTYI.