diff options
| author | Robin H. Johnson <robbat2@gentoo.org> | 2011-12-21 07:44:53 +0000 | 
|---|---|---|
| committer | Robin H. Johnson <robbat2@gentoo.org> | 2011-12-21 08:02:53 +0000 | 
| commit | e5eb062f050d96a70f72ee78f431f774c98b24e2 (patch) | |
| tree | fd3bef3a56b8ac707002aa4730be99e97e720630 /net | |
| parent | f6dc3d5ae91ff6a660cf71a92d4a3a120b1180a4 (diff) | |
| download | openrc-e5eb062f050d96a70f72ee78f431f774c98b24e2.tar.xz | |
net/iproute2: iproute2 flag handling
Several of the optional flags were not being handled correctly, they
were being passed as values only, without the keyword before them.
Affected keywords: anycast, label, scope, valid_lft, preferred_lft
Also change the handling of keywords to a common setup now, making
broadcast and peer strings the same as the above keywords.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'net')
| -rw-r--r-- | net/iproute2.sh | 16 | 
1 files changed, 10 insertions, 6 deletions
| diff --git a/net/iproute2.sh b/net/iproute2.sh index c8f670ca..c3bb9c8c 100644 --- a/net/iproute2.sh +++ b/net/iproute2.sh @@ -113,31 +113,35 @@ _add_address()  	local address netmask broadcast peer anycast label scope  	local valid_lft preferred_lft home nodad +	local confflaglist  	address="$1" ; shift  	while [ -n "$*" ]; do  		case "$1" in  			netmask)  				netmask="/$(_netmask2cidr "$2")" ; shift ; shift ;;  			broadcast|brd) -				broadcast="broadcast $2" ; shift ; shift ;; +				broadcast="$2" ; shift ; shift ;;  			pointopoint|pointtopoint|peer) -				peer="peer $2" ; shift ; shift ;; +				peer="$2" ; shift ; shift ;;  			anycast|label|scope|valid_lft|preferred_lft)  				eval "$1=$2" ; shift ; shift ;;  			home|nodad) -				eval "$1=$1" ; shift ;; +				# FIXME: If we need to reorder these, this will take more code +				confflaglist="${confflaglist} $1" ; shift ;;  		esac  	done  	# Always scope lo addresses as host unless specified otherwise  	if [ "${IFACE}" = "lo" ]; then -		[ -z "$scope" ] && scope="scope host" +		[ -z "$scope" ] && scope="host"  	fi  	# figure out the broadcast address if it is not specified -	[ -z "$broadcast" ] && broadcast="broadcast +" +	# FIXME: I'm not sure if this should be set if we are passing a peer arg +	[ -z "$broadcast" ] && broadcast="+" -	set -- "${address}${netmask}" $peer $broadcast $anycast $label $scope dev "${IFACE}" $valid_lft $preferred_lft $home $nodad +	# This must appear on a single line, continuations cannot be used +	set -- "${address}${netmask}" ${peer:+peer} ${peer} ${broadcast:+broadcast} ${broadcast} ${anycast:+anycast} ${anycast} ${label:+label} ${label} ${scope:+scope} ${scope} dev "${IFACE}" ${valid_lft:+valid_lft} $valid_lft ${preferred_lft:+preferred_lft} $preferred_lft $confflaglist  	veinfo ip addr add "$@"  	ip addr add "$@"  } | 
