diff options
author | Willy Tarreau <w@1wt.eu> | 2020-08-16 15:54:17 +0200 |
---|---|---|
committer | Willy Tarreau <w@1wt.eu> | 2020-08-16 15:54:17 +0200 |
commit | be94527a39bf9a5b3c0e80be8fafb11118dea00e (patch) | |
tree | d410822a9843c3a5319edd34c5466174c62d5e2f | |
parent | 53533922b12fec1dab3f4534d63d089483ffb97d (diff) | |
download | prandom-20200816-siphash-noise.tar.gz |
WIP: tcp: reuse incoming skb hash in tcp_conn_request()20200816-siphash-noise
From Eric:
"looking more closely to tcp_conn_request(), there might be a way
to remove the prandom_u32() call when we generate a syncookie,
reflecting incoming skb hash (if already populated)"
-rw-r--r-- | net/ipv4/tcp_input.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 184ea556f50e35..fc698a8ea13b1b 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -6740,10 +6740,12 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops, isn = cookie_init_sequence(af_ops, sk, skb, &req->mss); if (!tmp_opt.tstamp_ok) inet_rsk(req)->ecn_ok = 0; + tcp_rsk(req)->txhash = skb->hash ?: 1; + } else { + tcp_rsk(req)->txhash = net_tx_rndhash(); } tcp_rsk(req)->snt_isn = isn; - tcp_rsk(req)->txhash = net_tx_rndhash(); tcp_openreq_init_rwin(req, sk, dst); sk_rx_queue_set(req_to_sk(req), skb); if (!want_cookie) { |