]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
ss: Add filter before printing unix stats from Netlink
authorVadim Kochan <vadim4j@gmail.com>
Sun, 22 Feb 2015 20:23:10 +0000 (22:23 +0200)
committerStephen Hemminger <shemming@brocade.com>
Tue, 24 Feb 2015 23:59:44 +0000 (15:59 -0800)
Detailed info can be printed if filter should not pass
the socket info.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
misc/ss.c

index 2678033fc344c7d65ffb62703d80029ab3f76edd..5320d3870d38fd02931620e5d27521c7c16e66e1 100644 (file)
--- 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) {