kdump/kdump-remove-IPv6-brackets-for-getaddrinfo.patch
Petr Tesařík adcc9c6f39 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
2018-04-06 18:10:12 +00:00

52 lines
1.6 KiB
Diff

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)