mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
tcp: simplify fast open cookie processing
Consolidate various cookie checking and generation code to simplify the fast open processing. The main goal is to reduce code duplication in tcp_v4_conn_request() for IPv6 support. Removes two experimental sysctl flags TFO_SERVER_ALWAYS and TFO_SERVER_COOKIE_NOT_CHKD used primarily for developmental debugging purposes. Signed-off-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Daniel Lee <longinus00@gmail.com> Signed-off-by: Jerry Chu <hkchu@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
5b7ed0892f
commit
89278c9dc9
5 changed files with 33 additions and 64 deletions
|
@ -1273,7 +1273,6 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
|
|||
bool want_cookie = false;
|
||||
struct flowi4 fl4;
|
||||
struct tcp_fastopen_cookie foc = { .len = -1 };
|
||||
struct tcp_fastopen_cookie valid_foc = { .len = -1 };
|
||||
struct sk_buff *skb_synack;
|
||||
int do_fastopen;
|
||||
|
||||
|
@ -1381,7 +1380,8 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
|
|||
if (dst == NULL)
|
||||
goto drop_and_free;
|
||||
}
|
||||
do_fastopen = tcp_fastopen_check(sk, skb, req, &foc, &valid_foc);
|
||||
do_fastopen = !want_cookie &&
|
||||
tcp_fastopen_check(sk, skb, req, &foc);
|
||||
|
||||
/* We don't call tcp_v4_send_synack() directly because we need
|
||||
* to make sure a child socket can be created successfully before
|
||||
|
@ -1394,8 +1394,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
|
|||
* latter to remove its dependency on the current implementation
|
||||
* of tcp_v4_send_synack()->tcp_select_initial_window().
|
||||
*/
|
||||
skb_synack = tcp_make_synack(sk, dst, req,
|
||||
fastopen_cookie_present(&valid_foc) ? &valid_foc : NULL);
|
||||
skb_synack = tcp_make_synack(sk, dst, req, &foc);
|
||||
|
||||
if (skb_synack) {
|
||||
__tcp_v4_send_check(skb_synack, ireq->ir_loc_addr, ireq->ir_rmt_addr);
|
||||
|
@ -1415,9 +1414,6 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
|
|||
tcp_rsk(req)->listener = NULL;
|
||||
/* Add the request_sock to the SYN table */
|
||||
inet_csk_reqsk_queue_hash_add(sk, req, TCP_TIMEOUT_INIT);
|
||||
if (fastopen_cookie_present(&foc) && foc.len != 0)
|
||||
NET_INC_STATS_BH(sock_net(sk),
|
||||
LINUX_MIB_TCPFASTOPENPASSIVEFAIL);
|
||||
} else if (tcp_fastopen_create_child(sk, skb, skb_synack, req))
|
||||
goto drop_and_release;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue