bsdinstall netconfig_ipv4: Fix resolv.conf rebuild

After an installation restart (for error or choice) dhclient does not
rebuild resolv.conf so `dialog --mixedform' of "Resolver Configuration"
in bsdinstall/scripts/netconfig draws empty forms. It causes a bad UX,
to see PR262262. Fixed resetting the interface before to run dhclient.

PR:			262262
Reviewed by:		bapt
Differential Revision:	https://reviews.freebsd.org/D35094
This commit is contained in:
Alfonso S. Siciliano 2022-04-30 17:25:57 +02:00
parent 11f49259c8
commit 1ad9134e11
No known key found for this signature in database
GPG Key ID: 3F9EEFACFD371E37

View File

@ -49,6 +49,9 @@ esac
dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --yesno 'Would you like to use DHCP to configure this interface?' 0 0
if [ $? -eq $DIALOG_OK ]; then
if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
# XXX: get interface down otherwise after installation restart
# dhclient does not build a new resolv.conf (see PR262262).
ifconfig $INTERFACE down
ifconfig $INTERFACE up
dialog --backtitle 'FreeBSD Installer' --infobox "Acquiring DHCP lease..." 0 0
err=$( pkill -F /var/run/dhclient/dhclient.${INTERFACE}.pid; dhclient $INTERFACE 2>&1 )