From: Andrey Vagin <avagin@openvz.org>
To: netdev@vger.kernel.org
Cc: Pavel Emelyanov <xemul@parallels.com>,
Andrey Vagin <avagin@openvz.org>,
Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 3/4] ss: show destination address for netlink sockets
Date: Thu, 21 Mar 2013 13:33:25 +0400 [thread overview]
Message-ID: <1363858406-1489-4-git-send-email-avagin@openvz.org> (raw)
In-Reply-To: <1363858406-1489-1-git-send-email-avagin@openvz.org>
A netlink socket may be connected to a specific group.
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
---
misc/ss.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/misc/ss.c b/misc/ss.c
index 962f304..1af677a 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -2476,6 +2476,7 @@ static int packet_show(struct filter *f)
static void netlink_show_one(struct filter *f,
int prot, int pid, unsigned groups,
+ int state, int dst_pid, unsigned dst_group,
int rq, int wq,
unsigned long long sk, unsigned long long cb)
{
@@ -2530,8 +2531,14 @@ static void netlink_show_one(struct filter *f,
} else {
printf("%-*d ", serv_width, pid);
}
- printf("%*s*%-*s",
- addr_width, "", serv_width, "");
+
+ if (state == NETLINK_CONNECTED) {
+ printf("%*d:%-*d",
+ addr_width, dst_group, serv_width, dst_pid);
+ } else {
+ printf("%*s*%-*s",
+ addr_width, "", serv_width, "");
+ }
if (show_details) {
printf(" sk=%llx cb=%llx groups=0x%08x", sk, cb, groups);
@@ -2566,7 +2573,7 @@ static int netlink_show(struct filter *f)
&sk,
&prot, &pid, &groups, &rq, &wq, &cb, &rc);
- netlink_show_one(f, prot, pid, groups, rq, wq, sk, cb);
+ netlink_show_one(f, prot, pid, groups, TCP_CLOSE, 0, 0, rq, wq, sk, cb);
}
return 0;
--
1.7.11.7
next prev parent reply other threads:[~2013-03-21 9:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-21 9:21 [PATCH 0/2] netlink: implement socket diag for netlink sockets Andrey Vagin
2013-03-21 9:21 ` [PATCH 1/2] net: prepare netlink code for netlink diag Andrey Vagin
2013-03-21 9:21 ` [PATCH 2/2] netlink: Diag core and basic socket info dumping Andrey Vagin
2013-03-21 11:46 ` Pavel Emelyanov
2013-03-21 12:52 ` Thomas Graf
2013-03-21 14:31 ` Andrew Vagin
2013-03-21 14:41 ` Thomas Graf
2013-03-21 9:33 ` [PATCH 0/4] ss: Get netlink sockets info via sock-diag Andrey Vagin
2013-03-21 9:33 ` [PATCH 1/4] ss: handle socket diag request in a separate function Andrey Vagin
2013-03-21 9:33 ` [PATCH 2/4] ss: create a function to print info about netlink sockets Andrey Vagin
2013-03-21 9:33 ` Andrey Vagin [this message]
2013-03-21 9:33 ` [PATCH 4/4] ss: Get netlink sockets info via sock-diag Andrey Vagin
2013-03-21 17:00 ` [PATCH 0/4] " Stephen Hemminger
-- strict thread matches above, loose matches on Subject: below --
2013-06-05 8:41 [PATCH 0/4] ss: Get netlink sockets info via sock-diag (v2) Andrey Vagin
2013-06-05 8:42 ` [PATCH 3/4] ss: show destination address for netlink sockets Andrey Vagin
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=1363858406-1489-4-git-send-email-avagin@openvz.org \
--to=avagin@openvz.org \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
--cc=xemul@parallels.com \
/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).