aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_minisocks.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 12:26:46 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 12:26:46 -0400
commit15c54033964a943de7b0763efd3bd0ede7326395 (patch)
tree840b292612d1b5396d5bab5bde537a9013db3ceb /net/ipv4/tcp_minisocks.c
parentad5da3cf39a5b11a198929be1f2644e17ecd767e (diff)
parent912a41a4ab935ce8c4308428ec13fc7f8b1f18f4 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (448 commits) [IPV4] nl_fib_lookup: Initialise res.r before fib_res_put(&res) [IPV6]: Fix thinko in ipv6_rthdr_rcv() changes. [IPV4]: Add multipath cached to feature-removal-schedule.txt [WIRELESS] cfg80211: Clarify locking comment. [WIRELESS] cfg80211: Fix locking in wiphy_new. [WEXT] net_device: Don't include wext bits if not required. [WEXT]: Misc code cleanups. [WEXT]: Reduce inline abuse. [WEXT]: Move EXPORT_SYMBOL statements where they belong. [WEXT]: Cleanup early ioctl call path. [WEXT]: Remove options. [WEXT]: Remove dead debug code. [WEXT]: Clean up how wext is called. [WEXT]: Move to net/wireless [AFS]: Eliminate cmpxchg() usage in vlocation code. [RXRPC]: Fix pointers passed to bitops. [RXRPC]: Remove bogus atomic_* overrides. [AFS]: Fix u64 printing in debug logging. [AFS]: Add "directory write" support. [AFS]: Implement the CB.InitCallBackState3 operation. ...
Diffstat (limited to 'net/ipv4/tcp_minisocks.c')
-rw-r--r--net/ipv4/tcp_minisocks.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 6b5c64f3c925..a12b08fca5ad 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -149,7 +149,7 @@ kill_with_rst:
149 tw->tw_substate = TCP_TIME_WAIT; 149 tw->tw_substate = TCP_TIME_WAIT;
150 tcptw->tw_rcv_nxt = TCP_SKB_CB(skb)->end_seq; 150 tcptw->tw_rcv_nxt = TCP_SKB_CB(skb)->end_seq;
151 if (tmp_opt.saw_tstamp) { 151 if (tmp_opt.saw_tstamp) {
152 tcptw->tw_ts_recent_stamp = xtime.tv_sec; 152 tcptw->tw_ts_recent_stamp = get_seconds();
153 tcptw->tw_ts_recent = tmp_opt.rcv_tsval; 153 tcptw->tw_ts_recent = tmp_opt.rcv_tsval;
154 } 154 }
155 155
@@ -208,7 +208,7 @@ kill:
208 208
209 if (tmp_opt.saw_tstamp) { 209 if (tmp_opt.saw_tstamp) {
210 tcptw->tw_ts_recent = tmp_opt.rcv_tsval; 210 tcptw->tw_ts_recent = tmp_opt.rcv_tsval;
211 tcptw->tw_ts_recent_stamp = xtime.tv_sec; 211 tcptw->tw_ts_recent_stamp = get_seconds();
212 } 212 }
213 213
214 inet_twsk_put(tw); 214 inet_twsk_put(tw);
@@ -246,7 +246,7 @@ kill:
246 if (paws_reject) 246 if (paws_reject)
247 NET_INC_STATS_BH(LINUX_MIB_PAWSESTABREJECTED); 247 NET_INC_STATS_BH(LINUX_MIB_PAWSESTABREJECTED);
248 248
249 if(!th->rst) { 249 if (!th->rst) {
250 /* In this case we must reset the TIMEWAIT timer. 250 /* In this case we must reset the TIMEWAIT timer.
251 * 251 *
252 * If it is ACKless SYN it may be both old duplicate 252 * If it is ACKless SYN it may be both old duplicate
@@ -324,7 +324,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo)
324 if (tcp_alloc_md5sig_pool() == NULL) 324 if (tcp_alloc_md5sig_pool() == NULL)
325 BUG(); 325 BUG();
326 } 326 }
327 } while(0); 327 } while (0);
328#endif 328#endif
329 329
330 /* Linkage updates. */ 330 /* Linkage updates. */
@@ -387,8 +387,8 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
387 /* Now setup tcp_sock */ 387 /* Now setup tcp_sock */
388 newtp = tcp_sk(newsk); 388 newtp = tcp_sk(newsk);
389 newtp->pred_flags = 0; 389 newtp->pred_flags = 0;
390 newtp->rcv_nxt = treq->rcv_isn + 1; 390 newtp->rcv_wup = newtp->copied_seq = newtp->rcv_nxt = treq->rcv_isn + 1;
391 newtp->snd_nxt = newtp->snd_una = newtp->snd_sml = treq->snt_isn + 1; 391 newtp->snd_sml = newtp->snd_una = newtp->snd_nxt = treq->snt_isn + 1;
392 392
393 tcp_prequeue_init(newtp); 393 tcp_prequeue_init(newtp);
394 394
@@ -422,10 +422,8 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
422 tcp_set_ca_state(newsk, TCP_CA_Open); 422 tcp_set_ca_state(newsk, TCP_CA_Open);
423 tcp_init_xmit_timers(newsk); 423 tcp_init_xmit_timers(newsk);
424 skb_queue_head_init(&newtp->out_of_order_queue); 424 skb_queue_head_init(&newtp->out_of_order_queue);
425 newtp->rcv_wup = treq->rcv_isn + 1;
426 newtp->write_seq = treq->snt_isn + 1; 425 newtp->write_seq = treq->snt_isn + 1;
427 newtp->pushed_seq = newtp->write_seq; 426 newtp->pushed_seq = newtp->write_seq;
428 newtp->copied_seq = treq->rcv_isn + 1;
429 427
430 newtp->rx_opt.saw_tstamp = 0; 428 newtp->rx_opt.saw_tstamp = 0;
431 429
@@ -440,7 +438,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
440 keepalive_time_when(newtp)); 438 keepalive_time_when(newtp));
441 439
442 newtp->rx_opt.tstamp_ok = ireq->tstamp_ok; 440 newtp->rx_opt.tstamp_ok = ireq->tstamp_ok;
443 if((newtp->rx_opt.sack_ok = ireq->sack_ok) != 0) { 441 if ((newtp->rx_opt.sack_ok = ireq->sack_ok) != 0) {
444 if (sysctl_tcp_fack) 442 if (sysctl_tcp_fack)
445 newtp->rx_opt.sack_ok |= 2; 443 newtp->rx_opt.sack_ok |= 2;
446 } 444 }
@@ -455,12 +453,13 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
455 newtp->rx_opt.snd_wscale = newtp->rx_opt.rcv_wscale = 0; 453 newtp->rx_opt.snd_wscale = newtp->rx_opt.rcv_wscale = 0;
456 newtp->window_clamp = min(newtp->window_clamp, 65535U); 454 newtp->window_clamp = min(newtp->window_clamp, 65535U);
457 } 455 }
458 newtp->snd_wnd = ntohs(skb->h.th->window) << newtp->rx_opt.snd_wscale; 456 newtp->snd_wnd = (ntohs(tcp_hdr(skb)->window) <<
457 newtp->rx_opt.snd_wscale);
459 newtp->max_window = newtp->snd_wnd; 458 newtp->max_window = newtp->snd_wnd;
460 459
461 if (newtp->rx_opt.tstamp_ok) { 460 if (newtp->rx_opt.tstamp_ok) {
462 newtp->rx_opt.ts_recent = req->ts_recent; 461 newtp->rx_opt.ts_recent = req->ts_recent;
463 newtp->rx_opt.ts_recent_stamp = xtime.tv_sec; 462 newtp->rx_opt.ts_recent_stamp = get_seconds();
464 newtp->tcp_header_len = sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED; 463 newtp->tcp_header_len = sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED;
465 } else { 464 } else {
466 newtp->rx_opt.ts_recent_stamp = 0; 465 newtp->rx_opt.ts_recent_stamp = 0;
@@ -490,7 +489,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
490 struct request_sock *req, 489 struct request_sock *req,
491 struct request_sock **prev) 490 struct request_sock **prev)
492{ 491{
493 struct tcphdr *th = skb->h.th; 492 const struct tcphdr *th = tcp_hdr(skb);
494 __be32 flg = tcp_flag_word(th) & (TCP_FLAG_RST|TCP_FLAG_SYN|TCP_FLAG_ACK); 493 __be32 flg = tcp_flag_word(th) & (TCP_FLAG_RST|TCP_FLAG_SYN|TCP_FLAG_ACK);
495 int paws_reject = 0; 494 int paws_reject = 0;
496 struct tcp_options_received tmp_opt; 495 struct tcp_options_received tmp_opt;
@@ -506,7 +505,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
506 * it can be estimated (approximately) 505 * it can be estimated (approximately)
507 * from another data. 506 * from another data.
508 */ 507 */
509 tmp_opt.ts_recent_stamp = xtime.tv_sec - ((TCP_TIMEOUT_INIT/HZ)<<req->retrans); 508 tmp_opt.ts_recent_stamp = get_seconds() - ((TCP_TIMEOUT_INIT/HZ)<<req->retrans);
510 paws_reject = tcp_paws_check(&tmp_opt, th->rst); 509 paws_reject = tcp_paws_check(&tmp_opt, th->rst);
511 } 510 }
512 } 511 }
@@ -712,8 +711,8 @@ int tcp_child_process(struct sock *parent, struct sock *child,
712 int state = child->sk_state; 711 int state = child->sk_state;
713 712
714 if (!sock_owned_by_user(child)) { 713 if (!sock_owned_by_user(child)) {
715 ret = tcp_rcv_state_process(child, skb, skb->h.th, skb->len); 714 ret = tcp_rcv_state_process(child, skb, tcp_hdr(skb),
716 715 skb->len);
717 /* Wakeup parent, send SIGIO */ 716 /* Wakeup parent, send SIGIO */
718 if (state == TCP_SYN_RECV && child->sk_state != state) 717 if (state == TCP_SYN_RECV && child->sk_state != state)
719 parent->sk_data_ready(parent, 0); 718 parent->sk_data_ready(parent, 0);