diff options
author | Robert Peichaer <rpe@cvs.openbsd.org> | 2017-12-22 19:41:50 +0000 |
---|---|---|
committer | Robert Peichaer <rpe@cvs.openbsd.org> | 2017-12-22 19:41:50 +0000 |
commit | f6919dcfd3637b4ade40803d224c9c760f673749 (patch) | |
tree | 62c92f26ce0c595b946cdf508fd1b5cd71ff76d9 /distrib/miniroot | |
parent | a6c89b1492d8f2d99d4746f02aebfcf13d570a61 (diff) |
Cope with the fact, that the DHCLIENT route label is gone which
helped to find out if the default route was configured by dhclient.
Check if the interface connected to the default route is in the
dhcp interface group which accomplishes the same functionality.
With feedback from and OK krw@
Diffstat (limited to 'distrib/miniroot')
-rw-r--r-- | distrib/miniroot/install.sub | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 5ee958f1840..cd52d8d6850 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: install.sub,v 1.1051 2017/12/21 19:22:14 rpe Exp $ +# $OpenBSD: install.sub,v 1.1052 2017/12/22 19:41:49 rpe Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org> @@ -1298,19 +1298,19 @@ configure_ifs() { # Set up IPv4 default route. v4_defroute() { - local _dr + local _dr _dr_if # Only configure a default route if an IPv4 address was configured. [[ -n $(ifconfig | sed -n '/[ ]inet .* broadcast /p') ]] || return # Check routing table to see if a default route ($1) already exists - # and if it is handled by dhclient ($2). - set -- $(route -nv show -inet | - { set -- $(grep '^default '); print $2 $9; }) - [[ -n $1 ]] && _dr=$1 + # and what interface it is connected to ($2). + set -- $(route -n show -inet | + sed -En 's/^default +([0-9.]+) .* ([a-z0-9]+) *$/\1 \2/p') + [[ -n $1 ]] && _dr=$1 _dr_if=$2 # Don't ask if a default route exits and is handled by dhclient. - [[ -n $_dr && $2 == \"DHCLIENT ]] && return + [[ -n $_dr ]] && isin "$_dr_if" $(get_ifs dhcp) && return while :; do ask_until "Default IPv4 route? (IPv4 address or none)" "$_dr" |