diff mbox

[4/5] ss: Get udp sockets info via sock-diag

Message ID 50893DAA.3010909@parallels.com
State Accepted, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Pavel Emelyanov Oct. 25, 2012, 1:24 p.m. UTC
Now everything is prepared for it, so the patch is straightforward.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>

---
 misc/ss.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

Comments

stephen hemminger Oct. 27, 2012, 12:51 a.m. UTC | #1
On Thu, 25 Oct 2012 17:24:58 +0400
Pavel Emelyanov <xemul@parallels.com> wrote:

> Now everything is prepared for it, so the patch is straightforward.
> 
> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
> 

1-4 standalone and do not require latest kernel; therefore applied

Please resubmit #5 during next merge window.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/misc/ss.c b/misc/ss.c
index 1ceb026..a0ab2e9 100644
--- 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)) {