From 50b08e7b85085169459dd971b711f712744598ef Mon Sep 17 00:00:00 2001 From: Will Woods Date: Mon, 11 Jun 2012 13:46:21 -0400 Subject: [PATCH] fix ifup for static ipv6 "brd +" is not valid for ipv6. This causes the 'ip addr add' command to fail with the message "Broadcast can be set only for IPv4 addresses". So: don't use "brd +" for ipv6. --- modules.d/40network/ifup.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh index 35ae3c6..ae434a8 100755 --- a/modules.d/40network/ifup.sh +++ b/modules.d/40network/ifup.sh @@ -105,10 +105,13 @@ do_static() { wait_for_if_up $netif [ -n "$macaddr" ] && ip link set address $macaddr [ -n "$mtu" ] && ip link set mtu $mtu - # do not flush addr for ipv6 - strstr $ip '*:*:*' || \ + if strstr $ip '*:*:*'; then + # note no ip addr flush for ipv6 + ip addr add $ip/$mask dev $netif + else ip addr flush dev $netif - ip addr add $ip/$mask brd + dev $netif + ip addr add $ip/$mask brd + dev $netif + fi [ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw [ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname