diff options
author | Denis V. Lunev <den@openvz.org> | 2008-02-29 14:43:03 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-02-29 14:43:03 -0500 |
commit | fd80eb942ad9761f241c9b287b3b9a342b20690d (patch) | |
tree | 664b7a2351dab82419ccf7fa91e6f89ede52065c | |
parent | 58fbbed4fbc0094fc808a568fe99a915f85402ee (diff) |
[INET]: Remove struct dst_entry *dst from request_sock_ops.rtx_syn_ack.
It looks like dst parameter is used in this API due to historical
reasons. Actually, it is really used in the direct call to
tcp_v4_send_synack only. So, create a wrapper for tcp_v4_send_synack
and remove dst from rtx_syn_ack.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/request_sock.h | 3 | ||||
-rw-r--r-- | net/dccp/ipv4.c | 11 | ||||
-rw-r--r-- | net/dccp/ipv6.c | 38 | ||||
-rw-r--r-- | net/dccp/minisocks.c | 2 | ||||
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 14 | ||||
-rw-r--r-- | net/ipv4/tcp_minisocks.c | 2 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 36 |
8 files changed, 53 insertions, 55 deletions
diff --git a/include/net/request_sock.h b/include/net/request_sock.h index cff4608179c1..040780add355 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h | |||
@@ -31,8 +31,7 @@ struct request_sock_ops { | |||
31 | int obj_size; | 31 | int obj_size; |
32 | struct kmem_cache *slab; | 32 | struct kmem_cache *slab; |
33 | int (*rtx_syn_ack)(struct sock *sk, | 33 | int (*rtx_syn_ack)(struct sock *sk, |
34 | struct request_sock *req, | 34 | struct request_sock *req); |
35 | struct dst_entry *dst); | ||
36 | void (*send_ack)(struct sk_buff *skb, | 35 | void (*send_ack)(struct sk_buff *skb, |
37 | struct request_sock *req); | 36 | struct request_sock *req); |
38 | void (*send_reset)(struct sock *sk, | 37 | void (*send_reset)(struct sock *sk, |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 474075adbde4..514a40b7fc7f 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -471,15 +471,14 @@ static struct dst_entry* dccp_v4_route_skb(struct sock *sk, | |||
471 | return &rt->u.dst; | 471 | return &rt->u.dst; |
472 | } | 472 | } |
473 | 473 | ||
474 | static int dccp_v4_send_response(struct sock *sk, struct request_sock *req, | 474 | static int dccp_v4_send_response(struct sock *sk, struct request_sock *req) |
475 | struct dst_entry *dst) | ||
476 | { | 475 | { |
477 | int err = -1; | 476 | int err = -1; |
478 | struct sk_buff *skb; | 477 | struct sk_buff *skb; |
478 | struct dst_entry *dst; | ||
479 | 479 | ||
480 | /* First, grab a route. */ | 480 | dst = inet_csk_route_req(sk, req); |
481 | 481 | if (dst == NULL) | |
482 | if (dst == NULL && (dst = inet_csk_route_req(sk, req)) == NULL) | ||
483 | goto out; | 482 | goto out; |
484 | 483 | ||
485 | skb = dccp_make_response(sk, dst, req); | 484 | skb = dccp_make_response(sk, dst, req); |
@@ -620,7 +619,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
620 | dreq->dreq_iss = dccp_v4_init_sequence(skb); | 619 | dreq->dreq_iss = dccp_v4_init_sequence(skb); |
621 | dreq->dreq_service = service; | 620 | dreq->dreq_service = service; |
622 | 621 | ||
623 | if (dccp_v4_send_response(sk, req, NULL)) | 622 | if (dccp_v4_send_response(sk, req)) |
624 | goto drop_and_free; | 623 | goto drop_and_free; |
625 | 624 | ||
626 | inet_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT); | 625 | inet_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT); |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 490333d47c7b..1a5e50b90677 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -224,8 +224,7 @@ out: | |||
224 | } | 224 | } |
225 | 225 | ||
226 | 226 | ||
227 | static int dccp_v6_send_response(struct sock *sk, struct request_sock *req, | 227 | static int dccp_v6_send_response(struct sock *sk, struct request_sock *req) |
228 | struct dst_entry *dst) | ||
229 | { | 228 | { |
230 | struct inet6_request_sock *ireq6 = inet6_rsk(req); | 229 | struct inet6_request_sock *ireq6 = inet6_rsk(req); |
231 | struct ipv6_pinfo *np = inet6_sk(sk); | 230 | struct ipv6_pinfo *np = inet6_sk(sk); |
@@ -234,6 +233,7 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req, | |||
234 | struct in6_addr *final_p = NULL, final; | 233 | struct in6_addr *final_p = NULL, final; |
235 | struct flowi fl; | 234 | struct flowi fl; |
236 | int err = -1; | 235 | int err = -1; |
236 | struct dst_entry *dst; | ||
237 | 237 | ||
238 | memset(&fl, 0, sizeof(fl)); | 238 | memset(&fl, 0, sizeof(fl)); |
239 | fl.proto = IPPROTO_DCCP; | 239 | fl.proto = IPPROTO_DCCP; |
@@ -245,28 +245,26 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req, | |||
245 | fl.fl_ip_sport = inet_sk(sk)->sport; | 245 | fl.fl_ip_sport = inet_sk(sk)->sport; |
246 | security_req_classify_flow(req, &fl); | 246 | security_req_classify_flow(req, &fl); |
247 | 247 | ||
248 | if (dst == NULL) { | 248 | opt = np->opt; |
249 | opt = np->opt; | ||
250 | 249 | ||
251 | if (opt != NULL && opt->srcrt != NULL) { | 250 | if (opt != NULL && opt->srcrt != NULL) { |
252 | const struct rt0_hdr *rt0 = (struct rt0_hdr *)opt->srcrt; | 251 | const struct rt0_hdr *rt0 = (struct rt0_hdr *)opt->srcrt; |
253 | 252 | ||
254 | ipv6_addr_copy(&final, &fl.fl6_dst); | 253 | ipv6_addr_copy(&final, &fl.fl6_dst); |
255 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | 254 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); |
256 | final_p = &final; | 255 | final_p = &final; |
257 | } | 256 | } |
258 | 257 | ||
259 | err = ip6_dst_lookup(sk, &dst, &fl); | 258 | err = ip6_dst_lookup(sk, &dst, &fl); |
260 | if (err) | 259 | if (err) |
261 | goto done; | 260 | goto done; |
262 | 261 | ||
263 | if (final_p) | 262 | if (final_p) |
264 | ipv6_addr_copy(&fl.fl6_dst, final_p); | 263 | ipv6_addr_copy(&fl.fl6_dst, final_p); |
265 | 264 | ||
266 | err = xfrm_lookup(&dst, &fl, sk, 0); | 265 | err = xfrm_lookup(&dst, &fl, sk, 0); |
267 | if (err < 0) | 266 | if (err < 0) |
268 | goto done; | 267 | goto done; |
269 | } | ||
270 | 268 | ||
271 | skb = dccp_make_response(sk, dst, req); | 269 | skb = dccp_make_response(sk, dst, req); |
272 | if (skb != NULL) { | 270 | if (skb != NULL) { |
@@ -448,7 +446,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
448 | dreq->dreq_iss = dccp_v6_init_sequence(skb); | 446 | dreq->dreq_iss = dccp_v6_init_sequence(skb); |
449 | dreq->dreq_service = service; | 447 | dreq->dreq_service = service; |
450 | 448 | ||
451 | if (dccp_v6_send_response(sk, req, NULL)) | 449 | if (dccp_v6_send_response(sk, req)) |
452 | goto drop_and_free; | 450 | goto drop_and_free; |
453 | 451 | ||
454 | inet6_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT); | 452 | inet6_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT); |
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c index 027d1814e1ab..33ad48321b08 100644 --- a/net/dccp/minisocks.c +++ b/net/dccp/minisocks.c | |||
@@ -216,7 +216,7 @@ struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb, | |||
216 | * counter (backoff, monitored by dccp_response_timer). | 216 | * counter (backoff, monitored by dccp_response_timer). |
217 | */ | 217 | */ |
218 | req->retrans++; | 218 | req->retrans++; |
219 | req->rsk_ops->rtx_syn_ack(sk, req, NULL); | 219 | req->rsk_ops->rtx_syn_ack(sk, req); |
220 | } | 220 | } |
221 | /* Network Duplicate, discard packet */ | 221 | /* Network Duplicate, discard packet */ |
222 | return NULL; | 222 | return NULL; |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index b189278c7bc1..c0e0fa03fce1 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -463,7 +463,7 @@ void inet_csk_reqsk_queue_prune(struct sock *parent, | |||
463 | if (time_after_eq(now, req->expires)) { | 463 | if (time_after_eq(now, req->expires)) { |
464 | if ((req->retrans < thresh || | 464 | if ((req->retrans < thresh || |
465 | (inet_rsk(req)->acked && req->retrans < max_retries)) | 465 | (inet_rsk(req)->acked && req->retrans < max_retries)) |
466 | && !req->rsk_ops->rtx_syn_ack(parent, req, NULL)) { | 466 | && !req->rsk_ops->rtx_syn_ack(parent, req)) { |
467 | unsigned long timeo; | 467 | unsigned long timeo; |
468 | 468 | ||
469 | if (req->retrans++ == 0) | 469 | if (req->retrans++ == 0) |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 256032a41069..3b26f9586dcb 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -723,8 +723,8 @@ static void tcp_v4_reqsk_send_ack(struct sk_buff *skb, | |||
723 | * This still operates on a request_sock only, not on a big | 723 | * This still operates on a request_sock only, not on a big |
724 | * socket. | 724 | * socket. |
725 | */ | 725 | */ |
726 | static int tcp_v4_send_synack(struct sock *sk, struct request_sock *req, | 726 | static int __tcp_v4_send_synack(struct sock *sk, struct request_sock *req, |
727 | struct dst_entry *dst) | 727 | struct dst_entry *dst) |
728 | { | 728 | { |
729 | const struct inet_request_sock *ireq = inet_rsk(req); | 729 | const struct inet_request_sock *ireq = inet_rsk(req); |
730 | int err = -1; | 730 | int err = -1; |
@@ -732,7 +732,7 @@ static int tcp_v4_send_synack(struct sock *sk, struct request_sock *req, | |||
732 | 732 | ||
733 | /* First, grab a route. */ | 733 | /* First, grab a route. */ |
734 | if (!dst && (dst = inet_csk_route_req(sk, req)) == NULL) | 734 | if (!dst && (dst = inet_csk_route_req(sk, req)) == NULL) |
735 | goto out; | 735 | return -1; |
736 | 736 | ||
737 | skb = tcp_make_synack(sk, dst, req); | 737 | skb = tcp_make_synack(sk, dst, req); |
738 | 738 | ||
@@ -751,11 +751,15 @@ static int tcp_v4_send_synack(struct sock *sk, struct request_sock *req, | |||
751 | err = net_xmit_eval(err); | 751 | err = net_xmit_eval(err); |
752 | } | 752 | } |
753 | 753 | ||
754 | out: | ||
755 | dst_release(dst); | 754 | dst_release(dst); |
756 | return err; | 755 | return err; |
757 | } | 756 | } |
758 | 757 | ||
758 | static int tcp_v4_send_synack(struct sock *sk, struct request_sock *req) | ||
759 | { | ||
760 | return __tcp_v4_send_synack(sk, req, NULL); | ||
761 | } | ||
762 | |||
759 | /* | 763 | /* |
760 | * IPv4 request_sock destructor. | 764 | * IPv4 request_sock destructor. |
761 | */ | 765 | */ |
@@ -1380,7 +1384,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1380 | } | 1384 | } |
1381 | tcp_rsk(req)->snt_isn = isn; | 1385 | tcp_rsk(req)->snt_isn = isn; |
1382 | 1386 | ||
1383 | if (tcp_v4_send_synack(sk, req, dst)) | 1387 | if (__tcp_v4_send_synack(sk, req, dst)) |
1384 | goto drop_and_free; | 1388 | goto drop_and_free; |
1385 | 1389 | ||
1386 | if (want_cookie) { | 1390 | if (want_cookie) { |
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index b61b76847ad9..0fdd1db641ac 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
@@ -536,7 +536,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb, | |||
536 | * Enforce "SYN-ACK" according to figure 8, figure 6 | 536 | * Enforce "SYN-ACK" according to figure 8, figure 6 |
537 | * of RFC793, fixed by RFC1122. | 537 | * of RFC793, fixed by RFC1122. |
538 | */ | 538 | */ |
539 | req->rsk_ops->rtx_syn_ack(sk, req, NULL); | 539 | req->rsk_ops->rtx_syn_ack(sk, req); |
540 | return NULL; | 540 | return NULL; |
541 | } | 541 | } |
542 | 542 | ||
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 12750f2b05ab..1cbbb87dbad2 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -455,8 +455,7 @@ out: | |||
455 | } | 455 | } |
456 | 456 | ||
457 | 457 | ||
458 | static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req, | 458 | static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req) |
459 | struct dst_entry *dst) | ||
460 | { | 459 | { |
461 | struct inet6_request_sock *treq = inet6_rsk(req); | 460 | struct inet6_request_sock *treq = inet6_rsk(req); |
462 | struct ipv6_pinfo *np = inet6_sk(sk); | 461 | struct ipv6_pinfo *np = inet6_sk(sk); |
@@ -464,6 +463,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req, | |||
464 | struct ipv6_txoptions *opt = NULL; | 463 | struct ipv6_txoptions *opt = NULL; |
465 | struct in6_addr * final_p = NULL, final; | 464 | struct in6_addr * final_p = NULL, final; |
466 | struct flowi fl; | 465 | struct flowi fl; |
466 | struct dst_entry *dst; | ||
467 | int err = -1; | 467 | int err = -1; |
468 | 468 | ||
469 | memset(&fl, 0, sizeof(fl)); | 469 | memset(&fl, 0, sizeof(fl)); |
@@ -476,24 +476,22 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req, | |||
476 | fl.fl_ip_sport = inet_sk(sk)->sport; | 476 | fl.fl_ip_sport = inet_sk(sk)->sport; |
477 | security_req_classify_flow(req, &fl); | 477 | security_req_classify_flow(req, &fl); |
478 | 478 | ||
479 | if (dst == NULL) { | 479 | opt = np->opt; |
480 | opt = np->opt; | 480 | if (opt && opt->srcrt) { |
481 | if (opt && opt->srcrt) { | 481 | struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt; |
482 | struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt; | 482 | ipv6_addr_copy(&final, &fl.fl6_dst); |
483 | ipv6_addr_copy(&final, &fl.fl6_dst); | 483 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); |
484 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | 484 | final_p = &final; |
485 | final_p = &final; | ||
486 | } | ||
487 | |||
488 | err = ip6_dst_lookup(sk, &dst, &fl); | ||
489 | if (err) | ||
490 | goto done; | ||
491 | if (final_p) | ||
492 | ipv6_addr_copy(&fl.fl6_dst, final_p); | ||
493 | if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) | ||
494 | goto done; | ||
495 | } | 485 | } |
496 | 486 | ||
487 | err = ip6_dst_lookup(sk, &dst, &fl); | ||
488 | if (err) | ||
489 | goto done; | ||
490 | if (final_p) | ||
491 | ipv6_addr_copy(&fl.fl6_dst, final_p); | ||
492 | if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) | ||
493 | goto done; | ||
494 | |||
497 | skb = tcp_make_synack(sk, dst, req); | 495 | skb = tcp_make_synack(sk, dst, req); |
498 | if (skb) { | 496 | if (skb) { |
499 | struct tcphdr *th = tcp_hdr(skb); | 497 | struct tcphdr *th = tcp_hdr(skb); |
@@ -1294,7 +1292,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1294 | 1292 | ||
1295 | security_inet_conn_request(sk, skb, req); | 1293 | security_inet_conn_request(sk, skb, req); |
1296 | 1294 | ||
1297 | if (tcp_v6_send_synack(sk, req, NULL)) | 1295 | if (tcp_v6_send_synack(sk, req)) |
1298 | goto drop; | 1296 | goto drop; |
1299 | 1297 | ||
1300 | inet6_csk_reqsk_queue_hash_add(sk, req, TCP_TIMEOUT_INIT); | 1298 | inet6_csk_reqsk_queue_hash_add(sk, req, TCP_TIMEOUT_INIT); |