* [PATCH iproute2] ss: do not bindly dump two families
@ 2015-05-29 12:37 Eric Dumazet
2015-06-25 3:32 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2015-05-29 12:37 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
From: Eric Dumazet <edumazet@google.com>
ss currently dumps IPv4 sockets, then IPv6 sockets from the kernel,
even if -4 or -6 option was given. Filtering in user space then has to
drop all sockets of wrong family. Such a waste of time...
Before :
$ time ss -tn -4 | wc -l
251659
real 0m1.241s
user 0m0.423s
sys 0m0.806s
After:
$ time ss -tn -4 | wc -l
251672
real 0m0.779s
user 0m0.412s
sys 0m0.386s
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
misc/ss.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/misc/ss.c b/misc/ss.c
index 347e3a1..4ef8fea 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -2209,6 +2209,8 @@ static int inet_show_netlink(struct filter *f, FILE *dump_fp, int protocol)
return -1;
rth.dump = MAGIC_SEQ;
rth.dump_fp = dump_fp;
+ if (preferred_family == PF_INET6)
+ family = PF_INET6;
again:
if ((err = sockdiag_send(family, rth.fd, protocol, f)))
@@ -2221,7 +2223,7 @@ again:
}
goto Exit;
}
- if (family == PF_INET) {
+ if (family == PF_INET && preferred_family != PF_INET) {
family = PF_INET6;
goto again;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH iproute2] ss: do not bindly dump two families
2015-05-29 12:37 [PATCH iproute2] ss: do not bindly dump two families Eric Dumazet
@ 2015-06-25 3:32 ` Stephen Hemminger
2015-06-25 4:56 ` Eric Dumazet
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2015-06-25 3:32 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev
On Fri, 29 May 2015 05:37:49 -0700
Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> ss currently dumps IPv4 sockets, then IPv6 sockets from the kernel,
> even if -4 or -6 option was given. Filtering in user space then has to
> drop all sockets of wrong family. Such a waste of time...
>
> Before :
>
> $ time ss -tn -4 | wc -l
> 251659
>
> real 0m1.241s
> user 0m0.423s
> sys 0m0.806s
>
> After:
>
> $ time ss -tn -4 | wc -l
> 251672
>
> real 0m0.779s
> user 0m0.412s
> sys 0m0.386s
>
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
I applied all 3 ss patches for the 4.1 release in progress.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH iproute2] ss: do not bindly dump two families
2015-06-25 3:32 ` Stephen Hemminger
@ 2015-06-25 4:56 ` Eric Dumazet
0 siblings, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2015-06-25 4:56 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
On Wed, 2015-06-24 at 23:32 -0400, Stephen Hemminger wrote:
>
> I applied all 3 ss patches for the 4.1 release in progress.
Thanks Stephen !
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-25 4:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-29 12:37 [PATCH iproute2] ss: do not bindly dump two families Eric Dumazet
2015-06-25 3:32 ` Stephen Hemminger
2015-06-25 4:56 ` Eric Dumazet
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).