NetBSD Problem Report #56661

From he@smistad.uninett.no  Sun Jan 23 22:04:11 2022
Return-Path: <he@smistad.uninett.no>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id BE16F1A923A
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 23 Jan 2022 22:04:11 +0000 (UTC)
Message-Id: <20220123220405.1E18643FFD8@smistad.uninett.no>
Date: Sun, 23 Jan 2022 23:04:05 +0100 (CET)
From: he@NetBSD.org
Reply-To: he@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: ip6mode=autohost after rtsol/rtsold/dhcp reshuffle is severely broken
X-Send-Pr-Version: 3.95

>Number:         56661
>Category:       bin
>Synopsis:       ip6mode=autohost after rtsol/rtsold/dhcp reshuffle is severely broken
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 23 22:05:00 +0000 2022
>Last-Modified:  Sun Jan 23 23:30:02 +0000 2022
>Originator:     he@NetBSD.org
>Release:        NetBSD 9.2
>Organization:
	I Try...
>Environment:
System: NetBSD mt.urc.uninett.no 9.2 NetBSD 9.2 (GENERIC) #0: Wed May 12 13:15:55 UTC 2021  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
	In the era before the large reshuffle of rtsol/rtsold/dhcp
	where we saw the actual commands rtsol and rtsold being
	removed and functionality-wise replaced by dhcpcd, you could
	configure a NetBSD host running on a network which allowed
	IPv6 address autoconfiguration with ip6mode=autohost, and
	choose between rtsol=YES or rtsold=YES for either a one-shot
	setting of the ipv6 default route or have a daemon which
	listens to IPv6 router advertisments and acts on the result
	wrt. setting or updating the IPv6 default route, typically
	useful if you have more than one router providing connectivity
	to your network.

	Hence, it was easy to run a host with a network with only
	"router advertisments", and to use autoconfigured IPv6
	addresses to gain working IPv6 network access.


	However, in the era after rtsol and rtosld was removed and
	dhcpcd took over the functionality, ip6mode=autohost is now
	basically broken, because /etc/rc.d/network does not ensure
	that an IPv6 default route is set.  Inside that startup file
	we find this nugget:

        if checkyesnox rtsol && ! checkyesno dhcpcd; then
                if [ "$ip6mode" = "autohost" ]; then
                        echo
                        warn "rtsol has been removed, " \
                            "please configure dhcpcd in its place."
                fi
        fi

	So... This is a joke, right?

	Suddenly, going from getting a nice working IPv6 config with
	just two settings in rc.conf, you as a user are forced to
	embark on a multi-hour project of comprehending the dhcpcd(8)
	man page, and you need to personally figure out what options
	you need to specify to get basically the same functionality as
	rtsol / rtsold.

	This is not reasonable.

	Even the concept that you are forced to configure something
	more (without little other guidance than the dhcpcd(8) man
	page) to get something which has "auto" in it's name working
	is, IMHO, quite user-hostile.


	Even though the rtsol and rtsold commands are gone, there is
	still an rtsold(8) man page which in netbsd-9 gives *some*
	information about dhcpcd, but the command provided there is
	not useful to set a default ipv6 route, but instead does
	"here's how you can inspect what data rtsol would have
	previous worked on" without actually doing anything(!)
	I.e. not exactly very helpful in solving the "no ipv6 default
	route" problem.


	In this particular case, I have a static IPv4 address, and a
	manually configured /etc/resolv.conf, neither of which I want
	dhcpcd to mess with, so I'm slightly apprehensive of "letting
	dhcpcd loose" on my config.


	Ref. the workaround below, it also feels somewhat strange to
	run "dhcpcd --nodhcp6": "run the DHCP client daemon, but,
	actually, don't do DHCP anyway", but I guess I can live with
	the command name, especially if it's run for me automatically
	by /etc/rc.d/network.


	And ... "--nodhcp6" appears to be an undocumented option in
	the dhcpcd(8) man page, both in -current and on netbsd-9.
	It's mentioned in the rtsold / rtsol man page, rtsold(8).


	I might also comment that it's quite difficult to find out via
	the dhcpcd(8) man page what options to supply to do an IPv6
	Router Solitication operation.  Sure, the man page says

     dhcpcd is also an implementation of the IPv6 Router Solicitor as
     specified in RFC 4861 and RFC 6106.

	but that's the only occurrance of "Solicit" in the man page,
	so it's quite difficult to get at what options to supply to
	get it to perform that operation.

	I know there is this dichotomy between dhcp and address auto-
	configuration in IPv6, but...  It seems that the information
	to do the equivalent of "rtsol" is buried in all the dhcp
	complexity in the dhcpcd(8) man page, almost as if the author
	wanted to push an agenda of "use DHCP instead!", which I think
	is quite counter-productive, and a stance we should not take.


>How-To-Repeat:
	Connect a host to a network with router advertisments for IPv6
	address autoconfiguration turned on, and ip6mode=autohost
	configured, and watch this result in no IPv6 default route.

>Fix:
	This needs fixing for improved usability.

	I would be fine with ip6mode=autohost to automatically install
	an IPv6 default route by /etc/rc.d/network, as a one-shot.

	What one should configure to correspond with rtsold=YES, I
	don't quite know.

	Pushing each and every user who wants to use ip6mode=autohost
	to deal with dhcpcd on his own does not result in a good user
	experience.


	For now I have put

	!dhcpcd -dB61 --nodhcp6 nfe0

	inside my /etc/ifconfig.nfe0 (I might drop the 'd' later), but
	that looks very much like a hack, and I would welcome a
	solution which follows the spirit of "auto" -- as this one
	doesn't.

>Audit-Trail:
From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: bin/56661: ip6mode=autohost after rtsol/rtsold/dhcp reshuffle is
 severely broken
Date: Mon, 24 Jan 2022 00:28:27 +0100

 On Sun, Jan 23, 2022 at 10:05:00PM +0000, he@NetBSD.org wrote:
 > 	Suddenly, going from getting a nice working IPv6 config with
 > 	just two settings in rc.conf, you as a user are forced to
 > 	embark on a multi-hour project of comprehending the dhcpcd(8)
 > 	man page, and you need to personally figure out what options
 > 	you need to specify to get basically the same functionality as
 > 	rtsol / rtsold.
 > 	
 > 	This is not reasonable.

 I don't understand this. For the typical client with DHCP and IPv6
 autoconfiguration, you need one setting only: dhcpcd=YES. If you want
 static IPv4 and IPv6 autoconfiguration, there are three options:
 (1) Setting -6 for dhcpcd and "classic" ipv4 configuration
 (2) Setting ipv6only in dhcpcd.conf and "classic" ipv4 configuration
 (3) Using dhcpcd.conf for all address configuration

 All three options cover different use cases. So yes, autohost is broken,
 but the alternatives are no more difficult.

 Joerg

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.