From nobody Thu Jul 18 15:23:27 2024 X-Original-To: freebsd-net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WPxQr320sz5Rbcv for ; Thu, 18 Jul 2024 15:23:32 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qv1-xf2c.google.com (mail-qv1-xf2c.google.com [IPv6:2607:f8b0:4864:20::f2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WPxQq4Gs2z4FZj; Thu, 18 Jul 2024 15:23:31 +0000 (UTC) (envelope-from markjdb@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20230601 header.b=Lgf6yPW7; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=freebsd.org (policy=none); spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::f2c as permitted sender) smtp.mailfrom=markjdb@gmail.com Received: by mail-qv1-xf2c.google.com with SMTP id 6a1803df08f44-6b7734055d1so4995946d6.3; Thu, 18 Jul 2024 08:23:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721316210; x=1721921010; darn=freebsd.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=Uz8/rHwkccAkXqPD4L/69CxuE7PDXhu8Rlr7d8GHQqo=; b=Lgf6yPW7j1HJFgP3woeE1fbiwO15u57MolQMpFNotRMo8AiwGj7TYeZNA63+7oJ2rJ U5SKvmw7VnvOUWbGRvkWFd1AMHkInKczRVLLjBrxgEaS80kOqDhUB/8TdNEuxel8MCoU 1j3RajA2m+1+h9/omDdX0G9QV9jriFunyIeRFX5wF5LOn1GMmy8VUyoVR6FUVNMiF+1r vJZHz7uD7SXaYUHChrosch5U9G8Gk2OIclL8RXnzfsWrNJQYgSFxPIS3BNAtRYiW3KiW aSyO1v/SttiAyslgLqG109ZZPygqTSVf6NGUAXbP8O3ddrCq9YMYbDmCHKSTxCRdyVQx eWxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721316210; x=1721921010; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Uz8/rHwkccAkXqPD4L/69CxuE7PDXhu8Rlr7d8GHQqo=; b=lksgVZ/rUZLPWY7WMyc1QKFvshdcLJG/3LyhxaVaLyDCp+mvoSZtuVBAGp3PWAlXOm DD5JVEP/XgUMFP17TwwZkFPe8XsDkQJJUjWtyAVsB8OlY30LYrT6Hajgsq/T5GyQwKmG jg/R80gZp5xsyMslRpRBoBtucw+nDd38SaFphVaay9T95fv7m8pnEf7wX/Jp/D80coVu tSGUGgZcX6fvmumY5BqfgG6WnhAXZ/GK/8auvtW6okVfHm5ZMifeyZiz7dEbyURdY36a gUDQLhZ8mfZI6bfF2AGfsoD/vl6m8oBKisfqHoaFVNUsdYrVX6MPt5/q4KIjc/9SQy8Z kDUQ== X-Gm-Message-State: AOJu0Yz3nDdQSOczzJdyeLfJuL4H6eYhOopWcPBUDUUuWv25AmIj5Lzu 2j4NrACf32Uw4tRQ8E64zAA+OfgPENXU5TRf+vWclzhwnDOJhfsjINlwpt8X X-Google-Smtp-Source: AGHT+IFwyZr8BOrRgw7vi2Kwpxcqsbjs3uGPZEAu/eqSMcp0i8LGSfQ9u6Yl+DlNZygVaA9K8WjezA== X-Received: by 2002:a05:6214:2688:b0:6b5:a4f6:daa2 with SMTP id 6a1803df08f44-6b79c5392f6mr33756576d6.17.1721316210127; Thu, 18 Jul 2024 08:23:30 -0700 (PDT) Received: from nuc (192-0-220-237.cpe.teksavvy.com. [192.0.220.237]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b79c50d560sm9080116d6.53.2024.07.18.08.23.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jul 2024 08:23:29 -0700 (PDT) Date: Thu, 18 Jul 2024 11:23:27 -0400 From: Mark Johnston To: Zhenlei Huang Cc: freebsd-net@freebsd.org Subject: Re: flushing default router list upon inet6 route flush Message-ID: References: List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.54 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.94)[-0.939]; MID_RHS_NOT_FQDN(0.50)[]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : SPF not aligned (relaxed), DKIM not aligned (relaxed),none]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_TWO(0.00)[2]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MLMMJ_DEST(0.00)[freebsd-net@freebsd.org]; RCVD_COUNT_TWO(0.00)[2]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; RCVD_TLS_LAST(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MISSING_XM_UA(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::f2c:from] X-Rspamd-Queue-Id: 4WPxQq4Gs2z4FZj On Wed, Jul 17, 2024 at 09:19:53AM +0800, Zhenlei Huang wrote: > > > > On Jul 17, 2024, at 4:04 AM, Mark Johnston wrote: > > > > Hello, > > > > When IPv6 SLAAC is configured for an interface, the kernel will update > > its default router list upon receipt of a router advertisement. In so > > doing it may install a default route; in the kernel this happens in > > defrouter_addreq(). > > > > If one uses "route flush" or "service routing restart" to reset the > > routing tables, the default router list is not purged, so a subsequent > > RA from the original default router does not update the list, and so > > does not re-create the default route, even if one re-runs rtsol(8). > > > > This appears to be a bug, but I'm not sure where best to fix it. Should > > "service routing restart" invoke "ndp -R" to flush the default router > > list? > > That can be a workaround, but not the ideal fix. > > > Should route(8) handle this as part of a flush command? > > No, I do not think so. route(8) should handle the routing / FIB parts. > IPv6 default route list is maintained as a per AF basis. Handling the > default route list via route(8), aka the userland, seems to be more a > HACK. > > > Or > > something else? > > I'd propose that the kernel handle this situation, so that for other cases > such as `route -6 delete default`, or route change event from NETLINK > socket, the IPv6 SLAAC default router feature can also work as expected. > > To be precise, `sys/netinet6/nd6_rtr.c` listen on route events and clear > the `installed` flag on deleting the previously installed default route, or > maybe purge all default route list. Then the next time the kernel receives > a RA it re-installs the default route. Thank you for the hint. It turns out that the kernel already does this, but a bug was preventing it from working correctly. https://reviews.freebsd.org/D46020 fixes the problem for me. > This IMO may have side effect that user may really want to delete the > default route while not providing an explicit default route. I think for that > case user should disable accepting RA on the interface ( aka > ifconfig em0 inet6 no_radr, or turn on net.inet6.ip6.no_radr globally). That sounds perfectly reasonable. > How about this proposal ? > > > Best regards, > Zhenlei >