Alan Somers <asom...@freebsd.org> wrote
  in <caotmx2hjmguwunyaz77j09edxrw_bcguy8fbn63sdydsoui...@mail.gmail.com>:
as> With this revision, I am unable to down an ipv4 interface using
as> "/etc/rc.d/netif stop em1".  When I try, ipv4_down cannot find the address
as> to delete, because "$_inet" begins with a tab character and the therefore
as> it matches the "*)" rule in the case statement.  Presumably "$_inet"
as> doesn't always begin with a tab, so this patch will match with or without
as> the tab.  Does it look good to you?
as>
as> --- /usr/home/alans/freebsd/head/etc/network.subr       2013-08-20
as> 19:33:30.6712
as> 28832 +0000
as> +++ /etc/network.subr   2013-08-22 15:49:53.000000000 +0000
as> @@ -661,16 +668,16 @@
as>         for _inet in $inetList ; do
as>                 # get rid of extraneous line
as>                 case $_inet in
as> -               "")             break ;;
as> -               inet\ *)        ;;
as> -               *)              continue ;;
as> +               "")                             break ;;
as> +               \       inet\ *|inet\ *)        ;;
as> +               *)                              continue ;;
as>                 esac
as>                 [ -z "$_inet" ] && break

 Sorry for the delay getting back to you.  Can you try the attached
 patch?  It includes some other fixes but I think adding \t to tr(1)
 should be enough to solve the problem.

-- Hiroki
Index: etc/network.subr
===================================================================
--- etc/network.subr	(revision 254465)
+++ etc/network.subr	(working copy)
@@ -654,7 +654,7 @@

 	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"
@@ -661,11 +661,9 @@
 	for _inet in $inetList ; do
 		# get rid of extraneous line
 		case $_inet in
-		"")		break ;;
 		inet\ *)	;;
 		*)		continue ;;
 		esac
-		[ -z "$_inet" ] && break

 		_inet=`expr "$_inet" : '.*\(inet \([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}\).*'`

@@ -696,13 +694,16 @@
 	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:]*\)\).*'`

Attachment: pgp0KvtfWeUft.pgp
Description: PGP signature

Reply via email to