File kdump-skip-IPv4-if-no-address.patch of Package kdump.21349

From: Michal Koutny <mkoutny@suse.com>
Date: Mon, 26 Mar 2018 20:51:19 +0200
Subject: IP setup: don't bother with IPv4 if there are no addresses
References: bsc#1062026
Upstream: merged
Git-commit: 7adc9d04d1eedd4f86c3d9a895ec725f553e3599

When an interface which is IPv6 only is used to store dump, kdump will
attempt to create IPv4 configuration option which dracut cannot parse.

> [    3.098548] dracut: FATAL: For argument 'ip=::10.100.33.254::germ184:eth1:none'\nValue 'none' without static configuration does not make sense
> [    3.115833] dracut: Refusing to continue

Use the same approach as with IPv6, i.e. configure it only when any
IPv4 addresses are present.

---
 init/setup-kdump.functions |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -572,12 +572,14 @@ function kdump_ip_config()						   # {{{
     gwaddr=$(ip route show 0/0 | sed -n 's/.* via \([^ ]*\).*/\1/p')
     hostname=$(hostname)
 
-    echo "ip=$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$bootif:none"
+    if [ -n "$ipaddr" ] ; then
+        echo "ip=$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$bootif:none"
 
-    routes=$(ip route show dev "$iface" | sed -n 's/\([0-9].*\) via \([^ ]*\).*/\1:\2/p')
-    for r in $routes ; do
-        echo "rd.route=$r:$bootif"
-    done
+        routes=$(ip route show dev "$iface" | sed -n 's/\([0-9].*\) via \([^ ]*\).*/\1:\2/p')
+        for r in $routes ; do
+            echo "rd.route=$r:$bootif"
+        done
+    fi 
 }									   # }}}
 
 #
openSUSE Build Service is sponsored by