diff options
author | Octavian Purdila <octavian.purdila@intel.com> | 2014-06-25 10:09:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-06-27 18:53:36 -0400 |
commit | 5db92c994982ed826cf38f38d58bd09bc326aef6 (patch) | |
tree | a47f81307b287fa65edfef7b1bd94c21d8cd7f1f | |
parent | d6274bd8d6ea84b7b54cc1c3fde6bcb6143b104f (diff) |
tcp: unify tcp_v4_rtx_synack and tcp_v6_rtx_synack
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/tcp.h | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 14 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 15 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 15 |
4 files changed, 19 insertions, 27 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 8c05c25018d5..8e9c28dccb80 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -1573,6 +1573,8 @@ int tcp4_proc_init(void); | |||
1573 | void tcp4_proc_exit(void); | 1573 | void tcp4_proc_exit(void); |
1574 | #endif | 1574 | #endif |
1575 | 1575 | ||
1576 | int tcp_rtx_synack(struct sock *sk, struct request_sock *req); | ||
1577 | |||
1576 | /* TCP af-specific functions */ | 1578 | /* TCP af-specific functions */ |
1577 | struct tcp_sock_af_ops { | 1579 | struct tcp_sock_af_ops { |
1578 | #ifdef CONFIG_TCP_MD5SIG | 1580 | #ifdef CONFIG_TCP_MD5SIG |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index b5945ac50876..597dd9d75210 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -845,18 +845,6 @@ static int tcp_v4_send_synack(struct sock *sk, struct dst_entry *dst, | |||
845 | return err; | 845 | return err; |
846 | } | 846 | } |
847 | 847 | ||
848 | static int tcp_v4_rtx_synack(struct sock *sk, struct request_sock *req) | ||
849 | { | ||
850 | const struct tcp_request_sock_ops *af_ops = tcp_rsk(req)->af_specific; | ||
851 | int res = af_ops->send_synack(sk, NULL, NULL, req, 0, NULL); | ||
852 | |||
853 | if (!res) { | ||
854 | TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_RETRANSSEGS); | ||
855 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPSYNRETRANS); | ||
856 | } | ||
857 | return res; | ||
858 | } | ||
859 | |||
860 | /* | 848 | /* |
861 | * IPv4 request_sock destructor. | 849 | * IPv4 request_sock destructor. |
862 | */ | 850 | */ |
@@ -1269,7 +1257,7 @@ static struct dst_entry *tcp_v4_route_req(struct sock *sk, struct flowi *fl, | |||
1269 | struct request_sock_ops tcp_request_sock_ops __read_mostly = { | 1257 | struct request_sock_ops tcp_request_sock_ops __read_mostly = { |
1270 | .family = PF_INET, | 1258 | .family = PF_INET, |
1271 | .obj_size = sizeof(struct tcp_request_sock), | 1259 | .obj_size = sizeof(struct tcp_request_sock), |
1272 | .rtx_syn_ack = tcp_v4_rtx_synack, | 1260 | .rtx_syn_ack = tcp_rtx_synack, |
1273 | .send_ack = tcp_v4_reqsk_send_ack, | 1261 | .send_ack = tcp_v4_reqsk_send_ack, |
1274 | .destructor = tcp_v4_reqsk_destructor, | 1262 | .destructor = tcp_v4_reqsk_destructor, |
1275 | .send_reset = tcp_v4_send_reset, | 1263 | .send_reset = tcp_v4_send_reset, |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index d92bce0ea24e..f8f2a944a1ce 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -3299,3 +3299,18 @@ void tcp_send_probe0(struct sock *sk) | |||
3299 | TCP_RTO_MAX); | 3299 | TCP_RTO_MAX); |
3300 | } | 3300 | } |
3301 | } | 3301 | } |
3302 | |||
3303 | int tcp_rtx_synack(struct sock *sk, struct request_sock *req) | ||
3304 | { | ||
3305 | const struct tcp_request_sock_ops *af_ops = tcp_rsk(req)->af_specific; | ||
3306 | struct flowi fl; | ||
3307 | int res; | ||
3308 | |||
3309 | res = af_ops->send_synack(sk, NULL, &fl, req, 0, NULL); | ||
3310 | if (!res) { | ||
3311 | TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_RETRANSSEGS); | ||
3312 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPSYNRETRANS); | ||
3313 | } | ||
3314 | return res; | ||
3315 | } | ||
3316 | EXPORT_SYMBOL(tcp_rtx_synack); | ||
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 210b6105afed..41389bbb08c0 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -506,19 +506,6 @@ done: | |||
506 | return err; | 506 | return err; |
507 | } | 507 | } |
508 | 508 | ||
509 | static int tcp_v6_rtx_synack(struct sock *sk, struct request_sock *req) | ||
510 | { | ||
511 | const struct tcp_request_sock_ops *af_ops = tcp_rsk(req)->af_specific; | ||
512 | struct flowi fl; | ||
513 | int res; | ||
514 | |||
515 | res = af_ops->send_synack(sk, NULL, &fl, req, 0, NULL); | ||
516 | if (!res) { | ||
517 | TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_RETRANSSEGS); | ||
518 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPSYNRETRANS); | ||
519 | } | ||
520 | return res; | ||
521 | } | ||
522 | 509 | ||
523 | static void tcp_v6_reqsk_destructor(struct request_sock *req) | 510 | static void tcp_v6_reqsk_destructor(struct request_sock *req) |
524 | { | 511 | { |
@@ -759,7 +746,7 @@ static struct dst_entry *tcp_v6_route_req(struct sock *sk, struct flowi *fl, | |||
759 | struct request_sock_ops tcp6_request_sock_ops __read_mostly = { | 746 | struct request_sock_ops tcp6_request_sock_ops __read_mostly = { |
760 | .family = AF_INET6, | 747 | .family = AF_INET6, |
761 | .obj_size = sizeof(struct tcp6_request_sock), | 748 | .obj_size = sizeof(struct tcp6_request_sock), |
762 | .rtx_syn_ack = tcp_v6_rtx_synack, | 749 | .rtx_syn_ack = tcp_rtx_synack, |
763 | .send_ack = tcp_v6_reqsk_send_ack, | 750 | .send_ack = tcp_v6_reqsk_send_ack, |
764 | .destructor = tcp_v6_reqsk_destructor, | 751 | .destructor = tcp_v6_reqsk_destructor, |
765 | .send_reset = tcp_v6_send_reset, | 752 | .send_reset = tcp_v6_send_reset, |