* [PATCH] iproute: Properly handle protocol level diag module absence
@ 2014-01-28 17:32 Pavel Emelyanov
2014-01-29 19:39 ` François-Xavier Le Bail
2014-02-10 22:37 ` Stephen Hemminger
0 siblings, 2 replies; 3+ messages in thread
From: Pavel Emelyanov @ 2014-01-28 17:32 UTC (permalink / raw)
To: Stephen Hemminger, Linux Netdev List; +Cc: François-Xavier Le Bail
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@yahoo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.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);
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] iproute: Properly handle protocol level diag module absence
2014-01-28 17:32 [PATCH] iproute: Properly handle protocol level diag module absence Pavel Emelyanov
@ 2014-01-29 19:39 ` François-Xavier Le Bail
2014-02-10 22:37 ` Stephen Hemminger
1 sibling, 0 replies; 3+ messages in thread
From: François-Xavier Le Bail @ 2014-01-29 19:39 UTC (permalink / raw)
To: Stephen Hemminger, Linux Netdev List, Pavel Emelyanov
On Tue, 1/28/14, Pavel Emelyanov <xemul@parallels.com> wrote:
> 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@yahoo.com>
> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
> ---
Tested-by: François-Xavier Le Bail <fx.lebail@yahoo.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iproute: Properly handle protocol level diag module absence
2014-01-28 17:32 [PATCH] iproute: Properly handle protocol level diag module absence Pavel Emelyanov
2014-01-29 19:39 ` François-Xavier Le Bail
@ 2014-02-10 22:37 ` Stephen Hemminger
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2014-02-10 22:37 UTC (permalink / raw)
To: Pavel Emelyanov
Cc: Stephen Hemminger, Linux Netdev List,
François-Xavier Le Bail
On Tue, 28 Jan 2014 21:32:00 +0400
Pavel Emelyanov <xemul@parallels.com> wrote:
> 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@yahoo.com>
> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
>
Silently ignoring the error seems wrong.
The fallback is good, but we should try and report the error so that
the user fixes the kernel config.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-10 22:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-28 17:32 [PATCH] iproute: Properly handle protocol level diag module absence Pavel Emelyanov
2014-01-29 19:39 ` François-Xavier Le Bail
2014-02-10 22:37 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).