[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1424636591-19903-2-git-send-email-vadim4j@gmail.com>
Date: Sun, 22 Feb 2015 22:23:10 +0200
From: Vadim Kochan <vadim4j@...il.com>
To: netdev@...r.kernel.org
Cc: Vadim Kochan <vadim4j@...il.com>
Subject: [PATCH iproute2 1/2] ss: Add filter before printing unix stats from Netlink
From: Vadim Kochan <vadim4j@...il.com>
Detailed info can be printed if filter should not pass
the socket info.
Signed-off-by: Vadim Kochan <vadim4j@...il.com>
---
misc/ss.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/misc/ss.c b/misc/ss.c
index 2678033..5320d38 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -2556,7 +2556,7 @@ static void unix_stats_print(struct sockstat *list, struct filter *f)
}
}
- if (f->f) {
+ if (use_proc && f->f) {
if (strcmp(peer, "*") == 0)
memset(s->remote.data, 0, sizeof(char *));
else
@@ -2628,6 +2628,9 @@ static int unix_show_sock(const struct sockaddr_nl *addr, struct nlmsghdr *nlh,
if (tb[UNIX_DIAG_PEER])
stat.rport = rta_getattr_u32(tb[UNIX_DIAG_PEER]);
+ if (f->f && run_ssfilter(f->f, &stat) == 0)
+ return 0;
+
unix_stats_print(&stat, f);
if (show_mem) {
--
2.2.2
--
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