net/iproute2: IPv6 cannot be used with broadcast

Broadcast and IPv6 should not be used together. Do not try to set the
keyword for auto-generation of the broadcast address. If the user passes
a broadcast address for IPv6, throw an error.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
This commit is contained in:
Robin H. Johnson 2011-12-21 08:03:38 +00:00
parent e5eb062f05
commit 8bb4b759eb

View File

@ -137,8 +137,14 @@ _add_address()
fi
# figure out the broadcast address if it is not specified
# This must NOT be set for IPv6 addresses
if [ "${address/:}" = "${address}" ]; then
# FIXME: I'm not sure if this should be set if we are passing a peer arg
[ -z "$broadcast" ] && broadcast="+"
elif [ -n "$broadcast" ]; then
eerror "Broadcast keywords are not valid with IPv6 addresses"
return 1
fi
# 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