Skip to contentSkip to conversation

ss: Fix case when UDP is printed as ipproto-xxx

PATCH In review Vadim Kochan 2 participants 2 messages Jan 8, 2015 – Jan 14, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ss: Fix case when UDP is printed as ipproto-xxx

From: Vadim Kochan <[email protected]>

When 'ss' prints UDP sockets info together with RAW sockets e.g.:

    $ ss -a

then UDP sockets are resolved as "ipproto-xxx".

It was caused that dg_proto was set after printing UDP socket info from netlink. So fixed issue by moving setting dg_proto before printing info from Netlink.

---
 misc/ss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
misc/ss.c +2 -2
index 08d210a..7c94463 100644
@@ -2287,12 +2287,12 @@ static int udp_show(struct filter *f)
 {
 	FILE *fp = NULL;
 
+	dg_proto = UDP_PROTO;
+
 	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)) {
 		if ((fp = net_udp_open()) == NULL)
 			goto outerr;
Signature · 1 line
2.1.3
#1 lore raw
Quoted 7 lines · On Thu, 8 Jan 2015 02:42:54 +0200 Vadim Kochan <[email protected]> wrote:

From: Vadim Kochan <[email protected]>

When 'ss' prints UDP sockets info together with RAW sockets e.g.:

    $ ss -a
Quoted 7 lines

then UDP sockets are resolved as "ipproto-xxx".

It was caused that dg_proto was set after printing UDP socket info from netlink. So fixed issue by moving setting dg_proto before printing info from Netlink.

Accepted