tcp_usrreq.c (50477) | tcp_usrreq.c (50673) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94 | 1/* 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94 |
34 * $FreeBSD: head/sys/netinet/tcp_usrreq.c 50477 1999-08-28 01:08:13Z peter $ | 34 * $FreeBSD: head/sys/netinet/tcp_usrreq.c 50673 1999-08-30 21:17:07Z jlemon $ |
35 */ 36 37#include "opt_tcpdebug.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/kernel.h> 42#include <sys/sysctl.h> --- 489 unchanged lines hidden (view full) --- 532 oinp = in_pcblookup_hash(inp->inp_pcbinfo, 533 sin->sin_addr, sin->sin_port, 534 inp->inp_laddr.s_addr != INADDR_ANY ? inp->inp_laddr 535 : ifaddr->sin_addr, 536 inp->inp_lport, 0); 537 if (oinp) { 538 if (oinp != inp && (otp = intotcpcb(oinp)) != NULL && 539 otp->t_state == TCPS_TIME_WAIT && | 35 */ 36 37#include "opt_tcpdebug.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/kernel.h> 42#include <sys/sysctl.h> --- 489 unchanged lines hidden (view full) --- 532 oinp = in_pcblookup_hash(inp->inp_pcbinfo, 533 sin->sin_addr, sin->sin_port, 534 inp->inp_laddr.s_addr != INADDR_ANY ? inp->inp_laddr 535 : ifaddr->sin_addr, 536 inp->inp_lport, 0); 537 if (oinp) { 538 if (oinp != inp && (otp = intotcpcb(oinp)) != NULL && 539 otp->t_state == TCPS_TIME_WAIT && |
540 otp->t_duration < TCPTV_MSL && | 540 (ticks - otp->t_starttime) < tcp_msl && |
541 (otp->t_flags & TF_RCVD_CC)) 542 otp = tcp_close(otp); 543 else 544 return EADDRINUSE; 545 } 546 if (inp->inp_laddr.s_addr == INADDR_ANY) 547 inp->inp_laddr = ifaddr->sin_addr; 548 inp->inp_faddr = sin->sin_addr; --- 9 unchanged lines hidden (view full) --- 558 /* Compute window scaling to request. */ 559 while (tp->request_r_scale < TCP_MAX_WINSHIFT && 560 (TCP_MAXWIN << tp->request_r_scale) < so->so_rcv.sb_hiwat) 561 tp->request_r_scale++; 562 563 soisconnecting(so); 564 tcpstat.tcps_connattempt++; 565 tp->t_state = TCPS_SYN_SENT; | 541 (otp->t_flags & TF_RCVD_CC)) 542 otp = tcp_close(otp); 543 else 544 return EADDRINUSE; 545 } 546 if (inp->inp_laddr.s_addr == INADDR_ANY) 547 inp->inp_laddr = ifaddr->sin_addr; 548 inp->inp_faddr = sin->sin_addr; --- 9 unchanged lines hidden (view full) --- 558 /* Compute window scaling to request. */ 559 while (tp->request_r_scale < TCP_MAX_WINSHIFT && 560 (TCP_MAXWIN << tp->request_r_scale) < so->so_rcv.sb_hiwat) 561 tp->request_r_scale++; 562 563 soisconnecting(so); 564 tcpstat.tcps_connattempt++; 565 tp->t_state = TCPS_SYN_SENT; |
566 tp->t_timer[TCPT_KEEP] = tcp_keepinit; | 566 callout_reset(tp->tt_keep, tcp_keepinit, tcp_timer_keep, tp); |
567 tp->iss = tcp_iss; tcp_iss += TCP_ISSINCR/2; 568 tcp_sendseqinit(tp); 569 570 /* 571 * Generate a CC value for this connection and 572 * check whether CC or CCnew should be used. 573 */ 574 if ((taop = tcp_gettaocache(tp->t_inpcb)) == NULL) { --- 230 unchanged lines hidden (view full) --- 805 case TCPS_CLOSE_WAIT: 806 tp->t_state = TCPS_LAST_ACK; 807 break; 808 } 809 if (tp && tp->t_state >= TCPS_FIN_WAIT_2) { 810 soisdisconnected(tp->t_inpcb->inp_socket); 811 /* To prevent the connection hanging in FIN_WAIT_2 forever. */ 812 if (tp->t_state == TCPS_FIN_WAIT_2) | 567 tp->iss = tcp_iss; tcp_iss += TCP_ISSINCR/2; 568 tcp_sendseqinit(tp); 569 570 /* 571 * Generate a CC value for this connection and 572 * check whether CC or CCnew should be used. 573 */ 574 if ((taop = tcp_gettaocache(tp->t_inpcb)) == NULL) { --- 230 unchanged lines hidden (view full) --- 805 case TCPS_CLOSE_WAIT: 806 tp->t_state = TCPS_LAST_ACK; 807 break; 808 } 809 if (tp && tp->t_state >= TCPS_FIN_WAIT_2) { 810 soisdisconnected(tp->t_inpcb->inp_socket); 811 /* To prevent the connection hanging in FIN_WAIT_2 forever. */ 812 if (tp->t_state == TCPS_FIN_WAIT_2) |
813 tp->t_timer[TCPT_2MSL] = tcp_maxidle; | 813 callout_reset(tp->tt_2msl, tcp_maxidle, 814 tcp_timer_2msl, tp); |
814 } 815 return (tp); 816} 817 | 815 } 816 return (tp); 817} 818 |