Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1791523rwl; Sat, 8 Apr 2023 01:50:57 -0700 (PDT) X-Google-Smtp-Source: AKy350YxOs1AYsnCppiItCCQ+0S2HIP6gSF5wlGQREQ4ig+aUd6aPINxjItv1+8r1/IirL5mujfS X-Received: by 2002:a50:ef0a:0:b0:504:84cb:831f with SMTP id m10-20020a50ef0a000000b0050484cb831fmr1758994eds.36.1680943857520; Sat, 08 Apr 2023 01:50:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680943857; cv=none; d=google.com; s=arc-20160816; b=jpovyGeN65juTw0xUxd15ULqdfsNFNnqxsJLMsUVxd5PFGtXe2dF+CXfHGWuMcyGpY Wv8gk5hL7IXpU96UnbcCFyxMdiJJcVR6zMVObrt1mQmGPT16GimtzlLciosNt7cPRBGM R248nZkXCWTg+hwIVf8wg+KVpuTzRsUMxmZeGY24jnwF9STjzwtRExDiHwwOtY5LEigD S+IKONsrgdcX3M0zMMaIniMfC06mn0L79Fd0ADLSInnskywwO9j90h69aeQ8JGx0Jjso IbnpipznFcACWrLTKKNc6uqwrAYB9B1+TNqP/X42RSp073+q7UuoUYmyPGHc7EtFIjCw tsKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date:feedback-id:dkim-signature:dkim-signature; bh=2yBXVbSSdNHxtHfP7iplYUCfsDs2K4dPwS9gffca2v0=; b=CnrHC6fCpcO6ooagzYuZhWIlpqMKctpYgRjhnhXU2Q+7BO7Xprzrc+b981g5iGLZTZ DN2UJzIOl1Rgi9pLNdoruI7IrRe15RE3Zo/etWGIGEfjCwzTsG6OC6x1UKuadtpQUfxr PrGYyUFLN8q06X2N05grCs7Ssv0zhgPruZAqF6NNLPs80F/4VA8Vq99/2NB1m2oLB9xE D0zRjpY9gQFOuZ/GdXCxpV4QXqUFByH1beEWrezfts9fkSTkqGfan1Q837nZChpszp2W ns6eM87P8X6e9A3vOspBmjarPv1DtQVG4PaIOepmRc2/xYaOOKi8hvEiDm9kTM/9x2Ks dF5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joshtriplett.org header.s=fm1 header.b=qnziuNy0; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=lOV+UeK7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v7-20020a1709060b4700b009495e73249esi4839951ejg.601.2023.04.08.01.50.21; Sat, 08 Apr 2023 01:50:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@joshtriplett.org header.s=fm1 header.b=qnziuNy0; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=lOV+UeK7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230073AbjDHIYU (ORCPT + 99 others); Sat, 8 Apr 2023 04:24:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbjDHIYT (ORCPT ); Sat, 8 Apr 2023 04:24:19 -0400 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3A80D524; Sat, 8 Apr 2023 01:24:17 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id F3E783200909; Sat, 8 Apr 2023 04:24:14 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sat, 08 Apr 2023 04:24:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= joshtriplett.org; h=cc:content-type:content-type:date:date:from :from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to; s=fm1; t=1680942254; x=1681028654; bh=2y BXVbSSdNHxtHfP7iplYUCfsDs2K4dPwS9gffca2v0=; b=qnziuNy0ypINMNUC4t LbshO8S4cz6pwpGvCspmYV8wYjIpSuusui+BrXV4fv+dTwsa2Hgws1HVzMI6uMn/ Vnlgx7xzz4w5igYnarE5MndhiUDXG/rwyJC3l7QesOVY0/PZw0w9jy8kJwIXS3Jx UykvuJKZi+snphDZ0gRhv7V2uGbg5fNbh+dAQp/PLQUmniuaUYJHnEpbmCK69cVJ f6IXEDN2jtrmMGEOfzSYGaiheZxhF16z3jd+GEJuWFLQ3/+ynjYfVfS04QKhrz/0 9pb4LMqeKoHrNyiuze4/LXIqaAqdhP6jcboVdnKRSSlawrQ1Pt3YfDNqTNcYejX0 6zrw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1680942254; x=1681028654; bh=2yBXVbSSdNHxtHfP7iplYUCfsDs2K4dPwS9 gffca2v0=; b=lOV+UeK7Ut1d7PEJcKYvd7u5/u5xwSNj3qL6ZLo9nr3ibF6KPWN vEttAkDc8R/a2Q+FW32kt+6BGxD4RtcOTWgYpzmVQ4S02EOTcAd6J+7ia2jJxtlX YfFzoQ/cpGWDi66GsGHly9XGa0F1kSBkqnHHOu84yD1zKQmvgSXFcsXKZsCI/g6r 350sYwgK6vipF5aS8yVJAlgSnbN4TFzqiWN5H7or/cvkm/4Pw9R+xAIYjf+DyZFl gtMXpKln51uaxBhCFCMiIpqAzZi/q1dPWgCozsDEyQbfN7YBdbWJmnE6TQN7pjpn GuiDj7suuKQundmDfmOiJCaf7dDM3m+TKqg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdejjedgtdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggusehttdertddttddvnecuhfhrohhmpeflohhshhcuvfhr ihhplhgvthhtuceojhhoshhhsehjohhshhhtrhhiphhlvghtthdrohhrgheqnecuggftrf grthhtvghrnhepudelkeevueetjeegudehgfevheffvdffieelieeggfffgeeuffehteek jefgueevnecuffhomhgrihhnpehshihstghtlhdrnhgvthenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjohhshhesjhhoshhhthhrihhplhgv thhtrdhorhhg X-ME-Proxy: Feedback-ID: i83e94755:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 8 Apr 2023 04:24:10 -0400 (EDT) Date: Sat, 8 Apr 2023 17:24:07 +0900 From: Josh Triplett To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , David Ahern , netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH] net: ipv6: Add Kconfig option to set default value of accept_dad Message-ID: <3072adab06f9c5f45cc72d2068d1aed0100436ff.1680941918.git.josh@joshtriplett.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The kernel already supports disabling Duplicate Address Detection (DAD) by setting net.ipv6.conf.$interface.accept_dad to 0. However, for interfaces available at boot time, the kernel brings up the interface and sets up the link-local address before processing sysctls set on the kernel command line; thus, setting sysctl.net.ipv6.conf.default.accept_dad=0 on the kernel command line does not suffice to affect such interfaces. Add a configuration option to set the default value of accept_dad for new interfaces. Signed-off-by: Josh Triplett --- I'm in a virtualized environment, and I'm trying to bring up network interfaces (including IPv6) extremely quickly and have them be immediately usable. I tried many different approaches to disable DAD on the interface, but I didn't find *any* way to successfully disable DAD before the kernel brought up the link-local address for eth0 and set it as tentative. I've verified that this option *does* successfully cause the link-local address for interfaces to not show up as "tentative". If this approach isn't appealing, or if there's a better way to accomplish this, I'd welcome suggestions for alternative approaches. Documentation/networking/ip-sysctl.rst | 4 +++- net/ipv6/Kconfig | 10 ++++++++++ net/ipv6/addrconf.c | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/networking/ip-sysctl.rst index 87dd1c5283e6..302f1f208339 100644 --- a/Documentation/networking/ip-sysctl.rst +++ b/Documentation/networking/ip-sysctl.rst @@ -2496,11 +2496,13 @@ accept_dad - INTEGER == ============================================================== 0 Disable DAD - 1 Enable DAD (default) + 1 Enable DAD 2 Enable DAD, and disable IPv6 operation if MAC-based duplicate link-local address has been found. == ============================================================== + Default: 1 if CONFIG_IPV6_DAD_DEFAULT_DISABLE is not set, otherwise 0. + DAD operation and mode on a given interface will be selected according to the maximum value of conf/{all,interface}/accept_dad. diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig index 658bfed1df8b..3535e1b6a38f 100644 --- a/net/ipv6/Kconfig +++ b/net/ipv6/Kconfig @@ -48,6 +48,16 @@ config IPV6_OPTIMISTIC_DAD If unsure, say N. +config IPV6_DAD_DEFAULT_DISABLE + bool "IPv6: Disable Duplicate Address Detection by default" + help + If enabled, this sets the default value of the + net.ipv6.conf.default.accept_dad sysctl to 0, disabling Duplicate + Address Detection (DAD). This allows the modified default to be + picked up early enough to affect interfaces that exist at boot time. + + If unsure, say N. + config INET6_AH tristate "IPv6: AH transformation" select XFRM_AH diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index faa47f9ea73a..e931c836a5dd 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -274,7 +274,11 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = { .proxy_ndp = 0, .accept_source_route = 0, /* we do not accept RH0 by default. */ .disable_ipv6 = 0, +#ifdef CONFIG_IPV6_DAD_DEFAULT_DISABLE + .accept_dad = 0, +#else .accept_dad = 1, +#endif .suppress_frag_ndisc = 1, .accept_ra_mtu = 1, .stable_secret = { -- 2.40.0