[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <52E7E990.7050501@parallels.com>
Date: Tue, 28 Jan 2014 21:32:00 +0400
From: Pavel Emelyanov <xemul@...allels.com>
To: Stephen Hemminger <shemminger@...ux-foundation.org>,
Linux Netdev List <netdev@...r.kernel.org>
CC: François-Xavier Le Bail <fx.lebail@...oo.com>
Subject: [PATCH] iproute: Properly handle protocol level diag module absence
When *_diag module is missing in the kernel, the ss tool should go
ad read legacry /proc/* files.
This is the case when all *_diag stuff is missing, but in case the
inet_diag.ko is loaded, but (tcp|udp)_diag.ko is not, the ss tool
doesn't notice this and produces empty output. The reason for that
is -- error from the inet_diag module (which means, that e.g. the
udp_diag is missing) is reported in the NLMSG_DONE message body.
That said, we need to check the NLMSG_DONE's message return code
and act respectively.
Reported-by: François-Xavier Le Bail <fx.lebail@...oo.com>
Signed-off-by: Pavel Emelyanov <xemul@...allels.com>
---
diff --git a/misc/ss.c b/misc/ss.c
index 37dcc11..9c7d937 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1746,8 +1746,15 @@ again:
h->nlmsg_seq != 123456)
goto skip_it;
- if (h->nlmsg_type == NLMSG_DONE)
+ if (h->nlmsg_type == NLMSG_DONE) {
+ int *len = (int *)NLMSG_DATA(h);
+ if (*len < 0) {
+ close(fd);
+ return -1;
+ }
+
goto done;
+ }
if (h->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists