Use a more robust, grep-free command to get the interface of the current

default route.

Submitted by:	Rostislav Krasny <rosti dot bsd at gmail dot com>
This commit is contained in:
Brooks Davis 2005-08-26 01:07:51 +00:00
parent 7e82455ea8
commit 6ae27cb6ce
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=149480

View File

@ -20,7 +20,6 @@
#
NETSTAT=/usr/bin/netstat
GREP=/usr/bin/grep
AWK=/usr/bin/awk
HOSTNAME=/bin/hostname
@ -198,7 +197,7 @@ if [ -f /etc/dhclient-enter-hooks ]; then
fi
if [ -x $NETSTAT ]; then
if_defaultroute=`$NETSTAT -rn | $GREP "^default" | $AWK '{print $6}'`
if_defaultroute=`$NETSTAT -rnf inet | $AWK '{if ($1=="default") printf $6}'`
else
if_defaultroute="x"
fi