From: Christoph Paasch <cpaasch@apple.com>
To: netdev@vger.kernel.org
Cc: Eric Dumazet <edumazet@google.com>,
Yuchung Cheng <ycheng@google.com>,
David Miller <davem@davemloft.net>
Subject: [PATCH net-next 4/5] tcp: Allow getsockopt of listener's keypool
Date: Fri, 14 Dec 2018 14:40:06 -0800 [thread overview]
Message-ID: <20181214224007.54813-5-cpaasch@apple.com> (raw)
In-Reply-To: <20181214224007.54813-1-cpaasch@apple.com>
Allow to get the full list of the listener's keypool through a
getsockopt.
Signed-off-by: Christoph Paasch <cpaasch@apple.com>
---
net/ipv4/tcp.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 27e2f6837062..cdb317392138 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3420,21 +3420,24 @@ static int do_tcp_getsockopt(struct sock *sk, int level,
return 0;
case TCP_FASTOPEN_KEY: {
- __u8 key[TCP_FASTOPEN_KEY_LENGTH];
+ __u8 key[TCP_FASTOPEN_KEY_LENGTH * TCP_FASTOPEN_CTXT_LEN];
struct tcp_fastopen_context *ctx;
+ unsigned int key_len = 0;
if (get_user(len, optlen))
return -EFAULT;
rcu_read_lock();
ctx = rcu_dereference(icsk->icsk_accept_queue.fastopenq.ctx);
- if (ctx)
- memcpy(key, ctx->key, sizeof(key));
- else
- len = 0;
+ while (ctx) {
+ memcpy(&key[key_len], ctx->key, TCP_FASTOPEN_KEY_LENGTH);
+
+ key_len += TCP_FASTOPEN_KEY_LENGTH;
+ ctx = rcu_dereference(ctx->next);
+ }
rcu_read_unlock();
- len = min_t(unsigned int, len, sizeof(key));
+ len = min_t(unsigned int, len, key_len);
if (put_user(len, optlen))
return -EFAULT;
if (copy_to_user(optval, key, len))
--
2.16.2
next prev parent reply other threads:[~2018-12-14 22:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-14 22:40 [PATCH net-next 0/5] tcp: Introduce a TFO key-pool for clean cookie-rotation Christoph Paasch
2018-12-14 22:40 ` [PATCH net-next 1/5] tcp: Create list of TFO-contexts Christoph Paasch
2018-12-17 6:31 ` Eric Dumazet
2018-12-17 15:49 ` Christoph Paasch
2018-12-17 16:07 ` Eric Dumazet
2018-12-17 16:04 ` Eric Dumazet
2018-12-17 21:57 ` Christoph Paasch
2018-12-17 22:01 ` Eric Dumazet
2018-12-17 22:50 ` Christoph Paasch
2018-12-14 22:40 ` [PATCH net-next 2/5] tcp: TFO: search for correct cookie and accept data Christoph Paasch
2018-12-17 6:30 ` Eric Dumazet
2018-12-17 22:59 ` Christoph Paasch
2018-12-14 22:40 ` [PATCH net-next 3/5] tcp: Print list of TFO-keys from proc Christoph Paasch
2018-12-17 6:32 ` Eric Dumazet
2018-12-17 16:52 ` Yuchung Cheng
2018-12-17 23:35 ` Christoph Paasch
2018-12-17 23:49 ` Yuchung Cheng
2018-12-14 22:40 ` Christoph Paasch [this message]
2018-12-14 22:40 ` [PATCH net-next 5/5] tcp: TFO - cleanup code duplication Christoph Paasch
2018-12-17 6:33 ` Eric Dumazet
2018-12-18 0:16 ` Christoph Paasch
2018-12-16 20:19 ` [PATCH net-next 0/5] tcp: Introduce a TFO key-pool for clean cookie-rotation David Miller
2018-12-17 5:54 ` Eric Dumazet
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=20181214224007.54813-5-cpaasch@apple.com \
--to=cpaasch@apple.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=netdev@vger.kernel.org \
--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).