File 0191-static_network_setup_return_zero.patch of Package dracut.15235

From: Thomas Blume <thomas.blume@suse.com>
Subject: Unset gateway variable if emtpy

If the gateway variable is empty (ie '::' for IPv6 or '0.0.0.0' for IPv4)
it should be unset.

References: bsc#919179

Signed-off-by: Thomas Blume <thomas.blume@suse.com>

Index: dracut-044/modules.d/40network/ifup.sh
===================================================================
--- dracut-044.orig/modules.d/40network/ifup.sh	2016-04-11 17:41:48.628218989 +0200
+++ dracut-044/modules.d/40network/ifup.sh	2016-04-11 17:43:45.250819391 +0200
@@ -327,6 +327,7 @@ if strglobin $ip '*:*:*'; then
         # note no ip addr flush for ipv6
         ip addr add $ip/$prefix ${srv:+peer $srv} dev $netif
         wait_for_ipv6_dad $netif
+        [ "$gw" = "::" ] && gw=""
     else
         if ! arping -f -q -D -c 2 -I $netif $ip; then
             warn "Duplicate address detected for $ip for interface $netif."
@@ -335,6 +336,7 @@ if strglobin $ip '*:*:*'; then
         # Assume /24 prefix for IPv4
         [ -z "$prefix" ] && prefix=24
         ip addr add $ip/$prefix ${srv:+peer $srv} brd + dev $netif
+        [ "$gw" = "0.0.0.0" ] && gw=""
     fi
 
     [ -n "$gw" ] && echo ip route replace default via $gw dev $netif > /tmp/net.$netif.gw
@@ -352,6 +354,9 @@ if strglobin $ip '*:*:*'; then
     done
 
     [ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
+
+    [ $? -ne 0 ] && info "Static network setup returned $?"
+    return 0
 }
 
 # loopback is always handled the same way
openSUSE Build Service is sponsored by