From: Soheil Hassas Yeganeh <soheil.kdev@gmail.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: edumazet@google.com, maze@google.com, willemb@google.com,
Soheil Hassas Yeganeh <soheil@google.com>
Subject: [PATCH net-next] sock: ignore TIMESTAMP, RXQ_OVFL, WIFI_STATUS in sock_cmsg_send
Date: Fri, 13 May 2016 00:47:10 -0400 [thread overview]
Message-ID: <1463114830-32751-1-git-send-email-soheil.kdev@gmail.com> (raw)
From: Soheil Hassas Yeganeh <soheil@google.com>
SO_TIMESTAMP(NS), RXQ_OVFL, and WIFI_STATUS can be returned as
receive-side control messages from recvmsg(). Although invalid,
some applications may reflect those receive-side control messages
back to sendmsg(). Since socket-level control messages were being
ignored in ipv4 and ipv6, such applications would not get an error.
24025c4 (ipv4: process socket-level control messages in IPv4) and
ad1e46 (ipv6: process socket-level control messages in IPv6) add
support for socket-level control messages in ipv4 and ipv6 on
sendmsg(). This results in getting -EINVAL, if the application
passes in a message with SO_WIFI_STATUS, SO_RXQ_OVFL, SO_TIMESTAMP
and/or SO_TIMESTAMPNS that might have been received in recvmsg().
Ignore SO_WIFI_STATUS, SO_TIMESTAMP(NS), and SO_RXQ_OVFL when
processing socket-level control messages in send-side to remain
backward compatible.
---
net/core/sock.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/core/sock.c b/net/core/sock.c
index 08bf97e..1e0bcd0 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1938,6 +1938,12 @@ int __sock_cmsg_send(struct sock *sk, struct msghdr *msg, struct cmsghdr *cmsg,
sockc->tsflags &= ~SOF_TIMESTAMPING_TX_RECORD_MASK;
sockc->tsflags |= tsflags;
break;
+ /* Ignore the following types on send to remain backward compatible. */
+ case SO_RXQ_OVFL: /* Fall through */
+ case SO_TIMESTAMP: /* Fall through */
+ case SO_TIMESTAMPNS: /* Fall through */
+ case SO_WIFI_STATUS:
+ break;
default:
return -EINVAL;
}
--
2.8.0.rc3.226.g39d4020
next reply other threads:[~2016-05-13 4:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-13 4:47 Soheil Hassas Yeganeh [this message]
2016-05-13 6:03 ` [PATCH net-next] sock: ignore TIMESTAMP, RXQ_OVFL, WIFI_STATUS in sock_cmsg_send David Miller
2016-05-13 12:14 ` Soheil Hassas Yeganeh
2016-05-13 12:46 ` Sergei Shtylyov
2016-05-13 13:14 ` [PATCH net-next] sock: propagate __sock_cmsg_send() error Eric Dumazet
2016-05-13 13:29 ` Soheil Hassas Yeganeh
2016-05-16 17:46 ` David Miller
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=1463114830-32751-1-git-send-email-soheil.kdev@gmail.com \
--to=soheil.kdev@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=maze@google.com \
--cc=netdev@vger.kernel.org \
--cc=soheil@google.com \
--cc=willemb@google.com \
/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).