From: Soheil Hassas Yeganeh <soheil.kdev@gmail.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: willemb@google.com, edumazet@google.com, ycheng@google.com,
ncardwell@google.com, kafai@fb.com,
Soheil Hassas Yeganeh <soheil@google.com>
Subject: [PATCH net-next 2/8] tcp: accept SOF_TIMESTAMPING_OPT_ID for passive TFO
Date: Wed, 30 Mar 2016 18:37:22 -0400 [thread overview]
Message-ID: <1459377448-2239-3-git-send-email-soheil.kdev@gmail.com> (raw)
In-Reply-To: <1459377448-2239-1-git-send-email-soheil.kdev@gmail.com>
From: Soheil Hassas Yeganeh <soheil@google.com>
SOF_TIMESTAMPING_OPT_ID is set to get data-independent IDs
to associate timestamps with send calls. For TCP connections,
tp->snd_una is used as the starting point to calculate
relative IDs.
This socket option will fail if set before the handshake on a
passive TCP fast open connection with data in SYN or SYN/ACK,
since setsockopt requires the connection to be in the
ESTABLISHED state.
To address these, instead of limiting the option to the
ESTABLISHED state, accept the SOF_TIMESTAMPING_OPT_ID option as
long as the connection is not in LISTEN or CLOSE states.
Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
---
net/core/sock.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/core/sock.c b/net/core/sock.c
index 66976f8..0a64fe2 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -832,7 +832,8 @@ set_rcvbuf:
!(sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID)) {
if (sk->sk_protocol == IPPROTO_TCP &&
sk->sk_type == SOCK_STREAM) {
- if (sk->sk_state != TCP_ESTABLISHED) {
+ if ((1 << sk->sk_state) &
+ (TCPF_CLOSE | TCPF_LISTEN)) {
ret = -EINVAL;
break;
}
--
2.8.0.rc3.226.g39d4020
next prev parent reply other threads:[~2016-03-30 22:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-30 22:37 [PATCH net-next 0/8] add TX timestamping via cmsg Soheil Hassas Yeganeh
2016-03-30 22:37 ` [PATCH net-next 1/8] sock: break up sock_cmsg_snd into __sock_cmsg_snd and loop Soheil Hassas Yeganeh
2016-03-30 22:37 ` Soheil Hassas Yeganeh [this message]
2016-03-31 3:35 ` [PATCH net-next 2/8] tcp: accept SOF_TIMESTAMPING_OPT_ID for passive TFO Willem de Bruijn
2016-03-31 23:43 ` Yuchung Cheng
2016-03-30 22:37 ` [PATCH net-next 3/8] tcp: use one bit in TCP_SKB_CB to mark ACK timestamps Soheil Hassas Yeganeh
2016-03-31 3:36 ` Willem de Bruijn
2016-03-30 22:37 ` [PATCH net-next 4/8] sock: accept SO_TIMESTAMPING flags in socket cmsg Soheil Hassas Yeganeh
2016-03-31 3:36 ` Willem de Bruijn
2016-03-30 22:37 ` [PATCH net-next 5/8] ipv4: process socket-level control messages in IPv4 Soheil Hassas Yeganeh
2016-03-31 3:36 ` Willem de Bruijn
2016-03-30 22:37 ` [PATCH net-next 6/8] ipv6: process socket-level control messages in IPv6 Soheil Hassas Yeganeh
2016-03-31 3:37 ` Willem de Bruijn
2016-03-30 22:37 ` [PATCH net-next 7/8] sock: enable timestamping using control messages Soheil Hassas Yeganeh
2016-03-31 3:39 ` Willem de Bruijn
2016-03-31 0:38 ` [PATCH net-next 0/8] add TX timestamping via cmsg Martin KaFai Lau
2016-03-31 1:08 ` Soheil Hassas Yeganeh
2016-03-31 3:50 ` Willem de Bruijn
2016-03-31 21:57 ` Martin KaFai Lau
2016-04-03 22:45 ` Willem de Bruijn
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=1459377448-2239-3-git-send-email-soheil.kdev@gmail.com \
--to=soheil.kdev@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kafai@fb.com \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=soheil@google.com \
--cc=willemb@google.com \
--cc=ycheng@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).