netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vadim Kochan <vadim4j@gmail.com>
To: netdev@vger.kernel.org
Cc: Vadim Kochan <vadim4j@gmail.com>
Subject: [PATCH iproute2 2/2] ss: Skip filtered netlink sockets before detailed info
Date: Sun, 22 Feb 2015 22:23:11 +0200	[thread overview]
Message-ID: <1424636591-19903-3-git-send-email-vadim4j@gmail.com> (raw)
In-Reply-To: <1424636591-19903-1-git-send-email-vadim4j@gmail.com>

From: Vadim Kochan <vadim4j@gmail.com>

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
 misc/ss.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/misc/ss.c b/misc/ss.c
index 5320d38..5113d85 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -2938,7 +2938,7 @@ static int packet_show(struct filter *f)
 	return 0;
 }
 
-static void netlink_show_one(struct filter *f,
+static int netlink_show_one(struct filter *f,
 				int prot, int pid, unsigned groups,
 				int state, int dst_pid, unsigned dst_group,
 				int rq, int wq,
@@ -2960,7 +2960,7 @@ static void netlink_show_one(struct filter *f,
 		st.lport = pid;
 		st.local.data[0] = prot;
 		if (run_ssfilter(f->f, &st) == 0)
-			return;
+			return 1;
 	}
 
 	sock_state_print(&st, "nl");
@@ -3032,7 +3032,7 @@ static void netlink_show_one(struct filter *f,
 	}
 	printf("\n");
 
-	return;
+	return 0;
 }
 
 static int netlink_show_sock(const struct sockaddr_nl *addr,
@@ -3058,9 +3058,11 @@ static int netlink_show_sock(const struct sockaddr_nl *addr,
 		wq = skmeminfo[SK_MEMINFO_WMEM_ALLOC];
 	}
 
-	netlink_show_one(f, r->ndiag_protocol, r->ndiag_portid, groups,
+	if (netlink_show_one(f, r->ndiag_protocol, r->ndiag_portid, groups,
 			 r->ndiag_state, r->ndiag_dst_portid, r->ndiag_dst_group,
-			 rq, wq, 0, 0);
+			 rq, wq, 0, 0)) {
+		return 0;
+	}
 
 	if (show_mem) {
 		printf("\t");
-- 
2.2.2

  parent reply	other threads:[~2015-02-22 20:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-22 20:23 [PATCH iproute2 0/2] ss: Filtering fixes for unix & netlink socks Vadim Kochan
2015-02-22 20:23 ` [PATCH iproute2 1/2] ss: Add filter before printing unix stats from Netlink Vadim Kochan
2015-02-22 20:23 ` Vadim Kochan [this message]
2015-02-25  1:39 ` [PATCH iproute2 0/2] ss: Filtering fixes for unix & netlink socks 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=1424636591-19903-3-git-send-email-vadim4j@gmail.com \
    --to=vadim4j@gmail.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).