ss: Add filter before printing unix stats from Netlink

Detailed info can be printed if filter should not pass
the socket info.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
This commit is contained in:
Vadim Kochan 2015-02-22 22:23:10 +02:00 committed by Stephen Hemminger
parent 6b8c871dc1
commit 29999b0ff2
1 changed files with 4 additions and 1 deletions

View File

@ -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) {