diff options
| author | Andreas Moran <andreas.moran@vyatta.com> | 2013-06-19 13:31:19 -0700 | 
|---|---|---|
| committer | Andreas Moran <andreas.moran@vyatta.com> | 2013-06-19 13:31:19 -0700 | 
| commit | 40ec1f7425dbdb2dec53f00aced61c59ff8bbdf4 (patch) | |
| tree | eb289dec890fdb8466c66f6443ecde1f7f7d8dd0 /scripts | |
| parent | 68963a887d3878cd1f56540809f871d762eabf41 (diff) | |
| download | vyatta-cfg-system-40ec1f7425dbdb2dec53f00aced61c59ff8bbdf4.tar.gz vyatta-cfg-system-40ec1f7425dbdb2dec53f00aced61c59ff8bbdf4.zip | |
Fix the problems encountered when the system has IPv6 addresses configured and then IPv6 is disabled (system/ipv6/disable = 1).
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/vyatta-address | 23 | 
1 files changed, 21 insertions, 2 deletions
| diff --git a/scripts/vyatta-address b/scripts/vyatta-address index a0c374e6..f14eff9b 100755 --- a/scripts/vyatta-address +++ b/scripts/vyatta-address @@ -18,7 +18,16 @@ case $1 in              exec /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --start -ifname "$2"  	elif [[ "$3" =~ ":" ]]  	then # Ipv6 address -		if ! ip -6 addr list dev $2 | grep -q $3; then +		# If IPv6 is disabled, the address is in the configuration +		# and can not be added to the system. By not running the +		# ip command and failing the configuration for the interface +		# is preserved. +		disable_ipv6=`cat /proc/sys/net/ipv6/conf/$2/disable_ipv6` +		clpsIp=`echo "$3" | sed -e 's/^\(.*\):0:[:0]*:0:\(.*\)$/\1::\2/'` +		ip -6 addr list dev "$2" | grep -q "$clpsIp" +		inList=$? +		if [ "$disable_ipv6" = "0" -a "$inList" != "0" ] +		then  			exec ip -6 addr add "$3" dev "$2"  		fi  	else @@ -39,7 +48,17 @@ case $1 in  	    exec /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --ifname "$2"  	elif [[ "$3" =~ ":" ]]          then -	    exec ip -6 addr del "$3" dev "$2" +		# If IPv6 is disabled the address is in the configuration +		# and not in the system. By not running the ip command and +		# failing the address is deleted from the configuration. +		disable_ipv6=`cat /proc/sys/net/ipv6/conf/$2/disable_ipv6` +		clpsIp=`echo "$3" | sed -e 's/^\(.*\):0:[:0]*:0:\(.*\)$/\1::\2/'` +		ip -6 addr list dev "$2" | grep -q "$clpsIp" +		inList=$? +		if [ "$disable_ipv6" = "0" -a "$inList" != "0" ] +		then +			exec ip -6 addr del "$3" dev "$2" +		fi  	else  	    exec ip addr del "$3" dev "$2"  	fi ;; | 
