From: Masatake YAMATO <yamato@redhat.com>
To: netdev@vger.kernel.org
Cc: yamato@redhat.com
Subject: [PATCH 2/3] ss: enable query by type in unix domain related socket
Date: Wed, 8 Jan 2014 20:13:47 +0900 [thread overview]
Message-ID: <1389179628-22147-2-git-send-email-yamato@redhat.com> (raw)
In-Reply-To: <1389179628-22147-1-git-send-email-yamato@redhat.com>
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 | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/misc/ss.c b/misc/ss.c
index bac1f9e..cea3f2e 100644
--- 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));
--
1.8.4.2
next prev parent reply other threads:[~2014-01-08 11:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-08 11:13 [PATCH 1/3] ss: handle seqpacket type of unix domain socket Masatake YAMATO
2014-01-08 11:13 ` Masatake YAMATO [this message]
2014-01-08 11:13 ` [PATCH 3/3] ss: add unix_seqpacket to the help message and the man page Masatake YAMATO
2014-01-10 7:07 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1389179628-22147-2-git-send-email-yamato@redhat.com \
--to=yamato@redhat.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).