Bug 1229355

Summary: ss -an shows only tcp sockets
Product: Red Hat Enterprise Linux 6 Reporter: Jaroslav Aster <jaster>
Component: iprouteAssignee: Phil Sutter <psutter>
Status: CLOSED ERRATA QA Contact: Jaroslav Aster <jaster>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.7CC: mmarusic, psutter, rkhan, tlavigne
Target Milestone: rcKeywords: Documentation
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: iproute-2.6.32-46.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1291818 (view as bug list) Environment:
Last Closed: 2016-05-11 00:19:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1275424    

Description Jaroslav Aster 2015-06-08 14:15:07 UTC
Description of problem:

ss -an shows only tcp sockets, but documentation says that all sockets should be shown.

Version-Release number of selected component (if applicable):

iproute-2.6.32-45.el6

How reproducible:

100%

Steps to Reproduce:

# ss -an
# ss -ant
# ss -anu

Actual results:

ss -an showes the same result as ss -ant.

Expected results:

ss -an shows all sockets, ss -ant shows all tcp sockets and ss -anu shows all udp sockets and so on.

Comment 1 Phil Sutter 2015-10-15 19:34:36 UTC
This is a documentation issue. In RHEL6's iproute code base, with no options given ss prints only TCP sockets. Option -a does not request all socket families, but all socket states (i.e., listening as well as connected, etc.).

The inconsistency has been fixed by the following upstream commit:

commit 5d8056357a032131057462fadb77c62cab6b2f0f
Author: Petr Sabata <psabata>
Date:   Mon Nov 29 14:00:37 2010 +0100

    ss(8) improvements by Jiri Popelka <jpopelka>

Comment 3 Marek Marusic 2015-11-16 08:26:52 UTC
Hello, is this really a documentation bug?
When you try to run 'ss -an' on RHEL7.2 it outputs upd sockets too.
I think the behaviour of this command shouldn't be so different on RHEL6 and RHEL7.

Comment 4 Phil Sutter 2015-11-16 15:16:31 UTC
Hi Marek,

(In reply to Marek Marusic from comment #3)
> Hello, is this really a documentation bug?
> When you try to run 'ss -an' on RHEL7.2 it outputs upd sockets too.
> I think the behaviour of this command shouldn't be so different on RHEL6 and
> RHEL7.

Yes, the behaviour has changed in between base release for RHEL6 and upstream. For RHEL7 there was an update of the whole ss code base at some point. Deciding between bug and feature is not trivial for me here. Basically I see two relevant commits, first one being the quoted one above which adjusts the documentation to point out that ss by default lists only TCP sockets. The second one is this (if I'm not mistaken):

commit 9db7bf15e22b6a1b8bc09c4a1e29571cbca55c94
Author: Vadim Kochan <vadim4j>
Date:   Sun Jan 4 22:18:40 2015 +0200

    ss: Filtering logic changing, with fixes
    
    This patch fixes some filtering combinations issues which does not
    work on the 'master' version:
    
        $ ss -4
        shows inet & unix sockets, instead of only inet sockets
    
        $ ss -u
        needs to specify 'state closed'
    
        $ ss src unix:*X11*
        needs to specify '-x' shortcut for UNIX family
    
        $ ss -A all
        shows only sockets with established states
    
    There might some other issues which was not observed.
    
    Also changed logic for calculating families, socket types and
    states filtering. I think that this version is a little simpler
    one. Now there are 2 predefined default tables which describes
    the following maping:
    
        family  -> (states, dbs)
        db      -> (states, families)
    
    Signed-off-by: Vadim Kochan <vadim4j>

As you see, this is fairly new and changes more things than just the default filters. In my point of view, this is rather an enhancement than bug fix (not least since it touches ~300 lines of code).

Given the state RHEL6 is in now, I'd really prefer to just fix the documentation to reflect the actual behaviour instead of taking the risk of this rather extensive backport.

Cheers, Phil

Comment 8 errata-xmlrpc 2016-05-11 00:19:29 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-0895.html