]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
distinguish the inet and inet6 domain when loading the tcp_diag module
authorLi Yewang <lyw@cn.fujitsu.com>
Tue, 9 Sep 2008 01:13:42 +0000 (09:13 +0800)
committerStephen Hemminger <stephen.hemminger@vyatta.com>
Thu, 18 Sep 2008 05:05:02 +0000 (22:05 -0700)
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>
Signed-off-by: Stephen Hemminger <stephen.hemminger@vyatta.com>
misc/ss.c

index e06946b49ad2347bd427393fe38407811c0315f3..651fe3b52476a84e131d60022f8c3ca05486e88a 100644 (file)
--- 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;