diff options
author | William Allen Simpson <william.allen.simpson@gmail.com> | 2009-12-02 13:07:39 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-12-03 01:07:23 -0500 |
commit | e6b4d11367519bc71729c09d05a126b133c755be (patch) | |
tree | b5d99b115a6ca9564d367b243a826d8b09da237e /net/ipv4/tcp_ipv4.c | |
parent | e00484023ebe94dce03fdd1270edf3e191c2bc79 (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/ipv4/tcp_ipv4.c')
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index df18ce04f41e..649a36d99c73 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -742,8 +742,9 @@ static void tcp_v4_reqsk_send_ack(struct sock *sk, struct sk_buff *skb, | |||
742 | * This still operates on a request_sock only, not on a big | 742 | * This still operates on a request_sock only, not on a big |
743 | * socket. | 743 | * socket. |
744 | */ | 744 | */ |
745 | static int __tcp_v4_send_synack(struct sock *sk, struct request_sock *req, | 745 | static int __tcp_v4_send_synack(struct sock *sk, struct dst_entry *dst, |
746 | struct dst_entry *dst) | 746 | struct request_sock *req, |
747 | struct request_values *rvp) | ||
747 | { | 748 | { |
748 | const struct inet_request_sock *ireq = inet_rsk(req); | 749 | const struct inet_request_sock *ireq = inet_rsk(req); |
749 | int err = -1; | 750 | int err = -1; |
@@ -753,7 +754,7 @@ static int __tcp_v4_send_synack(struct sock *sk, struct request_sock *req, | |||
753 | if (!dst && (dst = inet_csk_route_req(sk, req)) == NULL) | 754 | if (!dst && (dst = inet_csk_route_req(sk, req)) == NULL) |
754 | return -1; | 755 | return -1; |
755 | 756 | ||
756 | skb = tcp_make_synack(sk, dst, req); | 757 | skb = tcp_make_synack(sk, dst, req, rvp); |
757 | 758 | ||
758 | if (skb) { | 759 | if (skb) { |
759 | struct tcphdr *th = tcp_hdr(skb); | 760 | struct tcphdr *th = tcp_hdr(skb); |
@@ -774,9 +775,10 @@ static int __tcp_v4_send_synack(struct sock *sk, struct request_sock *req, | |||
774 | return err; | 775 | return err; |
775 | } | 776 | } |
776 | 777 | ||
777 | static int tcp_v4_send_synack(struct sock *sk, struct request_sock *req) | 778 | static int tcp_v4_send_synack(struct sock *sk, struct request_sock *req, |
779 | struct request_values *rvp) | ||
778 | { | 780 | { |
779 | return __tcp_v4_send_synack(sk, req, NULL); | 781 | return __tcp_v4_send_synack(sk, NULL, req, rvp); |
780 | } | 782 | } |
781 | 783 | ||
782 | /* | 784 | /* |
@@ -1211,13 +1213,13 @@ static struct timewait_sock_ops tcp_timewait_sock_ops = { | |||
1211 | 1213 | ||
1212 | int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | 1214 | int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) |
1213 | { | 1215 | { |
1214 | struct inet_request_sock *ireq; | ||
1215 | struct tcp_options_received tmp_opt; | 1216 | struct tcp_options_received tmp_opt; |
1216 | struct request_sock *req; | 1217 | struct request_sock *req; |
1218 | struct inet_request_sock *ireq; | ||
1219 | struct dst_entry *dst = NULL; | ||
1217 | __be32 saddr = ip_hdr(skb)->saddr; | 1220 | __be32 saddr = ip_hdr(skb)->saddr; |
1218 | __be32 daddr = ip_hdr(skb)->daddr; | 1221 | __be32 daddr = ip_hdr(skb)->daddr; |
1219 | __u32 isn = TCP_SKB_CB(skb)->when; | 1222 | __u32 isn = TCP_SKB_CB(skb)->when; |
1220 | struct dst_entry *dst = NULL; | ||
1221 | #ifdef CONFIG_SYN_COOKIES | 1223 | #ifdef CONFIG_SYN_COOKIES |
1222 | int want_cookie = 0; | 1224 | int want_cookie = 0; |
1223 | #else | 1225 | #else |
@@ -1337,7 +1339,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1337 | } | 1339 | } |
1338 | tcp_rsk(req)->snt_isn = isn; | 1340 | tcp_rsk(req)->snt_isn = isn; |
1339 | 1341 | ||
1340 | if (__tcp_v4_send_synack(sk, req, dst) || want_cookie) | 1342 | if (__tcp_v4_send_synack(sk, dst, req, NULL) || want_cookie) |
1341 | goto drop_and_free; | 1343 | goto drop_and_free; |
1342 | 1344 | ||
1343 | inet_csk_reqsk_queue_hash_add(sk, req, TCP_TIMEOUT_INIT); | 1345 | inet_csk_reqsk_queue_hash_add(sk, req, TCP_TIMEOUT_INIT); |