netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Li Yewang <lyw@cn.fujitsu.com>
To: shemminger@linux-foundation.org
Cc: "'Netdev'" <netdev@vger.kernel.org>
Subject: [PATCH][iproute2/ss]distinguish the inet and inet6 domain when loading the tcp_diag module
Date: Tue, 19 Aug 2008 15:39:56 +0800	[thread overview]
Message-ID: <48AA78CC.9030201@cn.fujitsu.com> (raw)

When load the tcp_diag module, and use "ss -f inet" command to show the socket 
information of inet domain. But this command also shows the information of inet6 
domain, but not only inet domain. and "ss -f inet6", "ss -4", "ss -6" have the
same problem.


Signed-off-by: Li Yewang <lyw@cn.fujitsu.com>

diff --git a/misc/ss.c b/misc/ss.c
index 38eed29..dea90b6 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1503,6 +1503,7 @@ static int tcp_show_netlink(struct filter *f, FILE 
*dump_fp, int socktype)
  		h = (struct nlmsghdr*)buf;
  		while (NLMSG_OK(h, status)) {
  			int err;
+			struct inet_diag_msg *r = NLMSG_DATA(h);

  			if (/*h->nlmsg_pid != rth->local.nl_pid ||*/
  			    h->nlmsg_seq != 123456)
@@ -1521,6 +1522,10 @@ static int tcp_show_netlink(struct filter *f, FILE 
*dump_fp, int socktype)
  				return 0;
  			}
  			if (!dump_fp) {
+				if (!(f->families & (1<<r->idiag_family))) {
+					h = NLMSG_NEXT(h, status);
+					continue;
+				}
  				err = tcp_show_sock(h, NULL);
  				if (err < 0)
  					return err;


                 reply	other threads:[~2008-08-19  7:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=48AA78CC.9030201@cn.fujitsu.com \
    --to=lyw@cn.fujitsu.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@linux-foundation.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).