aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2011-12-21 08:03:38 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2011-12-21 08:08:31 +0000
commit8bb4b759eb23004e8c6d5f9e267854624c70e354 (patch)
tree6b68ee8a6ff2405be3d4fe6fea3d6cefda104fb4
parente5eb062f050d96a70f72ee78f431f774c98b24e2 (diff)
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>
-rw-r--r--net/iproute2.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/net/iproute2.sh b/net/iproute2.sh
index c3bb9c8c..4c7fbdc5 100644
--- a/net/iproute2.sh
+++ b/net/iproute2.sh
@@ -137,8 +137,14 @@ _add_address()
fi
# figure out the broadcast address if it is not specified
- # FIXME: I'm not sure if this should be set if we are passing a peer arg
- [ -z "$broadcast" ] && broadcast="+"
+ # 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