From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from shards.monkeyblade.net ([184.105.139.130]:36166 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034013AbeCASnf (ORCPT ); Thu, 1 Mar 2018 13:43:35 -0500 Date: Thu, 01 Mar 2018 13:43:31 -0500 (EST) Message-Id: <20180301.134331.411913582403902141.davem@davemloft.net> To: sd@queasysnail.net Cc: netdev@vger.kernel.org, sbrivio@redhat.com, dsahern@gmail.com Subject: Re: [PATCH net-next v2] ipv6: allow userspace to add IFA_F_OPTIMISTIC addresses From: David Miller In-Reply-To: <8eabe9849c8fd3de711764c64d9e0bf6a4d6825b.1519831327.git.sd@queasysnail.net> References: <8eabe9849c8fd3de711764c64d9e0bf6a4d6825b.1519831327.git.sd@queasysnail.net> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: From: Sabrina Dubroca Date: Wed, 28 Feb 2018 16:40:08 +0100 > According to RFC 4429 (section 3.1), adding new IPv6 addresses as > optimistic addresses is acceptable, as long as the implementation > follows some rules: > > * Optimistic DAD SHOULD only be used when the implementation is aware > that the address is based on a most likely unique interface > identifier (such as in [RFC2464]), generated randomly [RFC3041], > or by a well-distributed hash function [RFC3972] or assigned by > Dynamic Host Configuration Protocol for IPv6 (DHCPv6) [RFC3315]. > Optimistic DAD SHOULD NOT be used for manually entered > addresses. > > Thus, it seems reasonable to allow userspace to set the optimistic flag > when adding new addresses. > > We must not let userspace set NODAD + OPTIMISTIC, since if the kernel is > not performing DAD we would never clear the optimistic flag. We must > also ignore userspace's request to add OPTIMISTIC flag to addresses that > have already completed DAD (addresses that don't have the TENTATIVE > flag, or that have the DADFAILED flag). > > Then we also need to clear the OPTIMISTIC flag on permanent addresses > when DAD fails. Otherwise, IFA_F_OPTIMISTIC addresses added by userspace > can still be used after DAD has failed, because in > ipv6_chk_addr_and_flags(), IFA_F_OPTIMISTIC overrides IFA_F_TENTATIVE. > > Setting IFA_F_OPTIMISTIC from userspace is conditional on > CONFIG_IPV6_OPTIMISTIC_DAD and the optimistic_dad sysctl. > > Signed-off-by: Sabrina Dubroca > Reviewed-by: Stefano Brivio Applied, thank you.