aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-10-05 00:08:11 -0400
committerDavid S. Miller <davem@davemloft.net>2015-10-05 05:45:27 -0400
commita1a5344ddbe8fd3e080013b317ac9a664490cfdf (patch)
tree75c793a05dd64db3df05f804e429bae45ead20d1 /net/ipv4/tcp_input.c
parent004a5d0140ce1d05c1f5fce5df4baa2717a330e0 (diff)
tcp: avoid two atomic ops for syncookies
inet_reqsk_alloc() is used to allocate a temporary request in order to generate a SYNACK with a cookie. Then later, syncookie validation also uses a temporary request. These paths already took a reference on listener refcount, we can avoid a couple of atomic operations. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a95c8eb04ff7..ddadb318e850 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -6042,9 +6042,11 @@ static void tcp_openreq_init(struct request_sock *req,
6042} 6042}
6043 6043
6044struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops, 6044struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops,
6045 struct sock *sk_listener) 6045 struct sock *sk_listener,
6046 bool attach_listener)
6046{ 6047{
6047 struct request_sock *req = reqsk_alloc(ops, sk_listener); 6048 struct request_sock *req = reqsk_alloc(ops, sk_listener,
6049 attach_listener);
6048 6050
6049 if (req) { 6051 if (req) {
6050 struct inet_request_sock *ireq = inet_rsk(req); 6052 struct inet_request_sock *ireq = inet_rsk(req);
@@ -6143,7 +6145,7 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
6143 goto drop; 6145 goto drop;
6144 } 6146 }
6145 6147
6146 req = inet_reqsk_alloc(rsk_ops, sk); 6148 req = inet_reqsk_alloc(rsk_ops, sk, !want_cookie);
6147 if (!req) 6149 if (!req)
6148 goto drop; 6150 goto drop;
6149 6151