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
--- 16 unchanged lines hidden (view full) ---
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/netinet/tcp_timewait.c 204838 2010-03-07 15:58:44Z bz $");
34
35#include "opt_inet.h"
36#include "opt_inet6.h"
37#include "opt_tcpdebug.h"
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/callout.h>
--- 45 unchanged lines hidden (view full) ---
87#include <netinet/tcp_debug.h>
88#endif
89#include <netinet6/ip6protosw.h>
90
91#include <machine/in_cksum.h>
92
93#include <security/mac/mac_framework.h>
94
95static int maxtcptw;
96
97/*
98 * The timed wait queue contains references to each of the TCP sessions
99 * currently in the TIME_WAIT state. The queue pointers, including the
100 * queue pointers in each tcptw structure, are protected using the global
101 * tcbinfo lock, which must be held over queue iteration and modification.
102 */
103static VNET_DEFINE(uma_zone_t, tcptw_zone);
104static VNET_DEFINE(TAILQ_HEAD(, tcptw), twq_2msl);
105VNET_DEFINE(int, nolocaltimewait);
106
107#define V_tcptw_zone VNET(tcptw_zone)
108#define V_twq_2msl VNET(twq_2msl)
109
110static void tcp_tw_2msl_reset(struct tcptw *, int);
111static void tcp_tw_2msl_stop(struct tcptw *);
112
113static int
114tcptw_auto_size(void)
115{
--- 28 unchanged lines hidden (view full) ---
144 }
145 return (error);
146}
147
148SYSCTL_PROC(_net_inet_tcp, OID_AUTO, maxtcptw, CTLTYPE_INT|CTLFLAG_RW,
149 &maxtcptw, 0, sysctl_maxtcptw, "IU",
150 "Maximum number of compressed TCP TIME_WAIT entries");
151
152SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, nolocaltimewait, CTLFLAG_RW,
153 &VNET_NAME(nolocaltimewait), 0,
154 "Do not create compressed TCP TIME_WAIT entries for local connections");
155
156void
157tcp_tw_zone_change(void)
158{
159
--- 457 unchanged lines hidden ---
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
--- 16 unchanged lines hidden (view full) ---
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/netinet/tcp_timewait.c 204838 2010-03-07 15:58:44Z bz $");
34
35#include "opt_inet.h"
36#include "opt_inet6.h"
37#include "opt_tcpdebug.h"
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/callout.h>
--- 45 unchanged lines hidden (view full) ---
87#include <netinet/tcp_debug.h>
88#endif
89#include <netinet6/ip6protosw.h>
90
91#include <machine/in_cksum.h>
92
93#include <security/mac/mac_framework.h>
94
95static int maxtcptw;
96
97/*
98 * The timed wait queue contains references to each of the TCP sessions
99 * currently in the TIME_WAIT state. The queue pointers, including the
100 * queue pointers in each tcptw structure, are protected using the global
101 * tcbinfo lock, which must be held over queue iteration and modification.
102 */
103static VNET_DEFINE(uma_zone_t, tcptw_zone);
104static VNET_DEFINE(TAILQ_HEAD(, tcptw), twq_2msl);
105VNET_DEFINE(int, nolocaltimewait);
106
107#define V_tcptw_zone VNET(tcptw_zone)
108#define V_twq_2msl VNET(twq_2msl)
109
110static void tcp_tw_2msl_reset(struct tcptw *, int);
111static void tcp_tw_2msl_stop(struct tcptw *);
112
113static int
114tcptw_auto_size(void)
115{
--- 28 unchanged lines hidden (view full) ---
144 }
145 return (error);
146}
147
148SYSCTL_PROC(_net_inet_tcp, OID_AUTO, maxtcptw, CTLTYPE_INT|CTLFLAG_RW,
149 &maxtcptw, 0, sysctl_maxtcptw, "IU",
150 "Maximum number of compressed TCP TIME_WAIT entries");
151
152SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, nolocaltimewait, CTLFLAG_RW,
153 &VNET_NAME(nolocaltimewait), 0,
154 "Do not create compressed TCP TIME_WAIT entries for local connections");
155
156void
157tcp_tw_zone_change(void)
158{
159
--- 457 unchanged lines hidden ---