[PATCH 1/3] fix ifup for static ipv6 address

[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 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
index 2111b41..e2c6023 100755
--- a/modules.d/40network/ifup.sh
+++ b/modules.d/40network/ifup.sh
@@ -107,10 +107,13 @@ do_static() {
         echo wait_for_if_up $netif
         [ -n "$macaddr" ] && echo ip link set address $macaddr
         [ -n "$mtu" ] && echo ip link set mtu $mtu
-        # do not flush addr for ipv6
-        strstr $ip '*:*:*' || \
+        if strstr $ip '*:*:*'; then
+            # do not flush addr for ipv6
+            echo ip addr add $ip/$mask dev $netif
+        else
             echo ip addr flush dev $netif
-        echo ip addr add $ip/$mask brd + dev $netif
+            echo ip addr add $ip/$mask brd + dev $netif
+        fi
     } > /tmp/net.$netif.up
 
     [ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
-- 
1.7.7.6

--
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