diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2003-02-16 23:25:41 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2003-02-16 23:25:41 +0000 |
commit | fa6de5abea4db1f9b18f00912a991fcca48ad8d5 (patch) | |
tree | c18b6094fb6d131da46ce7dcae057b5390b466f1 | |
parent | c5389094369de507ed8c671e902ac0fecd86a2c6 (diff) |
Fix up some DNS verbiage to make it consistant.
Fix up default route selection by
a) Forcing user to explicitly chose 'dhcp' as a mechanism for
specifying a default route, rather than guessing based on one or more
interfaces being configured by dhcp.
b) If the user specified default route does not work, re-present the
existing default route rather than losing it.
c) Move default route selection to after nameserver activation so the
user can specify a hostname as the default route.
Change /etc/netstart so that /etc/mygate wins if a default route was
already specified (i.e. by dhcp).
ok deraadt@.
-rw-r--r-- | distrib/miniroot/install.sub | 31 | ||||
-rw-r--r-- | etc/netstart | 3 |
2 files changed, 17 insertions, 17 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 1ae0c4a81b6..90a024698bc 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.289 2003/02/15 20:36:18 krw Exp $ +# $OpenBSD: install.sub,v 1.290 2003/02/16 23:25:40 krw Exp $ # $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $ # # Copyright (c) 1997-2003 Todd Miller, Theo de Raadt, Ken Westerback @@ -1643,7 +1643,7 @@ get_fqdn() { } donetconfig() { - local _dn _ns + local _dn _ns _dr [[ -n $DIDNET ]] && return @@ -1672,32 +1672,31 @@ donetconfig() { ask "DNS domain name? (e.g. 'bar.com')" "${_dn:=$(get_fqdn)}" hostname "$(hostname -s).$resp" - # Get/Confirm the default route. - resp=$(route -n show | sed -ne '/^default */{s///; s/ .*//; p;}') - route delete default > /dev/null 2>&1 - while : ; do - ask "IP address of default route? (or 'none')" "${resp:=none}" - [[ $resp == none ]] && break - route add default $resp || { resp= ; continue; } - # Save default route if DHCP wasn't used. - [ -f /tmp/dhclient.conf ] || echo $resp > /tmp/mygate - break - done - # Get/Confirm nameservers, and construct appropriate resolv.conf. - ask "IP address of DNS nameserver? (or 'none')" "${_ns:=none}" + ask "DNS nameserver? (IP address or 'none')" "${_ns:=none}" if [[ $resp != none ]]; then echo "lookup file bind" > /tmp/resolv.conf for _ns in $resp; do echo "nameserver $_ns" >> /tmp/resolv.conf done - ask "Would you like to use the nameserver now?" y + ask "Use the nameserver now?" y case $resp in y*|Y*) cp /tmp/resolv.conf /tmp/resolv.conf.shadow ;; esac fi + # Get/Confirm the default route. + _dr=$(route -n show | sed -ne '/^default */{s///; s/ .*//; p;}') + route delete default > /dev/null 2>&1 + while : ; do + ask_until "Default route? (IP address, 'dhcp' or 'none')" "$_dr" + case $resp in + none|dhcp) break ;; + esac + route -n add -host default "$resp" && { echo "$resp" > /tmp/mygate ; break ; } + done + edit_tmp_file hosts manual_net_cfg } diff --git a/etc/netstart b/etc/netstart index 824ee8561a0..6ccb0f28337 100644 --- a/etc/netstart +++ b/etc/netstart @@ -1,6 +1,6 @@ #!/bin/sh - # -# $OpenBSD: netstart,v 1.85 2002/05/16 20:48:25 todd Exp $ +# $OpenBSD: netstart,v 1.86 2003/02/16 23:25:40 krw Exp $ # Returns true if $1 contains only alphanumerics isalphanumeric() { @@ -275,6 +275,7 @@ fi # /etc/mygate, if it exists, contains the name of my gateway host # that name must be in /etc/hosts. if [ -f /etc/mygate ]; then + route delete default > /dev/null 2>&1 route -n add -host default `cat /etc/mygate` fi |