netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Vagin <avagin@openvz.org>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org, Andrey Vagin <avagin@openvz.org>
Subject: [PATCH 3/4] ss: show destination address for netlink sockets
Date: Wed,  5 Jun 2013 12:42:00 +0400	[thread overview]
Message-ID: <1370421721-30814-4-git-send-email-avagin@openvz.org> (raw)
In-Reply-To: <1370421721-30814-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 469ffd0..c8534ff 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -2674,6 +2674,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)
 {
@@ -2728,8 +2729,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);
@@ -2764,7 +2771,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, 0, 0, 0, rq, wq, sk, cb);
 	}
 
 	return 0;
-- 
1.8.1.4

  parent reply	other threads:[~2013-06-05  8:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05  8:41 [PATCH 0/4] ss: Get netlink sockets info via sock-diag (v2) Andrey Vagin
2013-06-05  8:41 ` [PATCH 1/4] ss: handle socket diag request in a separate function Andrey Vagin
2013-06-05  8:41 ` [PATCH 2/4] ss: create a function to print info about netlink sockets Andrey Vagin
2013-06-05  8:42 ` Andrey Vagin [this message]
2013-06-05  8:42 ` [PATCH 4/4] ss: Get netlink sockets info via sock-diag (v2) Andrey Vagin
2013-06-05 15:56 ` [PATCH 0/4] " Stephen Hemminger
  -- strict thread matches above, loose matches on Subject: below --
2013-03-21  9:21 [PATCH 0/2] netlink: implement socket diag for netlink sockets Andrey Vagin
2013-03-21  9:33 ` [PATCH 0/4] ss: Get netlink sockets info via sock-diag Andrey Vagin
2013-03-21  9:33   ` [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=1370421721-30814-4-git-send-email-avagin@openvz.org \
    --to=avagin@openvz.org \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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).