Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Jul 2019 13:20:32 +0000 (UTC)
From:      Eugene Grosbein <eugen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r349725 - stable/12/libexec/rc
Message-ID:  <201907041320.x64DKWhu026294@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eugen
Date: Thu Jul  4 13:20:32 2019
New Revision: 349725
URL: https://svnweb.freebsd.org/changeset/base/349725

Log:
  MFC r345970: network.subr: improve configuration of cloned gif(4) interfaces
  
  ifconfig(8) syntax allows to specify only single address_family,
  so we need additional invocation of ifconfig to support configuration
  of cloned gif interface that may use different address families
  for its internal and external addresses.
  
  Also, ifconfig(8) does not allow to omit "inet6" keyword for address family
  specifying IPv6 addresses as outer addresses of the interface.
  
  Also, address_family is not "parameter" and it has to go before parameters
  including "tunnel" keyword, so "ifconfig gif0 tunnel inet6 $oip1 $oip2" would be
  wrong syntax and only "ifconfig gif0 inet6 tunnel $oip1 $oip2" is right.
  
  With this change, the following works:
  
  gifconfig_gif0="inet6 2a00::1 2a01::1"
  ifconfig_gif0="inet 10.0.0.1 10.0.0.2 netmask 255.255.255.252"

Modified:
  stable/12/libexec/rc/network.subr
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/libexec/rc/network.subr
==============================================================================
--- stable/12/libexec/rc/network.subr	Thu Jul  4 12:40:38 2019	(r349724)
+++ stable/12/libexec/rc/network.subr	Thu Jul  4 13:20:32 2019	(r349725)
@@ -1323,7 +1323,7 @@ wlan_down()
 #
 clone_up()
 {
-	local _list ifn ifopt _iflist _n tmpargs
+	local _list ifn ifopt _iflist _inet6 _n tmpargs
 	_list=
 	_iflist=$*
 
@@ -1389,9 +1389,21 @@ clone_up()
 		esac
 		if [ $? -eq 0 ]; then
 			_list="$_list $ifn"
+			tmpargs=$(get_if_var $ifn gifconfig_IF)
+			_inet6=''
+			case "$tmpargs" in
+			'')
+			;;
+			inet6[[:space:]]*)
+				tmpargs=${tmpargs#inet6}
+				_inet6=inet6
+				# FALLTHROUGH
+			;&
+			*)
+				${IFCONFIG_CMD} $ifn $_inet6 tunnel $tmpargs
+			;;
+			esac
 		fi
-		tmpargs=$(get_if_var $ifn gifconfig_IF)
-		eval ifconfig_${ifn}=\"\$ifconfig_${ifn} tunnel \$tmpargs\"
 	done
 	if [ -n "${_list# }" ]; then
 		echo "Created clone interfaces: ${_list# }."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907041320.x64DKWhu026294>