13448Sdh155122 /* 23448Sdh155122 * CDDL HEADER START 33448Sdh155122 * 43448Sdh155122 * The contents of this file are subject to the terms of the 53448Sdh155122 * Common Development and Distribution License (the "License"). 63448Sdh155122 * You may not use this file except in compliance with the License. 73448Sdh155122 * 83448Sdh155122 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 93448Sdh155122 * or http://www.opensolaris.org/os/licensing. 103448Sdh155122 * See the License for the specific language governing permissions 113448Sdh155122 * and limitations under the License. 123448Sdh155122 * 133448Sdh155122 * When distributing Covered Code, include this CDDL HEADER in each 143448Sdh155122 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 153448Sdh155122 * If applicable, add the following below this CDDL HEADER, with the 163448Sdh155122 * fields enclosed by brackets "[]" replaced with your own identifying 173448Sdh155122 * information: Portions Copyright [yyyy] [name of copyright owner] 183448Sdh155122 * 193448Sdh155122 * CDDL HEADER END 203448Sdh155122 */ 213448Sdh155122 223448Sdh155122 /* 23*12869SKacheong.Poon@Sun.COM * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 243448Sdh155122 */ 253448Sdh155122 263448Sdh155122 #ifndef _INET_TCP_STACK_H 273448Sdh155122 #define _INET_TCP_STACK_H 283448Sdh155122 293448Sdh155122 #include <sys/netstack.h> 303448Sdh155122 #include <inet/ip.h> 313448Sdh155122 #include <inet/ipdrop.h> 3211754SKacheong.Poon@Sun.COM #include <inet/tcp_stats.h> 338348SEric.Yu@Sun.COM #include <sys/sunddi.h> 348348SEric.Yu@Sun.COM #include <sys/sunldi.h> 353448Sdh155122 363448Sdh155122 #ifdef __cplusplus 373448Sdh155122 extern "C" { 383448Sdh155122 #endif 393448Sdh155122 403448Sdh155122 #ifdef _KERNEL 413448Sdh155122 423448Sdh155122 /* 433448Sdh155122 * TCP stack instances 443448Sdh155122 */ 453448Sdh155122 struct tcp_stack { 463448Sdh155122 netstack_t *tcps_netstack; /* Common netstack */ 473448Sdh155122 483448Sdh155122 /* 493448Sdh155122 * Extra privileged ports. In host byte order. 503448Sdh155122 * Protected by tcp_epriv_port_lock. 513448Sdh155122 */ 523448Sdh155122 #define TCP_NUM_EPRIV_PORTS 64 533448Sdh155122 int tcps_g_num_epriv_ports; 5412016SGirish.Moodalbail@Sun.COM in_port_t tcps_g_epriv_ports[TCP_NUM_EPRIV_PORTS]; 553448Sdh155122 kmutex_t tcps_epriv_port_lock; 563448Sdh155122 573448Sdh155122 /* 583448Sdh155122 * The smallest anonymous port in the priviledged port range which TCP 593448Sdh155122 * looks for free port. Use in the option TCP_ANONPRIVBIND. 603448Sdh155122 */ 613448Sdh155122 in_port_t tcps_min_anonpriv_port; 623448Sdh155122 6312016SGirish.Moodalbail@Sun.COM /* holds the tcp tunables */ 6412016SGirish.Moodalbail@Sun.COM struct mod_prop_info_s *tcps_propinfo_tbl; 653448Sdh155122 663448Sdh155122 /* Hint not protected by any lock */ 673448Sdh155122 uint_t tcps_next_port_to_try; 683448Sdh155122 693448Sdh155122 /* TCP bind hash list - all tcp_t with state >= BOUND. */ 703448Sdh155122 struct tf_s *tcps_bind_fanout; 713448Sdh155122 723448Sdh155122 /* TCP queue hash list - all tcp_t in case they will be an acceptor. */ 733448Sdh155122 struct tf_s *tcps_acceptor_fanout; 743448Sdh155122 753448Sdh155122 /* 763448Sdh155122 * MIB-2 stuff for SNMP 773448Sdh155122 * Note: tcpInErrs {tcp 15} is accumulated in ip.c 783448Sdh155122 */ 79*12869SKacheong.Poon@Sun.COM kstat_t *tcps_mibkp; /* kstat exporting mib2_tcp_t data */ 80*12869SKacheong.Poon@Sun.COM kstat_t *tcps_kstat; /* kstat exporting tcp_stat_t data */ 813448Sdh155122 823448Sdh155122 uint32_t tcps_iss_incr_extra; 833448Sdh155122 /* Incremented for each connection */ 843448Sdh155122 kmutex_t tcps_iss_key_lock; 853448Sdh155122 MD5_CTX tcps_iss_key; 863448Sdh155122 873448Sdh155122 /* Packet dropper for TCP IPsec policy drops. */ 883448Sdh155122 ipdropper_t tcps_dropper; 893448Sdh155122 903448Sdh155122 /* 913448Sdh155122 * These two variables control the rate for TCP to generate RSTs in 923448Sdh155122 * response to segments not belonging to any connections. We limit 933448Sdh155122 * TCP to sent out tcp_rst_sent_rate (ndd param) number of RSTs in 943448Sdh155122 * each 1 second interval. This is to protect TCP against DoS attack. 953448Sdh155122 */ 9611303SKacheong.Poon@Sun.COM int64_t tcps_last_rst_intrvl; 973448Sdh155122 uint32_t tcps_rst_cnt; 9811303SKacheong.Poon@Sun.COM 998348SEric.Yu@Sun.COM ldi_ident_t tcps_ldi_ident; 10011042SErik.Nordmark@Sun.COM 10111042SErik.Nordmark@Sun.COM /* Used to synchronize access when reclaiming memory */ 10211042SErik.Nordmark@Sun.COM mblk_t *tcps_ixa_cleanup_mp; 10311042SErik.Nordmark@Sun.COM kmutex_t tcps_ixa_cleanup_lock; 10411042SErik.Nordmark@Sun.COM kcondvar_t tcps_ixa_cleanup_cv; 10511303SKacheong.Poon@Sun.COM 10611303SKacheong.Poon@Sun.COM /* Variables for handling kmem reclaim call back. */ 10711303SKacheong.Poon@Sun.COM kmutex_t tcps_reclaim_lock; 10811303SKacheong.Poon@Sun.COM boolean_t tcps_reclaim; 10911303SKacheong.Poon@Sun.COM timeout_id_t tcps_reclaim_tid; 11011303SKacheong.Poon@Sun.COM uint32_t tcps_reclaim_period; 11111303SKacheong.Poon@Sun.COM 11211303SKacheong.Poon@Sun.COM /* Listener connection limit configuration. */ 11311303SKacheong.Poon@Sun.COM kmutex_t tcps_listener_conf_lock; 11411303SKacheong.Poon@Sun.COM list_t tcps_listener_conf; 11511754SKacheong.Poon@Sun.COM 11611754SKacheong.Poon@Sun.COM /* 11711754SKacheong.Poon@Sun.COM * Per CPU stats 11811754SKacheong.Poon@Sun.COM * 11911754SKacheong.Poon@Sun.COM * tcps_sc: array of pointer to per CPU stats. The i-th element in the 12011754SKacheong.Poon@Sun.COM * array represents the stats of the CPU with cpu_seqid. 12111754SKacheong.Poon@Sun.COM * tcps_sc_cnt: number of CPU stats in the tcps_sc array. 12211754SKacheong.Poon@Sun.COM */ 12311754SKacheong.Poon@Sun.COM tcp_stats_cpu_t **tcps_sc; 12411754SKacheong.Poon@Sun.COM int tcps_sc_cnt; 1253448Sdh155122 }; 12611754SKacheong.Poon@Sun.COM 1273448Sdh155122 typedef struct tcp_stack tcp_stack_t; 1283448Sdh155122 1293448Sdh155122 #endif /* _KERNEL */ 1303448Sdh155122 #ifdef __cplusplus 1313448Sdh155122 } 1323448Sdh155122 #endif 1333448Sdh155122 1343448Sdh155122 #endif /* _INET_TCP_STACK_H */ 135