HomeFreeBSD

MFC r297323,r297324, r297325, r297326:

Description

MFC r297323,r297324, r297325, r297326:

Set only one default route for nfsroot mount, the one associated with the
interface that will be used to mount the rootfs (and never a self-ip proxy
arp route).  Made up of the following related changes...

Set ifctx->gotrootpath=1 only when the root path came from the dhcp/bootp
server (and not when it came from a fallback method such as the ROOTDEVNAME
option).  This makes the code in bootpc_init() choose the first interface
that provided a rootpath name.  Previously it was choosing the first
interface that got an IP address, which could be on a different and
potentially unreachable subnet than the server providing the rootfs.

If the rootpath name actually does come from a fallback source, then the
code continues to use the first interface in the list that got configured.
Note that this wasn't directly reported in the PR cited below, but was
discovered while working on that PR.

Switch bootpc_adjust_interface() from returning int to void.  Its one caller
doesn't check for errors, and all the errors that can happen result in it
calling panic anyway, except for one that's really more of a warning (and
is going to disappear on an upcoming commit anyway).

Stop setting the default route to the IP of the interface itself when the
bootp/dhcp server doesn't provide a router option.  Doing so prevents
setting defaultrouter=<ip> in rc.conf (it fails because there's already
a bogus default route installed by bootpc_init).

When an admin wants to use this style of proxy arp on an interface, the
proper mechanism is to set the "use-lease-addr-for-default-route" flag
in the dhcp server config.  That causes the lease address to be delivered
in the routers option, and the normal handling of the routers option will
then install the self-ip as the default route.

Do not try to install a default route for each interface found, because
only the first one will actually work and all the others just result in
errors (which would get printed but otherwise ignored).

Instead, wait until we make a choice of which interface will be used to
mount the rootfs, and install the default route associated with it (if any).
After doing the md_mount() call to obtain the needed info, remove the
default route again, and transcribe the route info into the nfs_diskless
structure.  If the system eventually chooses to mount the nfs rootfs, the
default route will be installed again when the nfs_diskless code
re-initializes the interface.

PR: 187094

Details

Provenance
ianAuthored on
Parents
rS301056: MFC r297147, r297148, r297149, r297150, r297151:
Branches
Unknown
Tags
Unknown