]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
ss: enable query by type in unix domain related socket
authorMasatake YAMATO <yamato@redhat.com>
Wed, 8 Jan 2014 11:13:47 +0000 (20:13 +0900)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 10 Jan 2014 07:05:26 +0000 (23:05 -0800)
This patch enables -A unix_stream, -A unix_dgram and
-A unix_seqpacket option even if ss gets socket information
via netlink.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
misc/ss.c

index 179fc470bfd1b86092c1e33d5fa9b3ee4f19fecd..887152ad0269d44b991563021acc4635ef6a806a 100644 (file)
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -2205,6 +2205,13 @@ static int unix_show_sock(struct nlmsghdr *nlh, struct filter *f)
        parse_rtattr(tb, UNIX_DIAG_MAX, (struct rtattr*)(r+1),
                     nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*r)));
 
+       if (r->udiag_type == SOCK_STREAM && !(f->dbs&(1<<UNIX_ST_DB)))
+               return 0;
+       if (r->udiag_type == SOCK_DGRAM && !(f->dbs&(1<<UNIX_DG_DB)))
+               return 0;
+       if (r->udiag_type == SOCK_SEQPACKET && !(f->dbs&(1<<UNIX_SQ_DB)))
+               return 0;
+
        if (netid_width)
                printf("%-*s ", netid_width,
                       unix_netid_name(r->udiag_type));