]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix ifup for static ipv6
authorWill Woods <wwoods@redhat.com>
Mon, 11 Jun 2012 17:46:21 +0000 (13:46 -0400)
committerHarald Hoyer <harald@redhat.com>
Tue, 12 Jun 2012 17:24:46 +0000 (19:24 +0200)
"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

index 35ae3c60bcd6e3574c72fa8be4310de361d8f2c6..ae434a8af53456a4f90b68a488b9180a728c0919 100755 (executable)
@@ -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