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 207369 2010-04-29 11:52:42Z 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 VNET_DEFINE(uma_zone_t, tcptw_zone);
96#define V_tcptw_zone VNET(tcptw_zone)
97static int maxtcptw;
98
99/*
100 * The timed wait queue contains references to each of the TCP sessions
101 * currently in the TIME_WAIT state. The queue pointers, including the
102 * queue pointers in each tcptw structure, are protected using the global
103 * tcbinfo lock, which must be held over queue iteration and modification.
104 */
105static VNET_DEFINE(TAILQ_HEAD(, tcptw), twq_2msl);
106#define V_twq_2msl VNET(twq_2msl)
107
108static void tcp_tw_2msl_reset(struct tcptw *, int);
109static void tcp_tw_2msl_stop(struct tcptw *);
110
111static int
112tcptw_auto_size(void)
113{
--- 28 unchanged lines hidden (view full) ---
142 }
143 return (error);
144}
145
146SYSCTL_PROC(_net_inet_tcp, OID_AUTO, maxtcptw, CTLTYPE_INT|CTLFLAG_RW,
147 &maxtcptw, 0, sysctl_maxtcptw, "IU",
148 "Maximum number of compressed TCP TIME_WAIT entries");
149
150VNET_DEFINE(int, nolocaltimewait) = 0;
151#define V_nolocaltimewait VNET(nolocaltimewait)
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 207369 2010-04-29 11:52:42Z 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 VNET_DEFINE(uma_zone_t, tcptw_zone);
96#define V_tcptw_zone VNET(tcptw_zone)
97static int maxtcptw;
98
99/*
100 * The timed wait queue contains references to each of the TCP sessions
101 * currently in the TIME_WAIT state. The queue pointers, including the
102 * queue pointers in each tcptw structure, are protected using the global
103 * tcbinfo lock, which must be held over queue iteration and modification.
104 */
105static VNET_DEFINE(TAILQ_HEAD(, tcptw), twq_2msl);
106#define V_twq_2msl VNET(twq_2msl)
107
108static void tcp_tw_2msl_reset(struct tcptw *, int);
109static void tcp_tw_2msl_stop(struct tcptw *);
110
111static int
112tcptw_auto_size(void)
113{
--- 28 unchanged lines hidden (view full) ---
142 }
143 return (error);
144}
145
146SYSCTL_PROC(_net_inet_tcp, OID_AUTO, maxtcptw, CTLTYPE_INT|CTLFLAG_RW,
147 &maxtcptw, 0, sysctl_maxtcptw, "IU",
148 "Maximum number of compressed TCP TIME_WAIT entries");
149
150VNET_DEFINE(int, nolocaltimewait) = 0;
151#define V_nolocaltimewait VNET(nolocaltimewait)
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 ---