Commit b9ea445d authored by Vadim Kochan's avatar Vadim Kochan Committed by Stephen Hemminger

ss: Dont show netlink and packet sockets by default

Checking by SS_CLOSE state was remowed in:

    (45a4770b) ss: Remove checking SS_CLOSE state for packet and netlink

which is not really correct because now by default all sockets are seen
when do 'ss'.

Here is most correct fix which considers specified family.

To see netlink sockets:
    ss -A netlink

To see packet sockets:
    ss -A packet

And ss by default will show only connected/established sockets as it
was before all the time.
Signed-off-by: default avatarVadim Kochan <vadim4j@gmail.com>
parent 8a4025f6
......@@ -2744,6 +2744,9 @@ static int packet_show(struct filter *f)
int ino;
unsigned long long sk;
if (preferred_family != AF_PACKET && !(f->states & (1 << SS_CLOSE)))
return 0;
if (packet_show_netlink(f) == 0)
return 0;
......@@ -2972,6 +2975,9 @@ static int netlink_show(struct filter *f)
int rq, wq, rc;
unsigned long long sk, cb;
if (preferred_family != AF_NETLINK && !(f->states & (1 << SS_CLOSE)))
return 0;
if (!getenv("PROC_NET_NETLINK") && !getenv("PROC_ROOT") &&
netlink_show_netlink(f) == 0)
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment