From b4b652e06df8a8f51e705260d1f6e5ce9b614d1b57504d77badfa11e84cb086a Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Wed, 23 Sep 2020 21:58:30 +0000 Subject: [PATCH] - Add 0001-ip-add-error-reporting-when-RTM_GETNSID-failed.patch OBS-URL: https://build.opensuse.org/package/show/security:netfilter/iproute2?expand=0&rev=201 --- ...or-reporting-when-RTM_GETNSID-failed.patch | 50 +++++++++++++++++++ iproute2.changes | 5 ++ iproute2.spec | 5 +- 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 0001-ip-add-error-reporting-when-RTM_GETNSID-failed.patch diff --git a/0001-ip-add-error-reporting-when-RTM_GETNSID-failed.patch b/0001-ip-add-error-reporting-when-RTM_GETNSID-failed.patch new file mode 100644 index 0000000..0bee424 --- /dev/null +++ b/0001-ip-add-error-reporting-when-RTM_GETNSID-failed.patch @@ -0,0 +1,50 @@ +From 4222d059c910136f5e2b5c6de96ddaf06828c1d5 Mon Sep 17 00:00:00 2001 +From: Jan Engelhardt +Date: Tue, 22 Sep 2020 01:41:50 +0200 +Subject: [PATCH] ip: add error reporting when RTM_GETNSID failed +Upstream: https://marc.info/?t=160073241300004&r=1&w=2 + +`ip addr` when run under qemu-user-riscv64, fails. This likely is +due to qemu-5.1 not doing translation of RTM_GETNSID calls. Aborting +ip completely is the wrong response however. This patch reworks the +error handling. + +2: host0@if5: mtu 1500 qdisc noqueue state UP group default qlen 1000 + link/ether 5a:44:da:1a:c4:0b brd ff:ff:ff:ff:ff:ff +request send failed: Operation not supported + +Signed-off-by: Jan Engelhardt +--- + ip/ipnetns.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/ip/ipnetns.c b/ip/ipnetns.c +index 46cc235b..e7a45653 100644 +--- a/ip/ipnetns.c ++++ b/ip/ipnetns.c +@@ -78,6 +78,8 @@ static int ipnetns_have_nsid(void) + if (have_rtnl_getnsid < 0) { + fd = open("/proc/self/ns/net", O_RDONLY); + if (fd < 0) { ++ fprintf(stderr, "/proc/self/ns/net: %s. " ++ "Continuing anyway.\n", strerror(errno)); + have_rtnl_getnsid = 0; + return 0; + } +@@ -85,8 +87,11 @@ static int ipnetns_have_nsid(void) + addattr32(&req.n, 1024, NETNSA_FD, fd); + + if (rtnl_send(&rth, &req.n, req.n.nlmsg_len) < 0) { +- perror("request send failed"); +- exit(1); ++ fprintf(stderr, "rtnl_send(RTM_GETNSID): %s. " ++ "Continuing anyway.\n", strerror(errno)); ++ have_rtnl_getnsid = 0; ++ close(fd); ++ return 0; + } + rtnl_listen(&rth, ipnetns_accept_msg, NULL); + close(fd); +-- +2.28.0 + diff --git a/iproute2.changes b/iproute2.changes index 0b0a86d..b73397f 100644 --- a/iproute2.changes +++ b/iproute2.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Sep 23 21:57:45 UTC 2020 - Jan Engelhardt + +- Add 0001-ip-add-error-reporting-when-RTM_GETNSID-failed.patch + ------------------------------------------------------------------- Wed Sep 2 10:03:46 UTC 2020 - Jan Engelhardt diff --git a/iproute2.spec b/iproute2.spec index 5da49de..0645c9a 100644 --- a/iproute2.spec +++ b/iproute2.spec @@ -16,6 +16,7 @@ # +%define _buildshell /bin/bash Name: iproute2 Version: 5.8.0 Release: 0 @@ -36,6 +37,7 @@ Patch2: use-sysconf-_SC_CLK_TCK-if-HZ-undefined.patch Patch3: add-explicit-typecast-to-avoid-gcc-warning.patch Patch4: xfrm-support-displaying-transformations-used-for-Mob.patch Patch6: split-link-and-compile-steps-for-binaries.patch +Patch7: 0001-ip-add-error-reporting-when-RTM_GETNSID-failed.patch BuildRequires: bison BuildRequires: db-devel BuildRequires: fdupes @@ -111,8 +113,7 @@ xt_cflags="$(pkg-config xtables --cflags)" b="%buildroot" install -d "$b"/{etc/,sbin/,usr/{bin,sbin,share/man/man{3,8}}} install -d "$b"/{/usr/include,%_libdir,/usr/share} -%make_install \ - MODDESTDIR="$b/%_libdir/tc" +%make_install MODDESTDIR="$b/%_libdir/tc" # We have m_xt rm -f "$b/%_libdir/tc/m_ipt.so"