diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2003-03-02 00:17:21 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2003-03-02 00:17:21 +0000 |
commit | 0d4ae03d6d21f5f02361f8d8c9ee858c7bf10a3f (patch) | |
tree | cca10476a4569ad0f8772f66661f366407b312ac /distrib/miniroot/install.sub | |
parent | 9a26fa74af4ce14f7cc9679e64ca878d4def7b67 (diff) |
Fix default route handling during installation to preserve active
default route even if 'none' or 'dhcp' is selected as the default
route for the installed system. Previously, specifying 'none' or
'dhcp' would delete the existing default route, making ftp installs
from non-local servers impossible.
This is done by only deleting the existing default route when a change
is attempted, and putting back the previous default route if the
change fails.
Problem noticed by drahn@.
Diffstat (limited to 'distrib/miniroot/install.sub')
-rw-r--r-- | distrib/miniroot/install.sub | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 90a024698bc..45ac3c52365 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.290 2003/02/16 23:25:40 krw Exp $ +# $OpenBSD: install.sub,v 1.291 2003/03/02 00:17:20 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 @@ -1688,13 +1688,15 @@ donetconfig() { # 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 delete default > /dev/null 2>&1 route -n add -host default "$resp" && { echo "$resp" > /tmp/mygate ; break ; } + # Put the old default route back. The new one did not work. + route -n add -host default $_dr > /dev/null 2>&2 done edit_tmp_file hosts |