File kdump-pass-IPv6-address-prefix-separately.patch of Package kdump.21349

From: Michal Koutny <mkoutny@suse.com>
Date: Mon, 26 Mar 2018 20:34:19 +0200
Subject: IPv6 setup: pass address prefix in separate dracut arg
References: bsc#1062026
Upstream: merged
Git-commit: c6fb83e6ebc310c615c145962f71b3f6f4819e88

Dracut distinguishes IPv6 addresses by bracket enclosing [1] so pass an
IPv6 address as such. The address prefix is passed separately through
netmask dracut argument (that is a slight misnomer as dracut just
propagates that value to iproute2 tools [2] which interpret it as
decimal number of prefix bits).

[1] https://github.com/dracutdevs/dracut/blob/031e2f7bb8aea447cd87e455b184106acb4aa435/modules.d/40network/net-lib.sh#L441
[2] https://github.com/dracutdevs/dracut/blob/031e2f7bb8aea447cd87e455b184106acb4aa435/modules.d/40network/ifup.sh#L130
---
 init/setup-kdump.functions |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -586,7 +586,7 @@ function kdump_ip6_config()						   # {{
 {
     local iface="$1"
     local bootif="$2"
-    local ipaddr peeraddr gwaddr hostname
+    local ipaddr peeraddr gwaddr netmask hostname
     local family cidr rest prefix
 
     hostname=$(hostname)
@@ -598,7 +598,8 @@ function kdump_ip6_config()						   # {{
 
 	ipaddr="${cidr%/*}"
 	prefix="${cidr:${#ipaddr}}"
-	ipaddr="[$ipaddr]$prefix"
+	netmask="${prefix:1}"
+	ipaddr="[$ipaddr]"
 	set -- $rest
 
         if [ "$1" == "peer" ] ; then
@@ -609,7 +610,7 @@ function kdump_ip6_config()						   # {{
 	    peeraddr=
         fi
 
-	echo "ip=$ipaddr:$peeraddr:$gwaddr::$hostname:$bootif:none"
+	echo "ip=$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$bootif:none"
     done < <(ip -6 address show dev "$iface" permanent scope global)
 }									   # }}}
 
openSUSE Build Service is sponsored by