xref: /titanic_53/usr/src/uts/common/inet/tcp.h (revision 9cd928fe5e3ea4e05f64cfb380beb54b2623e7dc)
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>
46c28749e9Skais #include <inet/kssl/ksslapi.h>
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate /* TCP states */
497c478bd9Sstevel@tonic-gate #define	TCPS_CLOSED		-6
507c478bd9Sstevel@tonic-gate #define	TCPS_IDLE		-5	/* idle (opened, but not bound) */
517c478bd9Sstevel@tonic-gate #define	TCPS_BOUND		-4	/* bound, ready to connect or accept */
527c478bd9Sstevel@tonic-gate #define	TCPS_LISTEN		-3	/* listening for connection */
537c478bd9Sstevel@tonic-gate #define	TCPS_SYN_SENT		-2	/* active, have sent syn */
547c478bd9Sstevel@tonic-gate #define	TCPS_SYN_RCVD		-1	/* have received syn (and sent ours) */
557c478bd9Sstevel@tonic-gate /* states < TCPS_ESTABLISHED are those where connections not established */
567c478bd9Sstevel@tonic-gate #define	TCPS_ESTABLISHED	0	/* established */
577c478bd9Sstevel@tonic-gate #define	TCPS_CLOSE_WAIT		1	/* rcvd fin, waiting for close */
587c478bd9Sstevel@tonic-gate /* states > TCPS_CLOSE_WAIT are those where user has closed */
597c478bd9Sstevel@tonic-gate #define	TCPS_FIN_WAIT_1		2	/* have closed and sent fin */
607c478bd9Sstevel@tonic-gate #define	TCPS_CLOSING		3	/* closed, xchd FIN, await FIN ACK */
617c478bd9Sstevel@tonic-gate #define	TCPS_LAST_ACK		4	/* had fin and close; await FIN ACK */
627c478bd9Sstevel@tonic-gate /* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */
637c478bd9Sstevel@tonic-gate #define	TCPS_FIN_WAIT_2		5	/* have closed, fin is acked */
647c478bd9Sstevel@tonic-gate #define	TCPS_TIME_WAIT		6	/* in 2*msl quiet wait after close */
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate /*
677c478bd9Sstevel@tonic-gate  * Internal flags used in conjunction with the packet header flags.
68bd670b35SErik Nordmark  * Used in tcp_input_data to keep track of what needs to be done.
697c478bd9Sstevel@tonic-gate  */
707c478bd9Sstevel@tonic-gate #define	TH_LIMIT_XMIT		0x0400	/* Limited xmit is needed */
717c478bd9Sstevel@tonic-gate #define	TH_XMIT_NEEDED		0x0800	/* Window opened - send queued data */
727c478bd9Sstevel@tonic-gate #define	TH_REXMIT_NEEDED	0x1000	/* Time expired for unacked data */
737c478bd9Sstevel@tonic-gate #define	TH_ACK_NEEDED		0x2000	/* Send an ack now. */
747c478bd9Sstevel@tonic-gate #define	TH_NEED_SACK_REXMIT	0x4000	/* Use SACK info to retransmission */
757c478bd9Sstevel@tonic-gate #define	TH_ACK_TIMER_NEEDED	0x8000	/* Start the delayed ACK timer */
767c478bd9Sstevel@tonic-gate #define	TH_ORDREL_NEEDED	0x10000	/* Generate an ordrel indication */
777c478bd9Sstevel@tonic-gate #define	TH_MARKNEXT_NEEDED	0x20000	/* Data should have MSGMARKNEXT */
787c478bd9Sstevel@tonic-gate #define	TH_SEND_URP_MARK	0x40000	/* Send up tcp_urp_mark_mp */
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate /*
817c478bd9Sstevel@tonic-gate  * TCP sequence numbers are 32 bit integers operated
827c478bd9Sstevel@tonic-gate  * on with modular arithmetic.  These macros can be
837c478bd9Sstevel@tonic-gate  * used to compare such integers.
847c478bd9Sstevel@tonic-gate  */
857c478bd9Sstevel@tonic-gate #define	SEQ_LT(a, b)	((int32_t)((a)-(b)) < 0)
867c478bd9Sstevel@tonic-gate #define	SEQ_LEQ(a, b)	((int32_t)((a)-(b)) <= 0)
877c478bd9Sstevel@tonic-gate #define	SEQ_GT(a, b)	((int32_t)((a)-(b)) > 0)
887c478bd9Sstevel@tonic-gate #define	SEQ_GEQ(a, b)	((int32_t)((a)-(b)) >= 0)
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate /* TCP Protocol header */
917c478bd9Sstevel@tonic-gate typedef	struct tcphdr_s {
927c478bd9Sstevel@tonic-gate 	uint8_t		th_lport[2];	/* Source port */
937c478bd9Sstevel@tonic-gate 	uint8_t		th_fport[2];	/* Destination port */
947c478bd9Sstevel@tonic-gate 	uint8_t		th_seq[4];	/* Sequence number */
957c478bd9Sstevel@tonic-gate 	uint8_t		th_ack[4];	/* Acknowledgement number */
967c478bd9Sstevel@tonic-gate 	uint8_t		th_offset_and_rsrvd[1]; /* Offset to the packet data */
977c478bd9Sstevel@tonic-gate 	uint8_t		th_flags[1];
987c478bd9Sstevel@tonic-gate 	uint8_t		th_win[2];	/* Allocation number */
997c478bd9Sstevel@tonic-gate 	uint8_t		th_sum[2];	/* TCP checksum */
1007c478bd9Sstevel@tonic-gate 	uint8_t		th_urp[2];	/* Urgent pointer */
1017c478bd9Sstevel@tonic-gate } tcph_t;
1027c478bd9Sstevel@tonic-gate 
103bd670b35SErik Nordmark #define	TCP_HDR_LENGTH(tcph) \
104bd670b35SErik Nordmark 	((((tcph_t *)tcph)->th_offset_and_rsrvd[0] >>2) &(0xF << 2))
1057c478bd9Sstevel@tonic-gate #define	TCP_MAX_COMBINED_HEADER_LENGTH	(60 + 60) /* Maxed out ip + tcp */
1067c478bd9Sstevel@tonic-gate #define	TCP_MAX_IP_OPTIONS_LENGTH	(60 - IP_SIMPLE_HDR_LENGTH)
1077c478bd9Sstevel@tonic-gate #define	TCP_MAX_HDR_LENGTH		60
108bd670b35SErik Nordmark #define	TCP_MAX_TCP_OPTIONS_LENGTH	(60 - sizeof (tcpha_t))
1097c478bd9Sstevel@tonic-gate #define	TCP_MIN_HEADER_LENGTH		20
1107c478bd9Sstevel@tonic-gate #define	TCP_MAXWIN			65535
1117c478bd9Sstevel@tonic-gate #define	TCP_PORT_LEN			sizeof (in_port_t)
1127c478bd9Sstevel@tonic-gate #define	TCP_MAX_WINSHIFT		14
1137c478bd9Sstevel@tonic-gate #define	TCP_MAX_LARGEWIN		(TCP_MAXWIN << TCP_MAX_WINSHIFT)
1148347601bSyl150051 #define	TCP_MAX_LSO_LENGTH	(IP_MAXPACKET - TCP_MAX_COMBINED_HEADER_LENGTH)
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate #define	TCPIP_HDR_LENGTH(mp, n)					\
1177c478bd9Sstevel@tonic-gate 	(n) = IPH_HDR_LENGTH((mp)->b_rptr),			\
118bd670b35SErik Nordmark 	(n) += TCP_HDR_LENGTH((tcpha_t *)&(mp)->b_rptr[(n)])
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate /* TCP Protocol header (used if the header is known to be 32-bit aligned) */
1217c478bd9Sstevel@tonic-gate typedef	struct tcphdra_s {
1227c478bd9Sstevel@tonic-gate 	in_port_t	tha_lport;	/* Source port */
1237c478bd9Sstevel@tonic-gate 	in_port_t	tha_fport;	/* Destination port */
1247c478bd9Sstevel@tonic-gate 	uint32_t	tha_seq;	/* Sequence number */
1257c478bd9Sstevel@tonic-gate 	uint32_t	tha_ack;	/* Acknowledgement number */
1267c478bd9Sstevel@tonic-gate 	uint8_t tha_offset_and_reserved; /* Offset to the packet data */
1277c478bd9Sstevel@tonic-gate 	uint8_t		tha_flags;
1287c478bd9Sstevel@tonic-gate 	uint16_t	tha_win;	/* Allocation number */
1297c478bd9Sstevel@tonic-gate 	uint16_t	tha_sum;	/* TCP checksum */
1307c478bd9Sstevel@tonic-gate 	uint16_t	tha_urp;	/* Urgent pointer */
1317c478bd9Sstevel@tonic-gate } tcpha_t;
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate struct conn_s;
13493fcb0b9SKacheong Poon struct tcp_listen_cnt_s;
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate /*
1377c478bd9Sstevel@tonic-gate  * Control structure for each open TCP stream,
1387c478bd9Sstevel@tonic-gate  * defined only within the kernel or for a kmem user.
1397c478bd9Sstevel@tonic-gate  * NOTE: tcp_reinit_values MUST have a line for each field in this structure!
1407c478bd9Sstevel@tonic-gate  */
1417c478bd9Sstevel@tonic-gate #if (defined(_KERNEL) || defined(_KMEMUSER))
1427c478bd9Sstevel@tonic-gate 
1437c478bd9Sstevel@tonic-gate typedef struct tcp_s {
1447c478bd9Sstevel@tonic-gate 	struct tcp_s	*tcp_time_wait_next;
1457c478bd9Sstevel@tonic-gate 				/* Pointer to next T/W block */
1467c478bd9Sstevel@tonic-gate 	struct tcp_s	*tcp_time_wait_prev;
1477c478bd9Sstevel@tonic-gate 				/* Pointer to previous T/W next */
14866cd0f60SKacheong Poon 	int64_t		tcp_time_wait_expire;
149f4b3ec61Sdh155122 
150721fffe3SKacheong Poon 	struct conn_s	*tcp_connp;	/* back pointer to conn_t */
151721fffe3SKacheong Poon 	tcp_stack_t	*tcp_tcps;	/* back pointer to tcp_stack_t */
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate 	int32_t	tcp_state;
1547c478bd9Sstevel@tonic-gate 	int32_t	tcp_rcv_ws;		/* My window scale power */
1557c478bd9Sstevel@tonic-gate 	int32_t	tcp_snd_ws;		/* Sender's window scale power */
1567c478bd9Sstevel@tonic-gate 	uint32_t tcp_ts_recent;		/* Timestamp of earliest unacked */
1577c478bd9Sstevel@tonic-gate 					/*  data segment */
1587c478bd9Sstevel@tonic-gate 	clock_t	tcp_rto;		/* Round trip timeout */
1597c478bd9Sstevel@tonic-gate 	clock_t	tcp_last_rcv_lbolt;
1607c478bd9Sstevel@tonic-gate 				/* lbolt on last packet, used for PAWS */
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate 	uint32_t tcp_snxt;		/* Senders next seq num */
1637c478bd9Sstevel@tonic-gate 	uint32_t tcp_swnd;		/* Senders window (relative to suna) */
1647c478bd9Sstevel@tonic-gate 	uint32_t tcp_mss;		/* Max segment size */
1657c478bd9Sstevel@tonic-gate 	uint32_t tcp_iss;		/* Initial send seq num */
1667c478bd9Sstevel@tonic-gate 	uint32_t tcp_rnxt;		/* Seq we expect to recv next */
1677c478bd9Sstevel@tonic-gate 	uint32_t tcp_rwnd;
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate 	/* Fields arranged in approximate access order along main paths */
170721fffe3SKacheong Poon 	mblk_t	*tcp_xmit_head;		/* Head of xmit/rexmit list */
171721fffe3SKacheong Poon 	mblk_t	*tcp_xmit_last;		/* Last valid data seen by tcp_wput */
172721fffe3SKacheong Poon 	mblk_t	*tcp_xmit_tail;		/* Last data sent */
1737c478bd9Sstevel@tonic-gate 	uint32_t tcp_unsent;		/* # of bytes in hand that are unsent */
1747c478bd9Sstevel@tonic-gate 	uint32_t tcp_xmit_tail_unsent;	/* # of unsent bytes in xmit_tail */
1757c478bd9Sstevel@tonic-gate 
1767c478bd9Sstevel@tonic-gate 	uint32_t tcp_suna;		/* Sender unacknowledged */
1777c478bd9Sstevel@tonic-gate 	uint32_t tcp_rexmit_nxt;	/* Next rexmit seq num */
1787c478bd9Sstevel@tonic-gate 	uint32_t tcp_rexmit_max;	/* Max retran seq num */
1797c478bd9Sstevel@tonic-gate 	int32_t	tcp_snd_burst;		/* Send burst factor */
1807c478bd9Sstevel@tonic-gate 	uint32_t tcp_cwnd;		/* Congestion window */
1817c478bd9Sstevel@tonic-gate 	int32_t tcp_cwnd_cnt;		/* cwnd cnt in congestion avoidance */
1827c478bd9Sstevel@tonic-gate 
1837c478bd9Sstevel@tonic-gate 	uint32_t tcp_ibsegs;		/* Inbound segments on this stream */
1847c478bd9Sstevel@tonic-gate 	uint32_t tcp_obsegs;		/* Outbound segments on this stream */
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate 	uint32_t tcp_naglim;		/* Tunable nagle limit */
1877c478bd9Sstevel@tonic-gate 	uint32_t	tcp_valid_bits;
1887c478bd9Sstevel@tonic-gate #define	TCP_ISS_VALID	0x1	/* Is the tcp_iss seq num active? */
1897c478bd9Sstevel@tonic-gate #define	TCP_FSS_VALID	0x2	/* Is the tcp_fss seq num active? */
1907c478bd9Sstevel@tonic-gate #define	TCP_URG_VALID	0x4	/* Is the tcp_urg seq num active? */
1917c478bd9Sstevel@tonic-gate #define	TCP_OFO_FIN_VALID 0x8	/* Has TCP received an out of order FIN? */
1927c478bd9Sstevel@tonic-gate 
1937c478bd9Sstevel@tonic-gate 
1947c478bd9Sstevel@tonic-gate 
1957c478bd9Sstevel@tonic-gate 	timeout_id_t	tcp_timer_tid;	/* Control block for timer service */
1967c478bd9Sstevel@tonic-gate 	uchar_t	tcp_timer_backoff;	/* Backoff shift count. */
1977c478bd9Sstevel@tonic-gate 	int64_t tcp_last_recv_time;	/* Last time we receive a segment. */
1987c478bd9Sstevel@tonic-gate 	uint32_t tcp_init_cwnd;		/* Initial cwnd (start/restart) */
1997c478bd9Sstevel@tonic-gate 
2007c478bd9Sstevel@tonic-gate 	/* Following manipulated by TCP under squeue protection */
2017c478bd9Sstevel@tonic-gate 	uint32_t
2027c478bd9Sstevel@tonic-gate 		tcp_urp_last_valid : 1,	/* Is tcp_urp_last valid? */
203bd670b35SErik Nordmark 		tcp_hard_binding : 1,	/* TCP_DETACHED_NONEAGER */
2047c478bd9Sstevel@tonic-gate 		tcp_fin_acked : 1,	/* Has our FIN been acked? */
2057c478bd9Sstevel@tonic-gate 		tcp_fin_rcvd : 1,	/* Have we seen a FIN? */
206bd670b35SErik Nordmark 
2077c478bd9Sstevel@tonic-gate 		tcp_fin_sent : 1,	/* Have we sent our FIN yet? */
2087c478bd9Sstevel@tonic-gate 		tcp_ordrel_done : 1,	/* Have we sent the ord_rel upstream? */
2097c478bd9Sstevel@tonic-gate 		tcp_detached : 1,	/* If we're detached from a stream */
2107c478bd9Sstevel@tonic-gate 		tcp_zero_win_probe: 1,	/* Zero win probing is in progress */
211f7f8e53dSKacheong Poon 
2127c478bd9Sstevel@tonic-gate 		tcp_loopback: 1,	/* src and dst are the same machine */
2137c478bd9Sstevel@tonic-gate 		tcp_localnet: 1,	/* src and dst are on the same subnet */
2147c478bd9Sstevel@tonic-gate 		tcp_syn_defense: 1,	/* For defense against SYN attack */
2157c478bd9Sstevel@tonic-gate #define	tcp_dontdrop	tcp_syn_defense
2167c478bd9Sstevel@tonic-gate 		tcp_set_timer : 1,
2178380b3ccSYu Xiangning 
218f7f8e53dSKacheong Poon 		tcp_active_open: 1,	/* This is a active open */
219f7f8e53dSKacheong Poon 		tcp_rexmit : 1,		/* TCP is retransmitting */
2207c478bd9Sstevel@tonic-gate 		tcp_snd_sack_ok : 1,	/* Can use SACK for this connection */
2217c478bd9Sstevel@tonic-gate 		tcp_hwcksum : 1,	/* The NIC is capable of hwcksum */
222f7f8e53dSKacheong Poon 
223bd670b35SErik Nordmark 		tcp_ip_forward_progress : 1,
2247c478bd9Sstevel@tonic-gate 		tcp_ecn_ok : 1,		/* Can use ECN for this connection */
2257c478bd9Sstevel@tonic-gate 		tcp_ecn_echo_on : 1,	/* Need to do ECN echo */
2267c478bd9Sstevel@tonic-gate 		tcp_ecn_cwr_sent : 1,	/* ECN_CWR has been sent */
227bd670b35SErik Nordmark 
228e0968231Svi117747 		tcp_cwr : 1,		/* Cwnd has reduced recently */
229f7f8e53dSKacheong Poon 
230bd670b35SErik Nordmark 		tcp_pad_to_bit31 : 11;
231bd670b35SErik Nordmark 
2327c478bd9Sstevel@tonic-gate 	/* Following manipulated by TCP under squeue protection */
2337c478bd9Sstevel@tonic-gate 	uint32_t
2347c478bd9Sstevel@tonic-gate 		tcp_snd_ts_ok  : 1,
2357c478bd9Sstevel@tonic-gate 		tcp_snd_ws_ok  : 1,
236bd670b35SErik Nordmark 		tcp_reserved_port : 1,
2377c478bd9Sstevel@tonic-gate 		tcp_in_free_list : 1,
2387c478bd9Sstevel@tonic-gate 
239bd670b35SErik Nordmark 		tcp_snd_zcopy_on : 1,	/* xmit zero-copy enabled */
2407c478bd9Sstevel@tonic-gate 		tcp_snd_zcopy_aware : 1, /* client is zero-copy aware */
2417c478bd9Sstevel@tonic-gate 		tcp_xmit_zc_clean : 1,	/* the xmit list is free of zc-mblk */
2427c478bd9Sstevel@tonic-gate 		tcp_wait_for_eagers : 1, /* Wait for eagers to disappear */
2437c478bd9Sstevel@tonic-gate 
244bd670b35SErik Nordmark 		tcp_accept_error : 1,	/* Error during TLI accept */
2457c478bd9Sstevel@tonic-gate 		tcp_send_discon_ind : 1, /* TLI accept err, send discon ind */
2467c478bd9Sstevel@tonic-gate 		tcp_cork : 1,		/* tcp_cork option */
247866ba9ddSjprakash 		tcp_tconnind_started : 1, /* conn_ind message is being sent */
2487c478bd9Sstevel@tonic-gate 
249bd670b35SErik Nordmark 		tcp_lso :1,		/* Lower layer is capable of LSO */
250bd670b35SErik Nordmark 		tcp_is_wnd_shrnk : 1,	/* Window has shrunk */
251bd670b35SErik Nordmark 
252bd670b35SErik Nordmark 		tcp_pad_to_bit_31 : 18;
253bd670b35SErik Nordmark 
254bd670b35SErik Nordmark 	uint32_t	tcp_initial_pmtu; /* Initial outgoing Path MTU. */
2557c478bd9Sstevel@tonic-gate 
2567c478bd9Sstevel@tonic-gate 	mblk_t	*tcp_reass_head;	/* Out of order reassembly list head */
2577c478bd9Sstevel@tonic-gate 	mblk_t	*tcp_reass_tail;	/* Out of order reassembly list tail */
2587c478bd9Sstevel@tonic-gate 
25966cd0f60SKacheong Poon 	/* SACK related info */
26066cd0f60SKacheong Poon 	tcp_sack_info_t	tcp_sack_info;
2617c478bd9Sstevel@tonic-gate 
26266cd0f60SKacheong Poon #define	tcp_pipe		tcp_sack_info.tcp_pipe
26366cd0f60SKacheong Poon #define	tcp_fack		tcp_sack_info.tcp_fack
26466cd0f60SKacheong Poon #define	tcp_sack_snxt		tcp_sack_info.tcp_sack_snxt
26566cd0f60SKacheong Poon #define	tcp_max_sack_blk	tcp_sack_info.tcp_max_sack_blk
26666cd0f60SKacheong Poon #define	tcp_num_sack_blk	tcp_sack_info.tcp_num_sack_blk
26766cd0f60SKacheong Poon #define	tcp_sack_list		tcp_sack_info.tcp_sack_list
26866cd0f60SKacheong Poon #define	tcp_num_notsack_blk	tcp_sack_info.tcp_num_notsack_blk
26966cd0f60SKacheong Poon #define	tcp_cnt_notsack_list	tcp_sack_info.tcp_cnt_notsack_list
27066cd0f60SKacheong Poon #define	tcp_notsack_list	tcp_sack_info.tcp_notsack_list
2717c478bd9Sstevel@tonic-gate 
2727c478bd9Sstevel@tonic-gate 	mblk_t	*tcp_rcv_list;		/* Queued until push, urgent data, */
2737c478bd9Sstevel@tonic-gate 	mblk_t	*tcp_rcv_last_head;	/* optdata, or the count exceeds */
2747c478bd9Sstevel@tonic-gate 	mblk_t	*tcp_rcv_last_tail;	/* tcp_rcv_push_wait. */
2757c478bd9Sstevel@tonic-gate 	uint32_t tcp_rcv_cnt;		/* tcp_rcv_list is b_next chain. */
2767c478bd9Sstevel@tonic-gate 
2777c478bd9Sstevel@tonic-gate 	uint32_t tcp_cwnd_ssthresh;	/* Congestion window */
2787c478bd9Sstevel@tonic-gate 	uint32_t tcp_cwnd_max;
2797c478bd9Sstevel@tonic-gate 	uint32_t tcp_csuna;		/* Clear (no rexmits in window) suna */
2807c478bd9Sstevel@tonic-gate 
2817c478bd9Sstevel@tonic-gate 	clock_t	tcp_rtt_sa;		/* Round trip smoothed average */
2827c478bd9Sstevel@tonic-gate 	clock_t	tcp_rtt_sd;		/* Round trip smoothed deviation */
2837c478bd9Sstevel@tonic-gate 	clock_t	tcp_rtt_update;		/* Round trip update(s) */
2847c478bd9Sstevel@tonic-gate 	clock_t tcp_ms_we_have_waited;	/* Total retrans time */
2857c478bd9Sstevel@tonic-gate 
2867c478bd9Sstevel@tonic-gate 	uint32_t tcp_swl1;		/* These help us avoid using stale */
2877c478bd9Sstevel@tonic-gate 	uint32_t tcp_swl2;		/*  packets to update state */
2887c478bd9Sstevel@tonic-gate 
2897c478bd9Sstevel@tonic-gate 	uint32_t tcp_rack;		/* Seq # we have acked */
2907c478bd9Sstevel@tonic-gate 	uint32_t tcp_rack_cnt;		/* # of segs we have deferred ack */
2917c478bd9Sstevel@tonic-gate 	uint32_t tcp_rack_cur_max;	/* # of segs we may defer ack for now */
2927c478bd9Sstevel@tonic-gate 	uint32_t tcp_rack_abs_max;	/* # of segs we may defer ack ever */
2937c478bd9Sstevel@tonic-gate 	timeout_id_t	tcp_ack_tid;	/* Delayed ACK timer ID */
2947c478bd9Sstevel@tonic-gate 	timeout_id_t	tcp_push_tid;	/* Push timer ID */
2957c478bd9Sstevel@tonic-gate 
2967c478bd9Sstevel@tonic-gate 	uint32_t tcp_max_swnd;		/* Maximum swnd we have seen */
2977c478bd9Sstevel@tonic-gate 
2987c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_listener;	/* Our listener */
2997c478bd9Sstevel@tonic-gate 
3007c478bd9Sstevel@tonic-gate 	uint32_t tcp_irs;		/* Initial recv seq num */
3017c478bd9Sstevel@tonic-gate 	uint32_t tcp_fss;		/* Final/fin send seq num */
3027c478bd9Sstevel@tonic-gate 	uint32_t tcp_urg;		/* Urgent data seq num */
3037c478bd9Sstevel@tonic-gate 
3047c478bd9Sstevel@tonic-gate 	clock_t	tcp_first_timer_threshold;  /* When to prod IP */
3057c478bd9Sstevel@tonic-gate 	clock_t	tcp_second_timer_threshold; /* When to give up completely */
3067c478bd9Sstevel@tonic-gate 	clock_t	tcp_first_ctimer_threshold; /* 1st threshold while connecting */
3077c478bd9Sstevel@tonic-gate 	clock_t tcp_second_ctimer_threshold; /* 2nd ... while connecting */
3087c478bd9Sstevel@tonic-gate 
3097c478bd9Sstevel@tonic-gate 	uint32_t tcp_urp_last;		/* Last urp for which signal sent */
3107c478bd9Sstevel@tonic-gate 	mblk_t	*tcp_urp_mp;		/* T_EXDATA_IND for urgent byte */
3117c478bd9Sstevel@tonic-gate 	mblk_t	*tcp_urp_mark_mp;	/* zero-length marked/unmarked msg */
3127c478bd9Sstevel@tonic-gate 
3137c478bd9Sstevel@tonic-gate 	int tcp_conn_req_cnt_q0;	/* # of conn reqs in SYN_RCVD */
3147c478bd9Sstevel@tonic-gate 	int tcp_conn_req_cnt_q;	/* # of conn reqs in ESTABLISHED */
3157c478bd9Sstevel@tonic-gate 	int tcp_conn_req_max;	/* # of ESTABLISHED conn reqs allowed */
3167c478bd9Sstevel@tonic-gate 	t_scalar_t tcp_conn_req_seqnum;	/* Incrementing pending conn req ID */
3177c478bd9Sstevel@tonic-gate #define	tcp_ip_addr_cache	tcp_reass_tail
3187c478bd9Sstevel@tonic-gate 					/* Cache ip addresses that */
3197c478bd9Sstevel@tonic-gate 					/* complete the 3-way handshake */
3207c478bd9Sstevel@tonic-gate 	kmutex_t  tcp_eager_lock;
3217c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_eager_next_q; /* next eager in ESTABLISHED state */
3227c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_eager_last_q;	/* last eager in ESTABLISHED state */
3237c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_eager_next_q0; /* next eager in SYN_RCVD state */
3247c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_eager_prev_q0; /* prev eager in SYN_RCVD state */
3257c478bd9Sstevel@tonic-gate 					/* all eagers form a circular list */
3268380b3ccSYu Xiangning 	boolean_t tcp_conn_def_q0;	/* move from q0 to q deferred */
3278380b3ccSYu Xiangning 
3287c478bd9Sstevel@tonic-gate 	union {
3297c478bd9Sstevel@tonic-gate 	    mblk_t *tcp_eager_conn_ind; /* T_CONN_IND waiting for 3rd ack. */
3307c478bd9Sstevel@tonic-gate 	    mblk_t *tcp_opts_conn_req; /* T_CONN_REQ w/ options processed */
3317c478bd9Sstevel@tonic-gate 	} tcp_conn;
3327c478bd9Sstevel@tonic-gate 	uint32_t tcp_syn_rcvd_timeout;	/* How many SYN_RCVD timeout in q0 */
3337c478bd9Sstevel@tonic-gate 
3347c478bd9Sstevel@tonic-gate 	/* TCP Keepalive Timer members */
3357c478bd9Sstevel@tonic-gate 	int32_t	tcp_ka_last_intrvl;	/* Last probe interval */
3367c478bd9Sstevel@tonic-gate 	timeout_id_t tcp_ka_tid;	/* Keepalive timer ID */
3377c478bd9Sstevel@tonic-gate 	uint32_t tcp_ka_interval;	/* Keepalive interval */
3387c478bd9Sstevel@tonic-gate 	uint32_t tcp_ka_abort_thres;	/* Keepalive abort threshold */
3397c478bd9Sstevel@tonic-gate 
3407c478bd9Sstevel@tonic-gate 	int32_t	tcp_client_errno;	/* How the client screwed up */
3417c478bd9Sstevel@tonic-gate 
342bd670b35SErik Nordmark 	/*
343bd670b35SErik Nordmark 	 * The header template lives in conn_ht_iphc allocated by tcp_build_hdrs
344bd670b35SErik Nordmark 	 * We maintain three pointers into conn_ht_iphc.
345bd670b35SErik Nordmark 	 */
346bd670b35SErik Nordmark 	ipha_t	*tcp_ipha;		/* IPv4 header in conn_ht_iphc */
347bd670b35SErik Nordmark 	ip6_t	*tcp_ip6h;		/* IPv6 header in conn_ht_iphc */
348bd670b35SErik Nordmark 	tcpha_t	*tcp_tcpha;		/* TCP header in conn_ht_iphc */
3497c478bd9Sstevel@tonic-gate 
3507c478bd9Sstevel@tonic-gate 	uint16_t tcp_last_sent_len;	/* Record length for nagle */
351*9cd928feSAlan Maguire 	uint16_t tcp_last_recv_len;	/* Used by DTrace */
3527c478bd9Sstevel@tonic-gate 	uint16_t tcp_dupack_cnt;	/* # of consequtive duplicate acks */
3537c478bd9Sstevel@tonic-gate 
3547c478bd9Sstevel@tonic-gate 	kmutex_t	*tcp_acceptor_lockp;	/* Ptr to tf_lock */
3557c478bd9Sstevel@tonic-gate 
356f7f8e53dSKacheong Poon 	mblk_t		*tcp_ordrel_mp;		/* T_ordrel_ind mblk */
3577c478bd9Sstevel@tonic-gate 	t_uscalar_t	tcp_acceptor_id;	/* ACCEPTOR_id */
3587c478bd9Sstevel@tonic-gate 
3597c478bd9Sstevel@tonic-gate 	int		tcp_ipsec_overhead;
3607c478bd9Sstevel@tonic-gate 
3617c478bd9Sstevel@tonic-gate 	uint_t		tcp_recvifindex; /* Last received IPV6_RCVPKTINFO */
3627c478bd9Sstevel@tonic-gate 	uint_t		tcp_recvhops;	/* Last received IPV6_RECVHOPLIMIT */
3637c478bd9Sstevel@tonic-gate 	uint_t		tcp_recvtclass;	/* Last received IPV6_RECVTCLASS */
3647c478bd9Sstevel@tonic-gate 	ip6_hbh_t	*tcp_hopopts;	/* Last received IPV6_RECVHOPOPTS */
3657c478bd9Sstevel@tonic-gate 	ip6_dest_t	*tcp_dstopts;	/* Last received IPV6_RECVDSTOPTS */
366bd670b35SErik Nordmark 	ip6_dest_t	*tcp_rthdrdstopts; /* Last recv IPV6_RECVRTHDRDSTOPTS */
3677c478bd9Sstevel@tonic-gate 	ip6_rthdr_t	*tcp_rthdr;	/* Last received IPV6_RECVRTHDR */
3687c478bd9Sstevel@tonic-gate 	uint_t		tcp_hopoptslen;
3697c478bd9Sstevel@tonic-gate 	uint_t		tcp_dstoptslen;
370bd670b35SErik Nordmark 	uint_t		tcp_rthdrdstoptslen;
3717c478bd9Sstevel@tonic-gate 	uint_t		tcp_rthdrlen;
3727c478bd9Sstevel@tonic-gate 
3737c478bd9Sstevel@tonic-gate 	mblk_t		*tcp_timercache;
3747c478bd9Sstevel@tonic-gate 
3757c478bd9Sstevel@tonic-gate 	kmutex_t	tcp_closelock;
3767c478bd9Sstevel@tonic-gate 	kcondvar_t	tcp_closecv;
3777c478bd9Sstevel@tonic-gate 	uint8_t		tcp_closed;
3787c478bd9Sstevel@tonic-gate 	uint8_t		tcp_closeflags;
3797c478bd9Sstevel@tonic-gate 	mblk_t		tcp_closemp;
3807c478bd9Sstevel@tonic-gate 	timeout_id_t	tcp_linger_tid;	/* Linger timer ID */
3817c478bd9Sstevel@tonic-gate 
3827c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_acceptor_hash; /* Acceptor hash chain */
3837c478bd9Sstevel@tonic-gate 	struct tcp_s **tcp_ptpahn; /* Pointer to previous accept hash next. */
3847c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_bind_hash; /* Bind hash chain */
3850f1702c5SYu Xiangning 	struct tcp_s *tcp_bind_hash_port; /* tcp_t's bound to the same lport */
3867c478bd9Sstevel@tonic-gate 	struct tcp_s **tcp_ptpbhn;
3877c478bd9Sstevel@tonic-gate 
388bd670b35SErik Nordmark 	uint_t		tcp_maxpsz_multiplier;
3897c478bd9Sstevel@tonic-gate 
3908347601bSyl150051 	uint32_t	tcp_lso_max; /* maximum LSO payload */
3918347601bSyl150051 
3927c478bd9Sstevel@tonic-gate 	uint32_t	tcp_ofo_fin_seq; /* Recv out of order FIN seq num */
3937c478bd9Sstevel@tonic-gate 	uint32_t	tcp_cwr_snd_max;
394bd670b35SErik Nordmark 
3957c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_saved_listener;	/* saved value of listener */
3967c478bd9Sstevel@tonic-gate 
397ff550d0eSmasputra 	uint32_t	tcp_in_ack_unsent;	/* ACK for unsent data cnt. */
398ff550d0eSmasputra 
399ff550d0eSmasputra 	/*
4007b8f5432SAnders Persson 	 * All fusion-related fields are protected by squeue.
401ff550d0eSmasputra 	 */
4027c478bd9Sstevel@tonic-gate 	struct tcp_s *tcp_loopback_peer;	/* peer tcp for loopback */
4037c478bd9Sstevel@tonic-gate 	mblk_t	*tcp_fused_sigurg_mp;		/* M_PCSIG mblk for SIGURG */
4047b8f5432SAnders Persson 
405ff550d0eSmasputra 	uint32_t
406ff550d0eSmasputra 		tcp_fused : 1,		/* loopback tcp in fusion mode */
407ff550d0eSmasputra 		tcp_unfusable : 1,	/* fusion not allowed on endpoint */
408ff550d0eSmasputra 		tcp_fused_sigurg : 1,	/* send SIGURG upon draining */
4097c478bd9Sstevel@tonic-gate 
4107b8f5432SAnders Persson 		tcp_fuse_to_bit_31 : 29;
4117b8f5432SAnders Persson 
4127b8f5432SAnders Persson 	kmutex_t tcp_non_sq_lock;
4137c478bd9Sstevel@tonic-gate 
4147c478bd9Sstevel@tonic-gate 	/*
4157c478bd9Sstevel@tonic-gate 	 * This variable is accessed without any lock protection
4167c478bd9Sstevel@tonic-gate 	 * and therefore must not be declared as a bit field along
4177c478bd9Sstevel@tonic-gate 	 * with the rest which require such condition.
4187c478bd9Sstevel@tonic-gate 	 */
4197c478bd9Sstevel@tonic-gate 	boolean_t	tcp_issocket;	/* this is a socket tcp */
420ff550d0eSmasputra 
421e0968231Svi117747 	/* protected by the tcp_non_sq_lock lock */
422ff550d0eSmasputra 	uint32_t	tcp_squeue_bytes;
423c28749e9Skais 	/*
424c28749e9Skais 	 * Kernel SSL session information
425c28749e9Skais 	 */
426c28749e9Skais 	boolean_t		tcp_kssl_pending; /* waiting for 1st SSL rec. */
427c28749e9Skais 	boolean_t		tcp_kssl_inhandshake; /* during SSL handshake */
428c28749e9Skais 	kssl_ent_t		tcp_kssl_ent;	/* SSL table entry */
429c28749e9Skais 	kssl_ctx_t		tcp_kssl_ctx;	/* SSL session */
430866ba9ddSjprakash 
431866ba9ddSjprakash 	/*
432866ba9ddSjprakash 	 * tcp_closemp_used is protected by listener's tcp_eager_lock
433866ba9ddSjprakash 	 * when used for eagers. When used for a tcp in TIME_WAIT state
434866ba9ddSjprakash 	 * or in tcp_close(), it is not protected by any lock as we
435866ba9ddSjprakash 	 * do not expect any other thread to use it concurrently.
4360163a147Sjprakash 	 * We do allow re-use of tcp_closemp in tcp_time_wait_collector()
4370163a147Sjprakash 	 * and tcp_close() but not concurrently.
438866ba9ddSjprakash 	 */
4390163a147Sjprakash 	boolean_t tcp_closemp_used;
440866ba9ddSjprakash 
441866ba9ddSjprakash 	/*
442866ba9ddSjprakash 	 * previous and next eagers in the list of droppable eagers. See
443866ba9ddSjprakash 	 * the comments before MAKE_DROPPABLE(). These pointers are
444866ba9ddSjprakash 	 * protected by listener's tcp_eager_lock.
445866ba9ddSjprakash 	 */
446866ba9ddSjprakash 	struct tcp_s	*tcp_eager_prev_drop_q0;
447866ba9ddSjprakash 	struct tcp_s	*tcp_eager_next_drop_q0;
448e0968231Svi117747 
449e0968231Svi117747 	/*
450e0968231Svi117747 	 * Have we flow controlled xmitter?
451e0968231Svi117747 	 * This variable can be modified outside the squeue and hence must
452e0968231Svi117747 	 * not be declared as a bit field along with the rest that are
453e0968231Svi117747 	 * modified only within the squeue.
454e0968231Svi117747 	 * protected by the tcp_non_sq_lock lock.
455e0968231Svi117747 	 */
456e0968231Svi117747 	boolean_t	tcp_flow_stopped;
457e0968231Svi117747 
45817169044Sbrutus 	/*
459410734d4SPhilip Kirk 	 * Sender's next sequence number at the time the window was shrunk.
460410734d4SPhilip Kirk 	 */
461410734d4SPhilip Kirk 	uint32_t	tcp_snxt_shrunk;
462410734d4SPhilip Kirk 
463410734d4SPhilip Kirk 	/*
464dc7c1171SAnders Persson 	 * Socket generation number which is bumped when a connection attempt
465dc7c1171SAnders Persson 	 * is initiated. Its main purpose is to ensure that the socket does not
466dc7c1171SAnders Persson 	 * miss the asynchronous connected/disconnected notification.
4670f1702c5SYu Xiangning 	 */
4680f1702c5SYu Xiangning 	sock_connid_t	tcp_connid;
4690f1702c5SYu Xiangning 
470f7f8e53dSKacheong Poon 	/* mblk_t used to enter TCP's squeue from the service routine. */
471f7f8e53dSKacheong Poon 	mblk_t		*tcp_rsrv_mp;
472f7f8e53dSKacheong Poon 	/* Mutex for accessing tcp_rsrv_mp */
473f7f8e53dSKacheong Poon 	kmutex_t	tcp_rsrv_mp_lock;
474f7f8e53dSKacheong Poon 
47593fcb0b9SKacheong Poon 	/* For connection counting. */
47693fcb0b9SKacheong Poon 	struct tcp_listen_cnt_s	*tcp_listen_cnt;
47793fcb0b9SKacheong Poon 
47893fcb0b9SKacheong Poon 	/* Segment reassembly timer. */
47993fcb0b9SKacheong Poon 	timeout_id_t		tcp_reass_tid;
48093fcb0b9SKacheong Poon 
481866ba9ddSjprakash #ifdef DEBUG
482866ba9ddSjprakash 	pc_t			tcmp_stk[15];
483866ba9ddSjprakash #endif
4847c478bd9Sstevel@tonic-gate } tcp_t;
4857c478bd9Sstevel@tonic-gate 
486866ba9ddSjprakash #ifdef DEBUG
487866ba9ddSjprakash #define	TCP_DEBUG_GETPCSTACK(buffer, depth)	((void) getpcstack(buffer, \
488866ba9ddSjprakash 						    depth))
489866ba9ddSjprakash #else
490866ba9ddSjprakash #define	TCP_DEBUG_GETPCSTACK(buffer, depth)
491866ba9ddSjprakash #endif
492866ba9ddSjprakash 
49393fcb0b9SKacheong Poon extern void	tcp_conn_reclaim(void *);
4947c478bd9Sstevel@tonic-gate extern void 	tcp_free(tcp_t *tcp);
495f4b3ec61Sdh155122 extern void	tcp_ddi_g_init(void);
496f4b3ec61Sdh155122 extern void	tcp_ddi_g_destroy(void);
497f3124163SAnders Persson extern void 	*tcp_get_conn(void *arg, tcp_stack_t *);
498fc80c0dfSnordmark extern mblk_t	*tcp_snmp_get(queue_t *, mblk_t *);
499ff550d0eSmasputra extern int	tcp_snmp_set(queue_t *, int, int, uchar_t *, int len);
5000854dd28SPhilip Kirk 
5017c478bd9Sstevel@tonic-gate /*
502721fffe3SKacheong Poon  * The TCP Fanout structure for bind and acceptor hashes.
503721fffe3SKacheong Poon  * The hash tables and their linkage (tcp_*_hash, tcp_ptp*hn) are
5047c478bd9Sstevel@tonic-gate  * protected by the per-bucket tf_lock.  Each tcp_t
5057c478bd9Sstevel@tonic-gate  * inserted in the list points back at this lock using tcp_*_lockp.
5067c478bd9Sstevel@tonic-gate  *
507721fffe3SKacheong Poon  * The bind and acceptor hash queues are lists of tcp_t.
5087c478bd9Sstevel@tonic-gate  */
5097c478bd9Sstevel@tonic-gate /* listener hash and acceptor hash queue head */
5107c478bd9Sstevel@tonic-gate typedef struct tf_s {
5117c478bd9Sstevel@tonic-gate 	tcp_t		*tf_tcp;
5127c478bd9Sstevel@tonic-gate 	kmutex_t	tf_lock;
5137c478bd9Sstevel@tonic-gate } tf_t;
514721fffe3SKacheong Poon 
515721fffe3SKacheong Poon 
516721fffe3SKacheong Poon /* Also used in ipclassifier.c */
517721fffe3SKacheong Poon extern struct kmem_cache  *tcp_sack_info_cache;
518721fffe3SKacheong Poon 
5197c478bd9Sstevel@tonic-gate #endif	/* (defined(_KERNEL) || defined(_KMEMUSER)) */
5207c478bd9Sstevel@tonic-gate 
5217c478bd9Sstevel@tonic-gate /* Contract private interface between TCP and Clustering. */
5227c478bd9Sstevel@tonic-gate 
5237c478bd9Sstevel@tonic-gate #define	CL_TCPI_V1	1	/* cl_tcpi_version number */
5247c478bd9Sstevel@tonic-gate 
5257c478bd9Sstevel@tonic-gate typedef struct cl_tcp_info_s {
5267c478bd9Sstevel@tonic-gate 	ushort_t	cl_tcpi_version;	/* cl_tcp_info_t's version no */
5277c478bd9Sstevel@tonic-gate 	ushort_t	cl_tcpi_ipversion;	/* IP version */
5287c478bd9Sstevel@tonic-gate 	int32_t		cl_tcpi_state;		/* TCP state */
5297c478bd9Sstevel@tonic-gate 	in_port_t	cl_tcpi_lport;		/* Local port */
5307c478bd9Sstevel@tonic-gate 	in_port_t	cl_tcpi_fport;		/* Remote port */
5317c478bd9Sstevel@tonic-gate 	in6_addr_t	cl_tcpi_laddr_v6;	/* Local IP address */
5327c478bd9Sstevel@tonic-gate 	in6_addr_t	cl_tcpi_faddr_v6;	/* Remote IP address */
5337c478bd9Sstevel@tonic-gate #ifdef _KERNEL
5347c478bd9Sstevel@tonic-gate /* Note: V4_PART_OF_V6 is meant to be used only for _KERNEL defined stuff */
5357c478bd9Sstevel@tonic-gate #define	cl_tcpi_laddr	V4_PART_OF_V6(cl_tcpi_laddr_v6)
5367c478bd9Sstevel@tonic-gate #define	cl_tcpi_faddr	V4_PART_OF_V6(cl_tcpi_faddr_v6)
5377c478bd9Sstevel@tonic-gate 
5387c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
5397c478bd9Sstevel@tonic-gate } cl_tcp_info_t;
5407c478bd9Sstevel@tonic-gate 
5417c478bd9Sstevel@tonic-gate /*
542bd670b35SErik Nordmark  * Hook functions to enable cluster networking
543bd670b35SErik Nordmark  * On non-clustered systems these vectors must always be NULL.
544bd670b35SErik Nordmark  */
545bd670b35SErik Nordmark extern void	(*cl_inet_listen)(netstackid_t, uint8_t, sa_family_t,
546bd670b35SErik Nordmark 		    uint8_t *, in_port_t, void *);
547bd670b35SErik Nordmark extern void	(*cl_inet_unlisten)(netstackid_t, uint8_t, sa_family_t,
548bd670b35SErik Nordmark 		    uint8_t *, in_port_t, void *);
549bd670b35SErik Nordmark 
550bd670b35SErik Nordmark /*
5517c478bd9Sstevel@tonic-gate  * Contracted Consolidation Private ioctl for aborting TCP connections.
5527c478bd9Sstevel@tonic-gate  * In order to keep the offsets and size of the structure the same between
5537c478bd9Sstevel@tonic-gate  * a 32-bit application and a 64-bit amd64 kernel, we use a #pragma
5547c478bd9Sstevel@tonic-gate  * pack(4).
5557c478bd9Sstevel@tonic-gate  */
5567c478bd9Sstevel@tonic-gate #define	TCP_IOC_ABORT_CONN	(('T' << 8) + 91)
5577c478bd9Sstevel@tonic-gate 
5587c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
5597c478bd9Sstevel@tonic-gate #pragma pack(4)
5607c478bd9Sstevel@tonic-gate #endif
5617c478bd9Sstevel@tonic-gate 
5627c478bd9Sstevel@tonic-gate typedef struct tcp_ioc_abort_conn_s {
5637c478bd9Sstevel@tonic-gate 	struct sockaddr_storage ac_local;	/* local addr and port */
5647c478bd9Sstevel@tonic-gate 	struct sockaddr_storage ac_remote;	/* remote addr and port */
5657c478bd9Sstevel@tonic-gate 	int32_t ac_start;			/* start state */
5667c478bd9Sstevel@tonic-gate 	int32_t ac_end;				/* end state  */
5677c478bd9Sstevel@tonic-gate 	int32_t ac_zoneid;			/* zoneid */
5687c478bd9Sstevel@tonic-gate } tcp_ioc_abort_conn_t;
5697c478bd9Sstevel@tonic-gate 
5707c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
5717c478bd9Sstevel@tonic-gate #pragma pack()
5727c478bd9Sstevel@tonic-gate #endif
5737c478bd9Sstevel@tonic-gate 
5747c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
5757c478bd9Sstevel@tonic-gate }
5767c478bd9Sstevel@tonic-gate #endif
5777c478bd9Sstevel@tonic-gate 
5787c478bd9Sstevel@tonic-gate #endif	/* _INET_TCP_H */
579