summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2021-08-18 14:29:46 -0700
committerStephen Hemminger <stephen@networkplumber.org>2021-08-18 15:03:46 -0700
commit85b0e73c7714d33e94e3d289c49c4e0f35497071 (patch)
tree4a31828b42e97885f4ab0a8cedf66e70daedd187 /misc
parent1afde094988702fbc8cd553fedbed883d3be5638 (diff)
downloadiproute2-85b0e73c7714d33e94e3d289c49c4e0f35497071.tar.gz
ss: fix fallback to procfs for raw sockets
Jonas reports that ss -awp does not display any RAW sockets on a Knoppix 4.4 kernel. 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. Link: https://lore.kernel.org/netdev/20210815231738.7b42bad4@mmluhan/ Reported-and-tested-by: Jonas Bechtel <post@jbechtel.de> Fixes: 41fe6c34de50 ("ss: Add inet raw sockets information gathering via netlink diag interface") Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Diffstat (limited to 'misc')
-rw-r--r--misc/ss.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/misc/ss.c b/misc/ss.c
index 894ad405..b39f63fe 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));