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>
This commit is contained in:
parent
f6dc3d5ae9
commit
e5eb062f05
@ -113,31 +113,35 @@ _add_address()
|
|||||||
|
|
||||||
local address netmask broadcast peer anycast label scope
|
local address netmask broadcast peer anycast label scope
|
||||||
local valid_lft preferred_lft home nodad
|
local valid_lft preferred_lft home nodad
|
||||||
|
local confflaglist
|
||||||
address="$1" ; shift
|
address="$1" ; shift
|
||||||
while [ -n "$*" ]; do
|
while [ -n "$*" ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
netmask)
|
netmask)
|
||||||
netmask="/$(_netmask2cidr "$2")" ; shift ; shift ;;
|
netmask="/$(_netmask2cidr "$2")" ; shift ; shift ;;
|
||||||
broadcast|brd)
|
broadcast|brd)
|
||||||
broadcast="broadcast $2" ; shift ; shift ;;
|
broadcast="$2" ; shift ; shift ;;
|
||||||
pointopoint|pointtopoint|peer)
|
pointopoint|pointtopoint|peer)
|
||||||
peer="peer $2" ; shift ; shift ;;
|
peer="$2" ; shift ; shift ;;
|
||||||
anycast|label|scope|valid_lft|preferred_lft)
|
anycast|label|scope|valid_lft|preferred_lft)
|
||||||
eval "$1=$2" ; shift ; shift ;;
|
eval "$1=$2" ; shift ; shift ;;
|
||||||
home|nodad)
|
home|nodad)
|
||||||
eval "$1=$1" ; shift ;;
|
# FIXME: If we need to reorder these, this will take more code
|
||||||
|
confflaglist="${confflaglist} $1" ; shift ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Always scope lo addresses as host unless specified otherwise
|
# Always scope lo addresses as host unless specified otherwise
|
||||||
if [ "${IFACE}" = "lo" ]; then
|
if [ "${IFACE}" = "lo" ]; then
|
||||||
[ -z "$scope" ] && scope="scope host"
|
[ -z "$scope" ] && scope="host"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# figure out the broadcast address if it is not specified
|
# 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 "$@"
|
veinfo ip addr add "$@"
|
||||||
ip addr add "$@"
|
ip addr add "$@"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user