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 /* 238dfac042SAnil udupa * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _INET_SCTP_SCTP_IMPL_H 287c478bd9Sstevel@tonic-gate #define _INET_SCTP_SCTP_IMPL_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #include <sys/inttypes.h> 317c478bd9Sstevel@tonic-gate #include <sys/taskq.h> 327c478bd9Sstevel@tonic-gate #include <sys/list.h> 337c478bd9Sstevel@tonic-gate #include <sys/strsun.h> 3445916cd2Sjpk #include <sys/zone.h> 357c478bd9Sstevel@tonic-gate #include <netinet/ip6.h> 367c478bd9Sstevel@tonic-gate #include <inet/optcom.h> 37*6e91bba0SGirish Moodalbail #include <inet/tunables.h> 387c478bd9Sstevel@tonic-gate #include <netinet/sctp.h> 397c478bd9Sstevel@tonic-gate #include <inet/sctp_itf.h> 40f4b3ec61Sdh #include "sctp_stack.h" 41f4b3ec61Sdh 42f4b3ec61Sdh #ifdef __cplusplus 43f4b3ec61Sdh extern "C" { 44f4b3ec61Sdh #endif 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate /* Streams device identifying info and version */ 477c478bd9Sstevel@tonic-gate #define SCTP_DEV_IDINFO "SCTP Streams device 1.0" 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate #define SSN_GT(a, b) ((int16_t)((a)-(b)) > 0) 507c478bd9Sstevel@tonic-gate #define SSN_GE(a, b) ((int16_t)((a)-(b)) >= 0) 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate /* Default buffer size and flow control wake up threshold. */ 537c478bd9Sstevel@tonic-gate #define SCTP_XMIT_LOWATER 8192 547c478bd9Sstevel@tonic-gate #define SCTP_XMIT_HIWATER 102400 557c478bd9Sstevel@tonic-gate #define SCTP_RECV_LOWATER 8192 567c478bd9Sstevel@tonic-gate #define SCTP_RECV_HIWATER 102400 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate /* SCTP Timer control structure */ 597c478bd9Sstevel@tonic-gate typedef struct sctpt_s { 607c478bd9Sstevel@tonic-gate pfv_t sctpt_pfv; /* The routine we are to call */ 617c478bd9Sstevel@tonic-gate struct sctp_s *sctpt_sctp; /* The parameter we are to pass in */ 627c478bd9Sstevel@tonic-gate struct sctp_faddr_s *sctpt_faddr; 637c478bd9Sstevel@tonic-gate } sctpt_t; 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate /* 667c478bd9Sstevel@tonic-gate * Maximum number of duplicate TSNs we can report. This is currently 677c478bd9Sstevel@tonic-gate * static, and governs the size of the mblk used to hold the duplicate 687c478bd9Sstevel@tonic-gate * reports. The use of duplcate TSN reports is currently experimental, 697c478bd9Sstevel@tonic-gate * so for now a static limit should suffice. 707c478bd9Sstevel@tonic-gate */ 717c478bd9Sstevel@tonic-gate #define SCTP_DUP_MBLK_SZ 64 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate #define SCTP_IS_ADDR_UNSPEC(isv4, addr) \ 747c478bd9Sstevel@tonic-gate ((isv4) ? IN6_IS_ADDR_V4MAPPED_ANY(&(addr)) : \ 757c478bd9Sstevel@tonic-gate IN6_IS_ADDR_UNSPECIFIED(&(addr))) 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate /* 78*6e91bba0SGirish Moodalbail * SCTP properties/tunables 797c478bd9Sstevel@tonic-gate */ 80*6e91bba0SGirish Moodalbail #define sctps_max_init_retr sctps_propinfo_tbl[0].prop_cur_uval 81*6e91bba0SGirish Moodalbail #define sctps_max_init_retr_high sctps_propinfo_tbl[0].prop_max_uval 82*6e91bba0SGirish Moodalbail #define sctps_max_init_retr_low sctps_propinfo_tbl[0].prop_min_uval 83*6e91bba0SGirish Moodalbail #define sctps_pa_max_retr sctps_propinfo_tbl[1].prop_cur_uval 84*6e91bba0SGirish Moodalbail #define sctps_pa_max_retr_high sctps_propinfo_tbl[1].prop_max_uval 85*6e91bba0SGirish Moodalbail #define sctps_pa_max_retr_low sctps_propinfo_tbl[1].prop_min_uval 86*6e91bba0SGirish Moodalbail #define sctps_pp_max_retr sctps_propinfo_tbl[2].prop_cur_uval 87*6e91bba0SGirish Moodalbail #define sctps_pp_max_retr_high sctps_propinfo_tbl[2].prop_max_uval 88*6e91bba0SGirish Moodalbail #define sctps_pp_max_retr_low sctps_propinfo_tbl[2].prop_min_uval 89*6e91bba0SGirish Moodalbail #define sctps_cwnd_max_ sctps_propinfo_tbl[3].prop_cur_uval 90*6e91bba0SGirish Moodalbail #define sctps_smallest_nonpriv_port sctps_propinfo_tbl[4].prop_cur_uval 91*6e91bba0SGirish Moodalbail #define sctps_ipv4_ttl sctps_propinfo_tbl[5].prop_cur_uval 92*6e91bba0SGirish Moodalbail #define sctps_heartbeat_interval sctps_propinfo_tbl[6].prop_cur_uval 93*6e91bba0SGirish Moodalbail #define sctps_heartbeat_interval_high sctps_propinfo_tbl[6].prop_max_uval 94*6e91bba0SGirish Moodalbail #define sctps_heartbeat_interval_low sctps_propinfo_tbl[6].prop_min_uval 95*6e91bba0SGirish Moodalbail #define sctps_initial_mtu sctps_propinfo_tbl[7].prop_cur_uval 96*6e91bba0SGirish Moodalbail #define sctps_mtu_probe_interval sctps_propinfo_tbl[8].prop_cur_uval 97*6e91bba0SGirish Moodalbail #define sctps_new_secret_interval sctps_propinfo_tbl[9].prop_cur_uval 98*6e91bba0SGirish Moodalbail #define sctps_deferred_ack_interval sctps_propinfo_tbl[10].prop_cur_uval 99*6e91bba0SGirish Moodalbail #define sctps_snd_lowat_fraction sctps_propinfo_tbl[11].prop_cur_uval 100*6e91bba0SGirish Moodalbail #define sctps_ignore_path_mtu sctps_propinfo_tbl[12].prop_cur_bval 101*6e91bba0SGirish Moodalbail #define sctps_initial_ssthresh sctps_propinfo_tbl[13].prop_cur_uval 102*6e91bba0SGirish Moodalbail #define sctps_smallest_anon_port sctps_propinfo_tbl[14].prop_cur_uval 103*6e91bba0SGirish Moodalbail #define sctps_largest_anon_port sctps_propinfo_tbl[15].prop_cur_uval 104*6e91bba0SGirish Moodalbail #define sctps_xmit_hiwat sctps_propinfo_tbl[16].prop_cur_uval 105*6e91bba0SGirish Moodalbail #define sctps_xmit_lowat sctps_propinfo_tbl[17].prop_cur_uval 106*6e91bba0SGirish Moodalbail #define sctps_recv_hiwat sctps_propinfo_tbl[18].prop_cur_uval 107*6e91bba0SGirish Moodalbail #define sctps_max_buf sctps_propinfo_tbl[19].prop_cur_uval 108*6e91bba0SGirish Moodalbail #define sctps_rtt_updates sctps_propinfo_tbl[20].prop_cur_uval 109*6e91bba0SGirish Moodalbail #define sctps_ipv6_hoplimit sctps_propinfo_tbl[21].prop_cur_uval 110*6e91bba0SGirish Moodalbail #define sctps_rto_ming sctps_propinfo_tbl[22].prop_cur_uval 111*6e91bba0SGirish Moodalbail #define sctps_rto_ming_high sctps_propinfo_tbl[22].prop_max_uval 112*6e91bba0SGirish Moodalbail #define sctps_rto_ming_low sctps_propinfo_tbl[22].prop_min_uval 113*6e91bba0SGirish Moodalbail #define sctps_rto_maxg sctps_propinfo_tbl[23].prop_cur_uval 114*6e91bba0SGirish Moodalbail #define sctps_rto_maxg_high sctps_propinfo_tbl[23].prop_max_uval 115*6e91bba0SGirish Moodalbail #define sctps_rto_maxg_low sctps_propinfo_tbl[23].prop_min_uval 116*6e91bba0SGirish Moodalbail #define sctps_rto_initialg sctps_propinfo_tbl[24].prop_cur_uval 117*6e91bba0SGirish Moodalbail #define sctps_rto_initialg_high sctps_propinfo_tbl[24].prop_max_uval 118*6e91bba0SGirish Moodalbail #define sctps_rto_initialg_low sctps_propinfo_tbl[24].prop_min_uval 119*6e91bba0SGirish Moodalbail #define sctps_cookie_life sctps_propinfo_tbl[25].prop_cur_uval 120*6e91bba0SGirish Moodalbail #define sctps_cookie_life_high sctps_propinfo_tbl[25].prop_max_uval 121*6e91bba0SGirish Moodalbail #define sctps_cookie_life_low sctps_propinfo_tbl[25].prop_min_uval 122*6e91bba0SGirish Moodalbail #define sctps_max_in_streams sctps_propinfo_tbl[26].prop_cur_uval 123*6e91bba0SGirish Moodalbail #define sctps_max_in_streams_high sctps_propinfo_tbl[26].prop_max_uval 124*6e91bba0SGirish Moodalbail #define sctps_max_in_streams_low sctps_propinfo_tbl[26].prop_min_uval 125*6e91bba0SGirish Moodalbail #define sctps_initial_out_streams sctps_propinfo_tbl[27].prop_cur_uval 126*6e91bba0SGirish Moodalbail #define sctps_initial_out_streams_high sctps_propinfo_tbl[27].prop_max_uval 127*6e91bba0SGirish Moodalbail #define sctps_initial_out_streams_low sctps_propinfo_tbl[27].prop_min_uval 128*6e91bba0SGirish Moodalbail #define sctps_shutack_wait_bound sctps_propinfo_tbl[28].prop_cur_uval 129*6e91bba0SGirish Moodalbail #define sctps_maxburst sctps_propinfo_tbl[29].prop_cur_uval 130*6e91bba0SGirish Moodalbail #define sctps_addip_enabled sctps_propinfo_tbl[30].prop_cur_bval 131*6e91bba0SGirish Moodalbail #define sctps_recv_hiwat_minmss sctps_propinfo_tbl[31].prop_cur_uval 132*6e91bba0SGirish Moodalbail #define sctps_slow_start_initial sctps_propinfo_tbl[32].prop_cur_uval 133*6e91bba0SGirish Moodalbail #define sctps_slow_start_after_idle sctps_propinfo_tbl[33].prop_cur_uval 134*6e91bba0SGirish Moodalbail #define sctps_prsctp_enabled sctps_propinfo_tbl[34].prop_cur_bval 135*6e91bba0SGirish Moodalbail #define sctps_fast_rxt_thresh sctps_propinfo_tbl[35].prop_cur_uval 136*6e91bba0SGirish Moodalbail #define sctps_deferred_acks_max sctps_propinfo_tbl[36].prop_cur_uval 137*6e91bba0SGirish Moodalbail #define sctps_wroff_xtra sctps_propinfo_tbl[37].prop_cur_uval 1387c478bd9Sstevel@tonic-gate 13977c67f2fSkcpoon /* 14077c67f2fSkcpoon * Retransmission timer start and stop macro for a given faddr. 14177c67f2fSkcpoon */ 14277c67f2fSkcpoon #define SCTP_FADDR_TIMER_RESTART(sctp, fp, intvl) \ 14377c67f2fSkcpoon { \ 14477c67f2fSkcpoon dprint(3, ("faddr_timer_restart: fp=%p %x:%x:%x:%x %d\n", \ 14577c67f2fSkcpoon (void *)(fp), SCTP_PRINTADDR((fp)->faddr), (int)(intvl))); \ 14677c67f2fSkcpoon sctp_timer((sctp), (fp)->timer_mp, (intvl)); \ 14777c67f2fSkcpoon (fp)->timer_running = 1; \ 14877c67f2fSkcpoon } 14977c67f2fSkcpoon 15077c67f2fSkcpoon #define SCTP_FADDR_TIMER_STOP(fp) \ 15177c67f2fSkcpoon ASSERT((fp)->timer_mp != NULL); \ 15277c67f2fSkcpoon if ((fp)->timer_running) { \ 15377c67f2fSkcpoon sctp_timer_stop((fp)->timer_mp); \ 15477c67f2fSkcpoon (fp)->timer_running = 0; \ 15577c67f2fSkcpoon } 15677c67f2fSkcpoon 1579f13099eSGeorge Shepherd /* For per endpoint association statistics */ 1589f13099eSGeorge Shepherd #define SCTP_MAX_RTO(sctp, fp) { \ 1599f13099eSGeorge Shepherd /* \ 1609f13099eSGeorge Shepherd * Record the maximum observed RTO, \ 1619f13099eSGeorge Shepherd * sctp_maxrto is zeroed elsewhere \ 1629f13099eSGeorge Shepherd * at the end of each stats request. \ 1639f13099eSGeorge Shepherd */ \ 1649f13099eSGeorge Shepherd (sctp)->sctp_maxrto = \ 1659f13099eSGeorge Shepherd MAX((sctp)->sctp_maxrto, (fp)->rto); \ 1669f13099eSGeorge Shepherd DTRACE_PROBE2(sctp__maxrto, sctp_t *, \ 1679f13099eSGeorge Shepherd sctp, struct sctp_faddr_s, fp); \ 1689f13099eSGeorge Shepherd } 1699f13099eSGeorge Shepherd 1709f13099eSGeorge Shepherd #define SCTP_CALC_RXT(sctp, fp) \ 1719f13099eSGeorge Shepherd { \ 1729f13099eSGeorge Shepherd if (((fp)->rto <<= 1) > (sctp)->sctp_rto_max) \ 1739f13099eSGeorge Shepherd (fp)->rto = (sctp)->sctp_rto_max; \ 1749f13099eSGeorge Shepherd SCTP_MAX_RTO(sctp, fp); \ 17577c67f2fSkcpoon } 17677c67f2fSkcpoon 17777c67f2fSkcpoon 1787c478bd9Sstevel@tonic-gate #define SCTP_MAX_COMBINED_HEADER_LENGTH (60 + 12) /* Maxed out ip + sctp */ 1797c478bd9Sstevel@tonic-gate #define SCTP_MAX_IP_OPTIONS_LENGTH (60 - IP_SIMPLE_HDR_LENGTH) 1807c478bd9Sstevel@tonic-gate #define SCTP_MAX_HDR_LENGTH 60 1817c478bd9Sstevel@tonic-gate 1827c478bd9Sstevel@tonic-gate #define SCTP_SECRET_LEN 16 1837c478bd9Sstevel@tonic-gate 18492baa190SGeorge Shepherd #define SCTP_REFHOLD(sctp) { \ 1857c478bd9Sstevel@tonic-gate mutex_enter(&(sctp)->sctp_reflock); \ 18692baa190SGeorge Shepherd (sctp)->sctp_refcnt++; \ 18792baa190SGeorge Shepherd DTRACE_PROBE1(sctp_refhold, sctp_t, sctp); \ 1887c478bd9Sstevel@tonic-gate ASSERT((sctp)->sctp_refcnt != 0); \ 18992baa190SGeorge Shepherd mutex_exit(&(sctp)->sctp_reflock); \ 19092baa190SGeorge Shepherd } 19192baa190SGeorge Shepherd 19292baa190SGeorge Shepherd #define SCTP_REFRELE(sctp) { \ 19392baa190SGeorge Shepherd mutex_enter(&(sctp)->sctp_reflock); \ 19492baa190SGeorge Shepherd ASSERT((sctp)->sctp_refcnt != 0); \ 19592baa190SGeorge Shepherd if (--(sctp)->sctp_refcnt == 0) { \ 19692baa190SGeorge Shepherd DTRACE_PROBE1(sctp_refrele, sctp_t, sctp); \ 19792baa190SGeorge Shepherd mutex_exit(&(sctp)->sctp_reflock); \ 19892baa190SGeorge Shepherd CONN_DEC_REF((sctp)->sctp_connp); \ 19992baa190SGeorge Shepherd } else { \ 20092baa190SGeorge Shepherd DTRACE_PROBE1(sctp_refrele, sctp_t, sctp); \ 20192baa190SGeorge Shepherd mutex_exit(&(sctp)->sctp_reflock); \ 20292baa190SGeorge Shepherd } \ 2037c478bd9Sstevel@tonic-gate } 2047c478bd9Sstevel@tonic-gate 2057c478bd9Sstevel@tonic-gate #define SCTP_PRINTADDR(a) (a).s6_addr32[0], (a).s6_addr32[1],\ 2067c478bd9Sstevel@tonic-gate (a).s6_addr32[2], (a).s6_addr32[3] 2077c478bd9Sstevel@tonic-gate 2087c478bd9Sstevel@tonic-gate #define CONN2SCTP(conn) ((sctp_t *)(&((conn_t *)conn)[1])) 2097c478bd9Sstevel@tonic-gate 2107c478bd9Sstevel@tonic-gate /* 2117c478bd9Sstevel@tonic-gate * Outbound data, flags and macros for per-message, per-chunk info 2127c478bd9Sstevel@tonic-gate */ 2137c478bd9Sstevel@tonic-gate typedef struct { 2147c478bd9Sstevel@tonic-gate int64_t smh_ttl; /* Time to Live */ 2157c478bd9Sstevel@tonic-gate int64_t smh_tob; /* Time of Birth */ 2167c478bd9Sstevel@tonic-gate uint32_t smh_context; 2177c478bd9Sstevel@tonic-gate uint16_t smh_sid; 2187c478bd9Sstevel@tonic-gate uint16_t smh_ssn; 2197c478bd9Sstevel@tonic-gate uint32_t smh_ppid; 2207c478bd9Sstevel@tonic-gate uint16_t smh_flags; 2217c478bd9Sstevel@tonic-gate uint32_t smh_msglen; 2227c478bd9Sstevel@tonic-gate } sctp_msg_hdr_t; 2237c478bd9Sstevel@tonic-gate 2247c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_FLAG_SENT 0x01 2257c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_FLAG_REXMIT 0x02 2267c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_FLAG_ACKED 0x04 2277c478bd9Sstevel@tonic-gate #define SCTP_MSG_FLAG_CHUNKED 0x08 2287c478bd9Sstevel@tonic-gate #define SCTP_MSG_FLAG_ABANDONED 0x10 2297c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_FLAG_ABANDONED 0x20 2307c478bd9Sstevel@tonic-gate 2317c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_CLEAR_FLAGS(mp) ((mp)->b_flag = 0) 2327c478bd9Sstevel@tonic-gate /* 2337c478bd9Sstevel@tonic-gate * If we are transmitting the chunk for the first time we assign the TSN and 2347c478bd9Sstevel@tonic-gate * SSN here. The reason we assign the SSN here (as opposed to doing it in 2357c478bd9Sstevel@tonic-gate * sctp_chunkify()) is that the chunk may expire, if PRSCTP is enabled, before 2367c478bd9Sstevel@tonic-gate * we get a chance to send it out. If we assign the SSN in sctp_chunkify() 2377c478bd9Sstevel@tonic-gate * and this happens, then we need to send a Forward TSN to the peer, which 2387c478bd9Sstevel@tonic-gate * will be expecting this SSN, assuming ordered. If we assign it here we 2397c478bd9Sstevel@tonic-gate * can just take out the chunk from the transmit list without having to 2407c478bd9Sstevel@tonic-gate * send a Forward TSN chunk. While assigning the SSN we use (meta)->b_cont 2417c478bd9Sstevel@tonic-gate * to determine if it needs a new SSN (i.e. the next SSN for the stream), 2427c478bd9Sstevel@tonic-gate * since (meta)->b_cont signifies the first chunk of a message (if the message 2437c478bd9Sstevel@tonic-gate * is unordered, then the SSN is 0). 2447c478bd9Sstevel@tonic-gate * 2457c478bd9Sstevel@tonic-gate */ 2467c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_SENT(sctp, mp, sdc, fp, chunkdata, meta) { \ 2477c478bd9Sstevel@tonic-gate if (!SCTP_CHUNK_ISSENT(mp)) { \ 2487c478bd9Sstevel@tonic-gate sctp_msg_hdr_t *mhdr = (sctp_msg_hdr_t *)(meta)->b_rptr; \ 2497c478bd9Sstevel@tonic-gate ASSERT(!SCTP_CHUNK_ABANDONED(mp)); \ 2507c478bd9Sstevel@tonic-gate (mp)->b_flag = SCTP_CHUNK_FLAG_SENT; \ 2517c478bd9Sstevel@tonic-gate (sdc)->sdh_tsn = htonl((sctp)->sctp_ltsn++); \ 2527c478bd9Sstevel@tonic-gate if ((mhdr)->smh_flags & MSG_UNORDERED) { \ 2537c478bd9Sstevel@tonic-gate (sdc)->sdh_ssn = 0; \ 2547c478bd9Sstevel@tonic-gate SCTP_DATA_SET_UBIT(sdc); \ 2557c478bd9Sstevel@tonic-gate BUMP_LOCAL((sctp)->sctp_oudchunks); \ 2567c478bd9Sstevel@tonic-gate } else { \ 2577c478bd9Sstevel@tonic-gate BUMP_LOCAL((sctp)->sctp_odchunks); \ 2587c478bd9Sstevel@tonic-gate if ((mp) == (meta)->b_cont) { \ 2597c478bd9Sstevel@tonic-gate mhdr->smh_ssn = htons( \ 2607c478bd9Sstevel@tonic-gate (sctp)->sctp_ostrcntrs[mhdr->smh_sid]++); \ 2617c478bd9Sstevel@tonic-gate } \ 2627c478bd9Sstevel@tonic-gate (sdc)->sdh_ssn = mhdr->smh_ssn; \ 2637c478bd9Sstevel@tonic-gate } \ 2647c478bd9Sstevel@tonic-gate (sctp)->sctp_unacked += (chunkdata); \ 2657c478bd9Sstevel@tonic-gate (sctp)->sctp_unsent -= (chunkdata); \ 2667c478bd9Sstevel@tonic-gate (sctp)->sctp_frwnd -= (chunkdata); \ 2677c478bd9Sstevel@tonic-gate } else { \ 2687c478bd9Sstevel@tonic-gate if (SCTP_CHUNK_ISACKED(mp)) { \ 2697c478bd9Sstevel@tonic-gate (sctp)->sctp_unacked += (chunkdata); \ 2707c478bd9Sstevel@tonic-gate } else { \ 2717c478bd9Sstevel@tonic-gate ASSERT(SCTP_CHUNK_DEST(mp)->suna >= ((chunkdata) + \ 2727c478bd9Sstevel@tonic-gate sizeof (*sdc))); \ 2737c478bd9Sstevel@tonic-gate SCTP_CHUNK_DEST(mp)->suna -= ((chunkdata) + \ 2747c478bd9Sstevel@tonic-gate sizeof (*sdc)); \ 2757c478bd9Sstevel@tonic-gate } \ 2767c478bd9Sstevel@tonic-gate (mp)->b_flag &= ~(SCTP_CHUNK_FLAG_REXMIT | \ 2777c478bd9Sstevel@tonic-gate SCTP_CHUNK_FLAG_ACKED); \ 2787c478bd9Sstevel@tonic-gate SCTP_CHUNK_SET_SACKCNT(mp, 0); \ 2797c478bd9Sstevel@tonic-gate BUMP_LOCAL(sctp->sctp_rxtchunks); \ 2807c478bd9Sstevel@tonic-gate BUMP_LOCAL((sctp)->sctp_T3expire); \ 2817c478bd9Sstevel@tonic-gate BUMP_LOCAL((fp)->T3expire); \ 2827c478bd9Sstevel@tonic-gate } \ 2837c478bd9Sstevel@tonic-gate SCTP_SET_CHUNK_DEST(mp, fp); \ 2847c478bd9Sstevel@tonic-gate (fp)->suna += ((chunkdata) + sizeof (*sdc)); \ 2857c478bd9Sstevel@tonic-gate } 2867c478bd9Sstevel@tonic-gate 2877c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_ISSENT(mp) ((mp)->b_flag & SCTP_CHUNK_FLAG_SENT) 2887c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_CANSEND(mp) \ 2897c478bd9Sstevel@tonic-gate (!(SCTP_CHUNK_ABANDONED(mp)) && \ 2907c478bd9Sstevel@tonic-gate (((mp)->b_flag & (SCTP_CHUNK_FLAG_REXMIT|SCTP_CHUNK_FLAG_SENT)) != \ 2917c478bd9Sstevel@tonic-gate SCTP_CHUNK_FLAG_SENT)) 2927c478bd9Sstevel@tonic-gate 2937c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_DEST(mp) ((sctp_faddr_t *)(mp)->b_queue) 2947c478bd9Sstevel@tonic-gate #define SCTP_SET_CHUNK_DEST(mp, fp) ((mp)->b_queue = (queue_t *)fp) 2957c478bd9Sstevel@tonic-gate 2967c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_REXMIT(mp) ((mp)->b_flag |= SCTP_CHUNK_FLAG_REXMIT) 2977c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_CLEAR_REXMIT(mp) ((mp)->b_flag &= ~SCTP_CHUNK_FLAG_REXMIT) 2987c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_WANT_REXMIT(mp) ((mp)->b_flag & SCTP_CHUNK_FLAG_REXMIT) 2997c478bd9Sstevel@tonic-gate 3007c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_ACKED(mp) \ 3017c478bd9Sstevel@tonic-gate ((mp)->b_flag = (SCTP_CHUNK_FLAG_SENT|SCTP_CHUNK_FLAG_ACKED)) 3027c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_ISACKED(mp) ((mp)->b_flag & SCTP_CHUNK_FLAG_ACKED) 3037c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_CLEAR_ACKED(mp) ((mp)->b_flag &= ~SCTP_CHUNK_FLAG_ACKED) 3047c478bd9Sstevel@tonic-gate 3057c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_SACKCNT(mp) ((intptr_t)((mp)->b_prev)) 3067c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_SET_SACKCNT(mp, val) ((mp)->b_prev = \ 3077c478bd9Sstevel@tonic-gate (mblk_t *)(uintptr_t)(val)) 3087c478bd9Sstevel@tonic-gate 3097c478bd9Sstevel@tonic-gate #define SCTP_MSG_SET_CHUNKED(mp) ((mp)->b_flag |= SCTP_MSG_FLAG_CHUNKED) 3107c478bd9Sstevel@tonic-gate #define SCTP_MSG_CLEAR_CHUNKED(mp)((mp)->b_flag &= ~SCTP_MSG_FLAG_CHUNKED) 3117c478bd9Sstevel@tonic-gate #define SCTP_IS_MSG_CHUNKED(mp) ((mp)->b_flag & SCTP_MSG_FLAG_CHUNKED) 3127c478bd9Sstevel@tonic-gate 3137c478bd9Sstevel@tonic-gate /* For PR-SCTP */ 3147c478bd9Sstevel@tonic-gate #define SCTP_ABANDON_CHUNK(mp) ((mp)->b_flag |= SCTP_CHUNK_FLAG_ABANDONED) 3157c478bd9Sstevel@tonic-gate #define SCTP_CHUNK_ABANDONED(mp) \ 3167c478bd9Sstevel@tonic-gate ((mp)->b_flag & SCTP_CHUNK_FLAG_ABANDONED) 3177c478bd9Sstevel@tonic-gate 3187c478bd9Sstevel@tonic-gate #define SCTP_MSG_SET_ABANDONED(mp) \ 3197c478bd9Sstevel@tonic-gate ((mp)->b_flag |= SCTP_MSG_FLAG_ABANDONED) 3207c478bd9Sstevel@tonic-gate #define SCTP_MSG_CLEAR_ABANDONED(mp)((mp)->b_flag &= ~SCTP_MSG_FLAG_ABANDONED) 3217c478bd9Sstevel@tonic-gate #define SCTP_IS_MSG_ABANDONED(mp) ((mp)->b_flag & SCTP_MSG_FLAG_ABANDONED) 3227c478bd9Sstevel@tonic-gate 3237c478bd9Sstevel@tonic-gate /* 3247c478bd9Sstevel@tonic-gate * Check if a message has expired. A message is expired if 3257c478bd9Sstevel@tonic-gate * 1. It has a non-zero time to live value and has not been sent before 3267c478bd9Sstevel@tonic-gate * that time expires. 3277c478bd9Sstevel@tonic-gate * 2. It is sent using PRSCTP and it has not been SACK'ed before 3287c478bd9Sstevel@tonic-gate * its lifetime expires. 3297c478bd9Sstevel@tonic-gate */ 3307c478bd9Sstevel@tonic-gate #define SCTP_MSG_TO_BE_ABANDONED(meta, mhdr, sctp) \ 3317c478bd9Sstevel@tonic-gate (((!SCTP_CHUNK_ISSENT((meta)->b_cont) && (mhdr)->smh_ttl > 0) || \ 3327c478bd9Sstevel@tonic-gate ((sctp)->sctp_prsctp_aware && ((mhdr)->smh_flags & MSG_PR_SCTP))) && \ 333d3d50737SRafael Vanoni ((ddi_get_lbolt64() - (mhdr)->smh_tob) > (mhdr)->smh_ttl)) 3347c478bd9Sstevel@tonic-gate 3357c478bd9Sstevel@tonic-gate /* SCTP association hash function. */ 336f4b3ec61Sdh #define SCTP_CONN_HASH(sctps, ports) \ 337f4b3ec61Sdh ((((ports) ^ ((ports) >> 16)) * 31) & \ 338f4b3ec61Sdh ((sctps)->sctps_conn_hash_size - 1)) 3397c478bd9Sstevel@tonic-gate 3407c478bd9Sstevel@tonic-gate /* 3417c478bd9Sstevel@tonic-gate * Bind hash array size and hash function. The size must be a power 3427c478bd9Sstevel@tonic-gate * of 2 and lport must be in host byte order. 3437c478bd9Sstevel@tonic-gate */ 3447c478bd9Sstevel@tonic-gate #define SCTP_BIND_FANOUT_SIZE 2048 3457c478bd9Sstevel@tonic-gate #define SCTP_BIND_HASH(lport) (((lport) * 31) & (SCTP_BIND_FANOUT_SIZE - 1)) 3467c478bd9Sstevel@tonic-gate 3477c478bd9Sstevel@tonic-gate /* options that SCTP negotiates during association establishment */ 3487c478bd9Sstevel@tonic-gate #define SCTP_PRSCTP_OPTION 0x01 3497c478bd9Sstevel@tonic-gate 3507c478bd9Sstevel@tonic-gate /* 3517c478bd9Sstevel@tonic-gate * Listener hash array size and hash function. The size must be a power 3527c478bd9Sstevel@tonic-gate * of 2 and lport must be in host byte order. 3537c478bd9Sstevel@tonic-gate */ 3547c478bd9Sstevel@tonic-gate #define SCTP_LISTEN_FANOUT_SIZE 512 3557c478bd9Sstevel@tonic-gate #define SCTP_LISTEN_HASH(lport) (((lport) * 31) & (SCTP_LISTEN_FANOUT_SIZE - 1)) 3567c478bd9Sstevel@tonic-gate 3577c478bd9Sstevel@tonic-gate typedef struct sctp_tf_s { 3587c478bd9Sstevel@tonic-gate struct sctp_s *tf_sctp; 3597c478bd9Sstevel@tonic-gate kmutex_t tf_lock; 3607c478bd9Sstevel@tonic-gate } sctp_tf_t; 3617c478bd9Sstevel@tonic-gate 3627c478bd9Sstevel@tonic-gate /* Round up the value to the nearest mss. */ 3637c478bd9Sstevel@tonic-gate #define MSS_ROUNDUP(value, mss) ((((value) - 1) / (mss) + 1) * (mss)) 3647c478bd9Sstevel@tonic-gate 3657c478bd9Sstevel@tonic-gate extern sin_t sctp_sin_null; /* Zero address for quick clears */ 3667c478bd9Sstevel@tonic-gate extern sin6_t sctp_sin6_null; /* Zero address for quick clears */ 3677c478bd9Sstevel@tonic-gate 3687c478bd9Sstevel@tonic-gate #define SCTP_IS_DETACHED(sctp) ((sctp)->sctp_detached) 3697c478bd9Sstevel@tonic-gate 3707c478bd9Sstevel@tonic-gate /* Data structure used to track received TSNs */ 3717c478bd9Sstevel@tonic-gate typedef struct sctp_set_s { 3727c478bd9Sstevel@tonic-gate struct sctp_set_s *next; 3737c478bd9Sstevel@tonic-gate struct sctp_set_s *prev; 3747c478bd9Sstevel@tonic-gate uint32_t begin; 3757c478bd9Sstevel@tonic-gate uint32_t end; 3767c478bd9Sstevel@tonic-gate } sctp_set_t; 3777c478bd9Sstevel@tonic-gate 3787c478bd9Sstevel@tonic-gate /* Data structure used to track TSNs for PR-SCTP */ 3797c478bd9Sstevel@tonic-gate typedef struct sctp_ftsn_set_s { 3807c478bd9Sstevel@tonic-gate struct sctp_ftsn_set_s *next; 3817c478bd9Sstevel@tonic-gate ftsn_entry_t ftsn_entries; 3827c478bd9Sstevel@tonic-gate } sctp_ftsn_set_t; 3837c478bd9Sstevel@tonic-gate 3847c478bd9Sstevel@tonic-gate /* Data structure used to track incoming SCTP streams */ 3857c478bd9Sstevel@tonic-gate typedef struct sctp_instr_s { 3867c478bd9Sstevel@tonic-gate mblk_t *istr_msgs; 3877c478bd9Sstevel@tonic-gate int istr_nmsgs; 3887c478bd9Sstevel@tonic-gate uint16_t nextseq; 3897c478bd9Sstevel@tonic-gate struct sctp_s *sctp; 3907c478bd9Sstevel@tonic-gate mblk_t *istr_reass; 3917c478bd9Sstevel@tonic-gate } sctp_instr_t; 3927c478bd9Sstevel@tonic-gate 3937c478bd9Sstevel@tonic-gate /* Reassembly data structure (per-stream) */ 3947c478bd9Sstevel@tonic-gate typedef struct sctp_reass_s { 3957c478bd9Sstevel@tonic-gate uint16_t ssn; 3967c478bd9Sstevel@tonic-gate uint16_t needed; 3977c478bd9Sstevel@tonic-gate uint16_t got; 3987d546a59Svi uint16_t msglen; /* len of consecutive fragments */ 3997d546a59Svi /* from the begining (B-bit) */ 4007c478bd9Sstevel@tonic-gate mblk_t *tail; 4017d546a59Svi boolean_t hasBchunk; /* If the fragment list begins with */ 4027d546a59Svi /* a B-bit set chunk */ 4037d546a59Svi uint32_t nexttsn; /* TSN of the next fragment we */ 4047d546a59Svi /* are expecting */ 4057c478bd9Sstevel@tonic-gate boolean_t partial_delivered; 4067c478bd9Sstevel@tonic-gate } sctp_reass_t; 4077c478bd9Sstevel@tonic-gate 4087c478bd9Sstevel@tonic-gate /* debugging */ 4097c478bd9Sstevel@tonic-gate #undef dprint 41045916cd2Sjpk #ifdef DEBUG 4117c478bd9Sstevel@tonic-gate extern int sctpdebug; 4127c478bd9Sstevel@tonic-gate #define dprint(level, args) { if (sctpdebug > (level)) printf args; } 41345916cd2Sjpk #else 4147c478bd9Sstevel@tonic-gate #define dprint(level, args) {} 41545916cd2Sjpk #endif 4167c478bd9Sstevel@tonic-gate 4177c478bd9Sstevel@tonic-gate 4187c478bd9Sstevel@tonic-gate /* Peer address tracking */ 4197c478bd9Sstevel@tonic-gate 4207c478bd9Sstevel@tonic-gate /* 4217c478bd9Sstevel@tonic-gate * States for peer addresses 4227c478bd9Sstevel@tonic-gate * 4237c478bd9Sstevel@tonic-gate * SCTP_FADDRS_UNCONFIRMED: we have not communicated with this peer address 4247c478bd9Sstevel@tonic-gate * before, mark it as unconfirmed so that we will not send data to it. 4257c478bd9Sstevel@tonic-gate * All addresses initially are in unconfirmed state and required 4267c478bd9Sstevel@tonic-gate * validation. SCTP sends a heartbeat to each of them and when it gets 4277c478bd9Sstevel@tonic-gate * back a heartbeat ACK, the address will be marked as alive. This 4287c478bd9Sstevel@tonic-gate * validation fixes a security issue with multihoming. If an attacker 4297c478bd9Sstevel@tonic-gate * establishes an association with us and tells us that it has addresses 4307c478bd9Sstevel@tonic-gate * belonging to another host A, this will prevent A from communicating 4317c478bd9Sstevel@tonic-gate * with us. This is fixed by peer address validation. In the above case, 4327c478bd9Sstevel@tonic-gate * A will respond with an abort. 4337c478bd9Sstevel@tonic-gate * 4347c478bd9Sstevel@tonic-gate * SCTP_FADDRS_ALIVE: this peer address is alive and we can communicate with 4357c478bd9Sstevel@tonic-gate * it with no problem. 4367c478bd9Sstevel@tonic-gate * 4377c478bd9Sstevel@tonic-gate * SCTP_FADDRS_DOWN: we have exceeded the retransmission limit to this 4387c478bd9Sstevel@tonic-gate * peer address. Once an address is marked down, we will only send 4397c478bd9Sstevel@tonic-gate * a heartbeat to it every hb_interval in case it becomes alive now. 4407c478bd9Sstevel@tonic-gate * 4417c478bd9Sstevel@tonic-gate * SCTP_FADDRS_UNREACH: there is no suitable source address to send to 4427c478bd9Sstevel@tonic-gate * this peer address. For example, the peer address is v6 but we only 4437c478bd9Sstevel@tonic-gate * have v4 addresses. It is marked unreachable until there is an 4447c478bd9Sstevel@tonic-gate * address configuration change. At that time, mark these addresses 4457c478bd9Sstevel@tonic-gate * as unconfirmed and try again to see if those unreachable addresses 4467c478bd9Sstevel@tonic-gate * are OK as we may have more source addresses. 4477c478bd9Sstevel@tonic-gate */ 4487c478bd9Sstevel@tonic-gate typedef enum { 4497c478bd9Sstevel@tonic-gate SCTP_FADDRS_UNREACH, 4507c478bd9Sstevel@tonic-gate SCTP_FADDRS_DOWN, 4517c478bd9Sstevel@tonic-gate SCTP_FADDRS_ALIVE, 4527c478bd9Sstevel@tonic-gate SCTP_FADDRS_UNCONFIRMED 4537c478bd9Sstevel@tonic-gate } faddr_state_t; 4547c478bd9Sstevel@tonic-gate 4557c478bd9Sstevel@tonic-gate typedef struct sctp_faddr_s { 4567c478bd9Sstevel@tonic-gate struct sctp_faddr_s *next; 4577c478bd9Sstevel@tonic-gate faddr_state_t state; 4587c478bd9Sstevel@tonic-gate 4597c478bd9Sstevel@tonic-gate in6_addr_t faddr; 4607c478bd9Sstevel@tonic-gate in6_addr_t saddr; 4617c478bd9Sstevel@tonic-gate 4627c478bd9Sstevel@tonic-gate int64_t hb_expiry; /* time to retransmit heartbeat */ 4637c478bd9Sstevel@tonic-gate uint32_t hb_interval; /* the heartbeat interval */ 4647c478bd9Sstevel@tonic-gate 4657c478bd9Sstevel@tonic-gate int rto; /* RTO in tick */ 4667c478bd9Sstevel@tonic-gate int srtt; /* Smoothed RTT in tick */ 4677c478bd9Sstevel@tonic-gate int rttvar; /* RTT variance in tick */ 4687c478bd9Sstevel@tonic-gate uint32_t rtt_updates; 4697c478bd9Sstevel@tonic-gate int strikes; 4707c478bd9Sstevel@tonic-gate int max_retr; 4717c478bd9Sstevel@tonic-gate uint32_t sfa_pmss; 4727c478bd9Sstevel@tonic-gate uint32_t cwnd; 4737c478bd9Sstevel@tonic-gate uint32_t ssthresh; 4747c478bd9Sstevel@tonic-gate uint32_t suna; /* sent - unack'ed */ 4757c478bd9Sstevel@tonic-gate uint32_t pba; /* partial bytes acked */ 4767c478bd9Sstevel@tonic-gate uint32_t acked; 4777c478bd9Sstevel@tonic-gate int64_t lastactive; 4787c478bd9Sstevel@tonic-gate mblk_t *timer_mp; /* retransmission timer control */ 4797c478bd9Sstevel@tonic-gate uint32_t 4807c478bd9Sstevel@tonic-gate hb_pending : 1, 4817c478bd9Sstevel@tonic-gate timer_running : 1, 4827c478bd9Sstevel@tonic-gate df : 1, 4837c478bd9Sstevel@tonic-gate pmtu_discovered : 1, 4847c478bd9Sstevel@tonic-gate 4857c478bd9Sstevel@tonic-gate rc_timer_running : 1, 486c31292eeSkcpoon isv4 : 1, 487c31292eeSkcpoon hb_enabled : 1; 4887c478bd9Sstevel@tonic-gate 4897c478bd9Sstevel@tonic-gate mblk_t *rc_timer_mp; /* reliable control chunk timer */ 490bd670b35SErik Nordmark ip_xmit_attr_t *ixa; /* Transmit attributes */ 4917c478bd9Sstevel@tonic-gate uint32_t T3expire; /* # of times T3 timer expired */ 4927c478bd9Sstevel@tonic-gate 4937c478bd9Sstevel@tonic-gate uint64_t hb_secret; /* per addr "secret" in heartbeat */ 49412f47623Skcpoon uint32_t rxt_unacked; /* # unack'ed retransmitted bytes */ 4957c478bd9Sstevel@tonic-gate } sctp_faddr_t; 4967c478bd9Sstevel@tonic-gate 4977c478bd9Sstevel@tonic-gate /* Flags to indicate supported address type in the PARM_SUP_ADDRS. */ 4987c478bd9Sstevel@tonic-gate #define PARM_SUPP_V6 0x1 4997c478bd9Sstevel@tonic-gate #define PARM_SUPP_V4 0x2 5007c478bd9Sstevel@tonic-gate 5017c478bd9Sstevel@tonic-gate /* 5027c478bd9Sstevel@tonic-gate * Set heartbeat interval plus jitter. The jitter is supposed to be random, 5037c478bd9Sstevel@tonic-gate * up to +/- 50% of the RTO. We use gethrtime() here for performance reason 5047c478bd9Sstevel@tonic-gate * as the jitter does not really need to be "very" random. 5057c478bd9Sstevel@tonic-gate */ 5067c478bd9Sstevel@tonic-gate #define SET_HB_INTVL(fp) \ 5077c478bd9Sstevel@tonic-gate ((fp)->hb_interval + (fp)->rto + ((fp)->rto >> 1) - \ 508c31292eeSkcpoon (uint_t)gethrtime() % (fp)->rto) 5097c478bd9Sstevel@tonic-gate 5107c478bd9Sstevel@tonic-gate #define SCTP_IPIF_HASH 16 5117c478bd9Sstevel@tonic-gate 5127c478bd9Sstevel@tonic-gate typedef struct sctp_ipif_hash_s { 51392baa190SGeorge Shepherd list_t sctp_ipif_list; 51492baa190SGeorge Shepherd int ipif_count; 51592baa190SGeorge Shepherd krwlock_t ipif_hash_lock; 5167c478bd9Sstevel@tonic-gate } sctp_ipif_hash_t; 5177c478bd9Sstevel@tonic-gate 51812f47623Skcpoon 51912f47623Skcpoon /* 52012f47623Skcpoon * Initialize cwnd according to RFC 3390. def_max_init_cwnd is 52112f47623Skcpoon * either sctp_slow_start_initial or sctp_slow_start_after idle 52212f47623Skcpoon * depending on the caller. 52312f47623Skcpoon */ 52412f47623Skcpoon #define SET_CWND(fp, mss, def_max_init_cwnd) \ 52512f47623Skcpoon { \ 52612f47623Skcpoon (fp)->cwnd = MIN(def_max_init_cwnd * (mss), \ 52712f47623Skcpoon MIN(4 * (mss), MAX(2 * (mss), 4380 / (mss) * (mss)))); \ 52812f47623Skcpoon } 52912f47623Skcpoon 53012f47623Skcpoon 5317c478bd9Sstevel@tonic-gate struct sctp_s; 5327c478bd9Sstevel@tonic-gate 5337c478bd9Sstevel@tonic-gate /* 5347c478bd9Sstevel@tonic-gate * Control structure for each open SCTP stream, 5357c478bd9Sstevel@tonic-gate * defined only within the kernel or for a kmem user. 5367c478bd9Sstevel@tonic-gate * NOTE: sctp_reinit_values MUST have a line for each field in this structure! 5377c478bd9Sstevel@tonic-gate */ 5387c478bd9Sstevel@tonic-gate #if (defined(_KERNEL) || defined(_KMEMUSER)) 5397c478bd9Sstevel@tonic-gate 5407c478bd9Sstevel@tonic-gate typedef struct sctp_s { 5417c478bd9Sstevel@tonic-gate 5427c478bd9Sstevel@tonic-gate /* 5437c478bd9Sstevel@tonic-gate * The following is shared with (and duplicated) in IP, so if you 5447c478bd9Sstevel@tonic-gate * make changes, make sure you also change things in ip_sctp.c. 5457c478bd9Sstevel@tonic-gate */ 5467c478bd9Sstevel@tonic-gate struct sctp_s *sctp_conn_hash_next; 5477c478bd9Sstevel@tonic-gate struct sctp_s *sctp_conn_hash_prev; 5487c478bd9Sstevel@tonic-gate 5497c478bd9Sstevel@tonic-gate struct sctp_s *sctp_listen_hash_next; 5507c478bd9Sstevel@tonic-gate struct sctp_s *sctp_listen_hash_prev; 5517c478bd9Sstevel@tonic-gate 5527c478bd9Sstevel@tonic-gate sctp_tf_t *sctp_listen_tfp; /* Ptr to tf */ 5537c478bd9Sstevel@tonic-gate sctp_tf_t *sctp_conn_tfp; /* Ptr to tf */ 5547c478bd9Sstevel@tonic-gate 5557c478bd9Sstevel@tonic-gate /* Global list of sctp */ 5567c478bd9Sstevel@tonic-gate list_node_t sctp_list; 5577c478bd9Sstevel@tonic-gate 5587c478bd9Sstevel@tonic-gate sctp_faddr_t *sctp_faddrs; 5591d8c4025Svi int sctp_nfaddrs; 5607c478bd9Sstevel@tonic-gate sctp_ipif_hash_t sctp_saddrs[SCTP_IPIF_HASH]; 5617c478bd9Sstevel@tonic-gate int sctp_nsaddrs; 5627c478bd9Sstevel@tonic-gate 5637c478bd9Sstevel@tonic-gate kmutex_t sctp_lock; 5647c478bd9Sstevel@tonic-gate kcondvar_t sctp_cv; 5657c478bd9Sstevel@tonic-gate boolean_t sctp_running; 5667c478bd9Sstevel@tonic-gate 5670f1702c5SYu Xiangning #define sctp_ulpd sctp_connp->conn_upper_handle 5680f1702c5SYu Xiangning #define sctp_upcalls sctp_connp->conn_upcalls 5697c478bd9Sstevel@tonic-gate 5700f1702c5SYu Xiangning #define sctp_ulp_newconn sctp_upcalls->su_newconn 5710f1702c5SYu Xiangning #define sctp_ulp_connected sctp_upcalls->su_connected 5720f1702c5SYu Xiangning #define sctp_ulp_disconnected sctp_upcalls->su_disconnected 5730f1702c5SYu Xiangning #define sctp_ulp_opctl sctp_upcalls->su_opctl 5740f1702c5SYu Xiangning #define sctp_ulp_recv sctp_upcalls->su_recv 5750f1702c5SYu Xiangning #define sctp_ulp_xmitted sctp_upcalls->su_txq_full 5760f1702c5SYu Xiangning #define sctp_ulp_prop sctp_upcalls->su_set_proto_props 5777c478bd9Sstevel@tonic-gate 5787c478bd9Sstevel@tonic-gate int32_t sctp_state; 5797c478bd9Sstevel@tonic-gate 5807c478bd9Sstevel@tonic-gate conn_t *sctp_connp; /* conn_t stuff */ 581f4b3ec61Sdh sctp_stack_t *sctp_sctps; 582f4b3ec61Sdh 5837c478bd9Sstevel@tonic-gate /* Peer address tracking */ 5847c478bd9Sstevel@tonic-gate sctp_faddr_t *sctp_lastfaddr; /* last faddr in list */ 5857c478bd9Sstevel@tonic-gate sctp_faddr_t *sctp_primary; /* primary faddr */ 5867c478bd9Sstevel@tonic-gate sctp_faddr_t *sctp_current; /* current faddr */ 5877c478bd9Sstevel@tonic-gate sctp_faddr_t *sctp_lastdata; /* last data seen from this */ 5887c478bd9Sstevel@tonic-gate 5897c478bd9Sstevel@tonic-gate /* Outbound data tracking */ 5907c478bd9Sstevel@tonic-gate mblk_t *sctp_xmit_head; 5917c478bd9Sstevel@tonic-gate mblk_t *sctp_xmit_tail; 5927c478bd9Sstevel@tonic-gate mblk_t *sctp_xmit_unsent; 5937c478bd9Sstevel@tonic-gate mblk_t *sctp_xmit_unsent_tail; 5947c478bd9Sstevel@tonic-gate mblk_t *sctp_xmit_unacked; 5957c478bd9Sstevel@tonic-gate 5967c478bd9Sstevel@tonic-gate int32_t sctp_unacked; /* # of unacked bytes */ 5977c478bd9Sstevel@tonic-gate int32_t sctp_unsent; /* # of unsent bytes in hand */ 5987c478bd9Sstevel@tonic-gate 5997c478bd9Sstevel@tonic-gate uint32_t sctp_ltsn; /* Local instance TSN */ 6007c478bd9Sstevel@tonic-gate uint32_t sctp_lastack_rxd; /* Last rx'd cumtsn */ 6017c478bd9Sstevel@tonic-gate uint32_t sctp_recovery_tsn; /* Exit from fast recovery */ 6027c478bd9Sstevel@tonic-gate uint32_t sctp_adv_pap; /* Adv. Peer Ack Point */ 6037c478bd9Sstevel@tonic-gate 6047c478bd9Sstevel@tonic-gate uint16_t sctp_num_ostr; 6057c478bd9Sstevel@tonic-gate uint16_t *sctp_ostrcntrs; 6067c478bd9Sstevel@tonic-gate 607121e5416Skcpoon mblk_t *sctp_pad_mp; /* pad unaligned data chunks */ 608121e5416Skcpoon 6097c478bd9Sstevel@tonic-gate /* sendmsg() default parameters */ 6107c478bd9Sstevel@tonic-gate uint16_t sctp_def_stream; /* default stream id */ 6117c478bd9Sstevel@tonic-gate uint16_t sctp_def_flags; /* default xmit flags */ 6127c478bd9Sstevel@tonic-gate uint32_t sctp_def_ppid; /* default payload id */ 6137c478bd9Sstevel@tonic-gate uint32_t sctp_def_context; /* default context */ 6147c478bd9Sstevel@tonic-gate uint32_t sctp_def_timetolive; /* default msg TTL */ 6157c478bd9Sstevel@tonic-gate 6167c478bd9Sstevel@tonic-gate /* Inbound data tracking */ 6177c478bd9Sstevel@tonic-gate sctp_set_t *sctp_sack_info; /* Sack tracking */ 6187c478bd9Sstevel@tonic-gate mblk_t *sctp_ack_mp; /* Delayed ACK timer block */ 6197c478bd9Sstevel@tonic-gate sctp_instr_t *sctp_instr; /* Instream trackers */ 6207c478bd9Sstevel@tonic-gate mblk_t *sctp_uo_frags; /* Un-ordered msg. fragments */ 6217c478bd9Sstevel@tonic-gate uint32_t sctp_ftsn; /* Peer's TSN */ 6227c478bd9Sstevel@tonic-gate uint32_t sctp_lastacked; /* last cumtsn SACKd */ 6237c478bd9Sstevel@tonic-gate uint16_t sctp_num_istr; /* No. of instreams */ 6247c478bd9Sstevel@tonic-gate int32_t sctp_istr_nmsgs; /* No. of chunks in instreams */ 6257c478bd9Sstevel@tonic-gate int32_t sctp_sack_gaps; /* No. of received gaps */ 6267c478bd9Sstevel@tonic-gate int32_t sctp_sack_toggle; /* SACK every other pkt */ 6277c478bd9Sstevel@tonic-gate 6287c478bd9Sstevel@tonic-gate /* RTT calculation */ 6297c478bd9Sstevel@tonic-gate uint32_t sctp_rtt_tsn; 6307c478bd9Sstevel@tonic-gate int64_t sctp_out_time; 6317c478bd9Sstevel@tonic-gate 63235e12f9cSGeorge Shepherd /* Stats can be reset by snmp users kstat, netstat and snmp agents */ 6337c478bd9Sstevel@tonic-gate uint64_t sctp_opkts; /* sent pkts */ 6347c478bd9Sstevel@tonic-gate uint64_t sctp_obchunks; /* sent control chunks */ 6357c478bd9Sstevel@tonic-gate uint64_t sctp_odchunks; /* sent ordered data chunks */ 6367c478bd9Sstevel@tonic-gate uint64_t sctp_oudchunks; /* sent unord data chunks */ 6377c478bd9Sstevel@tonic-gate uint64_t sctp_rxtchunks; /* retransmitted chunks */ 6387c478bd9Sstevel@tonic-gate uint64_t sctp_ipkts; /* recv pkts */ 6397c478bd9Sstevel@tonic-gate uint64_t sctp_ibchunks; /* recv control chunks */ 6407c478bd9Sstevel@tonic-gate uint64_t sctp_idchunks; /* recv ordered data chunks */ 6417c478bd9Sstevel@tonic-gate uint64_t sctp_iudchunks; /* recv unord data chunks */ 6427c478bd9Sstevel@tonic-gate uint64_t sctp_fragdmsgs; 6437c478bd9Sstevel@tonic-gate uint64_t sctp_reassmsgs; 6447c478bd9Sstevel@tonic-gate uint32_t sctp_T1expire; /* # of times T1timer expired */ 6457c478bd9Sstevel@tonic-gate uint32_t sctp_T2expire; /* # of times T2timer expired */ 6467c478bd9Sstevel@tonic-gate uint32_t sctp_T3expire; /* # of times T3timer expired */ 6477c478bd9Sstevel@tonic-gate uint32_t sctp_assoc_start_time; /* time when assoc was est. */ 6487c478bd9Sstevel@tonic-gate 6497c478bd9Sstevel@tonic-gate uint32_t sctp_frwnd; /* Peer RWND */ 6507c478bd9Sstevel@tonic-gate uint32_t sctp_cwnd_max; 6517c478bd9Sstevel@tonic-gate 6527c478bd9Sstevel@tonic-gate /* Inbound flow control */ 6537c478bd9Sstevel@tonic-gate int32_t sctp_rwnd; /* Current receive window */ 6541d8c4025Svi int32_t sctp_irwnd; /* Initial receive window */ 6557c478bd9Sstevel@tonic-gate int32_t sctp_rxqueued; /* No. of bytes in RX q's */ 6567c478bd9Sstevel@tonic-gate 6577c478bd9Sstevel@tonic-gate /* Pre-initialized composite headers */ 658bd670b35SErik Nordmark uchar_t *sctp_iphc; /* v4 sctp/ip hdr template buffer */ 659bd670b35SErik Nordmark uchar_t *sctp_iphc6; /* v6 sctp/ip hdr template buffer */ 6607c478bd9Sstevel@tonic-gate 6617c478bd9Sstevel@tonic-gate int32_t sctp_iphc_len; /* actual allocated v4 buffer size */ 6627c478bd9Sstevel@tonic-gate int32_t sctp_iphc6_len; /* actual allocated v6 buffer size */ 6637c478bd9Sstevel@tonic-gate 6647c478bd9Sstevel@tonic-gate int32_t sctp_hdr_len; /* len of combined SCTP/IP v4 hdr */ 6657c478bd9Sstevel@tonic-gate int32_t sctp_hdr6_len; /* len of combined SCTP/IP v6 hdr */ 6667c478bd9Sstevel@tonic-gate 6677c478bd9Sstevel@tonic-gate ipha_t *sctp_ipha; /* IPv4 header in the buffer */ 6687c478bd9Sstevel@tonic-gate ip6_t *sctp_ip6h; /* IPv6 header in the buffer */ 6697c478bd9Sstevel@tonic-gate 6707c478bd9Sstevel@tonic-gate int32_t sctp_ip_hdr_len; /* Byte len of our current v4 hdr */ 6717c478bd9Sstevel@tonic-gate int32_t sctp_ip_hdr6_len; /* Byte len of our current v6 hdr */ 6727c478bd9Sstevel@tonic-gate 6737c478bd9Sstevel@tonic-gate sctp_hdr_t *sctp_sctph; /* sctp header in combined v4 hdr */ 6747c478bd9Sstevel@tonic-gate sctp_hdr_t *sctp_sctph6; /* sctp header in combined v6 hdr */ 6757c478bd9Sstevel@tonic-gate 6767c478bd9Sstevel@tonic-gate uint32_t sctp_lvtag; /* local SCTP instance verf tag */ 6777c478bd9Sstevel@tonic-gate uint32_t sctp_fvtag; /* Peer's SCTP verf tag */ 6787c478bd9Sstevel@tonic-gate 6797c478bd9Sstevel@tonic-gate /* Path MTU Discovery */ 6807c478bd9Sstevel@tonic-gate int64_t sctp_last_mtu_probe; 6817c478bd9Sstevel@tonic-gate clock_t sctp_mtu_probe_intvl; 6827c478bd9Sstevel@tonic-gate uint32_t sctp_mss; /* Max send size (not TCP MSS!) */ 6837c478bd9Sstevel@tonic-gate 6847c478bd9Sstevel@tonic-gate /* structs sctp_bits, sctp_events are for clearing all bits at once */ 6857c478bd9Sstevel@tonic-gate struct { 6867c478bd9Sstevel@tonic-gate uint32_t 6877c478bd9Sstevel@tonic-gate 6887c478bd9Sstevel@tonic-gate sctp_understands_asconf : 1, /* Peer handles ASCONF chunks */ 6897c478bd9Sstevel@tonic-gate sctp_cchunk_pend : 1, /* Control chunk in flight. */ 6907c478bd9Sstevel@tonic-gate sctp_lingering : 1, /* Lingering in close */ 6917c478bd9Sstevel@tonic-gate sctp_loopback: 1, /* src and dst are the same machine */ 6927c478bd9Sstevel@tonic-gate 693bd670b35SErik Nordmark sctp_force_sack : 1, 6947c478bd9Sstevel@tonic-gate sctp_ack_timer_running: 1, /* Delayed ACK timer running */ 6957c478bd9Sstevel@tonic-gate sctp_hwcksum : 1, /* The NIC is capable of hwcksum */ 6967c478bd9Sstevel@tonic-gate sctp_understands_addip : 1, 6977c478bd9Sstevel@tonic-gate 6987c478bd9Sstevel@tonic-gate sctp_bound_to_all : 1, 6997c478bd9Sstevel@tonic-gate sctp_cansleep : 1, /* itf routines can sleep */ 7007c478bd9Sstevel@tonic-gate sctp_detached : 1, /* If we're detached from a stream */ 701558fbd03Skcpoon sctp_send_adaptation : 1, /* send adaptation layer ind */ 7027c478bd9Sstevel@tonic-gate 703558fbd03Skcpoon sctp_recv_adaptation : 1, /* recv adaptation layer ind */ 7047c478bd9Sstevel@tonic-gate sctp_ndelay : 1, /* turn off Nagle */ 7057c478bd9Sstevel@tonic-gate sctp_condemned : 1, /* this sctp is about to disappear */ 7067c478bd9Sstevel@tonic-gate sctp_chk_fast_rexmit : 1, /* check for fast rexmit message */ 707f551bb10Svi 708f551bb10Svi sctp_prsctp_aware : 1, /* is peer PR-SCTP aware? */ 70945916cd2Sjpk sctp_linklocal : 1, /* is linklocal assoc. */ 71077c67f2fSkcpoon sctp_rexmitting : 1, /* SCTP is retransmitting */ 711769b977dSvi sctp_zero_win_probe : 1, /* doing zero win probe */ 71277c67f2fSkcpoon 7130f1702c5SYu Xiangning sctp_txq_full : 1, /* the tx queue is full */ 714c31292eeSkcpoon sctp_ulp_discon_done : 1, /* ulp_disconnecting done */ 7150f1702c5SYu Xiangning sctp_dummy : 6; 7167c478bd9Sstevel@tonic-gate } sctp_bits; 7177c478bd9Sstevel@tonic-gate struct { 7187c478bd9Sstevel@tonic-gate uint32_t 7197c478bd9Sstevel@tonic-gate 7207c478bd9Sstevel@tonic-gate sctp_recvsndrcvinfo : 1, 7217c478bd9Sstevel@tonic-gate sctp_recvassocevnt : 1, 7227c478bd9Sstevel@tonic-gate sctp_recvpathevnt : 1, 7237c478bd9Sstevel@tonic-gate sctp_recvsendfailevnt : 1, 7247c478bd9Sstevel@tonic-gate 7257c478bd9Sstevel@tonic-gate sctp_recvpeererr : 1, 7267c478bd9Sstevel@tonic-gate sctp_recvshutdownevnt : 1, 7277c478bd9Sstevel@tonic-gate sctp_recvpdevnt : 1, 7287c478bd9Sstevel@tonic-gate sctp_recvalevnt : 1; 7297c478bd9Sstevel@tonic-gate } sctp_events; 7307c478bd9Sstevel@tonic-gate #define sctp_priv_stream sctp_bits.sctp_priv_stream 7317c478bd9Sstevel@tonic-gate #define sctp_understands_asconf sctp_bits.sctp_understands_asconf 7327c478bd9Sstevel@tonic-gate #define sctp_cchunk_pend sctp_bits.sctp_cchunk_pend 7337c478bd9Sstevel@tonic-gate #define sctp_lingering sctp_bits.sctp_lingering 7347c478bd9Sstevel@tonic-gate #define sctp_loopback sctp_bits.sctp_loopback 7357c478bd9Sstevel@tonic-gate #define sctp_force_sack sctp_bits.sctp_force_sack 7367c478bd9Sstevel@tonic-gate #define sctp_ack_timer_running sctp_bits.sctp_ack_timer_running 7377c478bd9Sstevel@tonic-gate #define sctp_hwcksum sctp_bits.sctp_hwcksum 7387c478bd9Sstevel@tonic-gate #define sctp_understands_addip sctp_bits.sctp_understands_addip 7397c478bd9Sstevel@tonic-gate #define sctp_bound_to_all sctp_bits.sctp_bound_to_all 7407c478bd9Sstevel@tonic-gate #define sctp_cansleep sctp_bits.sctp_cansleep 7417c478bd9Sstevel@tonic-gate #define sctp_detached sctp_bits.sctp_detached 742558fbd03Skcpoon #define sctp_send_adaptation sctp_bits.sctp_send_adaptation 743558fbd03Skcpoon #define sctp_recv_adaptation sctp_bits.sctp_recv_adaptation 7447c478bd9Sstevel@tonic-gate #define sctp_ndelay sctp_bits.sctp_ndelay 7457c478bd9Sstevel@tonic-gate #define sctp_condemned sctp_bits.sctp_condemned 7467c478bd9Sstevel@tonic-gate #define sctp_chk_fast_rexmit sctp_bits.sctp_chk_fast_rexmit 7477c478bd9Sstevel@tonic-gate #define sctp_prsctp_aware sctp_bits.sctp_prsctp_aware 748f551bb10Svi #define sctp_linklocal sctp_bits.sctp_linklocal 74977c67f2fSkcpoon #define sctp_rexmitting sctp_bits.sctp_rexmitting 750769b977dSvi #define sctp_zero_win_probe sctp_bits.sctp_zero_win_probe 7510f1702c5SYu Xiangning #define sctp_txq_full sctp_bits.sctp_txq_full 752c31292eeSkcpoon #define sctp_ulp_discon_done sctp_bits.sctp_ulp_discon_done 7537c478bd9Sstevel@tonic-gate 7547c478bd9Sstevel@tonic-gate #define sctp_recvsndrcvinfo sctp_events.sctp_recvsndrcvinfo 7557c478bd9Sstevel@tonic-gate #define sctp_recvassocevnt sctp_events.sctp_recvassocevnt 7567c478bd9Sstevel@tonic-gate #define sctp_recvpathevnt sctp_events.sctp_recvpathevnt 7577c478bd9Sstevel@tonic-gate #define sctp_recvsendfailevnt sctp_events.sctp_recvsendfailevnt 7587c478bd9Sstevel@tonic-gate #define sctp_recvpeererr sctp_events.sctp_recvpeererr 7597c478bd9Sstevel@tonic-gate #define sctp_recvshutdownevnt sctp_events.sctp_recvshutdownevnt 7607c478bd9Sstevel@tonic-gate #define sctp_recvpdevnt sctp_events.sctp_recvpdevnt 7617c478bd9Sstevel@tonic-gate #define sctp_recvalevnt sctp_events.sctp_recvalevnt 7627c478bd9Sstevel@tonic-gate 7637c478bd9Sstevel@tonic-gate /* Retransmit info */ 7647c478bd9Sstevel@tonic-gate mblk_t *sctp_cookie_mp; /* cookie chunk, if rxt needed */ 7657c478bd9Sstevel@tonic-gate int32_t sctp_strikes; /* Total number of assoc strikes */ 7667c478bd9Sstevel@tonic-gate int32_t sctp_max_init_rxt; 7677c478bd9Sstevel@tonic-gate int32_t sctp_pa_max_rxt; /* Max per-assoc retransmit cnt */ 7687c478bd9Sstevel@tonic-gate int32_t sctp_pp_max_rxt; /* Max per-path retransmit cnt */ 7697c478bd9Sstevel@tonic-gate uint32_t sctp_rto_max; 7707c478bd9Sstevel@tonic-gate uint32_t sctp_init_rto_max; 7717c478bd9Sstevel@tonic-gate uint32_t sctp_rto_min; 7727c478bd9Sstevel@tonic-gate uint32_t sctp_rto_initial; 7737c478bd9Sstevel@tonic-gate 7747c478bd9Sstevel@tonic-gate int64_t sctp_last_secret_update; 7757c478bd9Sstevel@tonic-gate uint8_t sctp_secret[SCTP_SECRET_LEN]; /* for cookie auth */ 7767c478bd9Sstevel@tonic-gate uint8_t sctp_old_secret[SCTP_SECRET_LEN]; 77712f47623Skcpoon uint32_t sctp_cookie_lifetime; /* cookie lifetime in tick */ 7787c478bd9Sstevel@tonic-gate 7797c478bd9Sstevel@tonic-gate /* Bind hash tables */ 7807c478bd9Sstevel@tonic-gate kmutex_t *sctp_bind_lockp; /* Ptr to tf_lock */ 7817c478bd9Sstevel@tonic-gate struct sctp_s *sctp_bind_hash; 7827c478bd9Sstevel@tonic-gate struct sctp_s **sctp_ptpbhn; 7837c478bd9Sstevel@tonic-gate 7847c478bd9Sstevel@tonic-gate /* Shutdown / cleanup */ 7857c478bd9Sstevel@tonic-gate sctp_faddr_t *sctp_shutdown_faddr; /* rotate faddr during shutd */ 7867c478bd9Sstevel@tonic-gate int32_t sctp_client_errno; /* How the client screwed up */ 7877c478bd9Sstevel@tonic-gate kmutex_t sctp_reflock; /* Protects sctp_refcnt & timer mp */ 7887c478bd9Sstevel@tonic-gate ushort_t sctp_refcnt; /* No. of pending upstream msg */ 7897c478bd9Sstevel@tonic-gate mblk_t *sctp_timer_mp; /* List of fired timers. */ 7907c478bd9Sstevel@tonic-gate 7917c478bd9Sstevel@tonic-gate mblk_t *sctp_heartbeat_mp; /* Timer block for heartbeats */ 7927c478bd9Sstevel@tonic-gate uint32_t sctp_hb_interval; /* Default hb_interval */ 7937c478bd9Sstevel@tonic-gate 7947c478bd9Sstevel@tonic-gate int32_t sctp_autoclose; /* Auto disconnect in ticks */ 7957c478bd9Sstevel@tonic-gate int64_t sctp_active; /* Last time data/sack on this conn */ 796558fbd03Skcpoon uint32_t sctp_tx_adaptation_code; /* TX adaptation code */ 797558fbd03Skcpoon uint32_t sctp_rx_adaptation_code; /* RX adaptation code */ 7987c478bd9Sstevel@tonic-gate 7997c478bd9Sstevel@tonic-gate /* Reliable control chunks */ 8007c478bd9Sstevel@tonic-gate mblk_t *sctp_cxmit_list; /* Xmit list for control chunks */ 8017c478bd9Sstevel@tonic-gate uint32_t sctp_lcsn; /* Our serial number */ 8027c478bd9Sstevel@tonic-gate uint32_t sctp_fcsn; /* Peer serial number */ 8037c478bd9Sstevel@tonic-gate 8047c478bd9Sstevel@tonic-gate /* Per association receive queue */ 8057c478bd9Sstevel@tonic-gate kmutex_t sctp_recvq_lock; 8067c478bd9Sstevel@tonic-gate mblk_t *sctp_recvq; 8077c478bd9Sstevel@tonic-gate mblk_t *sctp_recvq_tail; 8087c478bd9Sstevel@tonic-gate taskq_t *sctp_recvq_tq; 8097c478bd9Sstevel@tonic-gate 8107c478bd9Sstevel@tonic-gate /* IPv6 ancillary data */ 8117c478bd9Sstevel@tonic-gate uint_t sctp_recvifindex; /* last rcvd IPV6_RCVPKTINFO */ 8127c478bd9Sstevel@tonic-gate uint_t sctp_recvhops; /* " IPV6_RECVHOPLIMIT */ 813bd670b35SErik Nordmark uint_t sctp_recvtclass; /* " IPV6_RECVTCLASS */ 8147c478bd9Sstevel@tonic-gate ip6_hbh_t *sctp_hopopts; /* " IPV6_RECVHOPOPTS */ 8157c478bd9Sstevel@tonic-gate ip6_dest_t *sctp_dstopts; /* " IPV6_RECVDSTOPTS */ 816bd670b35SErik Nordmark ip6_dest_t *sctp_rthdrdstopts; /* " IPV6_RECVRTHDRDSTOPTS */ 8177c478bd9Sstevel@tonic-gate ip6_rthdr_t *sctp_rthdr; /* " IPV6_RECVRTHDR */ 8187c478bd9Sstevel@tonic-gate uint_t sctp_hopoptslen; 8197c478bd9Sstevel@tonic-gate uint_t sctp_dstoptslen; 820bd670b35SErik Nordmark uint_t sctp_rthdrdstoptslen; 8217c478bd9Sstevel@tonic-gate uint_t sctp_rthdrlen; 8227c478bd9Sstevel@tonic-gate 8237c478bd9Sstevel@tonic-gate /* Stats */ 8247c478bd9Sstevel@tonic-gate uint64_t sctp_msgcount; 8257c478bd9Sstevel@tonic-gate uint64_t sctp_prsctpdrop; 82645916cd2Sjpk 82745916cd2Sjpk uint_t sctp_v4label_len; /* length of cached v4 label */ 82845916cd2Sjpk uint_t sctp_v6label_len; /* length of cached v6 label */ 82977c67f2fSkcpoon uint32_t sctp_rxt_nxttsn; /* Next TSN to be rexmitted */ 83077c67f2fSkcpoon uint32_t sctp_rxt_maxtsn; /* Max TSN sent at time out */ 8317d546a59Svi 8327d546a59Svi int sctp_pd_point; /* Partial delivery point */ 8337f093707Skcpoon mblk_t *sctp_err_chunks; /* Error chunks */ 8347f093707Skcpoon uint32_t sctp_err_len; /* Total error chunks length */ 835de8c4a14SErik Nordmark 8369f13099eSGeorge Shepherd /* additional source data for per endpoint association statistics */ 8379f13099eSGeorge Shepherd uint64_t sctp_outseqtsns; /* TSN rx > expected TSN */ 8389f13099eSGeorge Shepherd uint64_t sctp_osacks; /* total sacks sent */ 8399f13099eSGeorge Shepherd uint64_t sctp_isacks; /* total sacks received */ 8409f13099eSGeorge Shepherd uint64_t sctp_idupchunks; /* rx dups, ord or unord */ 8419f13099eSGeorge Shepherd uint64_t sctp_gapcnt; /* total gap acks rx */ 84235e12f9cSGeorge Shepherd /* 84335e12f9cSGeorge Shepherd * Add the current data from the counters which are reset by snmp 84435e12f9cSGeorge Shepherd * to these cumulative counters to use in per endpoint statistics. 84535e12f9cSGeorge Shepherd */ 84635e12f9cSGeorge Shepherd uint64_t sctp_cum_obchunks; /* sent control chunks */ 84735e12f9cSGeorge Shepherd uint64_t sctp_cum_odchunks; /* sent ordered data chunks */ 84835e12f9cSGeorge Shepherd uint64_t sctp_cum_oudchunks; /* sent unord data chunks */ 84935e12f9cSGeorge Shepherd uint64_t sctp_cum_rxtchunks; /* retransmitted chunks */ 85035e12f9cSGeorge Shepherd uint64_t sctp_cum_ibchunks; /* recv control chunks */ 85135e12f9cSGeorge Shepherd uint64_t sctp_cum_idchunks; /* recv ordered data chunks */ 85235e12f9cSGeorge Shepherd uint64_t sctp_cum_iudchunks; /* recv unord data chunks */ 8539f13099eSGeorge Shepherd 8549f13099eSGeorge Shepherd /* 8559f13099eSGeorge Shepherd * When non-zero, this is the maximum observed RTO since assoc stats 8569f13099eSGeorge Shepherd * were last requested. When zero, no RTO update has occurred since 8579f13099eSGeorge Shepherd * the previous user request for stats on this endpoint. 8589f13099eSGeorge Shepherd */ 8599f13099eSGeorge Shepherd int sctp_maxrto; 8609f13099eSGeorge Shepherd /* 8619f13099eSGeorge Shepherd * The stored value of sctp_maxrto passed to user during the previous 8629f13099eSGeorge Shepherd * user request for stats on this endpoint. 8639f13099eSGeorge Shepherd */ 8649f13099eSGeorge Shepherd int sctp_prev_maxrto; 8657c478bd9Sstevel@tonic-gate } sctp_t; 8667c478bd9Sstevel@tonic-gate 8670f1702c5SYu Xiangning #define SCTP_TXQ_LEN(sctp) ((sctp)->sctp_unsent + (sctp)->sctp_unacked) 8680f1702c5SYu Xiangning #define SCTP_TXQ_UPDATE(sctp) \ 8690f1702c5SYu Xiangning if ((sctp)->sctp_txq_full && SCTP_TXQ_LEN(sctp) <= \ 870bd670b35SErik Nordmark (sctp)->sctp_connp->conn_sndlowat) { \ 8710f1702c5SYu Xiangning (sctp)->sctp_txq_full = 0; \ 8720f1702c5SYu Xiangning (sctp)->sctp_ulp_xmitted((sctp)->sctp_ulpd, \ 8730f1702c5SYu Xiangning B_FALSE); \ 8740f1702c5SYu Xiangning } 8750f1702c5SYu Xiangning 8767c478bd9Sstevel@tonic-gate #endif /* (defined(_KERNEL) || defined(_KMEMUSER)) */ 8777c478bd9Sstevel@tonic-gate 8787c478bd9Sstevel@tonic-gate extern void sctp_ack_timer(sctp_t *); 879558fbd03Skcpoon extern size_t sctp_adaptation_code_param(sctp_t *, uchar_t *); 880558fbd03Skcpoon extern void sctp_adaptation_event(sctp_t *); 8817f093707Skcpoon extern void sctp_add_err(sctp_t *, uint16_t, void *, size_t, 8827f093707Skcpoon sctp_faddr_t *); 88377c67f2fSkcpoon extern int sctp_add_faddr(sctp_t *, in6_addr_t *, int, boolean_t); 8847c478bd9Sstevel@tonic-gate extern boolean_t sctp_add_ftsn_set(sctp_ftsn_set_t **, sctp_faddr_t *, mblk_t *, 8857c478bd9Sstevel@tonic-gate uint_t *, uint32_t *); 886bd670b35SErik Nordmark extern void sctp_add_recvq(sctp_t *, mblk_t *, boolean_t, 887bd670b35SErik Nordmark ip_recv_attr_t *); 888c513743fSGeorge Shepherd extern void sctp_add_unrec_parm(sctp_parm_hdr_t *, mblk_t **, boolean_t); 88912f47623Skcpoon extern size_t sctp_addr_params(sctp_t *, int, uchar_t *, boolean_t); 890df19b344Svi extern mblk_t *sctp_add_proto_hdr(sctp_t *, sctp_faddr_t *, mblk_t *, int, 891df19b344Svi int *); 8927c478bd9Sstevel@tonic-gate extern void sctp_addr_req(sctp_t *, mblk_t *); 8937c478bd9Sstevel@tonic-gate extern sctp_t *sctp_addrlist2sctp(mblk_t *, sctp_hdr_t *, sctp_chunk_hdr_t *, 894e35d2278Svi zoneid_t, sctp_stack_t *); 8957c478bd9Sstevel@tonic-gate extern void sctp_check_adv_ack_pt(sctp_t *, mblk_t *, mblk_t *); 8967c478bd9Sstevel@tonic-gate extern void sctp_assoc_event(sctp_t *, uint16_t, uint16_t, 8977c478bd9Sstevel@tonic-gate sctp_chunk_hdr_t *); 8987c478bd9Sstevel@tonic-gate 8997c478bd9Sstevel@tonic-gate extern void sctp_bind_hash_insert(sctp_tf_t *, sctp_t *, int); 9007c478bd9Sstevel@tonic-gate extern void sctp_bind_hash_remove(sctp_t *); 90145916cd2Sjpk extern int sctp_bindi(sctp_t *, in_port_t, boolean_t, int, in_port_t *); 9021d8c4025Svi extern int sctp_bind_add(sctp_t *, const void *, uint32_t, boolean_t, 9031d8c4025Svi in_port_t); 9047c478bd9Sstevel@tonic-gate extern int sctp_bind_del(sctp_t *, const void *, uint32_t, boolean_t); 905bd670b35SErik Nordmark extern int sctp_build_hdrs(sctp_t *, int); 9067c478bd9Sstevel@tonic-gate 9077c478bd9Sstevel@tonic-gate extern int sctp_check_abandoned_msg(sctp_t *, mblk_t *); 9087c478bd9Sstevel@tonic-gate extern void sctp_clean_death(sctp_t *, int); 9097c478bd9Sstevel@tonic-gate extern void sctp_close_eager(sctp_t *); 9107c478bd9Sstevel@tonic-gate extern int sctp_compare_faddrsets(sctp_faddr_t *, sctp_faddr_t *); 9117c478bd9Sstevel@tonic-gate extern void sctp_congest_reset(sctp_t *); 9127c478bd9Sstevel@tonic-gate extern void sctp_conn_hash_insert(sctp_tf_t *, sctp_t *, int); 9137c478bd9Sstevel@tonic-gate extern void sctp_conn_hash_remove(sctp_t *); 914121e5416Skcpoon extern void sctp_conn_init(conn_t *); 915e35d2278Svi extern sctp_t *sctp_conn_match(in6_addr_t *, in6_addr_t *, uint32_t, 916bd670b35SErik Nordmark zoneid_t, iaflags_t, sctp_stack_t *); 9177c478bd9Sstevel@tonic-gate extern sctp_t *sctp_conn_request(sctp_t *, mblk_t *, uint_t, uint_t, 918bd670b35SErik Nordmark sctp_init_chunk_t *, ip_recv_attr_t *); 9197c478bd9Sstevel@tonic-gate extern uint32_t sctp_cumack(sctp_t *, uint32_t, mblk_t **); 9207c478bd9Sstevel@tonic-gate extern sctp_t *sctp_create_eager(sctp_t *); 9217c478bd9Sstevel@tonic-gate 9227c478bd9Sstevel@tonic-gate extern void sctp_dispatch_rput(queue_t *, sctp_t *, sctp_hdr_t *, mblk_t *, 9237c478bd9Sstevel@tonic-gate uint_t, uint_t, in6_addr_t); 9247c478bd9Sstevel@tonic-gate extern char *sctp_display(sctp_t *, char *); 925f4b3ec61Sdh extern void sctp_display_all(sctp_stack_t *); 9267c478bd9Sstevel@tonic-gate 9278dfac042SAnil udupa extern void sctp_error_event(sctp_t *, sctp_chunk_hdr_t *, boolean_t); 9287c478bd9Sstevel@tonic-gate 9297c478bd9Sstevel@tonic-gate extern void sctp_faddr_alive(sctp_t *, sctp_faddr_t *); 9307c478bd9Sstevel@tonic-gate extern int sctp_faddr_dead(sctp_t *, sctp_faddr_t *, int); 93145916cd2Sjpk extern void sctp_faddr_fini(void); 93245916cd2Sjpk extern void sctp_faddr_init(void); 9337c478bd9Sstevel@tonic-gate extern void sctp_fast_rexmit(sctp_t *); 9347c478bd9Sstevel@tonic-gate extern void sctp_fill_sack(sctp_t *, unsigned char *, int); 9357c478bd9Sstevel@tonic-gate extern void sctp_free_faddr_timers(sctp_t *); 9367c478bd9Sstevel@tonic-gate extern void sctp_free_ftsn_set(sctp_ftsn_set_t *); 9377c478bd9Sstevel@tonic-gate extern void sctp_free_msg(mblk_t *); 9387c478bd9Sstevel@tonic-gate extern void sctp_free_reass(sctp_instr_t *); 9397c478bd9Sstevel@tonic-gate extern void sctp_free_set(sctp_set_t *); 9407c478bd9Sstevel@tonic-gate extern void sctp_ftsn_sets_fini(void); 9417c478bd9Sstevel@tonic-gate extern void sctp_ftsn_sets_init(void); 9427c478bd9Sstevel@tonic-gate 9431d8c4025Svi extern int sctp_get_addrlist(sctp_t *, const void *, uint32_t *, 9441d8c4025Svi uchar_t **, int *, size_t *); 9457c478bd9Sstevel@tonic-gate extern int sctp_get_addrparams(sctp_t *, sctp_t *, mblk_t *, 9467c478bd9Sstevel@tonic-gate sctp_chunk_hdr_t *, uint_t *); 947bd670b35SErik Nordmark extern void sctp_get_dest(sctp_t *, sctp_faddr_t *); 9481d8c4025Svi extern void sctp_get_faddr_list(sctp_t *, uchar_t *, size_t); 9497c478bd9Sstevel@tonic-gate extern mblk_t *sctp_get_first_sent(sctp_t *); 9507c478bd9Sstevel@tonic-gate extern mblk_t *sctp_get_msg_to_send(sctp_t *, mblk_t **, mblk_t *, int *, 9517c478bd9Sstevel@tonic-gate int32_t, uint32_t, sctp_faddr_t *); 9521d8c4025Svi extern void sctp_get_saddr_list(sctp_t *, uchar_t *, size_t); 9537c478bd9Sstevel@tonic-gate 9547c478bd9Sstevel@tonic-gate extern int sctp_handle_error(sctp_t *, sctp_hdr_t *, sctp_chunk_hdr_t *, 955bd670b35SErik Nordmark mblk_t *, ip_recv_attr_t *); 956f4b3ec61Sdh extern void sctp_hash_destroy(sctp_stack_t *); 957f4b3ec61Sdh extern void sctp_hash_init(sctp_stack_t *); 9587c478bd9Sstevel@tonic-gate extern void sctp_heartbeat_timer(sctp_t *); 9597c478bd9Sstevel@tonic-gate 9607c478bd9Sstevel@tonic-gate extern void sctp_icmp_error(sctp_t *, mblk_t *); 961f4b3ec61Sdh extern void sctp_inc_taskq(sctp_stack_t *); 9627c478bd9Sstevel@tonic-gate extern void sctp_info_req(sctp_t *, mblk_t *); 963bd670b35SErik Nordmark extern mblk_t *sctp_init_mp(sctp_t *, sctp_faddr_t *); 9647c478bd9Sstevel@tonic-gate extern boolean_t sctp_initialize_params(sctp_t *, sctp_init_chunk_t *, 9657c478bd9Sstevel@tonic-gate sctp_init_chunk_t *); 9667c478bd9Sstevel@tonic-gate extern uint32_t sctp_init2vtag(sctp_chunk_hdr_t *); 9677c478bd9Sstevel@tonic-gate extern void sctp_intf_event(sctp_t *, in6_addr_t, int, int); 968bd670b35SErik Nordmark extern void sctp_input_data(sctp_t *, mblk_t *, ip_recv_attr_t *); 9697c478bd9Sstevel@tonic-gate extern void sctp_instream_cleanup(sctp_t *, boolean_t); 9707c478bd9Sstevel@tonic-gate extern int sctp_is_a_faddr_clean(sctp_t *); 9717c478bd9Sstevel@tonic-gate 972f4b3ec61Sdh extern void *sctp_kstat_init(netstackid_t); 973f4b3ec61Sdh extern void sctp_kstat_fini(netstackid_t, kstat_t *); 974f4b3ec61Sdh extern void *sctp_kstat2_init(netstackid_t, sctp_kstat_t *); 975f4b3ec61Sdh extern void sctp_kstat2_fini(netstackid_t, kstat_t *); 9767c478bd9Sstevel@tonic-gate 9777c478bd9Sstevel@tonic-gate extern ssize_t sctp_link_abort(mblk_t *, uint16_t, char *, size_t, int, 9787c478bd9Sstevel@tonic-gate boolean_t); 9797c478bd9Sstevel@tonic-gate extern void sctp_listen_hash_insert(sctp_tf_t *, sctp_t *); 9807c478bd9Sstevel@tonic-gate extern void sctp_listen_hash_remove(sctp_t *); 9817c478bd9Sstevel@tonic-gate extern sctp_t *sctp_lookup(sctp_t *, in6_addr_t *, sctp_tf_t *, uint32_t *, 9827c478bd9Sstevel@tonic-gate int); 9837c478bd9Sstevel@tonic-gate extern sctp_faddr_t *sctp_lookup_faddr(sctp_t *, in6_addr_t *); 9847c478bd9Sstevel@tonic-gate 9857c478bd9Sstevel@tonic-gate extern mblk_t *sctp_make_err(sctp_t *, uint16_t, void *, size_t); 9867c478bd9Sstevel@tonic-gate extern mblk_t *sctp_make_ftsn_chunk(sctp_t *, sctp_faddr_t *, 9877c478bd9Sstevel@tonic-gate sctp_ftsn_set_t *, uint_t, uint32_t); 9887c478bd9Sstevel@tonic-gate extern void sctp_make_ftsns(sctp_t *, mblk_t *, mblk_t *, mblk_t **, 9897c478bd9Sstevel@tonic-gate sctp_faddr_t *, uint32_t *); 9907c478bd9Sstevel@tonic-gate extern mblk_t *sctp_make_mp(sctp_t *, sctp_faddr_t *, int); 9917c478bd9Sstevel@tonic-gate extern mblk_t *sctp_make_sack(sctp_t *, sctp_faddr_t *, mblk_t *); 9927c478bd9Sstevel@tonic-gate extern void sctp_maxpsz_set(sctp_t *); 9937c478bd9Sstevel@tonic-gate extern void sctp_move_faddr_timers(queue_t *, sctp_t *); 9947c478bd9Sstevel@tonic-gate 9957c478bd9Sstevel@tonic-gate extern sctp_parm_hdr_t *sctp_next_parm(sctp_parm_hdr_t *, ssize_t *); 9967c478bd9Sstevel@tonic-gate 997bd670b35SErik Nordmark extern void sctp_ootb_shutdown_ack(mblk_t *, uint_t, ip_recv_attr_t *, 998bd670b35SErik Nordmark ip_stack_t *); 9997c478bd9Sstevel@tonic-gate extern size_t sctp_options_param(const sctp_t *, void *, int); 10007c478bd9Sstevel@tonic-gate extern size_t sctp_options_param_len(const sctp_t *, int); 100112f47623Skcpoon extern void sctp_output(sctp_t *, uint_t); 10027c478bd9Sstevel@tonic-gate 10037c478bd9Sstevel@tonic-gate extern void sctp_partial_delivery_event(sctp_t *); 10047c478bd9Sstevel@tonic-gate extern int sctp_process_cookie(sctp_t *, sctp_chunk_hdr_t *, mblk_t *, 1005bd670b35SErik Nordmark sctp_init_chunk_t **, sctp_hdr_t *, int *, in6_addr_t *, 1006bd670b35SErik Nordmark ip_recv_attr_t *); 10077f093707Skcpoon extern void sctp_process_err(sctp_t *); 10087c478bd9Sstevel@tonic-gate extern void sctp_process_heartbeat(sctp_t *, sctp_chunk_hdr_t *); 10097c478bd9Sstevel@tonic-gate extern void sctp_process_timer(sctp_t *); 10107c478bd9Sstevel@tonic-gate 10117c478bd9Sstevel@tonic-gate extern void sctp_redo_faddr_srcs(sctp_t *); 10127c478bd9Sstevel@tonic-gate extern void sctp_regift_xmitlist(sctp_t *); 10137c478bd9Sstevel@tonic-gate extern void sctp_return_heartbeat(sctp_t *, sctp_chunk_hdr_t *, mblk_t *); 10147c478bd9Sstevel@tonic-gate extern void sctp_rexmit(sctp_t *, sctp_faddr_t *); 1015769b977dSvi extern mblk_t *sctp_rexmit_packet(sctp_t *, mblk_t **, mblk_t **, 1016769b977dSvi sctp_faddr_t *, uint_t *); 10177c478bd9Sstevel@tonic-gate extern void sctp_rexmit_timer(sctp_t *, sctp_faddr_t *); 10187c478bd9Sstevel@tonic-gate extern sctp_faddr_t *sctp_rotate_faddr(sctp_t *, sctp_faddr_t *); 10197c478bd9Sstevel@tonic-gate 10207f093707Skcpoon extern boolean_t sctp_sack(sctp_t *, mblk_t *); 10217c478bd9Sstevel@tonic-gate extern int sctp_secure_restart_check(mblk_t *, sctp_chunk_hdr_t *, 1022bd670b35SErik Nordmark uint32_t, int, sctp_stack_t *, ip_recv_attr_t *); 10237c478bd9Sstevel@tonic-gate extern void sctp_send_abort(sctp_t *, uint32_t, uint16_t, char *, size_t, 1024bd670b35SErik Nordmark mblk_t *, int, boolean_t, ip_recv_attr_t *); 1025bd670b35SErik Nordmark extern void sctp_ootb_send_abort(uint32_t, uint16_t, char *, size_t, 1026bd670b35SErik Nordmark const mblk_t *, int, boolean_t, ip_recv_attr_t *, 1027bd670b35SErik Nordmark ip_stack_t *); 10287c478bd9Sstevel@tonic-gate extern void sctp_send_cookie_ack(sctp_t *); 1029bd670b35SErik Nordmark extern void sctp_send_cookie_echo(sctp_t *, sctp_chunk_hdr_t *, mblk_t *, 1030bd670b35SErik Nordmark ip_recv_attr_t *); 1031d7ab25acSkp extern void sctp_send_initack(sctp_t *, sctp_hdr_t *, sctp_chunk_hdr_t *, 1032bd670b35SErik Nordmark mblk_t *, ip_recv_attr_t *); 10337c478bd9Sstevel@tonic-gate extern void sctp_send_shutdown(sctp_t *, int); 10347c478bd9Sstevel@tonic-gate extern void sctp_send_heartbeat(sctp_t *, sctp_faddr_t *); 10357c478bd9Sstevel@tonic-gate extern void sctp_sendfail_event(sctp_t *, mblk_t *, int, boolean_t); 103677c67f2fSkcpoon extern void sctp_set_faddr_current(sctp_t *, sctp_faddr_t *); 103777c67f2fSkcpoon extern int sctp_set_hdraddrs(sctp_t *); 1038769b977dSvi extern void sctp_set_saddr(sctp_t *, sctp_faddr_t *); 103945916cd2Sjpk extern void sctp_sets_init(void); 104045916cd2Sjpk extern void sctp_sets_fini(void); 10417c478bd9Sstevel@tonic-gate extern void sctp_shutdown_event(sctp_t *); 10427c478bd9Sstevel@tonic-gate extern void sctp_stop_faddr_timers(sctp_t *); 104377c67f2fSkcpoon extern int sctp_shutdown_received(sctp_t *, sctp_chunk_hdr_t *, boolean_t, 104477c67f2fSkcpoon boolean_t, sctp_faddr_t *); 10457c478bd9Sstevel@tonic-gate extern void sctp_shutdown_complete(sctp_t *); 10467c478bd9Sstevel@tonic-gate extern void sctp_set_if_mtu(sctp_t *); 1047bd670b35SErik Nordmark extern void sctp_set_iplen(sctp_t *, mblk_t *, ip_xmit_attr_t *); 10487c478bd9Sstevel@tonic-gate extern void sctp_set_ulp_prop(sctp_t *); 104977c67f2fSkcpoon extern void sctp_ss_rexmit(sctp_t *); 10507c478bd9Sstevel@tonic-gate extern size_t sctp_supaddr_param_len(sctp_t *); 10517c478bd9Sstevel@tonic-gate extern size_t sctp_supaddr_param(sctp_t *, uchar_t *); 10527c478bd9Sstevel@tonic-gate 10537c478bd9Sstevel@tonic-gate extern void sctp_timer(sctp_t *, mblk_t *, clock_t); 1054121e5416Skcpoon extern mblk_t *sctp_timer_alloc(sctp_t *, pfv_t, int); 10557c478bd9Sstevel@tonic-gate extern void sctp_timer_call(sctp_t *sctp, mblk_t *); 10567c478bd9Sstevel@tonic-gate extern void sctp_timer_free(mblk_t *); 10577c478bd9Sstevel@tonic-gate extern void sctp_timer_stop(mblk_t *); 10587c478bd9Sstevel@tonic-gate extern void sctp_unlink_faddr(sctp_t *, sctp_faddr_t *); 10597c478bd9Sstevel@tonic-gate 1060bd670b35SErik Nordmark extern void sctp_update_dce(sctp_t *sctp); 1061f4b3ec61Sdh extern in_port_t sctp_update_next_port(in_port_t, zone_t *zone, sctp_stack_t *); 10627c478bd9Sstevel@tonic-gate extern void sctp_update_rtt(sctp_t *, sctp_faddr_t *, clock_t); 1063e6f13f86SKacheong Poon extern void sctp_user_abort(sctp_t *, mblk_t *); 10647c478bd9Sstevel@tonic-gate 10657c478bd9Sstevel@tonic-gate extern void sctp_validate_peer(sctp_t *); 10667c478bd9Sstevel@tonic-gate 10677c478bd9Sstevel@tonic-gate extern int sctp_xmit_list_clean(sctp_t *, ssize_t); 10687c478bd9Sstevel@tonic-gate 10697c478bd9Sstevel@tonic-gate extern void sctp_zap_addrs(sctp_t *); 10707c478bd9Sstevel@tonic-gate extern void sctp_zap_faddrs(sctp_t *, int); 10717c478bd9Sstevel@tonic-gate 10721d8c4025Svi /* Contract private interface between SCTP and Clustering - PSARC/2005/602 */ 10731d8c4025Svi 10741d8c4025Svi extern void (*cl_sctp_listen)(sa_family_t, uchar_t *, uint_t, in_port_t); 10751d8c4025Svi extern void (*cl_sctp_unlisten)(sa_family_t, uchar_t *, uint_t, in_port_t); 10761d8c4025Svi extern void (*cl_sctp_connect)(sa_family_t, uchar_t *, uint_t, in_port_t, 10771d8c4025Svi uchar_t *, uint_t, in_port_t, boolean_t, cl_sctp_handle_t); 10781d8c4025Svi extern void (*cl_sctp_disconnect)(sa_family_t, cl_sctp_handle_t); 10791d8c4025Svi extern void (*cl_sctp_assoc_change)(sa_family_t, uchar_t *, size_t, uint_t, 10801d8c4025Svi uchar_t *, size_t, uint_t, int, cl_sctp_handle_t); 10811d8c4025Svi extern void (*cl_sctp_check_addrs)(sa_family_t, in_port_t, uchar_t **, 10821d8c4025Svi size_t, uint_t *, boolean_t); 10831d8c4025Svi 10847c478bd9Sstevel@tonic-gate #define RUN_SCTP(sctp) \ 10857c478bd9Sstevel@tonic-gate { \ 10867c478bd9Sstevel@tonic-gate mutex_enter(&(sctp)->sctp_lock); \ 10877c478bd9Sstevel@tonic-gate while ((sctp)->sctp_running) \ 10887c478bd9Sstevel@tonic-gate cv_wait(&(sctp)->sctp_cv, &(sctp)->sctp_lock); \ 10897c478bd9Sstevel@tonic-gate (sctp)->sctp_running = B_TRUE; \ 10907c478bd9Sstevel@tonic-gate mutex_exit(&(sctp)->sctp_lock); \ 10917c478bd9Sstevel@tonic-gate } 10927c478bd9Sstevel@tonic-gate 10937c478bd9Sstevel@tonic-gate /* Wake up recvq taskq */ 10947c478bd9Sstevel@tonic-gate #define WAKE_SCTP(sctp) \ 10957c478bd9Sstevel@tonic-gate { \ 10967c478bd9Sstevel@tonic-gate mutex_enter(&(sctp)->sctp_lock); \ 10977c478bd9Sstevel@tonic-gate if ((sctp)->sctp_timer_mp != NULL) \ 10987c478bd9Sstevel@tonic-gate sctp_process_timer(sctp); \ 10997c478bd9Sstevel@tonic-gate (sctp)->sctp_running = B_FALSE; \ 11007c478bd9Sstevel@tonic-gate cv_broadcast(&(sctp)->sctp_cv); \ 11017c478bd9Sstevel@tonic-gate mutex_exit(&(sctp)->sctp_lock); \ 11027c478bd9Sstevel@tonic-gate } 11037c478bd9Sstevel@tonic-gate 11047c478bd9Sstevel@tonic-gate #ifdef __cplusplus 11057c478bd9Sstevel@tonic-gate } 11067c478bd9Sstevel@tonic-gate #endif 11077c478bd9Sstevel@tonic-gate 11087c478bd9Sstevel@tonic-gate #endif /* _INET_SCTP_SCTP_IMPL_H */ 1109