[PATCH 1/2] fix ifup for static ipv6

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"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 f785968..245b450 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
-- 
1.7.10.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux