All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mptcp-next] mptcp: ignore unsupported msg flags
@ 2021-04-14 15:23 Paolo Abeni
  2021-04-14 15:51 ` Florian Westphal
  0 siblings, 1 reply; 6+ messages in thread
From: Paolo Abeni @ 2021-04-14 15:23 UTC (permalink / raw)
  To: mptcp

Currently mptcp_sendmsg()/mptcp_recvmsg() fail with EOPNOTSUPP
if the user-space provides some unsupported flag. That is
unexpected and may foul existing applications migrated to MPTCP,
which expect a different behavior.

Change the mentioned function to silently ignore the unsupported
flags.

Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/162
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/mptcp/protocol.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 2d895c3c8746..bdec946b9b04 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1585,8 +1585,8 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 	int ret = 0;
 	long timeo;
 
-	if (msg->msg_flags & ~(MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL))
-		return -EOPNOTSUPP;
+	/* ignore unsupported flags */
+	msg->msg_flags &= MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL;
 
 	mptcp_lock_sock(sk, __mptcp_wmem_reserve(sk, min_t(size_t, 1 << 20, len)));
 
@@ -1916,8 +1916,8 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
 	int target;
 	long timeo;
 
-	if (msg->msg_flags & ~(MSG_WAITALL | MSG_DONTWAIT))
-		return -EOPNOTSUPP;
+	/* ignore unsupported flags */
+	msg->msg_flags &= MSG_WAITALL | MSG_DONTWAIT;
 
 	mptcp_lock_sock(sk, __mptcp_splice_receive_queue(sk));
 	if (unlikely(sk->sk_state == TCP_LISTEN)) {
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-15  9:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-14 15:23 [PATCH mptcp-next] mptcp: ignore unsupported msg flags Paolo Abeni
2021-04-14 15:51 ` Florian Westphal
2021-04-14 16:07   ` Paolo Abeni
2021-04-15  8:27     ` Florian Westphal
2021-04-15  9:33       ` Paolo Abeni
2021-04-15  9:44         ` Florian Westphal

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.