View | Details | Raw Unified | Return to bug 174225 | Differences between
and this patch

Collapse All | Expand All

(-)etc/network.subr (+52 lines)
Lines 438-443 Link Here
438
		;;
438
		;;
439
	esac
439
	esac
440
440
441
	# Test for $ipv6_addrs_IF. If it exists then the
442
	# interface should be configured for IPv6
443
	_tmpargs=$(get_if_var $_if ipv6_addrs_IF)
444
	if [ -n "${_tmpargs}" ]; then
445
		return 0
446
	fi
447
441
	case "${ipv6_network_interfaces}" in
448
	case "${ipv6_network_interfaces}" in
442
	$_if|"$_if "*|*" $_if"|*" $_if "*|[Aa][Uu][Tt][Oo])
449
	$_if|"$_if "*|*" $_if"|*" $_if "*|[Aa][Uu][Tt][Oo])
443
		# True if $ifconfig_IF_ipv6 is defined.
450
		# True if $ifconfig_IF_ipv6 is defined.
Lines 562-567 Link Here
562
	fi
569
	fi
563
570
564
	ifalias_up ${_if} inet6 && _ret=0
571
	ifalias_up ${_if} inet6 && _ret=0
572
	ipv6_addrs_common ${_if} alias && _ret=0
565
	ipv6_prefix_hostid_addr_common ${_if} alias && _ret=0
573
	ipv6_prefix_hostid_addr_common ${_if} alias && _ret=0
566
	ipv6_accept_rtadv_up ${_if} && _ret=0
574
	ipv6_accept_rtadv_up ${_if} && _ret=0
567
575
Lines 619-624 Link Here
619
627
620
	ipv6_accept_rtadv_down ${_if} && _ret=0
628
	ipv6_accept_rtadv_down ${_if} && _ret=0
621
	ipv6_prefix_hostid_addr_common ${_if} -alias && _ret=0
629
	ipv6_prefix_hostid_addr_common ${_if} -alias && _ret=0
630
	ipv6_addrs_common ${_if} -alias && _ret=0
622
	ifalias_down ${_if} inet6 && _ret=0
631
	ifalias_down ${_if} inet6 && _ret=0
623
632
624
	inetList="`ifconfig ${_if} | grep 'inet6 ' | tr "\n" "$_ifs"`"
633
	inetList="`ifconfig ${_if} | grep 'inet6 ' | tr "\n" "$_ifs"`"
Lines 684-689 Link Here
684
	return $_ret
693
	return $_ret
685
}
694
}
686
695
696
697
ipv6_addrs_common()
698
{
699
	local _ret _if _action _ip6prefix _ip6prefixes
700
	local _ip6addr _prefixlen
701
	local _range _ip6net _ip6low _ip6high
702
	_ret=1
703
	_if=$1
704
	_action=$2
705
706
# get the prefixes from ipv6_addrs_IF variable
707
	_ip6prefixes=`get_if_var $_if ipv6_addrs_IF`
708
	for _ip6prefix in ${_ip6prefixes}; do
709
		_ip6addr=${_ip6prefix%%/*}
710
		_prefixlen=${_ip6prefix##*/}
711
		_range=${_ip6addr##*:}
712
		_ip6net=${_ip6addr%:*}
713
		_ip6low=${_range%-*}
714
		_ip6high=${_range#*-}
715
716
# If deleting an alias, set _prefixlen to null string.
717
		if [ "${_action}" = "-alias" ]; then
718
			_prefixlen=""
719
		else
720
			_prefixlen="prefixlen $_prefixlen"
721
		fi
722
723
		_ip6high=$(("0x${_ip6high}"))
724
		_ip6count=$(("0x${_ip6low}"))
725
		while [ "${_ip6count}" -le "${_ip6high}"  ]; do
726
            # Re-uses the _ip6addr variable from above
727
			_ip6addr=$(printf "%x" "${_ip6count}")
728
			eval "ifconfig ${_if} inet6 ${_ip6net}:${_ip6addr} ${_prefixlen} ${_action}"
729
			_ip6count=$((${_ip6count}+1))
730
			_ret=0
731
		done
732
	done
733
734
	return $_ret
735
}
736
737
738
687
# ifalias_up if af
739
# ifalias_up if af
688
#	Configure aliases for network interface $if.
740
#	Configure aliases for network interface $if.
689
#	It returns 0 if at least one alias was configured or
741
#	It returns 0 if at least one alias was configured or

Return to bug 174225