Accepting request 594067 from home:ptesarik:branches:Kernel:kdump

- kdump-pass-IPv6-address-prefix-separately.patch: IPv6 setup: pass
  address prefix in separate dracut arg (bsc#1062026).
- kdump-pass-all-IP-routes-to-kdump-environment.patch: IP setup:
  pass all routes to kdump environment (bsc#1062026).
- kdump-remove-IPv6-brackets-for-getaddrinfo.patch: Routable: do
  not pass bracketed IPv6 to getaddrinfo (bsc#1062026).
- kdump-skip-IPv4-if-no-address.patch: IP setup: don't bother with
  IPv4 if there are no addresses (bsc#1062026).

OBS-URL: https://build.opensuse.org/request/show/594067
OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kdump?expand=0&rev=161
This commit is contained in:
Petr Tesařík 2018-04-06 18:10:12 +00:00 committed by Git OBS Bridge
parent 62630aa7dd
commit adcc9c6f39
6 changed files with 218 additions and 0 deletions

View File

@ -0,0 +1,49 @@
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)
} # }}}

View File

@ -0,0 +1,56 @@
From: Michal Koutny <mkoutny@suse.com>
Date: Mon, 26 Mar 2018 20:40:40 +0200
Subject: IP setup: pass all routes to kdump environment
References: bsc#1062026
Upstream: merged
Git-commit: 7013c7f7e081b1691a6b30ba213c39a5ab38e5fe
In some network setups the kdump target may not be routable through the
default route. Thus pass all found routes.
---
init/setup-kdump.functions | 12 ++++++++++++
1 file changed, 12 insertions(+)
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -550,6 +550,7 @@ function kdump_ip_config() # {{{
local ipaddr peeraddr gwaddr netmask hostname
local family cidr rest
local prefix
+ local routes r
while read family cidr rest
do
[ "$family" = "inet" ] || continue
@@ -572,6 +573,11 @@ function kdump_ip_config() # {{{
hostname=$(hostname)
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
} # }}}
#
@@ -588,6 +594,7 @@ function kdump_ip6_config() # {{
local bootif="$2"
local ipaddr peeraddr gwaddr netmask hostname
local family cidr rest prefix
+ local routes r
hostname=$(hostname)
gwaddr=$(ip -6 route show ::/0 | sed -n 's/.* via \([^ ]*\).*/[\1]/p')
@@ -612,6 +619,11 @@ function kdump_ip6_config() # {{
echo "ip=$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$bootif:none"
done < <(ip -6 address show dev "$iface" permanent scope global)
+
+ routes=$(ip -6 route show dev "$iface" | sed -n 's/\([0-9a-fA-F:].*\) via \([^ ]*\).*/[\1]:[\2]/p')
+ for r in $routes ; do
+ echo "rd.route=$r:$bootif"
+ done
} # }}}
#

View File

@ -0,0 +1,51 @@
From: Michal Koutny <mkoutny@suse.com>
Date: Mon, 26 Mar 2018 20:43:40 +0200
Subject: Routable: do not pass bracketed IPv6 to getaddrinfo
References: bsc#1062026
Upstream: merged
Git-commit: ba186e82f9ea9b724fd48a1f119afb73b0063c12
It would be nicer to strip the brackets in URLParser and work with a
plain IPv6 as hostname. However, since we pass that value to callees
that expect bracketed form (e.g. NFS mount) we invert the convention and
keep the bracketed version and use bare IPv6 to feed getaddrinfo only.
---
kdumptool/routable.cc | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
--- a/kdumptool/routable.cc
+++ b/kdumptool/routable.cc
@@ -33,6 +33,7 @@
#include "global.h"
#include "routable.h"
+#include "stringutil.h"
#include "debug.h"
//{{{ NetLink ------------------------------------------------------------------
@@ -459,8 +460,14 @@ bool Routable::resolve(void)
{
struct addrinfo hints;
int res;
+ KString raw_host(m_host);
- Debug::debug()->trace("resolve(%s)", m_host.c_str());
+ // remove IPv6 URL bracketing for getaddrinfo
+ if (raw_host.size() > 0 &&
+ raw_host[0] == '[' && raw_host[raw_host.size()-1] == ']')
+ raw_host = raw_host.substr(1, raw_host.size()-2);
+
+ Debug::debug()->trace("resolve(%s)", raw_host.c_str());
if (m_ai)
freeaddrinfo(m_ai);
@@ -469,7 +476,7 @@ bool Routable::resolve(void)
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_RAW;
do {
- res = getaddrinfo(m_host.c_str(), NULL, &hints, &m_ai);
+ res = getaddrinfo(raw_host.c_str(), NULL, &hints, &m_ai);
} while (res == EAI_AGAIN);
if (res == 0)

View File

@ -0,0 +1,42 @@
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
} # }}}
#

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Fri Apr 6 16:48:57 UTC 2018 - ptesarik@suse.com
- kdump-pass-IPv6-address-prefix-separately.patch: IPv6 setup: pass
address prefix in separate dracut arg (bsc#1062026).
- kdump-pass-all-IP-routes-to-kdump-environment.patch: IP setup:
pass all routes to kdump environment (bsc#1062026).
- kdump-remove-IPv6-brackets-for-getaddrinfo.patch: Routable: do
not pass bracketed IPv6 to getaddrinfo (bsc#1062026).
- kdump-skip-IPv4-if-no-address.patch: IP setup: don't bother with
IPv4 if there are no addresses (bsc#1062026).
-------------------------------------------------------------------
Fri Apr 6 12:49:54 UTC 2018 - ptesarik@suse.com

View File

@ -92,6 +92,10 @@ Patch42: %{name}-nokaslr.patch
Patch43: %{name}-no-crashkernel-in-Xen-PV-DomU.patch
Patch44: %{name}-always-copy-timezone.patch
Patch45: %{name}-use-bus-id-to-identify-qeth-devices.patch
Patch46: %{name}-pass-IPv6-address-prefix-separately.patch
Patch47: %{name}-pass-all-IP-routes-to-kdump-environment.patch
Patch48: %{name}-remove-IPv6-brackets-for-getaddrinfo.patch
Patch49: %{name}-skip-IPv4-if-no-address.patch
BuildRequires: asciidoc
BuildRequires: cmake
BuildRequires: gcc-c++
@ -199,6 +203,10 @@ cp %{S:1} tests/data/
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%build
export CFLAGS="%{optflags}"