]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ss: Get udp sockets info via sock-diag
authorPavel Emelyanov <xemul@parallels.com>
Thu, 25 Oct 2012 03:24:58 +0000 (03:24 +0000)
committerStephen Hemminger <shemminger@vyatta.com>
Sat, 27 Oct 2012 00:48:49 +0000 (17:48 -0700)
Now everything is prepared for it, so the patch is straightforward.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
misc/ss.c

index 1ceb026841883c786093a4e6261cae2ced323512..a0ab2e97cb8aea3f684d07b38df1cdc278c57bbe 100644 (file)
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1508,6 +1508,9 @@ static int tcpdiag_send(int fd, int protocol, struct filter *f)
        struct rtattr rta;
        struct iovec iov[3];
 
+       if (protocol == IPPROTO_UDP)
+               return -1;
+
        memset(&nladdr, 0, sizeof(nladdr));
        nladdr.nl_family = AF_NETLINK;
 
@@ -1976,6 +1979,10 @@ int udp_show(struct filter *f)
 {
        FILE *fp = NULL;
 
+       if (!getenv("PROC_NET_UDP") && !getenv("PROC_ROOT")
+           && inet_show_netlink(f, NULL, IPPROTO_UDP) == 0)
+               return 0;
+
        dg_proto = UDP_PROTO;
 
        if (f->families&(1<<AF_INET)) {