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 */ 2177c67f2fSkcpoon 227c478bd9Sstevel@tonic-gate /* 23fd7b5aedSGeorge Shepherd * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _INET_SCTP_SCTP_IMPL_H 277c478bd9Sstevel@tonic-gate #define _INET_SCTP_SCTP_IMPL_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #include <sys/inttypes.h> 307c478bd9Sstevel@tonic-gate #include <sys/taskq.h> 317c478bd9Sstevel@tonic-gate #include <sys/list.h> 327c478bd9Sstevel@tonic-gate #include <sys/strsun.h> 3345916cd2Sjpk #include <sys/zone.h> 345dd46ab5SKacheong Poon #include <sys/cpuvar.h> 355dd46ab5SKacheong Poon #include <sys/clock_impl.h> 365dd46ab5SKacheong Poon 377c478bd9Sstevel@tonic-gate #include <netinet/ip6.h> 387c478bd9Sstevel@tonic-gate #include <inet/optcom.h> 396e91bba0SGirish Moodalbail #include <inet/tunables.h> 407c478bd9Sstevel@tonic-gate #include <netinet/sctp.h> 417c478bd9Sstevel@tonic-gate #include <inet/sctp_itf.h> 42f4b3ec61Sdh #include "sctp_stack.h" 43f4b3ec61Sdh 44f4b3ec61Sdh #ifdef __cplusplus 45f4b3ec61Sdh extern "C" { 46f4b3ec61Sdh #endif 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate /* Streams device identifying info and version */ 497c478bd9Sstevel@tonic-gate #define SCTP_DEV_IDINFO "SCTP Streams device 1.0" 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate #define SSN_GT(a, b) ((int16_t)((a)-(b)) > 0) 527c478bd9Sstevel@tonic-gate #define SSN_GE(a, b) ((int16_t)((a)-(b)) >= 0) 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate /* Default buffer size and flow control wake up threshold. */ 557c478bd9Sstevel@tonic-gate #define SCTP_XMIT_LOWATER 8192 567c478bd9Sstevel@tonic-gate #define SCTP_XMIT_HIWATER 102400 577c478bd9Sstevel@tonic-gate #define SCTP_RECV_LOWATER 8192 587c478bd9Sstevel@tonic-gate #define SCTP_RECV_HIWATER 102400 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate /* SCTP Timer control structure */ 617c478bd9Sstevel@tonic-gate typedef struct sctpt_s { 627c478bd9Sstevel@tonic-gate pfv_t sctpt_pfv; /* The routine we are to call */ 637c478bd9Sstevel@tonic-gate struct sctp_s *sctpt_sctp; /* The parameter we are to pass in */ 647c478bd9Sstevel@tonic-gate struct sctp_faddr_s *sctpt_faddr; 657c478bd9Sstevel@tonic-gate } sctpt_t; 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate /* 687c478bd9Sstevel@tonic-gate * Maximum number of duplicate TSNs we can report. This is currently 697c478bd9Sstevel@tonic-gate * static, and governs the size of the mblk used to hold the duplicate 707c478bd9Sstevel@tonic-gate * reports. The use of duplcate TSN reports is currently experimental, 717c478bd9Sstevel@tonic-gate * so for now a static limit should suffice. 727c478bd9Sstevel@tonic-gate */ 737c478bd9Sstevel@tonic-gate #define SCTP_DUP_MBLK_SZ 64 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate #define SCTP_IS_ADDR_UNSPEC(isv4, addr) \ 767c478bd9Sstevel@tonic-gate ((isv4) ? IN6_IS_ADDR_V4MAPPED_ANY(&(addr)) : \ 777c478bd9Sstevel@tonic-gate IN6_IS_ADDR_UNSPECIFIED(&(addr))) 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gate /* 806e91bba0SGirish Moodalbail * SCTP properties/tunables 817c478bd9Sstevel@tonic-gate */ 826e91bba0SGirish Moodalbail #define sctps_max_init_retr sctps_propinfo_tbl[0].prop_cur_uval 836e91bba0SGirish Moodalbail #define sctps_max_init_retr_high sctps_propinfo_tbl[0].prop_max_uval 846e91bba0SGirish Moodalbail #define sctps_max_init_retr_low sctps_propinfo_tbl[0].prop_min_uval 856e91bba0SGirish Moodalbail #define sctps_pa_max_retr sctps_propinfo_tbl[1].prop_cur_uval 866e91bba0SGirish Moodalbail #define sctps_pa_max_retr_high sctps_propinfo_tbl[1].prop_max_uval 876e91bba0SGirish Moodalbail #define sctps_pa_max_retr_low sctps_propinfo_tbl[1].prop_min_uval 886e91bba0SGirish Moodalbail #define sctps_pp_max_retr sctps_propinfo_tbl[2].prop_cur_uval 896e91bba0SGirish Moodalbail #define sctps_pp_max_retr_high sctps_propinfo_tbl[2].prop_max_uval 906e91bba0SGirish Moodalbail #define sctps_pp_max_retr_low sctps_propinfo_tbl[2].prop_min_uval 916e91bba0SGirish Moodalbail #define sctps_cwnd_max_ sctps_propinfo_tbl[3].prop_cur_uval 926e91bba0SGirish Moodalbail #define sctps_smallest_nonpriv_port sctps_propinfo_tbl[4].prop_cur_uval 936e91bba0SGirish Moodalbail #define sctps_ipv4_ttl sctps_propinfo_tbl[5].prop_cur_uval 946e91bba0SGirish Moodalbail #define sctps_heartbeat_interval sctps_propinfo_tbl[6].prop_cur_uval 956e91bba0SGirish Moodalbail #define sctps_heartbeat_interval_high sctps_propinfo_tbl[6].prop_max_uval 966e91bba0SGirish Moodalbail #define sctps_heartbeat_interval_low sctps_propinfo_tbl[6].prop_min_uval 976e91bba0SGirish Moodalbail #define sctps_initial_mtu sctps_propinfo_tbl[7].prop_cur_uval 986e91bba0SGirish Moodalbail #define sctps_mtu_probe_interval sctps_propinfo_tbl[8].prop_cur_uval 996e91bba0SGirish Moodalbail #define sctps_new_secret_interval sctps_propinfo_tbl[9].prop_cur_uval 1006e91bba0SGirish Moodalbail #define sctps_deferred_ack_interval sctps_propinfo_tbl[10].prop_cur_uval 1016e91bba0SGirish Moodalbail #define sctps_snd_lowat_fraction sctps_propinfo_tbl[11].prop_cur_uval 1026e91bba0SGirish Moodalbail #define sctps_ignore_path_mtu sctps_propinfo_tbl[12].prop_cur_bval 1036e91bba0SGirish Moodalbail #define sctps_initial_ssthresh sctps_propinfo_tbl[13].prop_cur_uval 1046e91bba0SGirish Moodalbail #define sctps_smallest_anon_port sctps_propinfo_tbl[14].prop_cur_uval 1056e91bba0SGirish Moodalbail #define sctps_largest_anon_port sctps_propinfo_tbl[15].prop_cur_uval 1066e91bba0SGirish Moodalbail #define sctps_xmit_hiwat sctps_propinfo_tbl[16].prop_cur_uval 1076e91bba0SGirish Moodalbail #define sctps_xmit_lowat sctps_propinfo_tbl[17].prop_cur_uval 1086e91bba0SGirish Moodalbail #define sctps_recv_hiwat sctps_propinfo_tbl[18].prop_cur_uval 1096e91bba0SGirish Moodalbail #define sctps_max_buf sctps_propinfo_tbl[19].prop_cur_uval 1106e91bba0SGirish Moodalbail #define sctps_rtt_updates sctps_propinfo_tbl[20].prop_cur_uval 1116e91bba0SGirish Moodalbail #define sctps_ipv6_hoplimit sctps_propinfo_tbl[21].prop_cur_uval 1126e91bba0SGirish Moodalbail #define sctps_rto_ming sctps_propinfo_tbl[22].prop_cur_uval 1136e91bba0SGirish Moodalbail #define sctps_rto_ming_high sctps_propinfo_tbl[22].prop_max_uval 1146e91bba0SGirish Moodalbail #define sctps_rto_ming_low sctps_propinfo_tbl[22].prop_min_uval 1156e91bba0SGirish Moodalbail #define sctps_rto_maxg sctps_propinfo_tbl[23].prop_cur_uval 1166e91bba0SGirish Moodalbail #define sctps_rto_maxg_high sctps_propinfo_tbl[23].prop_max_uval 1176e91bba0SGirish Moodalbail #define sctps_rto_maxg_low sctps_propinfo_tbl[23].prop_min_uval 1186e91bba0SGirish Moodalbail #define sctps_rto_initialg sctps_propinfo_tbl[24].prop_cur_uval 1196e91bba0SGirish Moodalbail #define sctps_rto_initialg_high sctps_propinfo_tbl[24].prop_max_uval 1206e91bba0SGirish Moodalbail #define sctps_rto_initialg_low sctps_propinfo_tbl[24].prop_min_uval 1216e91bba0SGirish Moodalbail #define sctps_cookie_life sctps_propinfo_tbl[25].prop_cur_uval 1226e91bba0SGirish Moodalbail #define sctps_cookie_life_high sctps_propinfo_tbl[25].prop_max_uval 1236e91bba0SGirish Moodalbail #define sctps_cookie_life_low sctps_propinfo_tbl[25].prop_min_uval 1246e91bba0SGirish Moodalbail #define sctps_max_in_streams sctps_propinfo_tbl[26].prop_cur_uval 1256e91bba0SGirish Moodalbail #define sctps_max_in_streams_high sctps_propinfo_tbl[26].prop_max_uval 1266e91bba0SGirish Moodalbail #define sctps_max_in_streams_low sctps_propinfo_tbl[26].prop_min_uval 1276e91bba0SGirish Moodalbail #define sctps_initial_out_streams sctps_propinfo_tbl[27].prop_cur_uval 1286e91bba0SGirish Moodalbail #define sctps_initial_out_streams_high sctps_propinfo_tbl[27].prop_max_uval 1296e91bba0SGirish Moodalbail #define sctps_initial_out_streams_low sctps_propinfo_tbl[27].prop_min_uval 1306e91bba0SGirish Moodalbail #define sctps_shutack_wait_bound sctps_propinfo_tbl[28].prop_cur_uval 1316e91bba0SGirish Moodalbail #define sctps_maxburst sctps_propinfo_tbl[29].prop_cur_uval 1326e91bba0SGirish Moodalbail #define sctps_addip_enabled sctps_propinfo_tbl[30].prop_cur_bval 1336e91bba0SGirish Moodalbail #define sctps_recv_hiwat_minmss sctps_propinfo_tbl[31].prop_cur_uval 1346e91bba0SGirish Moodalbail #define sctps_slow_start_initial sctps_propinfo_tbl[32].prop_cur_uval 1356e91bba0SGirish Moodalbail #define sctps_slow_start_after_idle sctps_propinfo_tbl[33].prop_cur_uval 1366e91bba0SGirish Moodalbail #define sctps_prsctp_enabled sctps_propinfo_tbl[34].prop_cur_bval 1376e91bba0SGirish Moodalbail #define sctps_fast_rxt_thresh sctps_propinfo_tbl[35].prop_cur_uval 1386e91bba0SGirish Moodalbail #define sctps_deferred_acks_max sctps_propinfo_tbl[36].prop_cur_uval 1396e91bba0SGirish Moodalbail #define sctps_wroff_xtra sctps_propinfo_tbl[37].prop_cur_uval 1407c478bd9Sstevel@tonic-gate 14177c67f2fSkcpoon /* 14277c67f2fSkcpoon * Retransmission timer start and stop macro for a given faddr. 14377c67f2fSkcpoon */ 14477c67f2fSkcpoon #define SCTP_FADDR_TIMER_RESTART(sctp, fp, intvl) \ 14577c67f2fSkcpoon { \ 14677c67f2fSkcpoon dprint(3, ("faddr_timer_restart: fp=%p %x:%x:%x:%x %d\n", \ 1476be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India (void *)(fp), SCTP_PRINTADDR((fp)->sf_faddr), (int)(intvl))); \ 1486be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India sctp_timer((sctp), (fp)->sf_timer_mp, (intvl)); \ 1496be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India (fp)->sf_timer_running = 1; \ 15077c67f2fSkcpoon } 15177c67f2fSkcpoon 15277c67f2fSkcpoon #define SCTP_FADDR_TIMER_STOP(fp) \ 1536be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India ASSERT((fp)->sf_timer_mp != NULL); \ 1546be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India if ((fp)->sf_timer_running) { \ 1556be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India sctp_timer_stop((fp)->sf_timer_mp); \ 1566be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India (fp)->sf_timer_running = 0; \ 15777c67f2fSkcpoon } 15877c67f2fSkcpoon 1599f13099eSGeorge Shepherd /* For per endpoint association statistics */ 1609f13099eSGeorge Shepherd #define SCTP_MAX_RTO(sctp, fp) { \ 1619f13099eSGeorge Shepherd /* \ 1629f13099eSGeorge Shepherd * Record the maximum observed RTO, \ 1639f13099eSGeorge Shepherd * sctp_maxrto is zeroed elsewhere \ 1649f13099eSGeorge Shepherd * at the end of each stats request. \ 1659f13099eSGeorge Shepherd */ \ 1669f13099eSGeorge Shepherd (sctp)->sctp_maxrto = \ 1676be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India MAX((sctp)->sctp_maxrto, (fp)->sf_rto); \ 1689f13099eSGeorge Shepherd DTRACE_PROBE2(sctp__maxrto, sctp_t *, \ 1699f13099eSGeorge Shepherd sctp, struct sctp_faddr_s, fp); \ 1709f13099eSGeorge Shepherd } 1719f13099eSGeorge Shepherd 172fd7b5aedSGeorge Shepherd #define SCTP_CALC_RXT(sctp, fp, max) \ 173fd7b5aedSGeorge Shepherd { \ 1746be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India if (((fp)->sf_rto <<= 1) > (max)) \ 1756be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India (fp)->sf_rto = (max); \ 176fd7b5aedSGeorge Shepherd SCTP_MAX_RTO(sctp, fp); \ 17777c67f2fSkcpoon } 17877c67f2fSkcpoon 17977c67f2fSkcpoon 1807c478bd9Sstevel@tonic-gate #define SCTP_MAX_COMBINED_HEADER_LENGTH (60 + 12) /* Maxed out ip + sctp */ 1817c478bd9Sstevel@tonic-gate #define SCTP_MAX_IP_OPTIONS_LENGTH (60 - IP_SIMPLE_HDR_LENGTH) 1827c478bd9Sstevel@tonic-gate #define SCTP_MAX_HDR_LENGTH 60 1837c478bd9Sstevel@tonic-gate 1847c478bd9Sstevel@tonic-gate #define SCTP_SECRET_LEN 16 1857c478bd9Sstevel@tonic-gate 18692baa190SGeorge Shepherd #define SCTP_REFHOLD(sctp) { \ 1877c478bd9Sstevel@tonic-gate mutex_enter(&(sctp)->sctp_reflock); \ 18892baa190SGeorge Shepherd (sctp)->sctp_refcnt++; \ 18992baa190SGeorge Shepherd DTRACE_PROBE1(sctp_refhold, sctp_t, sctp); \ 1907c478bd9Sstevel@tonic-gate ASSERT((sctp)->sctp_refcnt != 0); \ 19192baa190SGeorge Shepherd mutex_exit(&(sctp)->sctp_reflock); \ 19292baa190SGeorge Shepherd } 19392baa190SGeorge Shepherd 19492baa190SGeorge Shepherd #define SCTP_REFRELE(sctp) { \ 19592baa190SGeorge Shepherd mutex_enter(&(sctp)->sctp_reflock); \ 19692baa190SGeorge Shepherd ASSERT((sctp)->sctp_refcnt != 0); \ 19792baa190SGeorge Shepherd if (--(sctp)->sctp_refcnt == 0) { \ 19892baa190SGeorge Shepherd DTRACE_PROBE1(sctp_refrele, sctp_t, sctp); \ 19992baa190SGeorge Shepherd mutex_exit(&(sctp)->sctp_reflock); \ 20092baa190SGeorge Shepherd CONN_DEC_REF((sctp)->sctp_connp); \ 20192baa190SGeorge Shepherd } else { \ 20292baa190SGeorge Shepherd DTRACE_PROBE1(sctp_refrele, sctp_t, sctp); \ 20392baa190SGeorge Shepherd mutex_exit(&(sctp)->sctp_reflock); \ 20492baa190SGeorge Shepherd } \ 2057c478bd9Sstevel@tonic-gate } 2067c478bd9Sstevel@tonic-gate 2077c478bd9Sstevel@tonic-gate #define SCTP_PRINTADDR(a) (a).s6_addr32[0], (a).s6_addr32[1],\ 2087c478bd9Sstevel@tonic-gate (a).s6_addr32[2], (a).s6_addr32[3] 2097c478bd9Sstevel@tonic-gate 2107c478bd9Sstevel@tonic-gate #define CONN2SCTP(conn) ((sctp_t *)(&((conn_t *)conn)[1])) 2117c478bd9Sstevel@tonic-gate 2127c478bd9Sstevel@tonic-gate /* 2137c478bd9Sstevel@tonic-gate * Outbound data, flags and macros for per-message, per-chunk info 2147c478bd9Sstevel@tonic-gate */ 2157c478bd9Sstevel@tonic-gate typedef struct { 2167c478bd9Sstevel@tonic-gate int64_t smh_ttl; /* Time to Live */ 2177c478bd9Sstevel@tonic-gate int64_t smh_tob; /* Time of Birth */ 2187c478bd9Sstevel@tonic-gate uint32_t smh_context; 2197c478bd9Sstevel@tonic-gate uint16_t smh_sid; 2207c478bd9Sstevel@tonic-gate uint16_t smh_ssn; 2217c478bd9Sstevel@tonic-gate uint32_t smh_ppid; 2227c478bd9Sstevel@tonic-gate uint16_t smh_flags; 2237c478bd9Sstevel@tonic-gate uint32_t smh_msglen; 2247c478bd9Sstevel@tonic-gate } sctp_msg_hdr_t; 2257c478bd9Sstevel@tonic-gate 2267c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_FLAG_SENT 0x01 2277c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_FLAG_REXMIT 0x02 2287c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_FLAG_ACKED 0x04 2297c478bd9Sstevel@tonic-gate #define SCTP_MSG_FLAG_CHUNKED 0x08 2307c478bd9Sstevel@tonic-gate #define SCTP_MSG_FLAG_ABANDONED 0x10 2317c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_FLAG_ABANDONED 0x20 2327c478bd9Sstevel@tonic-gate 2337c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_CLEAR_FLAGS(mp) ((mp)->b_flag = 0) 2347c478bd9Sstevel@tonic-gate /* 2357c478bd9Sstevel@tonic-gate * If we are transmitting the chunk for the first time we assign the TSN and 2367c478bd9Sstevel@tonic-gate * SSN here. The reason we assign the SSN here (as opposed to doing it in 2377c478bd9Sstevel@tonic-gate * sctp_chunkify()) is that the chunk may expire, if PRSCTP is enabled, before 2387c478bd9Sstevel@tonic-gate * we get a chance to send it out. If we assign the SSN in sctp_chunkify() 2397c478bd9Sstevel@tonic-gate * and this happens, then we need to send a Forward TSN to the peer, which 2407c478bd9Sstevel@tonic-gate * will be expecting this SSN, assuming ordered. If we assign it here we 2417c478bd9Sstevel@tonic-gate * can just take out the chunk from the transmit list without having to 2427c478bd9Sstevel@tonic-gate * send a Forward TSN chunk. While assigning the SSN we use (meta)->b_cont 2437c478bd9Sstevel@tonic-gate * to determine if it needs a new SSN (i.e. the next SSN for the stream), 2447c478bd9Sstevel@tonic-gate * since (meta)->b_cont signifies the first chunk of a message (if the message 2457c478bd9Sstevel@tonic-gate * is unordered, then the SSN is 0). 2467c478bd9Sstevel@tonic-gate * 2477c478bd9Sstevel@tonic-gate */ 2487c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_SENT(sctp, mp, sdc, fp, chunkdata, meta) { \ 2497c478bd9Sstevel@tonic-gate if (!SCTP_CHUNK_ISSENT(mp)) { \ 2507c478bd9Sstevel@tonic-gate sctp_msg_hdr_t *mhdr = (sctp_msg_hdr_t *)(meta)->b_rptr; \ 2517c478bd9Sstevel@tonic-gate ASSERT(!SCTP_CHUNK_ABANDONED(mp)); \ 2527c478bd9Sstevel@tonic-gate (mp)->b_flag = SCTP_CHUNK_FLAG_SENT; \ 2537c478bd9Sstevel@tonic-gate (sdc)->sdh_tsn = htonl((sctp)->sctp_ltsn++); \ 2547c478bd9Sstevel@tonic-gate if ((mhdr)->smh_flags & MSG_UNORDERED) { \ 2557c478bd9Sstevel@tonic-gate (sdc)->sdh_ssn = 0; \ 2567c478bd9Sstevel@tonic-gate SCTP_DATA_SET_UBIT(sdc); \ 2577c478bd9Sstevel@tonic-gate BUMP_LOCAL((sctp)->sctp_oudchunks); \ 2587c478bd9Sstevel@tonic-gate } else { \ 2597c478bd9Sstevel@tonic-gate BUMP_LOCAL((sctp)->sctp_odchunks); \ 2607c478bd9Sstevel@tonic-gate if ((mp) == (meta)->b_cont) { \ 2617c478bd9Sstevel@tonic-gate mhdr->smh_ssn = htons( \ 2627c478bd9Sstevel@tonic-gate (sctp)->sctp_ostrcntrs[mhdr->smh_sid]++); \ 2637c478bd9Sstevel@tonic-gate } \ 2647c478bd9Sstevel@tonic-gate (sdc)->sdh_ssn = mhdr->smh_ssn; \ 2657c478bd9Sstevel@tonic-gate } \ 266c3c17166SGeorge Shepherd DTRACE_PROBE3(sctp__chunk__sent1, sctp_t *, sctp, \ 267c3c17166SGeorge Shepherd mblk_t *, mp, mblk_t *, meta); \ 2687c478bd9Sstevel@tonic-gate (sctp)->sctp_unacked += (chunkdata); \ 2697c478bd9Sstevel@tonic-gate (sctp)->sctp_unsent -= (chunkdata); \ 2707c478bd9Sstevel@tonic-gate (sctp)->sctp_frwnd -= (chunkdata); \ 2717c478bd9Sstevel@tonic-gate } else { \ 2727c478bd9Sstevel@tonic-gate if (SCTP_CHUNK_ISACKED(mp)) { \ 2737c478bd9Sstevel@tonic-gate (sctp)->sctp_unacked += (chunkdata); \ 2747c478bd9Sstevel@tonic-gate } else { \ 2756be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India ASSERT(SCTP_CHUNK_DEST(mp)->sf_suna >= ((chunkdata) + \ 2767c478bd9Sstevel@tonic-gate sizeof (*sdc))); \ 2776be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India SCTP_CHUNK_DEST(mp)->sf_suna -= ((chunkdata) + \ 2787c478bd9Sstevel@tonic-gate sizeof (*sdc)); \ 2797c478bd9Sstevel@tonic-gate } \ 280c3c17166SGeorge Shepherd DTRACE_PROBE3(sctp__chunk__sent2, sctp_t *, sctp, \ 281c3c17166SGeorge Shepherd mblk_t *, mp, mblk_t *, meta); \ 2827c478bd9Sstevel@tonic-gate (mp)->b_flag &= ~(SCTP_CHUNK_FLAG_REXMIT | \ 2837c478bd9Sstevel@tonic-gate SCTP_CHUNK_FLAG_ACKED); \ 2847c478bd9Sstevel@tonic-gate SCTP_CHUNK_SET_SACKCNT(mp, 0); \ 2857c478bd9Sstevel@tonic-gate BUMP_LOCAL(sctp->sctp_rxtchunks); \ 2867c478bd9Sstevel@tonic-gate BUMP_LOCAL((sctp)->sctp_T3expire); \ 2876be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India BUMP_LOCAL((fp)->sf_T3expire); \ 2887c478bd9Sstevel@tonic-gate } \ 2897c478bd9Sstevel@tonic-gate SCTP_SET_CHUNK_DEST(mp, fp); \ 2906be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India (fp)->sf_suna += ((chunkdata) + sizeof (*sdc)); \ 2917c478bd9Sstevel@tonic-gate } 2927c478bd9Sstevel@tonic-gate 2937c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_ISSENT(mp) ((mp)->b_flag & SCTP_CHUNK_FLAG_SENT) 2947c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_CANSEND(mp) \ 2957c478bd9Sstevel@tonic-gate (!(SCTP_CHUNK_ABANDONED(mp)) && \ 2967c478bd9Sstevel@tonic-gate (((mp)->b_flag & (SCTP_CHUNK_FLAG_REXMIT|SCTP_CHUNK_FLAG_SENT)) != \ 2977c478bd9Sstevel@tonic-gate SCTP_CHUNK_FLAG_SENT)) 2987c478bd9Sstevel@tonic-gate 2997c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_DEST(mp) ((sctp_faddr_t *)(mp)->b_queue) 3007c478bd9Sstevel@tonic-gate #define SCTP_SET_CHUNK_DEST(mp, fp) ((mp)->b_queue = (queue_t *)fp) 3017c478bd9Sstevel@tonic-gate 302c3c17166SGeorge Shepherd #define SCTP_CHUNK_REXMIT(sctp, mp) { \ 303c3c17166SGeorge Shepherd DTRACE_PROBE2(sctp__chunk__rexmit, sctp_t *, sctp, mblk_t *, \ 304c3c17166SGeorge Shepherd mp); \ 305c3c17166SGeorge Shepherd (mp)->b_flag |= SCTP_CHUNK_FLAG_REXMIT; \ 306c3c17166SGeorge Shepherd } 3077c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_CLEAR_REXMIT(mp) ((mp)->b_flag &= ~SCTP_CHUNK_FLAG_REXMIT) 3087c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_WANT_REXMIT(mp) ((mp)->b_flag & SCTP_CHUNK_FLAG_REXMIT) 3097c478bd9Sstevel@tonic-gate 3107c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_ACKED(mp) \ 3117c478bd9Sstevel@tonic-gate ((mp)->b_flag = (SCTP_CHUNK_FLAG_SENT|SCTP_CHUNK_FLAG_ACKED)) 3127c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_ISACKED(mp) ((mp)->b_flag & SCTP_CHUNK_FLAG_ACKED) 313c3c17166SGeorge Shepherd #define SCTP_CHUNK_CLEAR_ACKED(sctp, mp) { \ 314c3c17166SGeorge Shepherd DTRACE_PROBE2(sctp__chunk__clracked, sctp_t *, sctp, mblk_t *, \ 315c3c17166SGeorge Shepherd mp); \ 316c3c17166SGeorge Shepherd (mp)->b_flag &= ~SCTP_CHUNK_FLAG_ACKED; \ 317c3c17166SGeorge Shepherd } 3187c478bd9Sstevel@tonic-gate 3197c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_SACKCNT(mp) ((intptr_t)((mp)->b_prev)) 3207c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_SET_SACKCNT(mp, val) ((mp)->b_prev = \ 3217c478bd9Sstevel@tonic-gate (mblk_t *)(uintptr_t)(val)) 3227c478bd9Sstevel@tonic-gate 3237c478bd9Sstevel@tonic-gate #define SCTP_MSG_SET_CHUNKED(mp) ((mp)->b_flag |= SCTP_MSG_FLAG_CHUNKED) 3247c478bd9Sstevel@tonic-gate #define SCTP_MSG_CLEAR_CHUNKED(mp)((mp)->b_flag &= ~SCTP_MSG_FLAG_CHUNKED) 3257c478bd9Sstevel@tonic-gate #define SCTP_IS_MSG_CHUNKED(mp) ((mp)->b_flag & SCTP_MSG_FLAG_CHUNKED) 3267c478bd9Sstevel@tonic-gate 3277c478bd9Sstevel@tonic-gate /* For PR-SCTP */ 3287c478bd9Sstevel@tonic-gate #define SCTP_ABANDON_CHUNK(mp) ((mp)->b_flag |= SCTP_CHUNK_FLAG_ABANDONED) 3297c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_ABANDONED(mp) \ 3307c478bd9Sstevel@tonic-gate ((mp)->b_flag & SCTP_CHUNK_FLAG_ABANDONED) 3317c478bd9Sstevel@tonic-gate 3327c478bd9Sstevel@tonic-gate #define SCTP_MSG_SET_ABANDONED(mp) \ 3337c478bd9Sstevel@tonic-gate ((mp)->b_flag |= SCTP_MSG_FLAG_ABANDONED) 3347c478bd9Sstevel@tonic-gate #define SCTP_MSG_CLEAR_ABANDONED(mp)((mp)->b_flag &= ~SCTP_MSG_FLAG_ABANDONED) 3357c478bd9Sstevel@tonic-gate #define SCTP_IS_MSG_ABANDONED(mp) ((mp)->b_flag & SCTP_MSG_FLAG_ABANDONED) 3367c478bd9Sstevel@tonic-gate 3377c478bd9Sstevel@tonic-gate /* 3387c478bd9Sstevel@tonic-gate * Check if a message has expired. A message is expired if 3397c478bd9Sstevel@tonic-gate * 1. It has a non-zero time to live value and has not been sent before 3407c478bd9Sstevel@tonic-gate * that time expires. 3417c478bd9Sstevel@tonic-gate * 2. It is sent using PRSCTP and it has not been SACK'ed before 3427c478bd9Sstevel@tonic-gate * its lifetime expires. 3437c478bd9Sstevel@tonic-gate */ 3447c478bd9Sstevel@tonic-gate #define SCTP_MSG_TO_BE_ABANDONED(meta, mhdr, sctp) \ 3457c478bd9Sstevel@tonic-gate (((!SCTP_CHUNK_ISSENT((meta)->b_cont) && (mhdr)->smh_ttl > 0) || \ 3467c478bd9Sstevel@tonic-gate ((sctp)->sctp_prsctp_aware && ((mhdr)->smh_flags & MSG_PR_SCTP))) && \ 347d3d50737SRafael Vanoni ((ddi_get_lbolt64() - (mhdr)->smh_tob) > (mhdr)->smh_ttl)) 3487c478bd9Sstevel@tonic-gate 3497c478bd9Sstevel@tonic-gate /* SCTP association hash function. */ 350f4b3ec61Sdh #define SCTP_CONN_HASH(sctps, ports) \ 351f4b3ec61Sdh ((((ports) ^ ((ports) >> 16)) * 31) & \ 352f4b3ec61Sdh ((sctps)->sctps_conn_hash_size - 1)) 3537c478bd9Sstevel@tonic-gate 3545dd46ab5SKacheong Poon /* 3555dd46ab5SKacheong Poon * Linked list struct to store SCTP listener association limit configuration 3565dd46ab5SKacheong Poon * per IP stack. The list is stored at sctps_listener_conf in sctp_stack_t. 3575dd46ab5SKacheong Poon * 3585dd46ab5SKacheong Poon * sl_port: the listener port of this limit configuration 3595dd46ab5SKacheong Poon * sl_ratio: the maximum amount of memory consumed by all concurrent SCTP 3605dd46ab5SKacheong Poon * connections created by a listener does not exceed 1/tl_ratio 3615dd46ab5SKacheong Poon * of the total system memory. Note that this is only an 3625dd46ab5SKacheong Poon * approximation. 3635dd46ab5SKacheong Poon * sl_link: linked list struct 3645dd46ab5SKacheong Poon */ 3655dd46ab5SKacheong Poon typedef struct sctp_listener_s { 3665dd46ab5SKacheong Poon in_port_t sl_port; 3675dd46ab5SKacheong Poon uint32_t sl_ratio; 3685dd46ab5SKacheong Poon list_node_t sl_link; 3695dd46ab5SKacheong Poon } sctp_listener_t; 3705dd46ab5SKacheong Poon 3715dd46ab5SKacheong Poon /* 3725dd46ab5SKacheong Poon * If there is a limit set on the number of association allowed per each 3735dd46ab5SKacheong Poon * listener, the following struct is used to store that counter. It keeps 3745dd46ab5SKacheong Poon * the number of SCTP association created by a listener. Note that this needs 3755dd46ab5SKacheong Poon * to be separated from the listener since the listener can go away before 3765dd46ab5SKacheong Poon * all the associations are gone. 3775dd46ab5SKacheong Poon * 3785dd46ab5SKacheong Poon * When the struct is allocated, slc_cnt is set to 1. When a new association 3795dd46ab5SKacheong Poon * is created by the listener, slc_cnt is incremented by 1. When an 3805dd46ab5SKacheong Poon * association created by the listener goes away, slc_count is decremented by 3815dd46ab5SKacheong Poon * 1. When the listener itself goes away, slc_cnt is decremented by one. 3825dd46ab5SKacheong Poon * The last association (or the listener) which decrements slc_cnt to zero 3835dd46ab5SKacheong Poon * frees the struct. 3845dd46ab5SKacheong Poon * 3855dd46ab5SKacheong Poon * slc_max is the maximum number of concurrent associations created from a 3865dd46ab5SKacheong Poon * listener. It is calculated when the sctp_listen_cnt_t is allocated. 3875dd46ab5SKacheong Poon * 3885dd46ab5SKacheong Poon * slc_report_time stores the time when cmn_err() is called to report that the 3895dd46ab5SKacheong Poon * max has been exceeeded. Report is done at most once every 3905dd46ab5SKacheong Poon * SCTP_SLC_REPORT_INTERVAL mins for a listener. 3915dd46ab5SKacheong Poon * 3925dd46ab5SKacheong Poon * slc_drop stores the number of connection attempt dropped because the 3935dd46ab5SKacheong Poon * limit has reached. 3945dd46ab5SKacheong Poon */ 3955dd46ab5SKacheong Poon typedef struct sctp_listen_cnt_s { 3965dd46ab5SKacheong Poon uint32_t slc_max; 3975dd46ab5SKacheong Poon uint32_t slc_cnt; 3985dd46ab5SKacheong Poon int64_t slc_report_time; 3995dd46ab5SKacheong Poon uint32_t slc_drop; 4005dd46ab5SKacheong Poon } sctp_listen_cnt_t; 4015dd46ab5SKacheong Poon 4025dd46ab5SKacheong Poon #define SCTP_SLC_REPORT_INTERVAL (30 * MINUTES) 4035dd46ab5SKacheong Poon 4045dd46ab5SKacheong Poon #define SCTP_DECR_LISTEN_CNT(sctp) \ 4055dd46ab5SKacheong Poon { \ 4065dd46ab5SKacheong Poon ASSERT((sctp)->sctp_listen_cnt->slc_cnt > 0); \ 407*1a5e258fSJosef 'Jeff' Sipek if (atomic_dec_32_nv(&(sctp)->sctp_listen_cnt->slc_cnt) == 0) \ 4085dd46ab5SKacheong Poon kmem_free((sctp)->sctp_listen_cnt, sizeof (sctp_listen_cnt_t));\ 4095dd46ab5SKacheong Poon (sctp)->sctp_listen_cnt = NULL; \ 4105dd46ab5SKacheong Poon } 4115dd46ab5SKacheong Poon 4125dd46ab5SKacheong Poon /* Increment and decrement the number of associations in sctp_stack_t. */ 4135dd46ab5SKacheong Poon #define SCTPS_ASSOC_INC(sctps) \ 4145dd46ab5SKacheong Poon atomic_inc_64( \ 4155dd46ab5SKacheong Poon (uint64_t *)&(sctps)->sctps_sc[CPU->cpu_seqid]->sctp_sc_assoc_cnt) 4165dd46ab5SKacheong Poon 4175dd46ab5SKacheong Poon #define SCTPS_ASSOC_DEC(sctps) \ 4185dd46ab5SKacheong Poon atomic_dec_64( \ 4195dd46ab5SKacheong Poon (uint64_t *)&(sctps)->sctps_sc[CPU->cpu_seqid]->sctp_sc_assoc_cnt) 4205dd46ab5SKacheong Poon 4215dd46ab5SKacheong Poon #define SCTP_ASSOC_EST(sctps, sctp) \ 4225dd46ab5SKacheong Poon { \ 4235dd46ab5SKacheong Poon (sctp)->sctp_state = SCTPS_ESTABLISHED; \ 4245dd46ab5SKacheong Poon (sctp)->sctp_assoc_start_time = (uint32_t)LBOLT_FASTPATH64; \ 4255dd46ab5SKacheong Poon SCTPS_ASSOC_INC(sctps); \ 4265dd46ab5SKacheong Poon } 4275dd46ab5SKacheong Poon 4287c478bd9Sstevel@tonic-gate /* 4297c478bd9Sstevel@tonic-gate * Bind hash array size and hash function. The size must be a power 4307c478bd9Sstevel@tonic-gate * of 2 and lport must be in host byte order. 4317c478bd9Sstevel@tonic-gate */ 4327c478bd9Sstevel@tonic-gate #define SCTP_BIND_FANOUT_SIZE 2048 4337c478bd9Sstevel@tonic-gate #define SCTP_BIND_HASH(lport) (((lport) * 31) & (SCTP_BIND_FANOUT_SIZE - 1)) 4347c478bd9Sstevel@tonic-gate 4357c478bd9Sstevel@tonic-gate /* options that SCTP negotiates during association establishment */ 4367c478bd9Sstevel@tonic-gate #define SCTP_PRSCTP_OPTION 0x01 4377c478bd9Sstevel@tonic-gate 4387c478bd9Sstevel@tonic-gate /* 4397c478bd9Sstevel@tonic-gate * Listener hash array size and hash function. The size must be a power 4407c478bd9Sstevel@tonic-gate * of 2 and lport must be in host byte order. 4417c478bd9Sstevel@tonic-gate */ 4427c478bd9Sstevel@tonic-gate #define SCTP_LISTEN_FANOUT_SIZE 512 4437c478bd9Sstevel@tonic-gate #define SCTP_LISTEN_HASH(lport) (((lport) * 31) & (SCTP_LISTEN_FANOUT_SIZE - 1)) 4447c478bd9Sstevel@tonic-gate 4457c478bd9Sstevel@tonic-gate typedef struct sctp_tf_s { 4467c478bd9Sstevel@tonic-gate struct sctp_s *tf_sctp; 4477c478bd9Sstevel@tonic-gate kmutex_t tf_lock; 4487c478bd9Sstevel@tonic-gate } sctp_tf_t; 4497c478bd9Sstevel@tonic-gate 4507c478bd9Sstevel@tonic-gate /* Round up the value to the nearest mss. */ 4517c478bd9Sstevel@tonic-gate #define MSS_ROUNDUP(value, mss) ((((value) - 1) / (mss) + 1) * (mss)) 4527c478bd9Sstevel@tonic-gate 4537c478bd9Sstevel@tonic-gate extern sin_t sctp_sin_null; /* Zero address for quick clears */ 4547c478bd9Sstevel@tonic-gate extern sin6_t sctp_sin6_null; /* Zero address for quick clears */ 4557c478bd9Sstevel@tonic-gate 4567c478bd9Sstevel@tonic-gate #define SCTP_IS_DETACHED(sctp) ((sctp)->sctp_detached) 4577c478bd9Sstevel@tonic-gate 4587c478bd9Sstevel@tonic-gate /* Data structure used to track received TSNs */ 4597c478bd9Sstevel@tonic-gate typedef struct sctp_set_s { 4607c478bd9Sstevel@tonic-gate struct sctp_set_s *next; 4617c478bd9Sstevel@tonic-gate struct sctp_set_s *prev; 4627c478bd9Sstevel@tonic-gate uint32_t begin; 4637c478bd9Sstevel@tonic-gate uint32_t end; 4647c478bd9Sstevel@tonic-gate } sctp_set_t; 4657c478bd9Sstevel@tonic-gate 4667c478bd9Sstevel@tonic-gate /* Data structure used to track TSNs for PR-SCTP */ 4677c478bd9Sstevel@tonic-gate typedef struct sctp_ftsn_set_s { 4687c478bd9Sstevel@tonic-gate struct sctp_ftsn_set_s *next; 4697c478bd9Sstevel@tonic-gate ftsn_entry_t ftsn_entries; 4707c478bd9Sstevel@tonic-gate } sctp_ftsn_set_t; 4717c478bd9Sstevel@tonic-gate 4727c478bd9Sstevel@tonic-gate /* Data structure used to track incoming SCTP streams */ 4737c478bd9Sstevel@tonic-gate typedef struct sctp_instr_s { 4747c478bd9Sstevel@tonic-gate mblk_t *istr_msgs; 4757c478bd9Sstevel@tonic-gate int istr_nmsgs; 4767c478bd9Sstevel@tonic-gate uint16_t nextseq; 4777c478bd9Sstevel@tonic-gate struct sctp_s *sctp; 4787c478bd9Sstevel@tonic-gate mblk_t *istr_reass; 4797c478bd9Sstevel@tonic-gate } sctp_instr_t; 4807c478bd9Sstevel@tonic-gate 4817c478bd9Sstevel@tonic-gate /* Reassembly data structure (per-stream) */ 4827c478bd9Sstevel@tonic-gate typedef struct sctp_reass_s { 4836be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India uint16_t sr_ssn; 4846be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India uint16_t sr_needed; 4856be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India uint16_t sr_got; 4866be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India uint16_t sr_msglen; /* len of consecutive fragments */ 4877d546a59Svi /* from the begining (B-bit) */ 4886be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India mblk_t *sr_tail; 4896be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India boolean_t sr_hasBchunk; /* If the fragment list begins with */ 4907d546a59Svi /* a B-bit set chunk */ 4916be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India uint32_t sr_nexttsn; /* TSN of the next fragment we */ 4927d546a59Svi /* are expecting */ 4936be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India boolean_t sr_partial_delivered; 4947c478bd9Sstevel@tonic-gate } sctp_reass_t; 4957c478bd9Sstevel@tonic-gate 4967c478bd9Sstevel@tonic-gate /* debugging */ 4977c478bd9Sstevel@tonic-gate #undef dprint 49845916cd2Sjpk #ifdef DEBUG 4997c478bd9Sstevel@tonic-gate extern int sctpdebug; 5007c478bd9Sstevel@tonic-gate #define dprint(level, args) { if (sctpdebug > (level)) printf args; } 50145916cd2Sjpk #else 5027c478bd9Sstevel@tonic-gate #define dprint(level, args) {} 50345916cd2Sjpk #endif 5047c478bd9Sstevel@tonic-gate 5057c478bd9Sstevel@tonic-gate 5067c478bd9Sstevel@tonic-gate /* Peer address tracking */ 5077c478bd9Sstevel@tonic-gate 5087c478bd9Sstevel@tonic-gate /* 5097c478bd9Sstevel@tonic-gate * States for peer addresses 5107c478bd9Sstevel@tonic-gate * 5117c478bd9Sstevel@tonic-gate * SCTP_FADDRS_UNCONFIRMED: we have not communicated with this peer address 5127c478bd9Sstevel@tonic-gate * before, mark it as unconfirmed so that we will not send data to it. 5137c478bd9Sstevel@tonic-gate * All addresses initially are in unconfirmed state and required 5147c478bd9Sstevel@tonic-gate * validation. SCTP sends a heartbeat to each of them and when it gets 5157c478bd9Sstevel@tonic-gate * back a heartbeat ACK, the address will be marked as alive. This 5167c478bd9Sstevel@tonic-gate * validation fixes a security issue with multihoming. If an attacker 5177c478bd9Sstevel@tonic-gate * establishes an association with us and tells us that it has addresses 5187c478bd9Sstevel@tonic-gate * belonging to another host A, this will prevent A from communicating 5197c478bd9Sstevel@tonic-gate * with us. This is fixed by peer address validation. In the above case, 5207c478bd9Sstevel@tonic-gate * A will respond with an abort. 5217c478bd9Sstevel@tonic-gate * 5227c478bd9Sstevel@tonic-gate * SCTP_FADDRS_ALIVE: this peer address is alive and we can communicate with 5237c478bd9Sstevel@tonic-gate * it with no problem. 5247c478bd9Sstevel@tonic-gate * 5257c478bd9Sstevel@tonic-gate * SCTP_FADDRS_DOWN: we have exceeded the retransmission limit to this 5267c478bd9Sstevel@tonic-gate * peer address. Once an address is marked down, we will only send 5277c478bd9Sstevel@tonic-gate * a heartbeat to it every hb_interval in case it becomes alive now. 5287c478bd9Sstevel@tonic-gate * 5297c478bd9Sstevel@tonic-gate * SCTP_FADDRS_UNREACH: there is no suitable source address to send to 5307c478bd9Sstevel@tonic-gate * this peer address. For example, the peer address is v6 but we only 5317c478bd9Sstevel@tonic-gate * have v4 addresses. It is marked unreachable until there is an 5327c478bd9Sstevel@tonic-gate * address configuration change. At that time, mark these addresses 5337c478bd9Sstevel@tonic-gate * as unconfirmed and try again to see if those unreachable addresses 5347c478bd9Sstevel@tonic-gate * are OK as we may have more source addresses. 5357c478bd9Sstevel@tonic-gate */ 5367c478bd9Sstevel@tonic-gate typedef enum { 5377c478bd9Sstevel@tonic-gate SCTP_FADDRS_UNREACH, 5387c478bd9Sstevel@tonic-gate SCTP_FADDRS_DOWN, 5397c478bd9Sstevel@tonic-gate SCTP_FADDRS_ALIVE, 5407c478bd9Sstevel@tonic-gate SCTP_FADDRS_UNCONFIRMED 5417c478bd9Sstevel@tonic-gate } faddr_state_t; 5427c478bd9Sstevel@tonic-gate 5437c478bd9Sstevel@tonic-gate typedef struct sctp_faddr_s { 5446be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India struct sctp_faddr_s *sf_next; 5456be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India faddr_state_t sf_state; 5466be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India 5476be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India in6_addr_t sf_faddr; 5486be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India in6_addr_t sf_saddr; 5496be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India 5506be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India int64_t sf_hb_expiry; /* time to retransmit heartbeat */ 5516be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India uint32_t sf_hb_interval; /* the heartbeat interval */ 5526be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India 5536be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India int sf_rto; /* RTO in tick */ 5546be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India int sf_srtt; /* Smoothed RTT in tick */ 5556be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India int sf_rttvar; /* RTT variance in tick */ 5566be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India uint32_t sf_rtt_updates; 5576be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India int sf_strikes; 5586be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India int sf_max_retr; 5596be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India uint32_t sf_pmss; 5606be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India uint32_t sf_cwnd; 5616be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India uint32_t sf_ssthresh; 5626be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India uint32_t sf_suna; /* sent - unack'ed */ 5636be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India uint32_t sf_pba; /* partial bytes acked */ 5646be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India uint32_t sf_acked; 5656be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India int64_t sf_lastactive; 5666be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India mblk_t *sf_timer_mp; /* retransmission timer control */ 5677c478bd9Sstevel@tonic-gate uint32_t 5686be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India sf_hb_pending : 1, 5696be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India sf_timer_running : 1, 5706be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India sf_df : 1, 5716be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India sf_pmtu_discovered : 1, 5727c478bd9Sstevel@tonic-gate 5736be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India sf_rc_timer_running : 1, 5746be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India sf_isv4 : 1, 5756be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India sf_hb_enabled : 1; 5767c478bd9Sstevel@tonic-gate 5776be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India mblk_t *sf_rc_timer_mp; /* reliable control chunk timer */ 5786be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India ip_xmit_attr_t *sf_ixa; /* Transmit attributes */ 5796be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India uint32_t sf_T3expire; /* # of times T3 timer expired */ 5807c478bd9Sstevel@tonic-gate 5816be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India uint64_t sf_hb_secret; /* per addr "secret" in heartbeat */ 5826be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India uint32_t sf_rxt_unacked; /* # unack'ed retransmitted bytes */ 5837c478bd9Sstevel@tonic-gate } sctp_faddr_t; 5847c478bd9Sstevel@tonic-gate 5857c478bd9Sstevel@tonic-gate /* Flags to indicate supported address type in the PARM_SUP_ADDRS. */ 5867c478bd9Sstevel@tonic-gate #define PARM_SUPP_V6 0x1 5877c478bd9Sstevel@tonic-gate #define PARM_SUPP_V4 0x2 5887c478bd9Sstevel@tonic-gate 5897c478bd9Sstevel@tonic-gate /* 5907c478bd9Sstevel@tonic-gate * Set heartbeat interval plus jitter. The jitter is supposed to be random, 5917c478bd9Sstevel@tonic-gate * up to +/- 50% of the RTO. We use gethrtime() here for performance reason 5927c478bd9Sstevel@tonic-gate * as the jitter does not really need to be "very" random. 5937c478bd9Sstevel@tonic-gate */ 5947c478bd9Sstevel@tonic-gate #define SET_HB_INTVL(fp) \ 5956be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India ((fp)->sf_hb_interval + (fp)->sf_rto + ((fp)->sf_rto >> 1) - \ 5966be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India (uint_t)gethrtime() % (fp)->sf_rto) 5977c478bd9Sstevel@tonic-gate 5987c478bd9Sstevel@tonic-gate #define SCTP_IPIF_HASH 16 5997c478bd9Sstevel@tonic-gate 6007c478bd9Sstevel@tonic-gate typedef struct sctp_ipif_hash_s { 60192baa190SGeorge Shepherd list_t sctp_ipif_list; 60292baa190SGeorge Shepherd int ipif_count; 60392baa190SGeorge Shepherd krwlock_t ipif_hash_lock; 6047c478bd9Sstevel@tonic-gate } sctp_ipif_hash_t; 6057c478bd9Sstevel@tonic-gate 60612f47623Skcpoon 60712f47623Skcpoon /* 60812f47623Skcpoon * Initialize cwnd according to RFC 3390. def_max_init_cwnd is 60912f47623Skcpoon * either sctp_slow_start_initial or sctp_slow_start_after idle 61012f47623Skcpoon * depending on the caller. 61112f47623Skcpoon */ 61212f47623Skcpoon #define SET_CWND(fp, mss, def_max_init_cwnd) \ 61312f47623Skcpoon { \ 6146be61d4eSchandrasekar marimuthu - Sun Microsystems - Bangalore India (fp)->sf_cwnd = MIN(def_max_init_cwnd * (mss), \ 61512f47623Skcpoon MIN(4 * (mss), MAX(2 * (mss), 4380 / (mss) * (mss)))); \ 61612f47623Skcpoon } 61712f47623Skcpoon 61812f47623Skcpoon 6197c478bd9Sstevel@tonic-gate struct sctp_s; 6207c478bd9Sstevel@tonic-gate 6217c478bd9Sstevel@tonic-gate /* 6227c478bd9Sstevel@tonic-gate * Control structure for each open SCTP stream, 6237c478bd9Sstevel@tonic-gate * defined only within the kernel or for a kmem user. 6247c478bd9Sstevel@tonic-gate * NOTE: sctp_reinit_values MUST have a line for each field in this structure! 6257c478bd9Sstevel@tonic-gate */ 6267c478bd9Sstevel@tonic-gate #if (defined(_KERNEL) || defined(_KMEMUSER)) 6277c478bd9Sstevel@tonic-gate 6287c478bd9Sstevel@tonic-gate typedef struct sctp_s { 6297c478bd9Sstevel@tonic-gate 6307c478bd9Sstevel@tonic-gate /* 6317c478bd9Sstevel@tonic-gate * The following is shared with (and duplicated) in IP, so if you 6327c478bd9Sstevel@tonic-gate * make changes, make sure you also change things in ip_sctp.c. 6337c478bd9Sstevel@tonic-gate */ 6347c478bd9Sstevel@tonic-gate struct sctp_s *sctp_conn_hash_next; 6357c478bd9Sstevel@tonic-gate struct sctp_s *sctp_conn_hash_prev; 6367c478bd9Sstevel@tonic-gate 6377c478bd9Sstevel@tonic-gate struct sctp_s *sctp_listen_hash_next; 6387c478bd9Sstevel@tonic-gate struct sctp_s *sctp_listen_hash_prev; 6397c478bd9Sstevel@tonic-gate 6407c478bd9Sstevel@tonic-gate sctp_tf_t *sctp_listen_tfp; /* Ptr to tf */ 6417c478bd9Sstevel@tonic-gate sctp_tf_t *sctp_conn_tfp; /* Ptr to tf */ 6427c478bd9Sstevel@tonic-gate 6437c478bd9Sstevel@tonic-gate /* Global list of sctp */ 6447c478bd9Sstevel@tonic-gate list_node_t sctp_list; 6457c478bd9Sstevel@tonic-gate 6467c478bd9Sstevel@tonic-gate sctp_faddr_t *sctp_faddrs; 6471d8c4025Svi int sctp_nfaddrs; 6487c478bd9Sstevel@tonic-gate sctp_ipif_hash_t sctp_saddrs[SCTP_IPIF_HASH]; 6497c478bd9Sstevel@tonic-gate int sctp_nsaddrs; 6507c478bd9Sstevel@tonic-gate 6517c478bd9Sstevel@tonic-gate kmutex_t sctp_lock; 6527c478bd9Sstevel@tonic-gate kcondvar_t sctp_cv; 6537c478bd9Sstevel@tonic-gate boolean_t sctp_running; 6547c478bd9Sstevel@tonic-gate 6550f1702c5SYu Xiangning #define sctp_ulpd sctp_connp->conn_upper_handle 6560f1702c5SYu Xiangning #define sctp_upcalls sctp_connp->conn_upcalls 6577c478bd9Sstevel@tonic-gate 6580f1702c5SYu Xiangning #define sctp_ulp_newconn sctp_upcalls->su_newconn 6590f1702c5SYu Xiangning #define sctp_ulp_connected sctp_upcalls->su_connected 6600f1702c5SYu Xiangning #define sctp_ulp_disconnected sctp_upcalls->su_disconnected 6610f1702c5SYu Xiangning #define sctp_ulp_opctl sctp_upcalls->su_opctl 6620f1702c5SYu Xiangning #define sctp_ulp_recv sctp_upcalls->su_recv 663a215d4ebSKacheong Poon #define sctp_ulp_txq_full sctp_upcalls->su_txq_full 6640f1702c5SYu Xiangning #define sctp_ulp_prop sctp_upcalls->su_set_proto_props 6657c478bd9Sstevel@tonic-gate 6667c478bd9Sstevel@tonic-gate int32_t sctp_state; 6677c478bd9Sstevel@tonic-gate 6687c478bd9Sstevel@tonic-gate conn_t *sctp_connp; /* conn_t stuff */ 669f4b3ec61Sdh sctp_stack_t *sctp_sctps; 670f4b3ec61Sdh 6717c478bd9Sstevel@tonic-gate /* Peer address tracking */ 6727c478bd9Sstevel@tonic-gate sctp_faddr_t *sctp_lastfaddr; /* last faddr in list */ 6737c478bd9Sstevel@tonic-gate sctp_faddr_t *sctp_primary; /* primary faddr */ 6747c478bd9Sstevel@tonic-gate sctp_faddr_t *sctp_current; /* current faddr */ 6757c478bd9Sstevel@tonic-gate sctp_faddr_t *sctp_lastdata; /* last data seen from this */ 6767c478bd9Sstevel@tonic-gate 6777c478bd9Sstevel@tonic-gate /* Outbound data tracking */ 6787c478bd9Sstevel@tonic-gate mblk_t *sctp_xmit_head; 6797c478bd9Sstevel@tonic-gate mblk_t *sctp_xmit_tail; 6807c478bd9Sstevel@tonic-gate mblk_t *sctp_xmit_unsent; 6817c478bd9Sstevel@tonic-gate mblk_t *sctp_xmit_unsent_tail; 6827c478bd9Sstevel@tonic-gate mblk_t *sctp_xmit_unacked; 6837c478bd9Sstevel@tonic-gate 6847c478bd9Sstevel@tonic-gate int32_t sctp_unacked; /* # of unacked bytes */ 6857c478bd9Sstevel@tonic-gate int32_t sctp_unsent; /* # of unsent bytes in hand */ 6867c478bd9Sstevel@tonic-gate 6877c478bd9Sstevel@tonic-gate uint32_t sctp_ltsn; /* Local instance TSN */ 6887c478bd9Sstevel@tonic-gate uint32_t sctp_lastack_rxd; /* Last rx'd cumtsn */ 6897c478bd9Sstevel@tonic-gate uint32_t sctp_recovery_tsn; /* Exit from fast recovery */ 6907c478bd9Sstevel@tonic-gate uint32_t sctp_adv_pap; /* Adv. Peer Ack Point */ 6917c478bd9Sstevel@tonic-gate 6927c478bd9Sstevel@tonic-gate uint16_t sctp_num_ostr; 6937c478bd9Sstevel@tonic-gate uint16_t *sctp_ostrcntrs; 6947c478bd9Sstevel@tonic-gate 695121e5416Skcpoon mblk_t *sctp_pad_mp; /* pad unaligned data chunks */ 696121e5416Skcpoon 6977c478bd9Sstevel@tonic-gate /* sendmsg() default parameters */ 6987c478bd9Sstevel@tonic-gate uint16_t sctp_def_stream; /* default stream id */ 6997c478bd9Sstevel@tonic-gate uint16_t sctp_def_flags; /* default xmit flags */ 7007c478bd9Sstevel@tonic-gate uint32_t sctp_def_ppid; /* default payload id */ 7017c478bd9Sstevel@tonic-gate uint32_t sctp_def_context; /* default context */ 7027c478bd9Sstevel@tonic-gate uint32_t sctp_def_timetolive; /* default msg TTL */ 7037c478bd9Sstevel@tonic-gate 7047c478bd9Sstevel@tonic-gate /* Inbound data tracking */ 7057c478bd9Sstevel@tonic-gate sctp_set_t *sctp_sack_info; /* Sack tracking */ 7067c478bd9Sstevel@tonic-gate mblk_t *sctp_ack_mp; /* Delayed ACK timer block */ 7077c478bd9Sstevel@tonic-gate sctp_instr_t *sctp_instr; /* Instream trackers */ 7087c478bd9Sstevel@tonic-gate mblk_t *sctp_uo_frags; /* Un-ordered msg. fragments */ 7097c478bd9Sstevel@tonic-gate uint32_t sctp_ftsn; /* Peer's TSN */ 7107c478bd9Sstevel@tonic-gate uint32_t sctp_lastacked; /* last cumtsn SACKd */ 7117c478bd9Sstevel@tonic-gate uint16_t sctp_num_istr; /* No. of instreams */ 7127c478bd9Sstevel@tonic-gate int32_t sctp_istr_nmsgs; /* No. of chunks in instreams */ 7137c478bd9Sstevel@tonic-gate int32_t sctp_sack_gaps; /* No. of received gaps */ 7147c478bd9Sstevel@tonic-gate int32_t sctp_sack_toggle; /* SACK every other pkt */ 7157c478bd9Sstevel@tonic-gate 7167c478bd9Sstevel@tonic-gate /* RTT calculation */ 7177c478bd9Sstevel@tonic-gate uint32_t sctp_rtt_tsn; 7187c478bd9Sstevel@tonic-gate int64_t sctp_out_time; 7197c478bd9Sstevel@tonic-gate 72035e12f9cSGeorge Shepherd /* Stats can be reset by snmp users kstat, netstat and snmp agents */ 7217c478bd9Sstevel@tonic-gate uint64_t sctp_opkts; /* sent pkts */ 7227c478bd9Sstevel@tonic-gate uint64_t sctp_obchunks; /* sent control chunks */ 7237c478bd9Sstevel@tonic-gate uint64_t sctp_odchunks; /* sent ordered data chunks */ 7247c478bd9Sstevel@tonic-gate uint64_t sctp_oudchunks; /* sent unord data chunks */ 7257c478bd9Sstevel@tonic-gate uint64_t sctp_rxtchunks; /* retransmitted chunks */ 7267c478bd9Sstevel@tonic-gate uint64_t sctp_ipkts; /* recv pkts */ 7277c478bd9Sstevel@tonic-gate uint64_t sctp_ibchunks; /* recv control chunks */ 7287c478bd9Sstevel@tonic-gate uint64_t sctp_idchunks; /* recv ordered data chunks */ 7297c478bd9Sstevel@tonic-gate uint64_t sctp_iudchunks; /* recv unord data chunks */ 7307c478bd9Sstevel@tonic-gate uint64_t sctp_fragdmsgs; 7317c478bd9Sstevel@tonic-gate uint64_t sctp_reassmsgs; 7327c478bd9Sstevel@tonic-gate uint32_t sctp_T1expire; /* # of times T1timer expired */ 7337c478bd9Sstevel@tonic-gate uint32_t sctp_T2expire; /* # of times T2timer expired */ 7347c478bd9Sstevel@tonic-gate uint32_t sctp_T3expire; /* # of times T3timer expired */ 7357c478bd9Sstevel@tonic-gate uint32_t sctp_assoc_start_time; /* time when assoc was est. */ 7367c478bd9Sstevel@tonic-gate 7377c478bd9Sstevel@tonic-gate uint32_t sctp_frwnd; /* Peer RWND */ 7387c478bd9Sstevel@tonic-gate uint32_t sctp_cwnd_max; 7397c478bd9Sstevel@tonic-gate 7407c478bd9Sstevel@tonic-gate /* Inbound flow control */ 7417c478bd9Sstevel@tonic-gate int32_t sctp_rwnd; /* Current receive window */ 742a215d4ebSKacheong Poon int32_t sctp_arwnd; /* Last advertised window */ 7437c478bd9Sstevel@tonic-gate int32_t sctp_rxqueued; /* No. of bytes in RX q's */ 744a215d4ebSKacheong Poon int32_t sctp_ulp_rxqueued; /* Data in ULP */ 7457c478bd9Sstevel@tonic-gate 7467c478bd9Sstevel@tonic-gate /* Pre-initialized composite headers */ 747bd670b35SErik Nordmark uchar_t *sctp_iphc; /* v4 sctp/ip hdr template buffer */ 748bd670b35SErik Nordmark uchar_t *sctp_iphc6; /* v6 sctp/ip hdr template buffer */ 7497c478bd9Sstevel@tonic-gate 7507c478bd9Sstevel@tonic-gate int32_t sctp_iphc_len; /* actual allocated v4 buffer size */ 7517c478bd9Sstevel@tonic-gate int32_t sctp_iphc6_len; /* actual allocated v6 buffer size */ 7527c478bd9Sstevel@tonic-gate 7537c478bd9Sstevel@tonic-gate int32_t sctp_hdr_len; /* len of combined SCTP/IP v4 hdr */ 7547c478bd9Sstevel@tonic-gate int32_t sctp_hdr6_len; /* len of combined SCTP/IP v6 hdr */ 7557c478bd9Sstevel@tonic-gate 7567c478bd9Sstevel@tonic-gate ipha_t *sctp_ipha; /* IPv4 header in the buffer */ 7577c478bd9Sstevel@tonic-gate ip6_t *sctp_ip6h; /* IPv6 header in the buffer */ 7587c478bd9Sstevel@tonic-gate 7597c478bd9Sstevel@tonic-gate int32_t sctp_ip_hdr_len; /* Byte len of our current v4 hdr */ 7607c478bd9Sstevel@tonic-gate int32_t sctp_ip_hdr6_len; /* Byte len of our current v6 hdr */ 7617c478bd9Sstevel@tonic-gate 7627c478bd9Sstevel@tonic-gate sctp_hdr_t *sctp_sctph; /* sctp header in combined v4 hdr */ 7637c478bd9Sstevel@tonic-gate sctp_hdr_t *sctp_sctph6; /* sctp header in combined v6 hdr */ 7647c478bd9Sstevel@tonic-gate 7657c478bd9Sstevel@tonic-gate uint32_t sctp_lvtag; /* local SCTP instance verf tag */ 7667c478bd9Sstevel@tonic-gate uint32_t sctp_fvtag; /* Peer's SCTP verf tag */ 7677c478bd9Sstevel@tonic-gate 7687c478bd9Sstevel@tonic-gate /* Path MTU Discovery */ 7697c478bd9Sstevel@tonic-gate int64_t sctp_last_mtu_probe; 7707c478bd9Sstevel@tonic-gate clock_t sctp_mtu_probe_intvl; 7717c478bd9Sstevel@tonic-gate uint32_t sctp_mss; /* Max send size (not TCP MSS!) */ 7727c478bd9Sstevel@tonic-gate 7737c478bd9Sstevel@tonic-gate /* structs sctp_bits, sctp_events are for clearing all bits at once */ 7747c478bd9Sstevel@tonic-gate struct { 7757c478bd9Sstevel@tonic-gate uint32_t 7767c478bd9Sstevel@tonic-gate 7777c478bd9Sstevel@tonic-gate sctp_understands_asconf : 1, /* Peer handles ASCONF chunks */ 7787c478bd9Sstevel@tonic-gate sctp_cchunk_pend : 1, /* Control chunk in flight. */ 7797c478bd9Sstevel@tonic-gate sctp_lingering : 1, /* Lingering in close */ 7807c478bd9Sstevel@tonic-gate sctp_loopback: 1, /* src and dst are the same machine */ 7817c478bd9Sstevel@tonic-gate 782bd670b35SErik Nordmark sctp_force_sack : 1, 7837c478bd9Sstevel@tonic-gate sctp_ack_timer_running: 1, /* Delayed ACK timer running */ 7847c478bd9Sstevel@tonic-gate sctp_hwcksum : 1, /* The NIC is capable of hwcksum */ 7857c478bd9Sstevel@tonic-gate sctp_understands_addip : 1, 7867c478bd9Sstevel@tonic-gate 7877c478bd9Sstevel@tonic-gate sctp_bound_to_all : 1, 7887c478bd9Sstevel@tonic-gate sctp_cansleep : 1, /* itf routines can sleep */ 7897c478bd9Sstevel@tonic-gate sctp_detached : 1, /* If we're detached from a stream */ 790558fbd03Skcpoon sctp_send_adaptation : 1, /* send adaptation layer ind */ 7917c478bd9Sstevel@tonic-gate 792558fbd03Skcpoon sctp_recv_adaptation : 1, /* recv adaptation layer ind */ 7937c478bd9Sstevel@tonic-gate sctp_ndelay : 1, /* turn off Nagle */ 7947c478bd9Sstevel@tonic-gate sctp_condemned : 1, /* this sctp is about to disappear */ 7957c478bd9Sstevel@tonic-gate sctp_chk_fast_rexmit : 1, /* check for fast rexmit message */ 796f551bb10Svi 797f551bb10Svi sctp_prsctp_aware : 1, /* is peer PR-SCTP aware? */ 79845916cd2Sjpk sctp_linklocal : 1, /* is linklocal assoc. */ 79977c67f2fSkcpoon sctp_rexmitting : 1, /* SCTP is retransmitting */ 800769b977dSvi sctp_zero_win_probe : 1, /* doing zero win probe */ 80177c67f2fSkcpoon 8020f1702c5SYu Xiangning sctp_txq_full : 1, /* the tx queue is full */ 803c31292eeSkcpoon sctp_ulp_discon_done : 1, /* ulp_disconnecting done */ 804a215d4ebSKacheong Poon sctp_flowctrld : 1, /* upper layer flow controlled */ 805a215d4ebSKacheong Poon sctp_dummy : 5; 8067c478bd9Sstevel@tonic-gate } sctp_bits; 8077c478bd9Sstevel@tonic-gate struct { 8087c478bd9Sstevel@tonic-gate uint32_t 8097c478bd9Sstevel@tonic-gate 8107c478bd9Sstevel@tonic-gate sctp_recvsndrcvinfo : 1, 8117c478bd9Sstevel@tonic-gate sctp_recvassocevnt : 1, 8127c478bd9Sstevel@tonic-gate sctp_recvpathevnt : 1, 8137c478bd9Sstevel@tonic-gate sctp_recvsendfailevnt : 1, 8147c478bd9Sstevel@tonic-gate 8157c478bd9Sstevel@tonic-gate sctp_recvpeererr : 1, 8167c478bd9Sstevel@tonic-gate sctp_recvshutdownevnt : 1, 8177c478bd9Sstevel@tonic-gate sctp_recvpdevnt : 1, 8187c478bd9Sstevel@tonic-gate sctp_recvalevnt : 1; 8197c478bd9Sstevel@tonic-gate } sctp_events; 8207c478bd9Sstevel@tonic-gate #define sctp_priv_stream sctp_bits.sctp_priv_stream 8217c478bd9Sstevel@tonic-gate #define sctp_understands_asconf sctp_bits.sctp_understands_asconf 8227c478bd9Sstevel@tonic-gate #define sctp_cchunk_pend sctp_bits.sctp_cchunk_pend 8237c478bd9Sstevel@tonic-gate #define sctp_lingering sctp_bits.sctp_lingering 8247c478bd9Sstevel@tonic-gate #define sctp_loopback sctp_bits.sctp_loopback 8257c478bd9Sstevel@tonic-gate #define sctp_force_sack sctp_bits.sctp_force_sack 8267c478bd9Sstevel@tonic-gate #define sctp_ack_timer_running sctp_bits.sctp_ack_timer_running 8277c478bd9Sstevel@tonic-gate #define sctp_hwcksum sctp_bits.sctp_hwcksum 8287c478bd9Sstevel@tonic-gate #define sctp_understands_addip sctp_bits.sctp_understands_addip 8297c478bd9Sstevel@tonic-gate #define sctp_bound_to_all sctp_bits.sctp_bound_to_all 8307c478bd9Sstevel@tonic-gate #define sctp_cansleep sctp_bits.sctp_cansleep 8317c478bd9Sstevel@tonic-gate #define sctp_detached sctp_bits.sctp_detached 832558fbd03Skcpoon #define sctp_send_adaptation sctp_bits.sctp_send_adaptation 833558fbd03Skcpoon #define sctp_recv_adaptation sctp_bits.sctp_recv_adaptation 8347c478bd9Sstevel@tonic-gate #define sctp_ndelay sctp_bits.sctp_ndelay 8357c478bd9Sstevel@tonic-gate #define sctp_condemned sctp_bits.sctp_condemned 8367c478bd9Sstevel@tonic-gate #define sctp_chk_fast_rexmit sctp_bits.sctp_chk_fast_rexmit 8377c478bd9Sstevel@tonic-gate #define sctp_prsctp_aware sctp_bits.