ipv4: Remove the 'publish' logic in tcp_fastopen_init_key_once
The 'publish' logic is not necessary after commit dfea2aa654
("tcp:
Do not call tcp_fastopen_reset_cipher from interrupt context"), because
in tcp_fastopen_cookie_gen,it wouldn't call tcp_fastopen_init_key_once.
Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e1cfcbe82b
commit
dd000598a3
|
@ -1555,7 +1555,7 @@ void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb);
|
||||||
struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb,
|
struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb,
|
||||||
struct request_sock *req,
|
struct request_sock *req,
|
||||||
struct tcp_fastopen_cookie *foc);
|
struct tcp_fastopen_cookie *foc);
|
||||||
void tcp_fastopen_init_key_once(bool publish);
|
void tcp_fastopen_init_key_once(void);
|
||||||
bool tcp_fastopen_cookie_check(struct sock *sk, u16 *mss,
|
bool tcp_fastopen_cookie_check(struct sock *sk, u16 *mss,
|
||||||
struct tcp_fastopen_cookie *cookie);
|
struct tcp_fastopen_cookie *cookie);
|
||||||
bool tcp_fastopen_defer_connect(struct sock *sk, int *err);
|
bool tcp_fastopen_defer_connect(struct sock *sk, int *err);
|
||||||
|
|
|
@ -222,7 +222,7 @@ int inet_listen(struct socket *sock, int backlog)
|
||||||
(tcp_fastopen & TFO_SERVER_ENABLE) &&
|
(tcp_fastopen & TFO_SERVER_ENABLE) &&
|
||||||
!inet_csk(sk)->icsk_accept_queue.fastopenq.max_qlen) {
|
!inet_csk(sk)->icsk_accept_queue.fastopenq.max_qlen) {
|
||||||
fastopen_queue_tune(sk, backlog);
|
fastopen_queue_tune(sk, backlog);
|
||||||
tcp_fastopen_init_key_once(true);
|
tcp_fastopen_init_key_once();
|
||||||
}
|
}
|
||||||
|
|
||||||
err = inet_csk_listen_start(sk, backlog);
|
err = inet_csk_listen_start(sk, backlog);
|
||||||
|
|
|
@ -282,11 +282,6 @@ static int proc_tcp_fastopen_key(struct ctl_table *ctl, int write,
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto bad_key;
|
goto bad_key;
|
||||||
}
|
}
|
||||||
/* 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(user_key, TCP_FASTOPEN_KEY_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2749,7 +2749,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
|
||||||
case TCP_FASTOPEN:
|
case TCP_FASTOPEN:
|
||||||
if (val >= 0 && ((1 << sk->sk_state) & (TCPF_CLOSE |
|
if (val >= 0 && ((1 << sk->sk_state) & (TCPF_CLOSE |
|
||||||
TCPF_LISTEN))) {
|
TCPF_LISTEN))) {
|
||||||
tcp_fastopen_init_key_once(true);
|
tcp_fastopen_init_key_once();
|
||||||
|
|
||||||
fastopen_queue_tune(sk, val);
|
fastopen_queue_tune(sk, val);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -13,7 +13,7 @@ struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
|
||||||
|
|
||||||
static DEFINE_SPINLOCK(tcp_fastopen_ctx_lock);
|
static DEFINE_SPINLOCK(tcp_fastopen_ctx_lock);
|
||||||
|
|
||||||
void tcp_fastopen_init_key_once(bool publish)
|
void tcp_fastopen_init_key_once(void)
|
||||||
{
|
{
|
||||||
static u8 key[TCP_FASTOPEN_KEY_LENGTH];
|
static u8 key[TCP_FASTOPEN_KEY_LENGTH];
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ void tcp_fastopen_init_key_once(bool publish)
|
||||||
* All call sites of tcp_fastopen_cookie_gen also check
|
* All call sites of tcp_fastopen_cookie_gen also check
|
||||||
* for a valid cookie, so this is an acceptable risk.
|
* for a valid cookie, so this is an acceptable risk.
|
||||||
*/
|
*/
|
||||||
if (net_get_random_once(key, sizeof(key)) && publish)
|
if (net_get_random_once(key, sizeof(key)))
|
||||||
tcp_fastopen_reset_cipher(key, sizeof(key));
|
tcp_fastopen_reset_cipher(key, sizeof(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue