aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/tcp_ipv6.c
diff options
context:
space:
mode:
authorWilliam Allen Simpson <william.allen.simpson@gmail.com>2009-12-02 13:07:39 -0500
committerDavid S. Miller <davem@davemloft.net>2009-12-03 01:07:23 -0500
commite6b4d11367519bc71729c09d05a126b133c755be (patch)
treeb5d99b115a6ca9564d367b243a826d8b09da237e /net/ipv6/tcp_ipv6.c
parente00484023ebe94dce03fdd1270edf3e191c2bc79 (diff)
TCPCT part 1a: add request_values parameter for sending SYNACK
Add optional function parameters associated with sending SYNACK. These parameters are not needed after sending SYNACK, and are not used for retransmission. Avoids extending struct tcp_request_sock, and avoids allocating kernel memory. Also affects DCCP as it uses common struct request_sock_ops, but this parameter is currently reserved for future use. Signed-off-by: William.Allen.Simpson@gmail.com Acked-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r--net/ipv6/tcp_ipv6.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index de709091b26d..da6e24416d75 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -461,7 +461,8 @@ out:
461} 461}
462 462
463 463
464static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req) 464static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req,
465 struct request_values *rvp)
465{ 466{
466 struct inet6_request_sock *treq = inet6_rsk(req); 467 struct inet6_request_sock *treq = inet6_rsk(req);
467 struct ipv6_pinfo *np = inet6_sk(sk); 468 struct ipv6_pinfo *np = inet6_sk(sk);
@@ -499,7 +500,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req)
499 if ((err = xfrm_lookup(sock_net(sk), &dst, &fl, sk, 0)) < 0) 500 if ((err = xfrm_lookup(sock_net(sk), &dst, &fl, sk, 0)) < 0)
500 goto done; 501 goto done;
501 502
502 skb = tcp_make_synack(sk, dst, req); 503 skb = tcp_make_synack(sk, dst, req, rvp);
503 if (skb) { 504 if (skb) {
504 struct tcphdr *th = tcp_hdr(skb); 505 struct tcphdr *th = tcp_hdr(skb);
505 506
@@ -1161,13 +1162,13 @@ static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb)
1161 */ 1162 */
1162static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) 1163static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
1163{ 1164{
1165 struct tcp_options_received tmp_opt;
1166 struct request_sock *req;
1164 struct inet6_request_sock *treq; 1167 struct inet6_request_sock *treq;
1165 struct ipv6_pinfo *np = inet6_sk(sk); 1168 struct ipv6_pinfo *np = inet6_sk(sk);
1166 struct tcp_options_received tmp_opt;
1167 struct tcp_sock *tp = tcp_sk(sk); 1169 struct tcp_sock *tp = tcp_sk(sk);
1168 struct request_sock *req = NULL;
1169 __u32 isn = TCP_SKB_CB(skb)->when;
1170 struct dst_entry *dst = __sk_dst_get(sk); 1170 struct dst_entry *dst = __sk_dst_get(sk);
1171 __u32 isn = TCP_SKB_CB(skb)->when;
1171#ifdef CONFIG_SYN_COOKIES 1172#ifdef CONFIG_SYN_COOKIES
1172 int want_cookie = 0; 1173 int want_cookie = 0;
1173#else 1174#else
@@ -1239,23 +1240,19 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
1239 1240
1240 isn = tcp_v6_init_sequence(skb); 1241 isn = tcp_v6_init_sequence(skb);
1241 } 1242 }
1242
1243 tcp_rsk(req)->snt_isn = isn; 1243 tcp_rsk(req)->snt_isn = isn;
1244 1244
1245 security_inet_conn_request(sk, skb, req); 1245 security_inet_conn_request(sk, skb, req);
1246 1246
1247 if (tcp_v6_send_synack(sk, req)) 1247 if (tcp_v6_send_synack(sk, req, NULL) || want_cookie)
1248 goto drop; 1248 goto drop_and_free;
1249 1249
1250 if (!want_cookie) { 1250 inet6_csk_reqsk_queue_hash_add(sk, req, TCP_TIMEOUT_INIT);
1251 inet6_csk_reqsk_queue_hash_add(sk, req, TCP_TIMEOUT_INIT); 1251 return 0;
1252 return 0;
1253 }
1254 1252
1253drop_and_free:
1254 reqsk_free(req);
1255drop: 1255drop:
1256 if (req)
1257 reqsk_free(req);
1258
1259 return 0; /* don't send reset */ 1256 return 0; /* don't send reset */
1260} 1257}
1261 1258