]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ss: Fix case when UDP is printed as ipproto-xxx
authorVadim Kochan <vadim4j@gmail.com>
Thu, 8 Jan 2015 00:42:54 +0000 (02:42 +0200)
committerStephen Hemminger <shemming@brocade.com>
Wed, 14 Jan 2015 01:29:17 +0000 (17:29 -0800)
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.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
misc/ss.c

index 08d210ae88ed362f52e46ba912c67fa46b647cb7..7c94463931036616e7d8afff1472e02d02e671eb 100644 (file)
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -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;