`ip addr` when run under qemu-user-riscv64, fails. This likely is
due to qemu-5.1 not doing translation of RTM_GETNSID calls.

2: host0@if5: <BROADCAST,MULTICAST,UP,LOWER_UP> 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

Treat the situation similar to an absence of procfs.

Signed-off-by: Jan Engelhardt <jeng...@inai.de>
---
 ip/ipnetns.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ip/ipnetns.c b/ip/ipnetns.c
index 46cc235b..8fab51cd 100644
--- a/ip/ipnetns.c
+++ b/ip/ipnetns.c
@@ -85,8 +85,9 @@ 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);
+                       have_rtnl_getnsid = 0;
+                       close(fd);
+                       return 0;
                }
                rtnl_listen(&rth, ipnetns_accept_msg, NULL);
                close(fd);
-- 
2.28.0

Reply via email to