netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonas Bechtel <post@jbechtel.de>
To: David Ahern <dsahern@gmail.com>
Cc: Jakub Kicinski <kuba@kernel.org>, netdev@vger.kernel.org
Subject: Re: ss command not showing raw sockets? (regression)
Date: Wed, 18 Aug 2021 21:57:38 +0200	[thread overview]
Message-ID: <20210818215738.1830fd0b@mmluhan> (raw)
In-Reply-To: <74deda94-f14e-be9e-6925-527c7b70a563@gmail.com>




On Tue, 17 Aug 2021 18:47:06 -0600
David Ahern <dsahern@gmail.com> wrote with subject
"Re: ss command not showing raw sockets? (regression)":

> On 8/17/21 3:37 PM, Jakub Kicinski wrote:
> > 
> > Ah, good point, strace will show it. 
> > 
> > /me goes off to look at the strace Jonas sent off list.
> > 
> > Well this is unexpected:
> > 
> > sendmsg(3, {msg_name={sa_family=AF_NETLINK, nl_pid=0,
> > nl_groups=00000000}, msg_namelen=12, msg_iov=[{iov_base={{len=76,
> > type=DCCPDIAG_GETSOCK, ... --->8----------------  
> > 
> > From: Jakub Kicinski <kuba@kernel.org>
> > Subject: ss: fix fallback to procfs for raw and sctp sockets
> > 
> > sockdiag_send() diverts to tcpdiag_send() to try the older
> > netlink interface. tcpdiag_send() works for TCP and DCCP
> > but not other protocols. Instead of rejecting unsupported
> > protocols (and missing RAW and SCTP) match on supported ones.
> > 
> > Fixes: 41fe6c34de50 ("ss: Add inet raw sockets information
> > gathering via netlink diag interface") Signed-off-by: Jakub
> > Kicinski <kuba@kernel.org> ---
> >  misc/ss.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/misc/ss.c b/misc/ss.c
> > index 894ad40574f1..b39f63fe3b17 100644
> > --- a/misc/ss.c
> > +++ b/misc/ss.c
> > @@ -3404,13 +3404,13 @@ static int tcpdiag_send(int fd, int
> > protocol, struct filter *f) struct iovec iov[3];
> >  	int iovlen = 1;
> >  
> > -	if (protocol == IPPROTO_UDP || protocol == IPPROTO_MPTCP)
> > -		return -1;
> > -
> >  	if (protocol == IPPROTO_TCP)
> >  		req.nlh.nlmsg_type = TCPDIAG_GETSOCK;
> > -	else
> > +	else if (protocol == IPPROTO_DCCP)
> >  		req.nlh.nlmsg_type = DCCPDIAG_GETSOCK;
> > +	else
> > +		return -1;
> > +
> >  	if (show_mem) {
> >  		req.r.idiag_ext |= (1<<(INET_DIAG_MEMINFO-1));
> >  		req.r.idiag_ext |= (1<<(INET_DIAG_SKMEMINFO-1));
> >   
> 
> That looks correct to me.
> 
> Jonas: can you build iproute2 and test?

I've cloned branch main as instructed in https://wiki.linuxfoundation.org/networking/iproute2. Most recent commit is 9b7ea92b9e3f. After building, no socket was listed in table.

Then I [manually] applied the patch and rebuilt. The patched version works well, I do see the two sockets right now.

Command was in both cases misc/ss -awp


  reply	other threads:[~2021-08-18 20:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-15 21:17 ss command not showing raw sockets? (regression) Jonas Bechtel
2021-08-16 22:08 ` Jakub Kicinski
2021-08-17 14:57   ` David Ahern
2021-08-17 15:04   ` Jakub Kicinski
2021-08-17 18:21     ` Jonas Bechtel
2021-08-17 18:44       ` Jakub Kicinski
2021-08-17 19:54         ` David Ahern
2021-08-17 21:37           ` Jakub Kicinski
2021-08-18  0:47             ` David Ahern
2021-08-18 19:57               ` Jonas Bechtel [this message]
2021-08-18 20:43                 ` David Ahern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210818215738.1830fd0b@mmluhan \
    --to=post@jbechtel.de \
    --cc=dsahern@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).