tcp_timewait.c (121850) | tcp_timewait.c (121884) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 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 * @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95 | 1/* 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 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 * @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95 |
34 * $FreeBSD: head/sys/netinet/tcp_timewait.c 121850 2003-11-01 07:30:08Z silby $ | 34 * $FreeBSD: head/sys/netinet/tcp_timewait.c 121884 2003-11-02 07:47:03Z silby $ |
35 */ 36 37#include "opt_compat.h" 38#include "opt_inet6.h" 39#include "opt_ipsec.h" 40#include "opt_mac.h" 41#include "opt_tcpdebug.h" 42 --- 1590 unchanged lines hidden (view full) --- 1633 (TF_REQ_TSTMP|TF_RCVD_TSTMP)) 1634 tw->t_recent = tp->ts_recent; 1635 else 1636 tw->t_recent = 0; 1637 1638 tw->snd_nxt = tp->snd_nxt; 1639 tw->rcv_nxt = tp->rcv_nxt; 1640 tw->iss = tp->iss; | 35 */ 36 37#include "opt_compat.h" 38#include "opt_inet6.h" 39#include "opt_ipsec.h" 40#include "opt_mac.h" 41#include "opt_tcpdebug.h" 42 --- 1590 unchanged lines hidden (view full) --- 1633 (TF_REQ_TSTMP|TF_RCVD_TSTMP)) 1634 tw->t_recent = tp->ts_recent; 1635 else 1636 tw->t_recent = 0; 1637 1638 tw->snd_nxt = tp->snd_nxt; 1639 tw->rcv_nxt = tp->rcv_nxt; 1640 tw->iss = tp->iss; |
1641 tw->irs = tp->irs; |
|
1641 tw->cc_recv = tp->cc_recv; 1642 tw->cc_send = tp->cc_send; 1643 tw->t_starttime = tp->t_starttime; 1644 tw->tw_time = 0; 1645 1646/* XXX 1647 * If this code will 1648 * be used for fin-wait-2 state also, then we may need --- 19 unchanged lines hidden (view full) --- 1668 inp->inp_socket = NULL; 1669 inp->inp_ppcb = (caddr_t)tw; 1670 inp->inp_vflag |= INP_TIMEWAIT; 1671 tcp_timer_2msl_reset(tw, tw_time); 1672 INP_UNLOCK(inp); 1673} 1674 1675/* | 1642 tw->cc_recv = tp->cc_recv; 1643 tw->cc_send = tp->cc_send; 1644 tw->t_starttime = tp->t_starttime; 1645 tw->tw_time = 0; 1646 1647/* XXX 1648 * If this code will 1649 * be used for fin-wait-2 state also, then we may need --- 19 unchanged lines hidden (view full) --- 1669 inp->inp_socket = NULL; 1670 inp->inp_ppcb = (caddr_t)tw; 1671 inp->inp_vflag |= INP_TIMEWAIT; 1672 tcp_timer_2msl_reset(tw, tw_time); 1673 INP_UNLOCK(inp); 1674} 1675 1676/* |
1677 * The appromixate rate of ISN increase of Microsoft TCP stacks; 1678 * the actual rate is slightly higher due to the addition of 1679 * random positive increments. 1680 * 1681 * Most other new OSes use semi-randomized ISN values, so we 1682 * do not need to worry about them. 1683 */ 1684#define MS_ISN_BYTES_PER_SECOND 250000 1685 1686/* |
|
1676 * Determine if the ISN we will generate has advanced beyond the last 1677 * sequence number used by the previous connection. If so, indicate 1678 * that it is safe to recycle this tw socket by returning 1. 1679 */ 1680int 1681tcp_twrecycleable(struct tcptw *tw) 1682{ | 1687 * Determine if the ISN we will generate has advanced beyond the last 1688 * sequence number used by the previous connection. If so, indicate 1689 * that it is safe to recycle this tw socket by returning 1. 1690 */ 1691int 1692tcp_twrecycleable(struct tcptw *tw) 1693{ |
1683 tcp_seq new_isn = tw->iss; | 1694 tcp_seq new_iss = tw->iss; 1695 tcp_seq new_irs = tw->irs; |
1684 | 1696 |
1685 new_isn += (ticks - tw->t_starttime) * (ISN_BYTES_PER_SECOND / hz); | 1697 new_iss += (ticks - tw->t_starttime) * (ISN_BYTES_PER_SECOND / hz); 1698 new_irs += (ticks - tw->t_starttime) * (MS_ISN_BYTES_PER_SECOND / hz); |
1686 | 1699 |
1687 if (SEQ_GT(new_isn, tw->snd_nxt)) | 1700 if (SEQ_GT(new_iss, tw->snd_nxt) && SEQ_GT(new_irs, tw->rcv_nxt)) |
1688 return 1; 1689 else 1690 return 0; 1691} 1692 1693struct tcptw * 1694tcp_twclose(struct tcptw *tw, int reuse) 1695{ --- 279 unchanged lines hidden --- | 1701 return 1; 1702 else 1703 return 0; 1704} 1705 1706struct tcptw * 1707tcp_twclose(struct tcptw *tw, int reuse) 1708{ --- 279 unchanged lines hidden --- |