* [PATCH iproute2] ss: do not emit warn while dumping MPTCP on old kernels
@ 2021-01-25 16:02 Paolo Abeni
2021-01-27 13:30 ` Rantala, Tommi T. (Nokia - FI/Espoo)
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Abeni @ 2021-01-25 16:02 UTC (permalink / raw)
To: netdev; +Cc: Rantala, Tommi T. (Nokia - FI/Espoo), dsahern @ kernel . org
Prior to this commit, running 'ss' on a kernel older than v5.9
bumps an error message:
RTNETLINK answers: Invalid argument
When asked to dump protocol number > 255 - that is: MPTCP - 'ss'
adds an INET_DIAG_REQ_PROTOCOL attribute, unsupported by the older
kernel.
Avoid the warning ignoring filter issues when INET_DIAG_REQ_PROTOCOL
is used.
Additionally older kernel end-up invoking tcpdiag_send(), which
in turn will try to dump DCCP socks. Bail early in such function,
as the kernel does not implement an MPTCPDIAG_GET request.
Reported-by: "Rantala, Tommi T. (Nokia - FI/Espoo)" <tommi.t.rantala@nokia.com>
Fixes: 9c3be2c0eee0 ("ss: mptcp: add msk diag interface support")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
misc/ss.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/misc/ss.c b/misc/ss.c
index 0593627b..ad46f9db 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -3404,7 +3404,7 @@ static int tcpdiag_send(int fd, int protocol, struct filter *f)
struct iovec iov[3];
int iovlen = 1;
- if (protocol == IPPROTO_UDP)
+ if (protocol == IPPROTO_UDP || protocol == IPPROTO_MPTCP)
return -1;
if (protocol == IPPROTO_TCP)
@@ -3623,6 +3623,14 @@ static int inet_show_netlink(struct filter *f, FILE *dump_fp, int protocol)
if (preferred_family == PF_INET6)
family = PF_INET6;
+ /* extended protocol will use INET_DIAG_REQ_PROTOCOL,
+ * not supported by older kernels. On such kernel
+ * rtnl_dump will bail with rtnl_dump_error().
+ * Suppress the error to avoid confusing the user
+ */
+ if (protocol > 255)
+ rth.flags |= RTNL_HANDLE_F_SUPPRESS_NLERR;
+
again:
if ((err = sockdiag_send(family, rth.fd, protocol, f)))
goto Exit;
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iproute2] ss: do not emit warn while dumping MPTCP on old kernels
2021-01-25 16:02 [PATCH iproute2] ss: do not emit warn while dumping MPTCP on old kernels Paolo Abeni
@ 2021-01-27 13:30 ` Rantala, Tommi T. (Nokia - FI/Espoo)
0 siblings, 0 replies; 2+ messages in thread
From: Rantala, Tommi T. (Nokia - FI/Espoo) @ 2021-01-27 13:30 UTC (permalink / raw)
To: netdev, pabeni; +Cc: dsahern
On Mon, 2021-01-25 at 17:02 +0100, Paolo Abeni wrote:
> Prior to this commit, running 'ss' on a kernel older than v5.9
> bumps an error message:
>
> RTNETLINK answers: Invalid argument
Thanks, works perfectly for me.
-Tommi
> When asked to dump protocol number > 255 - that is: MPTCP - 'ss'
> adds an INET_DIAG_REQ_PROTOCOL attribute, unsupported by the older
> kernel.
>
> Avoid the warning ignoring filter issues when INET_DIAG_REQ_PROTOCOL
> is used.
>
> Additionally older kernel end-up invoking tcpdiag_send(), which
> in turn will try to dump DCCP socks. Bail early in such function,
> as the kernel does not implement an MPTCPDIAG_GET request.
>
> Reported-by: "Rantala, Tommi T. (Nokia - FI/Espoo)" <
> tommi.t.rantala@nokia.com>
> Fixes: 9c3be2c0eee0 ("ss: mptcp: add msk diag interface support")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> ---
> misc/ss.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/misc/ss.c b/misc/ss.c
> index 0593627b..ad46f9db 100644
> --- a/misc/ss.c
> +++ b/misc/ss.c
> @@ -3404,7 +3404,7 @@ static int tcpdiag_send(int fd, int protocol, struct
> filter *f)
> struct iovec iov[3];
> int iovlen = 1;
>
> - if (protocol == IPPROTO_UDP)
> + if (protocol == IPPROTO_UDP || protocol == IPPROTO_MPTCP)
> return -1;
>
> if (protocol == IPPROTO_TCP)
> @@ -3623,6 +3623,14 @@ static int inet_show_netlink(struct filter *f, FILE
> *dump_fp, int protocol)
> if (preferred_family == PF_INET6)
> family = PF_INET6;
>
> + /* extended protocol will use INET_DIAG_REQ_PROTOCOL,
> + * not supported by older kernels. On such kernel
> + * rtnl_dump will bail with rtnl_dump_error().
> + * Suppress the error to avoid confusing the user
> + */
> + if (protocol > 255)
> + rth.flags |= RTNL_HANDLE_F_SUPPRESS_NLERR;
> +
> again:
> if ((err = sockdiag_send(family, rth.fd, protocol, f)))
> goto Exit;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-27 13:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-25 16:02 [PATCH iproute2] ss: do not emit warn while dumping MPTCP on old kernels Paolo Abeni
2021-01-27 13:30 ` Rantala, Tommi T. (Nokia - FI/Espoo)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.