Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1739419
| From | 严海双 <yanhaishuang@cmss.chinamobile.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 2/3] ipv4: Namespaceify tcp_fastopen_key knob |
| Date | 2017-09-26 03:30 +0200 |
| Message-ID | <utMRc-65i-5@gated-at.bofh.it> (permalink) |
| References | <uswv7-6Hm-7@gated-at.bofh.it> <uswv8-6Hm-13@gated-at.bofh.it> <utKZ4-4P8-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> On 2017年9月26日, at 上午7:24, David Miller <davem@davemloft.net> wrote:
>
> From: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
> Date: Fri, 22 Sep 2017 21:48:43 +0800
>
>> @@ -9,13 +9,18 @@
>> #include <net/inetpeer.h>
>> #include <net/tcp.h>
>>
>> -struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
>> -
>> -static DEFINE_SPINLOCK(tcp_fastopen_ctx_lock);
>> -
>> -void tcp_fastopen_init_key_once(bool publish)
>> +void tcp_fastopen_init_key_once(struct net *net)
>
> Why did you remove the 'publish' logic from this function?
>
I think this logic is not necessary now, in proc_tcp_fastopen_key, I have removed
tcp_fastopen_init_key_once(false) where the ‘publish’ is false:
- /* Generate a dummy secret but don't publish it. This
- * is needed so we don't regenerate a new key on the
- * first invocation of tcp_fastopen_cookie_gen
- */
- tcp_fastopen_init_key_once(false);
- tcp_fastopen_reset_cipher(user_key, TCP_FASTOPEN_KEY_LENGTH);
+ tcp_fastopen_reset_cipher(net, user_key, TCP_FASTOPEN_KEY_LENGTH);
It said we don't regenerate a new key on first invocation of tcp_fastopen_cookie_gen,
but in tcp_fastopen_cookie_gen,it didn’t call tcp_fastopen_init_key_once since
from commit dfea2aa654243 (tcp: Do not call tcp_fastopen_reset_cipher from interrupt context):
And in other places where call tcp_fastopen_init_key_once, the ‘publish’ is always true:
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -222,7 +222,7 @@ int inet_listen(struct socket *sock, int backlog)
(tcp_fastopen & TFO_SERVER_ENABLE) &&
!inet_csk(sk)->icsk_accept_queue.fastopenq.max_qlen) {
fastopen_queue_tune(sk, backlog);
- tcp_fastopen_init_key_once(true);
+ tcp_fastopen_init_key_once(sock_net(sk));
}
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2749,7 +2749,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
case TCP_FASTOPEN:
if (val >= 0 && ((1 << sk->sk_state) & (TCPF_CLOSE |
TCPF_LISTEN))) {
- tcp_fastopen_init_key_once(true);
+ tcp_fastopen_init_key_once(net);
fastopen_queue_tune(sk, val);
} else {
So I deleted ‘publish’ logic to ensure it was always true.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v4 1/3] ipv4: Namespaceify tcp_fastopen knob Haishuang Yan <yanhaishuang@cmss.chinamobile.com> - 2017-09-22 15:50 +0200
[PATCH v4 3/3] ipv4: Namespaceify tcp_fastopen_blackhole_timeout knob Haishuang Yan <yanhaishuang@cmss.chinamobile.com> - 2017-09-22 15:50 +0200
[PATCH v4 2/3] ipv4: Namespaceify tcp_fastopen_key knob Haishuang Yan <yanhaishuang@cmss.chinamobile.com> - 2017-09-22 15:50 +0200
Re: [PATCH v4 2/3] ipv4: Namespaceify tcp_fastopen_key knob David Miller <davem@davemloft.net> - 2017-09-26 01:30 +0200
Re: [PATCH v4 2/3] ipv4: Namespaceify tcp_fastopen_key knob 严海双 <yanhaishuang@cmss.chinamobile.com> - 2017-09-26 03:30 +0200
csiph-web