diff options
author | hrs <hrs@FreeBSD.org> | 2013-09-17 20:22:24 +0000 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2013-09-17 20:22:24 +0000 |
commit | b688fb253785402e5be5cb6c14c88b272b6c2117 (patch) | |
tree | a3980da110053d666fd50214b96d64b7b6e973b9 /etc/network.subr | |
parent | 43b36ca99744a6f7b1d14397dbfb931feb1341a5 (diff) | |
download | FreeBSD-src-b688fb253785402e5be5cb6c14c88b272b6c2117.zip FreeBSD-src-b688fb253785402e5be5cb6c14c88b272b6c2117.tar.gz |
Fix parsing lines of ifconfig output which include \t in the case of
inet and inet6.
Approved by: re (delphij)
Diffstat (limited to 'etc/network.subr')
-rw-r--r-- | etc/network.subr | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/etc/network.subr b/etc/network.subr index 7dfb328..057fb71 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -654,18 +654,16 @@ ipv4_down() ifalias ${_if} inet -alias && _ret=0 - inetList="`${IFCONFIG_CMD} ${_if} | grep 'inet ' | tr "\n" "$_ifs"`" + inetList="`${IFCONFIG_CMD} ${_if} | grep 'inet ' | tr "\n\t" "$_ifs"`" oldifs="$IFS" IFS="$_ifs" for _inet in $inetList ; do # get rid of extraneous line case $_inet in - "") break ;; - \ inet\ *|inet\ *) ;; - *) continue ;; + inet\ *) ;; + *) continue ;; esac - [ -z "$_inet" ] && break _inet=`expr "$_inet" : '.*\(inet \([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}\).*'` @@ -696,13 +694,16 @@ ipv6_down() ipv6_prefix_hostid_addr_common ${_if} -alias && _ret=0 ifalias ${_if} inet6 -alias && _ret=0 - inetList="`${IFCONFIG_CMD} ${_if} | grep 'inet6 ' | tr "\n" "$_ifs"`" + inetList="`${IFCONFIG_CMD} ${_if} | grep 'inet6 ' | tr "\n\t" "$_ifs"`" oldifs="$IFS" IFS="$_ifs" for _inet6 in $inetList ; do # get rid of extraneous line - [ -z "$_inet6" ] && break + case $_inet in + inet6\ *) ;; + *) continue ;; + esac _inet6=`expr "$_inet6" : '.*\(inet6 \([0-9a-f:]*\)\).*'` |