View | Details | Raw Unified | Return to bug 176446 | Differences between
and this patch

Collapse All | Expand All

(-)sys/netinet/tcp_syncache.c (-2 / +36 lines)
Lines 97-102 Link Here
97
97
98
#include <security/mac/mac_framework.h>
98
#include <security/mac/mac_framework.h>
99
99
100
#include <sys/param.h>
101
#include <sys/stack.h>
102
#include <sys/types.h>
103
#include <sys/sbuf.h>
104
100
static VNET_DEFINE(int, tcp_syncookies) = 1;
105
static VNET_DEFINE(int, tcp_syncookies) = 1;
101
#define	V_tcp_syncookies		VNET(tcp_syncookies)
106
#define	V_tcp_syncookies		VNET(tcp_syncookies)
102
SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, syncookies, CTLFLAG_RW,
107
SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, syncookies, CTLFLAG_RW,
Lines 200-205 Link Here
200
#define	SCH_UNLOCK(sch)		mtx_unlock(&(sch)->sch_mtx)
205
#define	SCH_UNLOCK(sch)		mtx_unlock(&(sch)->sch_mtx)
201
#define	SCH_LOCK_ASSERT(sch)	mtx_assert(&(sch)->sch_mtx, MA_OWNED)
206
#define	SCH_LOCK_ASSERT(sch)	mtx_assert(&(sch)->sch_mtx, MA_OWNED)
202
207
208
struct stack *st;
209
struct mtx st_mtx;
210
struct sbuf st_sb;
211
char st_trace[65536];
212
203
/*
213
/*
204
 * Requires the syncache entry to be already removed from the bucket list.
214
 * Requires the syncache entry to be already removed from the bucket list.
205
 */
215
 */
Lines 223-228 Link Here
223
{
233
{
224
	int i;
234
	int i;
225
235
236
	st = stack_create();
237
	mtx_init(&st_mtx, "tcp_sc_stack", NULL, MTX_DEF);
238
	sbuf_new(&st_sb, st_trace, sizeof(st_trace), SBUF_FIXEDLEN);
239
226
	V_tcp_syncache.cache_count = 0;
240
	V_tcp_syncache.cache_count = 0;
227
	V_tcp_syncache.hashsize = TCP_SYNCACHE_HASHSIZE;
241
	V_tcp_syncache.hashsize = TCP_SYNCACHE_HASHSIZE;
228
	V_tcp_syncache.bucket_limit = TCP_SYNCACHE_BUCKETLIMIT;
242
	V_tcp_syncache.bucket_limit = TCP_SYNCACHE_BUCKETLIMIT;
Lines 277-282 Link Here
277
	struct syncache *sc, *nsc;
291
	struct syncache *sc, *nsc;
278
	int i;
292
	int i;
279
293
294
	sbuf_delete(&st_sb);
295
	mtx_destroy(&st_mtx);
296
	stack_destroy(st);
297
280
	/* Cleanup hash buckets: stop timers, free entries, destroy locks. */
298
	/* Cleanup hash buckets: stop timers, free entries, destroy locks. */
281
	for (i = 0; i < V_tcp_syncache.hashsize; i++) {
299
	for (i = 0; i < V_tcp_syncache.hashsize; i++) {
282
300
Lines 949-959 Link Here
949
967
950
	*lsop = syncache_socket(sc, *lsop, m);
968
	*lsop = syncache_socket(sc, *lsop, m);
951
969
952
	if (*lsop == NULL)
970
	if (*lsop == NULL) {
971
		if ((s = tcp_log_addrs(inc, th, NULL, NULL)))
972
			log(LOG_DEBUG, "%s; %s: SEQ %u, ACK %u, syncache_socket() "
973
			    "failed\n", s, __func__, th->th_seq, th->th_ack);
953
		TCPSTAT_INC(tcps_sc_aborted);
974
		TCPSTAT_INC(tcps_sc_aborted);
954
	else
975
        }
976
	else {
977
		if ((s = tcp_log_addrs(inc, th, NULL, NULL)))
978
			log(LOG_DEBUG, "%s; %s: SEQ %u, ACK %u, syncache_socket() "
979
			    "succeed\n", s, __func__, th->th_seq, th->th_ack);
955
		TCPSTAT_INC(tcps_sc_completed);
980
		TCPSTAT_INC(tcps_sc_completed);
981
	}
956
982
983
	mtx_lock(&st_mtx);
984
	stack_save(st);
985
	stack_sbuf_print(&st_sb, st);
986
	sbuf_finish(&st_sb);
987
	log(LOG_DEBUG, "%s", sbuf_data(&st_sb));
988
	sbuf_clear(&st_sb);
989
	mtx_unlock(&st_mtx);
990
957
/* how do we find the inp for the new socket? */
991
/* how do we find the inp for the new socket? */
958
	if (sc != &scs)
992
	if (sc != &scs)
959
		syncache_free(sc);
993
		syncache_free(sc);

Return to bug 176446