xref: /titanic_53/usr/src/uts/common/inet/tcp.h (revision 6f773e29841ff1573612158ae130301164c2a24a)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
545916cd2Sjpk  * Common Development and Distribution License (the "License").
645916cd2Sjpk  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
2266cd0f60SKacheong Poon  * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate /* Copyright (c) 1990 Mentat Inc. */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_INET_TCP_H
277c478bd9Sstevel@tonic-gate #define	_INET_TCP_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include <sys/inttypes.h>
347c478bd9Sstevel@tonic-gate #include <netinet/ip6.h>
357c478bd9Sstevel@tonic-gate #include <netinet/tcp.h>
367c478bd9Sstevel@tonic-gate #include <sys/socket.h>
370f1702c5SYu Xiangning #include <sys/socket_proto.h>
38f4b3ec61Sdh155122 #include <sys/md5.h>
39f4b3ec61Sdh155122 #include <inet/common.h>
40f4b3ec61Sdh155122 #include <inet/ip.h>
41f4b3ec61Sdh155122 #include <inet/ip6.h>
42f4b3ec61Sdh155122 #include <inet/mi.h>
43f4b3ec61Sdh155122 #include <inet/mib2.h>
44f4b3ec61Sdh155122 #include <inet/tcp_stack.h>
45f4b3ec61Sdh155122 #include <inet/tcp_sack.h>
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /* TCP states */
487c478bd9Sstevel@tonic-gate #define	TCPS_CLOSED		-6
497c478bd9Sstevel@tonic-gate #define	TCPS_IDLE		-5	/* idle (opened, but not bound) */
507c478bd9Sstevel@tonic-gate #define	TCPS_BOUND		-4	/* bound, ready to connect or accept */
517c478bd9Sstevel@tonic-gate #define	TCPS_LISTEN		-3	/* listening for connection */
527c478bd9Sstevel@tonic-gate #define	TCPS_SYN_SENT		-2	/* active, have sent syn */
537c478bd9Sstevel@tonic-gate #define	TCPS_SYN_RCVD		-1	/* have received syn (and sent ours) */
547c478bd9Sstevel@tonic-gate /* states < TCPS_ESTABLISHED are those where connections not established */
557c478bd9Sstevel@tonic-gate #define	TCPS_ESTABLISHED	0	/* established */
567c478bd9Sstevel@tonic-gate #define	TCPS_CLOSE_WAIT		1	/* rcvd fin, waiting for close */
577c478bd9Sstevel@tonic-gate /* states > TCPS_CLOSE_WAIT are those where user has closed */
587c478bd9Sstevel@tonic-gate #define	TCPS_FIN_WAIT_1		2	/* have closed and sent fin */
597c478bd9Sstevel@tonic-gate #define	TCPS_CLOSING		3	/* closed, xchd FIN, await FIN ACK */
607c478bd9Sstevel@tonic-gate #define	TCPS_LAST_ACK		4	/* had fin and close; await FIN ACK */
617c478bd9Sstevel@tonic-gate /* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */
627c478bd9Sstevel@tonic-gate #define	TCPS_FIN_WAIT_2		5	/* have closed, fin is acked */
637c478bd9Sstevel@tonic-gate #define	TCPS_TIME_WAIT		6	/* in 2*msl quiet wait after close */
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate /*
667c478bd9Sstevel@tonic-gate  * Internal flags used in conjunction with the packet header flags.
67bd670b35SErik Nordmark  * Used in tcp_input_data to keep track of what needs to be done.
687c478bd9Sstevel@tonic-gate  */
697c478bd9Sstevel@tonic-gate #define	TH_LIMIT_XMIT		0x0400	/* Limited xmit is needed */
707c478bd9Sstevel@tonic-gate #define	TH_XMIT_NEEDED		0x0800	/* Window opened - send queued data */
717c478bd9Sstevel@tonic-gate #define	TH_REXMIT_NEEDED	0x1000	/* Time expired for unacked data */
727c478bd9Sstevel@tonic-gate #define	TH_ACK_NEEDED		0x2000	/* Send an ack now. */
737c478bd9Sstevel@tonic-gate #define	TH_NEED_SACK_REXMIT	0x4000	/* Use SACK info to retransmission */
747c478bd9Sstevel@tonic-gate #define	TH_ACK_TIMER_NEEDED	0x8000	/* Start the delayed ACK timer */
757c478bd9Sstevel@tonic-gate #define	TH_ORDREL_NEEDED	0x10000	/* Generate an ordrel indication */
767c478bd9Sstevel@tonic-gate #define	TH_MARKNEXT_NEEDED	0x20000	/* Data should have MSGMARKNEXT */
777c478bd9Sstevel@tonic-gate #define	TH_SEND_URP_MARK	0x40000	/* Send up tcp_urp_mark_mp */
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate /*
807c478bd9Sstevel@tonic-gate  * TCP sequence numbers are 32 bit integers operated
817c478bd9Sstevel@tonic-gate  * on with modular arithmetic.  These macros can be
827c478bd9Sstevel@tonic-gate  * used to compare such integers.
837c478bd9Sstevel@tonic-gate  */
847c478bd9Sstevel@tonic-gate #define	SEQ_LT(a, b)	((int32_t)((a)-(b)) < 0)
857c478bd9Sstevel@tonic-gate #define	SEQ_LEQ(a, b)	((int32_t)((a)-(b)) <= 0)
867c478bd9Sstevel@tonic-gate #define	SEQ_GT(a, b)	((int32_t)((a)-(b)) > 0)
877c478bd9Sstevel@tonic-gate #define	SEQ_GEQ(a, b)	((int32_t)((a)-(b)) >= 0)
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate /* TCP Protocol header */
907c478bd9Sstevel@tonic-gate typedef	struct tcphdr_s {
917c478bd9Sstevel@tonic-gate 	uint8_t		th_lport[2];	/* Source port */
927c478bd9Sstevel@tonic-gate 	uint8_t		th_fport[2];	/* Destination port */
937c478bd9Sstevel@tonic-gate 	uint8_t		th_seq[4];	/* Sequence number */
947c478bd9Sstevel@tonic-gate 	uint8_t		th_ack[4];	/* Acknowledgement number */
957c478bd9Sstevel@tonic-gate 	uint8_t		th_offset_and_rsrvd[1]; /* Offset to the packet data */
967c478bd9Sstevel@tonic-gate 	uint8_t		th_flags[1];
977c478bd9Sstevel@tonic-gate 	uint8_t		th_win[2];	/* Allocation number */
987c478bd9Sstevel@tonic-gate 	uint8_t		th_sum[2];	/* TCP checksum */
997c478bd9Sstevel@tonic-gate 	uint8_t		th_urp[2];	/* Urgent pointer */
1007c478bd9Sstevel@tonic-gate } tcph_t;
1017c478bd9Sstevel@tonic-gate 
102bd670b35SErik Nordmark #define	TCP_HDR_LENGTH(tcph) \
103bd670b35SErik Nordmark 	((((tcph_t *)tcph)->th_offset_and_rsrvd[0] >>2) &(0xF << 2))
1047c478bd9Sstevel@tonic-gate #define	TCP_MAX_COMBINED_HEADER_LENGTH	(60 + 60) /* Maxed out ip + tcp */
1057c478bd9Sstevel@tonic-gate #define	TCP_MAX_IP_OPTIONS_LENGTH	(60 - IP_SIMPLE_HDR_LENGTH)
1067c478bd9Sstevel@tonic-gate #define	TCP_MAX_HDR_LENGTH		60
107bd670b35SErik Nordmark #define	TCP_MAX_TCP_OPTIONS_LENGTH	(60 - sizeof (tcpha_t))
1087c478bd9Sstevel@tonic-gate #define	TCP_MIN_HEADER_LENGTH		20
1097c478bd9Sstevel@tonic-gate #define	TCP_MAXWIN			65535
1107c478bd9Sstevel@tonic-gate #define	TCP_PORT_LEN			sizeof (in_port_t)
1117c478bd9Sstevel@tonic-gate #define	TCP_MAX_WINSHIFT		14
1127c478bd9Sstevel@tonic-gate #define	TCP_MAX_LARGEWIN		(TCP_MAXWIN << TCP_MAX_WINSHIFT)
1138347601bSyl150051 #define	TCP_MAX_LSO_LENGTH	(IP_MAXPACKET - TCP_MAX_COMBINED_HEADER_LENGTH)
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate #define	TCPIP_HDR_LENGTH(mp, n)					\
1167c478bd9Sstevel@tonic-gate 	(n) = IPH_HDR_LENGTH((mp)->b_rptr),			\
117bd670b35SErik Nordmark 	(n) += TCP_HDR_LENGTH((tcpha_t *)&(mp)->b_rptr[(n)])
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate /* TCP Protocol header (used if the header is known to be 32-bit aligned) */
1207c478bd9Sstevel@tonic-gate typedef	struct tcphdra_s {
1217c478bd9Sstevel@tonic-gate 	in_port_t	tha_lport;	/* Source port */
1227c478bd9Sstevel@tonic-gate 	in_port_t	tha_fport;	/* Destination port */
1237c478bd9Sstevel@tonic-gate 	uint32_t	tha_seq;	/* Sequence number */
1247c478bd9Sstevel@tonic-gate 	uint32_t	tha_ack;	/* Acknowledgement number */
1257c478bd9Sstevel@tonic-gate 	uint8_t tha_offset_and_reserved; /* Offset to the packet data */
1267c478bd9Sstevel@tonic-gate 	uint8_t		tha_flags;
1277c478bd9Sstevel@tonic-gate 	uint16_t	tha_win;	/* Allocation number */
1287c478bd9Sstevel@tonic-gate 	uint16_t	tha_sum;	/* TCP checksum */
1297c478bd9Sstevel@tonic-gate 	uint16_t	tha_urp;	/* Urgent pointer */
1307c478bd9Sstevel@tonic-gate } tcpha_t;
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate struct conn_s;
13393fcb0b9SKacheong Poon struct tcp_listen_cnt_s;
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate /*
1367c478bd9Sstevel@tonic-gate  * Control structure for each open TCP stream,
1377c478bd9Sstevel@tonic-gate  * defined only within the kernel or for a kmem user.
1387c478bd9Sstevel@tonic-gate  * NOTE: tcp_reinit_values MUST have a line for each field in this structure!
1397c478bd9Sstevel@tonic-gate  */
1407c478bd9Sstevel@tonic-gate #if (defined(_KERNEL) || defined(_KMEMUSER))
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate typedef struct tcp_s {
1437c478bd9Sstevel@tonic-gate 	struct tcp_s	*tcp_time_wait_next;
1447c478bd9Sstevel@tonic-gate 				/* Pointer to next T/W block */
1457c478bd9Sstevel@tonic-gate 	struct tcp_s	*tcp_time_wait_prev;
1467c478bd9Sstevel@tonic-gate 				/* Pointer to previous T/W next */
14766cd0f60SKacheong Poon 	int64_t		tcp_time_wait_expire;
148f4b3ec61Sdh155122 
149721fffe3SKacheong Poon 	struct conn_s	*tcp_connp;	/* back pointer to conn_t */
150721fffe3SKacheong Poon 	tcp_stack_t	*tcp_tcps;	/* back pointer to tcp_stack_t */
1517c478bd9Sstevel@tonic-gate 
1527c478bd9Sstevel@tonic-gate 	int32_t	tcp_state;
1537c478bd9Sstevel@tonic-gate 	int32_t	tcp_rcv_ws;		/* My window scale power */
1547c478bd9Sstevel@tonic-gate 	int32_t	tcp_snd_ws;		/* Sender's window scale power */
1557c478bd9Sstevel@tonic-gate 	uint32_t tcp_ts_recent;		/* Timestamp of earliest unacked */
1567c478bd9Sstevel@tonic-gate 					/*  data segment */
1577c478bd9Sstevel@tonic-gate 	clock_t	tcp_rto;		/* Round trip timeout */
158fec71d83SGeorge Shepherd 	int64_t	tcp_last_rcv_lbolt;
1597c478bd9Sstevel@tonic-gate 				/* lbolt on last packet, used for PAWS */
160707e74bcSKacheong Poon 	uint32_t tcp_rto_initial;	/* Initial RTO */
161707e74bcSKacheong Poon 	uint32_t tcp_rto_min;		/* Minimum RTO */
162707e74bcSKacheong Poon 	uint32_t tcp_rto_max;		/* Maximum RTO */
1637c478bd9Sstevel@tonic-gate 
1647c478bd9Sstevel@tonic-gate 	uint32_t tcp_snxt;		/* Senders next seq num */
1657c478bd9Sstevel@tonic-gate 	uint32_t tcp_swnd;		/* Senders window (relative to suna) */
1667c478bd9Sstevel@tonic-gate 	uint32_t tcp_mss;		/* Max segment size */
1677c478bd9Sstevel@tonic-gate 	uint32_t tcp_iss;		/* Initial send seq num */
1687c478bd9Sstevel@tonic-gate 	uint32_t tcp_rnxt;		/* Seq we expect to recv next */
1697c478bd9Sstevel@tonic-gate 	uint32_t tcp_rwnd;
1707c478bd9Sstevel@tonic-gate 
1717c478bd9Sstevel@tonic-gate 	/* Fields arranged in approximate access order along main paths */
172721fffe3SKacheong Poon 	mblk_t	*tcp_xmit_head;		/* Head of xmit/rexmit list */
173721fffe3SKacheong Poon 	mblk_t	*tcp_xmit_last;		/* Last valid data seen by tcp_wput */
174721fffe3SKacheong Poon 	mblk_t	*tcp_xmit_tail;		/* Last data sent */
1757c478bd9Sstevel@tonic-gate 	uint32_t tcp_unsent;		/* # of bytes in hand that are unsent */
1767c478bd9Sstevel@tonic-gate 	uint32_t tcp_xmit_tail_unsent;	/* # of unsent bytes in xmit_tail */
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate 	uint32_t tcp_suna;		/* Sender unacknowledged */
1797c478bd9Sstevel@tonic-gate 	uint32_t tcp_rexmit_nxt;	/* Next rexmit seq num */
1807c478bd9Sstevel@tonic-gate 	uint32_t tcp_rexmit_max;	/* Max retran seq num */
1817c478bd9Sstevel@tonic-gate 	int32_t	tcp_snd_burst;		/* Send burst factor */
1827c478bd9Sstevel@tonic-gate 	uint32_t tcp_cwnd;		/* Congestion window */
1837c478bd9Sstevel@tonic-gate 	int32_t tcp_cwnd_cnt;		/* cwnd cnt in congestion avoidance */
1847c478bd9Sstevel@tonic-gate 
1857c478bd9Sstevel@tonic-gate 	uint32_t tcp_ibsegs;		/* Inbound segments on this stream */
1867c478bd9Sstevel@tonic-gate 	uint32_t tcp_obsegs;		/* Outbound segments on this stream */
1877c478bd9Sstevel@tonic-gate 
1887c478bd9Sstevel@tonic-gate 	uint32_t tcp_naglim;		/* Tunable nagle limit */
1897c478bd9Sstevel@tonic-gate 	uint32_t	tcp_valid_bits;
1907c478bd9Sstevel@tonic-gate #define	TCP_ISS_VALID	0x1	/* Is the tcp_iss seq num active? */
1917c478bd9Sstevel@tonic-gate #define	TCP_FSS_VALID	0x2	/* Is the tcp_fss seq num active? */
1927c478bd9Sstevel@tonic-gate #define	TCP_URG_VALID	0x4	/* Is the tcp_urg seq num active? */
1937c478bd9Sstevel@tonic-gate #define	TCP_OFO_FIN_VALID 0x8	/* Has TCP received an out of order FIN? */
1947c478bd9Sstevel@tonic-gate 
1957c478bd9Sstevel@tonic-gate 
1967c478bd9Sstevel@tonic-gate 
1977c478bd9Sstevel@tonic-gate 	timeout_id_t	tcp_timer_tid;	/* Control block for timer service */
1987c478bd9Sstevel@tonic-gate 	uchar_t	tcp_timer_backoff;	/* Backoff shift count. */
1997c478bd9Sstevel@tonic-gate 	int64_t tcp_last_recv_time;	/* Last time we receive a segment. */
2007c478bd9Sstevel@tonic-gate 	uint32_t tcp_init_cwnd;		/* Initial cwnd (start/restart) */
2017c478bd9Sstevel@tonic-gate 
2027c478bd9Sstevel@tonic-gate 	/* Following manipulated by TCP under squeue protection */
2037c478bd9Sstevel@tonic-gate 	uint32_t
2047c478bd9Sstevel@tonic-gate 		tcp_urp_last_valid : 1,	/* Is tcp_urp_last valid? */
205bd670b35SErik Nordmark 		tcp_hard_binding : 1,	/* TCP_DETACHED_NONEAGER */
2067c478bd9Sstevel@tonic-gate 		tcp_fin_acked : 1,	/* Has our FIN been acked? */
2077c478bd9Sstevel@tonic-gate 		tcp_fin_rcvd : 1,	/* Have we seen a FIN? */
208bd670b35SErik Nordmark 
2097c478bd9Sstevel@tonic-gate 		tcp_fin_sent : 1,	/* Have we sent our FIN yet? */
2107c478bd9Sstevel@tonic-gate 		tcp_ordrel_done : 1,	/* Have we sent the ord_rel upstream? */
2117c478bd9Sstevel@tonic-gate 		tcp_detached : 1,	/* If we're detached from a stream */
2127c478bd9Sstevel@tonic-gate 		tcp_zero_win_probe: 1,	/* Zero win probing is in progress */
213f7f8e53dSKacheong Poon 
2147c478bd9Sstevel@tonic-gate 		tcp_loopback: 1,	/* src and dst are the same machine */
2157c478bd9Sstevel@tonic-gate 		tcp_localnet: 1,	/* src and dst are on the same subnet */
2167c478bd9Sstevel@tonic-gate 		tcp_syn_defense: 1,	/* For defense against SYN attack */
2177c478bd9Sstevel@tonic-gate #define	tcp_dontdrop	tcp_syn_defense
2187c478bd9Sstevel@tonic-gate 		tcp_set_timer : 1,
2198380b3ccSYu Xiangning 
220f7f8e53dSKacheong Poon 		tcp_active_open: 1,	/* This is a active open */
221f7f8e53dSKacheong Poon 		tcp_rexmit : 1,		/* TCP is retransmitting */
2227c478bd9Sstevel@tonic-gate 		tcp_snd_sack_ok : 1,	/* Can use SACK for this connection */
2237c478bd9Sstevel@tonic-gate 		tcp_hwcksum : 1,	/* The NIC is capable of hwcksum */
224f7f8e53dSKacheong Poon 
225bd670b35SErik Nordmark 		tcp_ip_forward_progress : 1,
2267c478bd9Sstevel@tonic-gate 		tcp_ecn_ok : 1,		/* Can use ECN for this connection */
2277c478bd9Sstevel@tonic-gate 		tcp_ecn_echo_on : 1,	/* Need to do ECN echo */
2287c478bd9Sstevel@tonic-gate 		tcp_ecn_cwr_sent : 1,	/* ECN_CWR has been sent */
229bd670b35SErik Nordmark 
230e0968231Svi117747 		tcp_cwr : 1,		/* Cwnd has reduced recently */
231f7f8e53dSKacheong Poon 
232bd670b35SErik Nordmark 		tcp_pad_to_bit31 : 11;
233bd670b35SErik Nordmark 
2347c478bd9Sstevel@tonic-gate 	/* Following manipulated by TCP under squeue protection */
2357c478bd9Sstevel@tonic-gate 	uint32_t
2367c478bd9Sstevel@tonic-gate 		tcp_snd_ts_ok  : 1,
2377c478bd9Sstevel@tonic-gate 		tcp_snd_ws_ok  : 1,
238bd670b35SErik Nordmark 		tcp_reserved_port : 1,
2397c478bd9Sstevel@tonic-gate 		tcp_in_free_list : 1,
2407c478bd9Sstevel@tonic-gate 
241bd670b35SErik Nordmark 		tcp_snd_zcopy_on : 1,	/* xmit zero-copy enabled */
2427c478bd9Sstevel@tonic-gate 		tcp_snd_zcopy_aware : 1, /* client is zero-copy aware */
2437c478bd9Sstevel@tonic-gate 		tcp_xmit_zc_clean : 1,	/* the xmit list is free of zc-mblk */
2447c478bd9Sstevel@tonic-gate 		tcp_wait_for_eagers : 1, /* Wait for eagers to disappear */
2457c478bd9Sstevel@tonic-gate 
246bd670b35SErik Nordmark 		tcp_accept_error : 1,	/* Error during TLI accept */
2477c478bd9Sstevel@tonic-gate 		tcp_send_discon_ind : 1, /* TLI accept err, send discon ind */
2487c478bd9Sstevel@tonic-gate 		tcp_cork : 1,		/* tcp_cork option */
249866ba9ddSjprakash 		tcp_tconnind_started : 1, /* conn_ind message is being sent */
2507c478bd9Sstevel@tonic-gate 
251bd670b35SErik Nordmark 		tcp_lso :1,		/* Lower layer is capable of LSO */
252bd670b35SErik Nordmark 		tcp_is_wnd_shrnk : 1,	/* Window has shrunk */
253bd670b35SErik Nordmark 
254bd670b35SErik Nordmark 		tcp_pad_to_bit_31 : 18;
255bd670b35SErik Nordmark 
256bd670b35SErik Nordmark 	uint32_t	tcp_initial_pmtu; /* Initial outgoing Path MTU. */
2577c478bd9Sstevel@tonic-gate 
2587c478bd9Sstevel@tonic-gate 	mblk_t	*tcp_reass_head;	/* Out of order reassembly list head */
2597c478bd9Sstevel@tonic-gate 	mblk_t	*tcp_reass_tail;	/* Out of order reassembly list tail */
2607c478bd9Sstevel@tonic-gate 
26166cd0f60SKacheong Poon 	/* SACK related info */
26266cd0f60SKacheong Poon 	tcp_sack_info_t	tcp_sack_info;
2637c478bd9Sstevel@tonic-gate 
26466cd0f60SKacheong Poon #define	tcp_pipe		tcp_sack_info.tcp_pipe
26566cd0f60SKacheong Poon #define	tcp_fack		tcp_sack_info.tcp_fack
26666cd0f60SKacheong Poon #define	tcp_sack_snxt		tcp_sack_info.tcp_sack_snxt
26766cd0f60SKacheong Poon #define	tcp_max_sack_blk	tcp_sack_info.tcp_max_sack_blk
26866cd0f60SKacheong Poon #define	tcp_num_sack_blk	tcp_sack_info.tcp_num_sack_blk
26966cd0f60SKacheong Poon #define	tcp_sack_list		tcp_sack_info.tcp_sack_list
27066cd0f60SKacheong Poon #define	tcp_num_notsack_blk	tcp_sack_info.tcp_num_notsack_blk
27166cd0f60SKacheong Poon #define	tcp_cnt_notsack_list	tcp_sack_info.tcp_cnt_notsack_list
27266cd0f60SKacheong Poon #define	tcp_notsack_list	tcp_sack_info.tcp_notsack_list
2737c478bd9Sstevel@tonic-gate 
2747c478bd9Sstevel@tonic-gate 	mblk_t	*tcp_rcv_list;		/* Queued until push, urgent data, */
2757c478bd9Sstevel@tonic-gate 	mblk_t	*tcp_rcv_last_head;	/* optdata, or the count exceeds */
2767c478bd9Sstevel@tonic-gate 	mblk_t	*tcp_rcv_last_tail;	/* tcp_rcv_push_wait. */
2777c478bd9Sstevel@tonic-gate 	uint32_t tcp_rcv_cnt;		/* tcp_rcv_list is b_next chain. */
2787c478bd9Sstevel@tonic-gate 
2797c478bd9Sstevel@tonic-gate 	uint32_t tcp_cwnd_ssthresh;	/* Congestion window */
2807c478bd9Sstevel@tonic-gate 	uint32_t tcp_cwnd_max;
2817c478bd9Sstevel@tonic-gate 	uint32_t tcp_csuna;		/* Clear (no rexmits in window) suna */
2827c478bd9Sstevel@tonic-gate 
2837c478bd9Sstevel@tonic-gate 	clock_t	tcp_rtt_sa;		/* Round trip smoothed average */
2847c478bd9Sstevel@tonic-gate 	clock_t	tcp_rtt_sd;		/* Round trip smoothed deviation */
2857c478bd9Sstevel@tonic-gate 	clock_t	tcp_rtt_update;		/* Round trip update(s) */
2867c478bd9Sstevel@tonic-gate 	clock_t tcp_ms_we_have_waited;	/* Total retrans time */
2877c478bd9Sstevel@tonic-gate 
2887c478bd9Sstevel@tonic-gate 	uint32_t tcp_swl1;		/* These help us avoid using stale */
2897c478bd9Sstevel@tonic-gate 	uint32_t tcp_swl2;		/*  packets to update state */
2907c478bd9Sstevel@tonic-gate 
2917c478bd9Sstevel@tonic-gate 	uint32_t tcp_rack;		/* Seq # we have acked */
2927c478bd9Sstevel@tonic-gate 	uint32_t tcp_rack_cnt;		/* # of segs we have deferred ack */
2937c478bd9Sstevel@tonic-gate 	uint32_t tcp_rack_cur_max;	/* # of segs we may defer ack for now */
2947c478bd9Sstevel@tonic-gate 	uint32_t tcp_rack_abs_max;	/* # of segs we may defer ack ever */
2957c478bd9Sstevel@tonic-gate 	timeout_id_t	tcp_ack_tid;	/* Delayed ACK timer ID */
2967c478bd9Sstevel@tonic-gate 	timeout_id_t	tcp_push_tid;	/* Push timer ID */
2977c478bd9Sstevel@tonic-gate 
2987c478bd9Sstevel@tonic-gate 	uint32_t tcp_max_swnd;		/* Maximum swnd we have seen */
2997c478bd9Sstevel@tonic-gate 
3007c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_listener;	/* Our listener */
3017c478bd9Sstevel@tonic-gate 
3027c478bd9Sstevel@tonic-gate 	uint32_t tcp_irs;		/* Initial recv seq num */
3037c478bd9Sstevel@tonic-gate 	uint32_t tcp_fss;		/* Final/fin send seq num */
3047c478bd9Sstevel@tonic-gate 	uint32_t tcp_urg;		/* Urgent data seq num */
3057c478bd9Sstevel@tonic-gate 
3067c478bd9Sstevel@tonic-gate 	clock_t	tcp_first_timer_threshold;  /* When to prod IP */
3077c478bd9Sstevel@tonic-gate 	clock_t	tcp_second_timer_threshold; /* When to give up completely */
3087c478bd9Sstevel@tonic-gate 	clock_t	tcp_first_ctimer_threshold; /* 1st threshold while connecting */
3097c478bd9Sstevel@tonic-gate 	clock_t tcp_second_ctimer_threshold; /* 2nd ... while connecting */
3107c478bd9Sstevel@tonic-gate 
3117c478bd9Sstevel@tonic-gate 	uint32_t tcp_urp_last;		/* Last urp for which signal sent */
3127c478bd9Sstevel@tonic-gate 	mblk_t	*tcp_urp_mp;		/* T_EXDATA_IND for urgent byte */
3137c478bd9Sstevel@tonic-gate 	mblk_t	*tcp_urp_mark_mp;	/* zero-length marked/unmarked msg */
3147c478bd9Sstevel@tonic-gate 
3157c478bd9Sstevel@tonic-gate 	int tcp_conn_req_cnt_q0;	/* # of conn reqs in SYN_RCVD */
3167c478bd9Sstevel@tonic-gate 	int tcp_conn_req_cnt_q;	/* # of conn reqs in ESTABLISHED */
3177c478bd9Sstevel@tonic-gate 	int tcp_conn_req_max;	/* # of ESTABLISHED conn reqs allowed */
3187c478bd9Sstevel@tonic-gate 	t_scalar_t tcp_conn_req_seqnum;	/* Incrementing pending conn req ID */
3197c478bd9Sstevel@tonic-gate #define	tcp_ip_addr_cache	tcp_reass_tail
3207c478bd9Sstevel@tonic-gate 					/* Cache ip addresses that */
3217c478bd9Sstevel@tonic-gate 					/* complete the 3-way handshake */
3227c478bd9Sstevel@tonic-gate 	kmutex_t  tcp_eager_lock;
3237c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_eager_next_q; /* next eager in ESTABLISHED state */
3247c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_eager_last_q;	/* last eager in ESTABLISHED state */
3257c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_eager_next_q0; /* next eager in SYN_RCVD state */
3267c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_eager_prev_q0; /* prev eager in SYN_RCVD state */
3277c478bd9Sstevel@tonic-gate 					/* all eagers form a circular list */
3288380b3ccSYu Xiangning 	boolean_t tcp_conn_def_q0;	/* move from q0 to q deferred */
3298380b3ccSYu Xiangning 
3307c478bd9Sstevel@tonic-gate 	union {
3317c478bd9Sstevel@tonic-gate 	    mblk_t *tcp_eager_conn_ind; /* T_CONN_IND waiting for 3rd ack. */
3327c478bd9Sstevel@tonic-gate 	    mblk_t *tcp_opts_conn_req; /* T_CONN_REQ w/ options processed */
3337c478bd9Sstevel@tonic-gate 	} tcp_conn;
3347c478bd9Sstevel@tonic-gate 	uint32_t tcp_syn_rcvd_timeout;	/* How many SYN_RCVD timeout in q0 */
3357c478bd9Sstevel@tonic-gate 
3367c478bd9Sstevel@tonic-gate 	/* TCP Keepalive Timer members */
3377c478bd9Sstevel@tonic-gate 	int32_t	tcp_ka_last_intrvl;	/* Last probe interval */
3387c478bd9Sstevel@tonic-gate 	timeout_id_t tcp_ka_tid;	/* Keepalive timer ID */
3397c478bd9Sstevel@tonic-gate 	uint32_t tcp_ka_interval;	/* Keepalive interval */
3407c478bd9Sstevel@tonic-gate 	uint32_t tcp_ka_abort_thres;	/* Keepalive abort threshold */
3417c478bd9Sstevel@tonic-gate 
3427c478bd9Sstevel@tonic-gate 	int32_t	tcp_client_errno;	/* How the client screwed up */
3437c478bd9Sstevel@tonic-gate 
344bd670b35SErik Nordmark 	/*
345bd670b35SErik Nordmark 	 * The header template lives in conn_ht_iphc allocated by tcp_build_hdrs
346bd670b35SErik Nordmark 	 * We maintain three pointers into conn_ht_iphc.
347bd670b35SErik Nordmark 	 */
348bd670b35SErik Nordmark 	ipha_t	*tcp_ipha;		/* IPv4 header in conn_ht_iphc */
349bd670b35SErik Nordmark 	ip6_t	*tcp_ip6h;		/* IPv6 header in conn_ht_iphc */
350bd670b35SErik Nordmark 	tcpha_t	*tcp_tcpha;		/* TCP header in conn_ht_iphc */
3517c478bd9Sstevel@tonic-gate 
3527c478bd9Sstevel@tonic-gate 	uint16_t tcp_last_sent_len;	/* Record length for nagle */
3539cd928feSAlan Maguire 	uint16_t tcp_last_recv_len;	/* Used by DTrace */
3547c478bd9Sstevel@tonic-gate 	uint16_t tcp_dupack_cnt;	/* # of consequtive duplicate acks */
3557c478bd9Sstevel@tonic-gate 
3567c478bd9Sstevel@tonic-gate 	kmutex_t	*tcp_acceptor_lockp;	/* Ptr to tf_lock */
3577c478bd9Sstevel@tonic-gate 
358f7f8e53dSKacheong Poon 	mblk_t		*tcp_ordrel_mp;		/* T_ordrel_ind mblk */
3597c478bd9Sstevel@tonic-gate 	t_uscalar_t	tcp_acceptor_id;	/* ACCEPTOR_id */
3607c478bd9Sstevel@tonic-gate 
3617c478bd9Sstevel@tonic-gate 	int		tcp_ipsec_overhead;
3627c478bd9Sstevel@tonic-gate 
3637c478bd9Sstevel@tonic-gate 	uint_t		tcp_recvifindex; /* Last received IPV6_RCVPKTINFO */
3647c478bd9Sstevel@tonic-gate 	uint_t		tcp_recvhops;	/* Last received IPV6_RECVHOPLIMIT */
3657c478bd9Sstevel@tonic-gate 	uint_t		tcp_recvtclass;	/* Last received IPV6_RECVTCLASS */
3667c478bd9Sstevel@tonic-gate 	ip6_hbh_t	*tcp_hopopts;	/* Last received IPV6_RECVHOPOPTS */
3677c478bd9Sstevel@tonic-gate 	ip6_dest_t	*tcp_dstopts;	/* Last received IPV6_RECVDSTOPTS */
368bd670b35SErik Nordmark 	ip6_dest_t	*tcp_rthdrdstopts; /* Last recv IPV6_RECVRTHDRDSTOPTS */
3697c478bd9Sstevel@tonic-gate 	ip6_rthdr_t	*tcp_rthdr;	/* Last received IPV6_RECVRTHDR */
3707c478bd9Sstevel@tonic-gate 	uint_t		tcp_hopoptslen;
3717c478bd9Sstevel@tonic-gate 	uint_t		tcp_dstoptslen;
372bd670b35SErik Nordmark 	uint_t		tcp_rthdrdstoptslen;
3737c478bd9Sstevel@tonic-gate 	uint_t		tcp_rthdrlen;
3747c478bd9Sstevel@tonic-gate 
3757c478bd9Sstevel@tonic-gate 	mblk_t		*tcp_timercache;
3767c478bd9Sstevel@tonic-gate 
3777c478bd9Sstevel@tonic-gate 	kmutex_t	tcp_closelock;
3787c478bd9Sstevel@tonic-gate 	kcondvar_t	tcp_closecv;
3797c478bd9Sstevel@tonic-gate 	uint8_t		tcp_closed;
3807c478bd9Sstevel@tonic-gate 	uint8_t		tcp_closeflags;
3817c478bd9Sstevel@tonic-gate 	mblk_t		tcp_closemp;
3827c478bd9Sstevel@tonic-gate 	timeout_id_t	tcp_linger_tid;	/* Linger timer ID */
3837c478bd9Sstevel@tonic-gate 
3847c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_acceptor_hash; /* Acceptor hash chain */
3857c478bd9Sstevel@tonic-gate 	struct tcp_s **tcp_ptpahn; /* Pointer to previous accept hash next. */
3867c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_bind_hash; /* Bind hash chain */
3870f1702c5SYu Xiangning 	struct tcp_s *tcp_bind_hash_port; /* tcp_t's bound to the same lport */
3887c478bd9Sstevel@tonic-gate 	struct tcp_s **tcp_ptpbhn;
3897c478bd9Sstevel@tonic-gate 
390bd670b35SErik Nordmark 	uint_t		tcp_maxpsz_multiplier;
3917c478bd9Sstevel@tonic-gate 
3928347601bSyl150051 	uint32_t	tcp_lso_max; /* maximum LSO payload */
3938347601bSyl150051 
3947c478bd9Sstevel@tonic-gate 	uint32_t	tcp_ofo_fin_seq; /* Recv out of order FIN seq num */
3957c478bd9Sstevel@tonic-gate 	uint32_t	tcp_cwr_snd_max;
396bd670b35SErik Nordmark 
3977c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_saved_listener;	/* saved value of listener */
3987c478bd9Sstevel@tonic-gate 
399ff550d0eSmasputra 	uint32_t	tcp_in_ack_unsent;	/* ACK for unsent data cnt. */
400ff550d0eSmasputra 
401ff550d0eSmasputra 	/*
4027b8f5432SAnders Persson 	 * All fusion-related fields are protected by squeue.
403ff550d0eSmasputra 	 */
4047c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_loopback_peer;	/* peer tcp for loopback */
4057c478bd9Sstevel@tonic-gate 	mblk_t	*tcp_fused_sigurg_mp;		/* M_PCSIG mblk for SIGURG */
4067b8f5432SAnders Persson 
407ff550d0eSmasputra 	uint32_t
408ff550d0eSmasputra 		tcp_fused : 1,		/* loopback tcp in fusion mode */
409ff550d0eSmasputra 		tcp_unfusable : 1,	/* fusion not allowed on endpoint */
410ff550d0eSmasputra 		tcp_fused_sigurg : 1,	/* send SIGURG upon draining */
4117c478bd9Sstevel@tonic-gate 
4127b8f5432SAnders Persson 		tcp_fuse_to_bit_31 : 29;
4137b8f5432SAnders Persson 
4147b8f5432SAnders Persson 	kmutex_t tcp_non_sq_lock;
4157c478bd9Sstevel@tonic-gate 
4167c478bd9Sstevel@tonic-gate 	/*
4177c478bd9Sstevel@tonic-gate 	 * This variable is accessed without any lock protection
4187c478bd9Sstevel@tonic-gate 	 * and therefore must not be declared as a bit field along
4197c478bd9Sstevel@tonic-gate 	 * with the rest which require such condition.
4207c478bd9Sstevel@tonic-gate 	 */
4217c478bd9Sstevel@tonic-gate 	boolean_t	tcp_issocket;	/* this is a socket tcp */
422ff550d0eSmasputra 
423e0968231Svi117747 	/* protected by the tcp_non_sq_lock lock */
424ff550d0eSmasputra 	uint32_t	tcp_squeue_bytes;
425866ba9ddSjprakash 
426866ba9ddSjprakash 	/*
427866ba9ddSjprakash 	 * tcp_closemp_used is protected by listener's tcp_eager_lock
428866ba9ddSjprakash 	 * when used for eagers. When used for a tcp in TIME_WAIT state
429866ba9ddSjprakash 	 * or in tcp_close(), it is not protected by any lock as we
430866ba9ddSjprakash 	 * do not expect any other thread to use it concurrently.
4310163a147Sjprakash 	 * We do allow re-use of tcp_closemp in tcp_time_wait_collector()
4320163a147Sjprakash 	 * and tcp_close() but not concurrently.
433866ba9ddSjprakash 	 */
4340163a147Sjprakash 	boolean_t tcp_closemp_used;
435866ba9ddSjprakash 
436866ba9ddSjprakash 	/*
437866ba9ddSjprakash 	 * previous and next eagers in the list of droppable eagers. See
438866ba9ddSjprakash 	 * the comments before MAKE_DROPPABLE(). These pointers are
439866ba9ddSjprakash 	 * protected by listener's tcp_eager_lock.
440866ba9ddSjprakash 	 */
441866ba9ddSjprakash 	struct tcp_s	*tcp_eager_prev_drop_q0;
442866ba9ddSjprakash 	struct tcp_s	*tcp_eager_next_drop_q0;
443e0968231Svi117747 
444e0968231Svi117747 	/*
445e0968231Svi117747 	 * Have we flow controlled xmitter?
446e0968231Svi117747 	 * This variable can be modified outside the squeue and hence must
447e0968231Svi117747 	 * not be declared as a bit field along with the rest that are
448e0968231Svi117747 	 * modified only within the squeue.
449e0968231Svi117747 	 * protected by the tcp_non_sq_lock lock.
450e0968231Svi117747 	 */
451e0968231Svi117747 	boolean_t	tcp_flow_stopped;
452e0968231Svi117747 
45317169044Sbrutus 	/*
454410734d4SPhilip Kirk 	 * Sender's next sequence number at the time the window was shrunk.
455410734d4SPhilip Kirk 	 */
456410734d4SPhilip Kirk 	uint32_t	tcp_snxt_shrunk;
457410734d4SPhilip Kirk 
458410734d4SPhilip Kirk 	/*
459dc7c1171SAnders Persson 	 * Socket generation number which is bumped when a connection attempt
460dc7c1171SAnders Persson 	 * is initiated. Its main purpose is to ensure that the socket does not
461dc7c1171SAnders Persson 	 * miss the asynchronous connected/disconnected notification.
4620f1702c5SYu Xiangning 	 */
4630f1702c5SYu Xiangning 	sock_connid_t	tcp_connid;
4640f1702c5SYu Xiangning 
465f7f8e53dSKacheong Poon 	/* mblk_t used to enter TCP's squeue from the service routine. */
466f7f8e53dSKacheong Poon 	mblk_t		*tcp_rsrv_mp;
467f7f8e53dSKacheong Poon 	/* Mutex for accessing tcp_rsrv_mp */
468f7f8e53dSKacheong Poon 	kmutex_t	tcp_rsrv_mp_lock;
469f7f8e53dSKacheong Poon 
47093fcb0b9SKacheong Poon 	/* For connection counting. */
47193fcb0b9SKacheong Poon 	struct tcp_listen_cnt_s	*tcp_listen_cnt;
47293fcb0b9SKacheong Poon 
47393fcb0b9SKacheong Poon 	/* Segment reassembly timer. */
47493fcb0b9SKacheong Poon 	timeout_id_t		tcp_reass_tid;
47593fcb0b9SKacheong Poon 
476707e74bcSKacheong Poon 	/* FIN-WAIT-2 flush timeout */
477707e74bcSKacheong Poon 	uint32_t		tcp_fin_wait_2_flush_interval;
478707e74bcSKacheong Poon 
479866ba9ddSjprakash #ifdef DEBUG
480866ba9ddSjprakash 	pc_t			tcmp_stk[15];
481866ba9ddSjprakash #endif
4827c478bd9Sstevel@tonic-gate } tcp_t;
4837c478bd9Sstevel@tonic-gate 
484866ba9ddSjprakash #ifdef DEBUG
485866ba9ddSjprakash #define	TCP_DEBUG_GETPCSTACK(buffer, depth)	((void) getpcstack(buffer, \
486866ba9ddSjprakash 						    depth))
487866ba9ddSjprakash #else
488866ba9ddSjprakash #define	TCP_DEBUG_GETPCSTACK(buffer, depth)
489866ba9ddSjprakash #endif
490866ba9ddSjprakash 
49193fcb0b9SKacheong Poon extern void	tcp_conn_reclaim(void *);
4927c478bd9Sstevel@tonic-gate extern void 	tcp_free(tcp_t *tcp);
493f4b3ec61Sdh155122 extern void	tcp_ddi_g_init(void);
494f4b3ec61Sdh155122 extern void	tcp_ddi_g_destroy(void);
495f3124163SAnders Persson extern void 	*tcp_get_conn(void *arg, tcp_stack_t *);
496*6f773e29SBaban Kenkre extern mblk_t	*tcp_snmp_get(queue_t *, mblk_t *, boolean_t);
497ff550d0eSmasputra extern int	tcp_snmp_set(queue_t *, int, int, uchar_t *, int len);
4980854dd28SPhilip Kirk 
4997c478bd9Sstevel@tonic-gate /*
500721fffe3SKacheong Poon  * The TCP Fanout structure for bind and acceptor hashes.
501721fffe3SKacheong Poon  * The hash tables and their linkage (tcp_*_hash, tcp_ptp*hn) are
5027c478bd9Sstevel@tonic-gate  * protected by the per-bucket tf_lock.  Each tcp_t
5037c478bd9Sstevel@tonic-gate  * inserted in the list points back at this lock using tcp_*_lockp.
5047c478bd9Sstevel@tonic-gate  *
505721fffe3SKacheong Poon  * The bind and acceptor hash queues are lists of tcp_t.
5067c478bd9Sstevel@tonic-gate  */
5077c478bd9Sstevel@tonic-gate /* listener hash and acceptor hash queue head */
5087c478bd9Sstevel@tonic-gate typedef struct tf_s {
5097c478bd9Sstevel@tonic-gate 	tcp_t		*tf_tcp;
5107c478bd9Sstevel@tonic-gate 	kmutex_t	tf_lock;
5117c478bd9Sstevel@tonic-gate } tf_t;
512721fffe3SKacheong Poon 
513721fffe3SKacheong Poon 
514721fffe3SKacheong Poon /* Also used in ipclassifier.c */
515721fffe3SKacheong Poon extern struct kmem_cache  *tcp_sack_info_cache;
516721fffe3SKacheong Poon 
5177c478bd9Sstevel@tonic-gate #endif	/* (defined(_KERNEL) || defined(_KMEMUSER)) */
5187c478bd9Sstevel@tonic-gate 
5197c478bd9Sstevel@tonic-gate /* Contract private interface between TCP and Clustering. */
5207c478bd9Sstevel@tonic-gate 
5217c478bd9Sstevel@tonic-gate #define	CL_TCPI_V1	1	/* cl_tcpi_version number */
5227c478bd9Sstevel@tonic-gate 
5237c478bd9Sstevel@tonic-gate typedef struct cl_tcp_info_s {
5247c478bd9Sstevel@tonic-gate 	ushort_t	cl_tcpi_version;	/* cl_tcp_info_t's version no */
5257c478bd9Sstevel@tonic-gate 	ushort_t	cl_tcpi_ipversion;	/* IP version */
5267c478bd9Sstevel@tonic-gate 	int32_t		cl_tcpi_state;		/* TCP state */
5277c478bd9Sstevel@tonic-gate 	in_port_t	cl_tcpi_lport;		/* Local port */
5287c478bd9Sstevel@tonic-gate 	in_port_t	cl_tcpi_fport;		/* Remote port */
5297c478bd9Sstevel@tonic-gate 	in6_addr_t	cl_tcpi_laddr_v6;	/* Local IP address */
5307c478bd9Sstevel@tonic-gate 	in6_addr_t	cl_tcpi_faddr_v6;	/* Remote IP address */
5317c478bd9Sstevel@tonic-gate #ifdef _KERNEL
5327c478bd9Sstevel@tonic-gate /* Note: V4_PART_OF_V6 is meant to be used only for _KERNEL defined stuff */
5337c478bd9Sstevel@tonic-gate #define	cl_tcpi_laddr	V4_PART_OF_V6(cl_tcpi_laddr_v6)
5347c478bd9Sstevel@tonic-gate #define	cl_tcpi_faddr	V4_PART_OF_V6(cl_tcpi_faddr_v6)
5357c478bd9Sstevel@tonic-gate 
5367c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
5377c478bd9Sstevel@tonic-gate } cl_tcp_info_t;
5387c478bd9Sstevel@tonic-gate 
5397c478bd9Sstevel@tonic-gate /*
540bd670b35SErik Nordmark  * Hook functions to enable cluster networking
541bd670b35SErik Nordmark  * On non-clustered systems these vectors must always be NULL.
542bd670b35SErik Nordmark  */
543bd670b35SErik Nordmark extern void	(*cl_inet_listen)(netstackid_t, uint8_t, sa_family_t,
544bd670b35SErik Nordmark 		    uint8_t *, in_port_t, void *);
545bd670b35SErik Nordmark extern void	(*cl_inet_unlisten)(netstackid_t, uint8_t, sa_family_t,
546bd670b35SErik Nordmark 		    uint8_t *, in_port_t, void *);
547bd670b35SErik Nordmark 
548bd670b35SErik Nordmark /*
5497c478bd9Sstevel@tonic-gate  * Contracted Consolidation Private ioctl for aborting TCP connections.
5507c478bd9Sstevel@tonic-gate  * In order to keep the offsets and size of the structure the same between
5517c478bd9Sstevel@tonic-gate  * a 32-bit application and a 64-bit amd64 kernel, we use a #pragma
5527c478bd9Sstevel@tonic-gate  * pack(4).
5537c478bd9Sstevel@tonic-gate  */
5547c478bd9Sstevel@tonic-gate #define	TCP_IOC_ABORT_CONN	(('T' << 8) + 91)
5557c478bd9Sstevel@tonic-gate 
5567c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
5577c478bd9Sstevel@tonic-gate #pragma pack(4)
5587c478bd9Sstevel@tonic-gate #endif
5597c478bd9Sstevel@tonic-gate 
5607c478bd9Sstevel@tonic-gate typedef struct tcp_ioc_abort_conn_s {
5617c478bd9Sstevel@tonic-gate 	struct sockaddr_storage ac_local;	/* local addr and port */
5627c478bd9Sstevel@tonic-gate 	struct sockaddr_storage ac_remote;	/* remote addr and port */
5637c478bd9Sstevel@tonic-gate 	int32_t ac_start;			/* start state */
5647c478bd9Sstevel@tonic-gate 	int32_t ac_end;				/* end state  */
5657c478bd9Sstevel@tonic-gate 	int32_t ac_zoneid;			/* zoneid */
5667c478bd9Sstevel@tonic-gate } tcp_ioc_abort_conn_t;
5677c478bd9Sstevel@tonic-gate 
5687c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
5697c478bd9Sstevel@tonic-gate #pragma pack()
5707c478bd9Sstevel@tonic-gate #endif
5717c478bd9Sstevel@tonic-gate 
5727c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
5737c478bd9Sstevel@tonic-gate }
5747c478bd9Sstevel@tonic-gate #endif
5757c478bd9Sstevel@tonic-gate 
5767c478bd9Sstevel@tonic-gate #endif	/* _INET_TCP_H */
577