aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_minisocks.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@ghostprotocols.net>2005-08-09 23:10:42 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-08-29 18:43:19 -0400
commit463c84b97f24010a67cd871746d6a7e4c925a5f9 (patch)
tree48df67ede4ebb5d12b3c0ae55d72531574bd51a6 /net/ipv4/tcp_minisocks.c
parent87d11ceb9deb7a3f13fdee6e89d9bb6be7d27a71 (diff)
[NET]: Introduce inet_connection_sock
This creates struct inet_connection_sock, moving members out of struct tcp_sock that are shareable with other INET connection oriented protocols, such as DCCP, that in my private tree already uses most of these members. The functions that operate on these members were renamed, using a inet_csk_ prefix while not being moved yet to a new file, so as to ease the review of these changes. Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_minisocks.c')
-rw-r--r--net/ipv4/tcp_minisocks.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 8b6cd8d80662..56823704eb7d 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -271,7 +271,8 @@ void tcp_time_wait(struct sock *sk, int state, int timeo)
271 271
272 if (tw != NULL) { 272 if (tw != NULL) {
273 struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw); 273 struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw);
274 const int rto = (tp->rto << 2) - (tp->rto >> 1); 274 const struct inet_connection_sock *icsk = inet_csk(sk);
275 const int rto = (icsk->icsk_rto << 2) - (icsk->icsk_rto >> 1);
275 276
276 tw->tw_rcv_wscale = tp->rx_opt.rcv_wscale; 277 tw->tw_rcv_wscale = tp->rx_opt.rcv_wscale;
277 tcptw->tw_rcv_nxt = tp->rcv_nxt; 278 tcptw->tw_rcv_nxt = tp->rcv_nxt;
@@ -605,10 +606,11 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
605 struct inet_request_sock *ireq = inet_rsk(req); 606 struct inet_request_sock *ireq = inet_rsk(req);
606 struct tcp_request_sock *treq = tcp_rsk(req); 607 struct tcp_request_sock *treq = tcp_rsk(req);
607 struct inet_sock *newinet = inet_sk(newsk); 608 struct inet_sock *newinet = inet_sk(newsk);
609 struct inet_connection_sock *newicsk = inet_csk(newsk);
608 struct tcp_sock *newtp; 610 struct tcp_sock *newtp;
609 611
610 newsk->sk_state = TCP_SYN_RECV; 612 newsk->sk_state = TCP_SYN_RECV;
611 newinet->bind_hash = NULL; 613 newicsk->icsk_bind_hash = NULL;
612 614
613 /* Clone the TCP header template */ 615 /* Clone the TCP header template */
614 newinet->dport = ireq->rmt_port; 616 newinet->dport = ireq->rmt_port;
@@ -624,11 +626,11 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
624 626
625 tcp_init_wl(newtp, treq->snt_isn, treq->rcv_isn); 627 tcp_init_wl(newtp, treq->snt_isn, treq->rcv_isn);
626 628
627 newtp->retransmits = 0; 629 newicsk->icsk_retransmits = 0;
628 newtp->backoff = 0; 630 newicsk->icsk_backoff = 0;
629 newtp->srtt = 0; 631 newtp->srtt = 0;
630 newtp->mdev = TCP_TIMEOUT_INIT; 632 newtp->mdev = TCP_TIMEOUT_INIT;
631 newtp->rto = TCP_TIMEOUT_INIT; 633 newicsk->icsk_rto = TCP_TIMEOUT_INIT;
632 634
633 newtp->packets_out = 0; 635 newtp->packets_out = 0;
634 newtp->left_out = 0; 636 newtp->left_out = 0;
@@ -667,11 +669,11 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
667 newtp->rx_opt.num_sacks = 0; 669 newtp->rx_opt.num_sacks = 0;
668 newtp->urg_data = 0; 670 newtp->urg_data = 0;
669 /* Deinitialize accept_queue to trap illegal accesses. */ 671 /* Deinitialize accept_queue to trap illegal accesses. */
670 memset(&newtp->accept_queue, 0, sizeof(newtp->accept_queue)); 672 memset(&newicsk->icsk_accept_queue, 0, sizeof(newicsk->icsk_accept_queue));
671 673
672 if (sock_flag(newsk, SOCK_KEEPOPEN)) 674 if (sock_flag(newsk, SOCK_KEEPOPEN))
673 tcp_reset_keepalive_timer(newsk, 675 inet_csk_reset_keepalive_timer(newsk,
674 keepalive_time_when(newtp)); 676 keepalive_time_when(newtp));
675 677
676 newtp->rx_opt.tstamp_ok = ireq->tstamp_ok; 678 newtp->rx_opt.tstamp_ok = ireq->tstamp_ok;
677 if((newtp->rx_opt.sack_ok = ireq->sack_ok) != 0) { 679 if((newtp->rx_opt.sack_ok = ireq->sack_ok) != 0) {
@@ -701,7 +703,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
701 newtp->tcp_header_len = sizeof(struct tcphdr); 703 newtp->tcp_header_len = sizeof(struct tcphdr);
702 } 704 }
703 if (skb->len >= TCP_MIN_RCVMSS+newtp->tcp_header_len) 705 if (skb->len >= TCP_MIN_RCVMSS+newtp->tcp_header_len)
704 newtp->ack.last_seg_size = skb->len-newtp->tcp_header_len; 706 newicsk->icsk_ack.last_seg_size = skb->len - newtp->tcp_header_len;
705 newtp->rx_opt.mss_clamp = req->mss; 707 newtp->rx_opt.mss_clamp = req->mss;
706 TCP_ECN_openreq_child(newtp, req); 708 TCP_ECN_openreq_child(newtp, req);
707 if (newtp->ecn_flags&TCP_ECN_OK) 709 if (newtp->ecn_flags&TCP_ECN_OK)
@@ -881,10 +883,10 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
881 if (child == NULL) 883 if (child == NULL)
882 goto listen_overflow; 884 goto listen_overflow;
883 885
884 tcp_synq_unlink(tp, req, prev); 886 inet_csk_reqsk_queue_unlink(sk, req, prev);
885 tcp_synq_removed(sk, req); 887 inet_csk_reqsk_queue_removed(sk, req);
886 888
887 tcp_acceptq_queue(sk, req, child); 889 inet_csk_reqsk_queue_add(sk, req, child);
888 return child; 890 return child;
889 891
890 listen_overflow: 892 listen_overflow:
@@ -898,7 +900,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
898 if (!(flg & TCP_FLAG_RST)) 900 if (!(flg & TCP_FLAG_RST))
899 req->rsk_ops->send_reset(skb); 901 req->rsk_ops->send_reset(skb);
900 902
901 tcp_synq_drop(sk, req, prev); 903 inet_csk_reqsk_queue_drop(sk, req, prev);
902 return NULL; 904 return NULL;
903} 905}
904 906