Lines Matching refs:sctp
77 static void sctp_closei_local(sctp_t *sctp);
79 static void sctp_icmp_error_ipv6(sctp_t *sctp, mblk_t *mp);
129 #define SCTP_CONDEMNED(sctp) \ argument
130 mutex_enter(&(sctp)->sctp_reflock); \
131 ((sctp)->sctp_condemned = B_TRUE); \
132 mutex_exit(&(sctp)->sctp_reflock);
135 #define SCTP_LINK(sctp, sctps) \ argument
137 list_insert_tail(&sctps->sctps_g_list, (sctp)); \
140 #define SCTP_UNLINK(sctp, sctps) \ argument
142 ASSERT((sctp)->sctp_condemned); \
143 list_remove(&(sctps)->sctps_g_list, (sctp)); \
177 sctp_t *sctp; in sctp_create_eager() local
188 sctp = CONN2SCTP(connp); in sctp_create_eager()
189 sctp->sctp_sctps = sctps; in sctp_create_eager()
191 if ((ack_mp = sctp_timer_alloc(sctp, sctp_ack_timer, in sctp_create_eager()
193 (hb_mp = sctp_timer_alloc(sctp, sctp_heartbeat_timer, in sctp_create_eager()
198 sctp->sctp_sctps = NULL; in sctp_create_eager()
203 sctp->sctp_ack_mp = ack_mp; in sctp_create_eager()
204 sctp->sctp_heartbeat_mp = hb_mp; in sctp_create_eager()
206 if (sctp_init_values(sctp, psctp, KM_NOSLEEP) != 0) { in sctp_create_eager()
210 sctp->sctp_sctps = NULL; in sctp_create_eager()
220 sctp->sctp_mss = psctp->sctp_mss; in sctp_create_eager()
221 sctp->sctp_detached = B_TRUE; in sctp_create_eager()
226 SCTP_LINK(sctp, sctps); in sctp_create_eager()
229 sctp->sctp_listen_cnt = psctp->sctp_listen_cnt; in sctp_create_eager()
231 return (sctp); in sctp_create_eager()
238 sctp_clean_death(sctp_t *sctp, int err) in sctp_clean_death() argument
240 ASSERT(sctp != NULL); in sctp_clean_death()
242 dprint(3, ("sctp_clean_death %p, state %d\n", (void *)sctp, in sctp_clean_death()
243 sctp->sctp_state)); in sctp_clean_death()
245 sctp->sctp_client_errno = err; in sctp_clean_death()
249 if ((sctp->sctp_state >= SCTPS_COOKIE_WAIT) && in sctp_clean_death()
250 !SCTP_IS_DETACHED(sctp)) { in sctp_clean_death()
251 if (sctp->sctp_xmit_head || sctp->sctp_xmit_unsent) { in sctp_clean_death()
252 sctp_regift_xmitlist(sctp); in sctp_clean_death()
254 if (sctp->sctp_ulp_disconnected(sctp->sctp_ulpd, 0, err)) { in sctp_clean_death()
258 sctp->sctp_detached = B_TRUE; in sctp_clean_death()
259 sctp->sctp_ulpd = NULL; in sctp_clean_death()
260 sctp->sctp_upcalls = NULL; in sctp_clean_death()
265 sctp_closei_local(sctp); in sctp_clean_death()
276 if (SCTP_IS_DETACHED(sctp)) { in sctp_clean_death()
277 SCTP_CONDEMNED(sctp); in sctp_clean_death()
278 SCTP_REFRELE(sctp); in sctp_clean_death()
299 sctp_disconnect(sctp_t *sctp) in sctp_disconnect() argument
302 conn_t *connp = sctp->sctp_connp; in sctp_disconnect()
304 dprint(3, ("sctp_disconnect %p, state %d\n", (void *)sctp, in sctp_disconnect()
305 sctp->sctp_state)); in sctp_disconnect()
307 RUN_SCTP(sctp); in sctp_disconnect()
309 switch (sctp->sctp_state) { in sctp_disconnect()
322 if (sctp->sctp_xmit_head == NULL && in sctp_disconnect()
323 sctp->sctp_xmit_unsent == NULL) { in sctp_disconnect()
333 sctp_user_abort(sctp, NULL); in sctp_disconnect()
334 WAKE_SCTP(sctp); in sctp_disconnect()
342 if (sctp->sctp_rxqueued > 0 || sctp->sctp_ulp_rxqueued > 0) { in sctp_disconnect()
343 sctp_user_abort(sctp, NULL); in sctp_disconnect()
344 WAKE_SCTP(sctp); in sctp_disconnect()
352 sctp_send_shutdown(sctp, 0); in sctp_disconnect()
355 sctp_update_dce(sctp); in sctp_disconnect()
365 sctp->sctp_state >= SCTPS_ESTABLISHED && in sctp_disconnect()
366 !sctp->sctp_lingering) { in sctp_disconnect()
370 sctp->sctp_lingering = 1; in sctp_disconnect()
371 sctp->sctp_client_errno = 0; in sctp_disconnect()
375 mutex_enter(&sctp->sctp_lock); in sctp_disconnect()
376 sctp->sctp_running = B_FALSE; in sctp_disconnect()
377 while (sctp->sctp_state >= SCTPS_ESTABLISHED && in sctp_disconnect()
378 sctp->sctp_client_errno == 0) { in sctp_disconnect()
379 cv_signal(&sctp->sctp_cv); in sctp_disconnect()
380 ret = cv_timedwait_sig(&sctp->sctp_cv, in sctp_disconnect()
381 &sctp->sctp_lock, stoptime); in sctp_disconnect()
384 sctp->sctp_client_errno = EWOULDBLOCK; in sctp_disconnect()
391 error = sctp->sctp_client_errno; in sctp_disconnect()
392 sctp->sctp_client_errno = 0; in sctp_disconnect()
393 mutex_exit(&sctp->sctp_lock); in sctp_disconnect()
396 WAKE_SCTP(sctp); in sctp_disconnect()
402 sctp_closei_local(sctp); in sctp_disconnect()
403 WAKE_SCTP(sctp); in sctp_disconnect()
408 sctp_close(sctp_t *sctp) in sctp_close() argument
410 dprint(3, ("sctp_close %p, state %d\n", (void *)sctp, in sctp_close()
411 sctp->sctp_state)); in sctp_close()
413 RUN_SCTP(sctp); in sctp_close()
414 sctp->sctp_detached = 1; in sctp_close()
415 sctp->sctp_ulpd = NULL; in sctp_close()
416 sctp->sctp_upcalls = NULL; in sctp_close()
417 bzero(&sctp->sctp_events, sizeof (sctp->sctp_events)); in sctp_close()
420 if (sctp->sctp_state != SCTPS_IDLE) { in sctp_close()
421 WAKE_SCTP(sctp); in sctp_close()
431 SCTP_CONDEMNED(sctp); in sctp_close()
432 WAKE_SCTP(sctp); in sctp_close()
433 SCTP_REFRELE(sctp); in sctp_close()
441 sctp_close_eager(sctp_t *sctp) in sctp_close_eager() argument
443 SCTP_CONDEMNED(sctp); in sctp_close_eager()
444 sctp_closei_local(sctp); in sctp_close_eager()
445 SCTP_REFRELE(sctp); in sctp_close_eager()
457 sctp_closei_local(sctp_t *sctp) in sctp_closei_local() argument
460 conn_t *connp = sctp->sctp_connp; in sctp_closei_local()
463 if (sctp->sctp_state >= SCTPS_ESTABLISHED) in sctp_closei_local()
464 SCTPS_ASSOC_DEC(sctp->sctp_sctps); in sctp_closei_local()
466 if (sctp->sctp_listen_cnt != NULL) in sctp_closei_local()
467 SCTP_DECR_LISTEN_CNT(sctp); in sctp_closei_local()
471 ASSERT(sctp->sctp_state == SCTPS_IDLE); in sctp_closei_local()
476 sctp_free_faddr_timers(sctp); in sctp_closei_local()
477 if ((mp = sctp->sctp_heartbeat_mp) != NULL) { in sctp_closei_local()
479 sctp->sctp_heartbeat_mp = NULL; in sctp_closei_local()
481 if ((mp = sctp->sctp_ack_mp) != NULL) { in sctp_closei_local()
483 sctp->sctp_ack_mp = NULL; in sctp_closei_local()
492 sctp_bind_hash_remove(sctp); in sctp_closei_local()
493 sctp_conn_hash_remove(sctp); in sctp_closei_local()
494 sctp_listen_hash_remove(sctp); in sctp_closei_local()
495 sctp->sctp_state = SCTPS_IDLE; in sctp_closei_local()
501 mutex_enter(&sctp->sctp_recvq_lock); in sctp_closei_local()
502 while ((mp = sctp->sctp_recvq) != NULL) { in sctp_closei_local()
503 sctp->sctp_recvq = mp->b_next; in sctp_closei_local()
511 mutex_exit(&sctp->sctp_recvq_lock); in sctp_closei_local()
518 sctp_headers_free(sctp_t *sctp) in sctp_headers_free() argument
520 if (sctp->sctp_iphc != NULL) { in sctp_headers_free()
521 kmem_free(sctp->sctp_iphc, sctp->sctp_iphc_len); in sctp_headers_free()
522 sctp->sctp_iphc = NULL; in sctp_headers_free()
523 sctp->sctp_ipha = NULL; in sctp_headers_free()
524 sctp->sctp_hdr_len = 0; in sctp_headers_free()
525 sctp->sctp_ip_hdr_len = 0; in sctp_headers_free()
526 sctp->sctp_iphc_len = 0; in sctp_headers_free()
527 sctp->sctp_sctph = NULL; in sctp_headers_free()
528 sctp->sctp_hdr_len = 0; in sctp_headers_free()
530 if (sctp->sctp_iphc6 != NULL) { in sctp_headers_free()
531 kmem_free(sctp->sctp_iphc6, sctp->sctp_iphc6_len); in sctp_headers_free()
532 sctp->sctp_iphc6 = NULL; in sctp_headers_free()
533 sctp->sctp_ip6h = NULL; in sctp_headers_free()
534 sctp->sctp_hdr6_len = 0; in sctp_headers_free()
535 sctp->sctp_ip_hdr6_len = 0; in sctp_headers_free()
536 sctp->sctp_iphc6_len = 0; in sctp_headers_free()
537 sctp->sctp_sctph6 = NULL; in sctp_headers_free()
538 sctp->sctp_hdr6_len = 0; in sctp_headers_free()
543 sctp_free_xmit_data(sctp_t *sctp) in sctp_free_xmit_data() argument
550 sctp->sctp_xmit_unacked = NULL; in sctp_free_xmit_data()
551 ump = sctp->sctp_xmit_head; in sctp_free_xmit_data()
552 sctp->sctp_xmit_tail = sctp->sctp_xmit_head = NULL; in sctp_free_xmit_data()
568 if ((ump = sctp->sctp_xmit_unsent) == NULL) { in sctp_free_xmit_data()
569 ASSERT(sctp->sctp_xmit_unsent_tail == NULL); in sctp_free_xmit_data()
572 sctp->sctp_xmit_unsent = sctp->sctp_xmit_unsent_tail = NULL; in sctp_free_xmit_data()
581 sctp_instream_cleanup(sctp_t *sctp, boolean_t free) in sctp_instream_cleanup() argument
587 if (sctp->sctp_instr != NULL) { in sctp_instream_cleanup()
589 for (i = 0; i < sctp->sctp_num_istr; i++) { in sctp_instream_cleanup()
590 mp = sctp->sctp_instr[i].istr_msgs; in sctp_instream_cleanup()
597 sctp->sctp_instr[i].istr_msgs = NULL; in sctp_instream_cleanup()
598 sctp->sctp_instr[i].istr_nmsgs = 0; in sctp_instream_cleanup()
599 sctp_free_reass((sctp->sctp_instr) + i); in sctp_instream_cleanup()
600 sctp->sctp_instr[i].nextseq = 0; in sctp_instream_cleanup()
603 kmem_free(sctp->sctp_instr, in sctp_instream_cleanup()
604 sizeof (*sctp->sctp_instr) * sctp->sctp_num_istr); in sctp_instream_cleanup()
605 sctp->sctp_instr = NULL; in sctp_instream_cleanup()
606 sctp->sctp_num_istr = 0; in sctp_instream_cleanup()
610 if (sctp->sctp_uo_frags != NULL) { in sctp_instream_cleanup()
611 for (mp = sctp->sctp_uo_frags; mp != NULL; mp = mp1) { in sctp_instream_cleanup()
616 sctp->sctp_uo_frags = NULL; in sctp_instream_cleanup()
627 sctp_t *sctp = CONN2SCTP(connp); in sctp_free() local
629 sctp_stack_t *sctps = sctp->sctp_sctps; in sctp_free()
633 SCTP_UNLINK(sctp, sctps); in sctp_free()
637 ASSERT(!MUTEX_HELD(&sctp->sctp_reflock)); in sctp_free()
638 ASSERT(sctp->sctp_refcnt == 0); in sctp_free()
640 ASSERT(sctp->sctp_ptpbhn == NULL && sctp->sctp_bind_hash == NULL); in sctp_free()
641 ASSERT(sctp->sctp_conn_hash_next == NULL && in sctp_free()
642 sctp->sctp_conn_hash_prev == NULL); in sctp_free()
648 if (sctp->sctp_ostrcntrs != NULL) { in sctp_free()
649 kmem_free(sctp->sctp_ostrcntrs, in sctp_free()
650 sizeof (uint16_t) * sctp->sctp_num_ostr); in sctp_free()
651 sctp->sctp_ostrcntrs = NULL; in sctp_free()
653 sctp_instream_cleanup(sctp, B_TRUE); in sctp_free()
656 sctp->sctp_istr_nmsgs = 0; in sctp_free()
657 sctp->sctp_rxqueued = 0; in sctp_free()
658 sctp_free_xmit_data(sctp); in sctp_free()
659 sctp->sctp_unacked = 0; in sctp_free()
660 sctp->sctp_unsent = 0; in sctp_free()
661 if (sctp->sctp_cxmit_list != NULL) in sctp_free()
662 sctp_asconf_free_cxmit(sctp, NULL); in sctp_free()
664 sctp->sctp_lastdata = NULL; in sctp_free()
667 sctp->sctp_def_stream = 0; in sctp_free()
668 sctp->sctp_def_flags = 0; in sctp_free()
669 sctp->sctp_def_ppid = 0; in sctp_free()
670 sctp->sctp_def_context = 0; in sctp_free()
671 sctp->sctp_def_timetolive = 0; in sctp_free()
673 if (sctp->sctp_sack_info != NULL) { in sctp_free()
674 sctp_free_set(sctp->sctp_sack_info); in sctp_free()
675 sctp->sctp_sack_info = NULL; in sctp_free()
677 sctp->sctp_sack_gaps = 0; in sctp_free()
679 if (sctp->sctp_cookie_mp != NULL) { in sctp_free()
680 freemsg(sctp->sctp_cookie_mp); in sctp_free()
681 sctp->sctp_cookie_mp = NULL; in sctp_free()
685 sctp_zap_addrs(sctp); in sctp_free()
687 ASSERT(sctp->sctp_saddrs[cnt].ipif_count == 0); in sctp_free()
688 list_destroy(&sctp->sctp_saddrs[cnt].sctp_ipif_list); in sctp_free()
691 if (sctp->sctp_hopopts != NULL) { in sctp_free()
692 mi_free(sctp->sctp_hopopts); in sctp_free()
693 sctp->sctp_hopopts = NULL; in sctp_free()
694 sctp->sctp_hopoptslen = 0; in sctp_free()
696 ASSERT(sctp->sctp_hopoptslen == 0); in sctp_free()
697 if (sctp->sctp_dstopts != NULL) { in sctp_free()
698 mi_free(sctp->sctp_dstopts); in sctp_free()
699 sctp->sctp_dstopts = NULL; in sctp_free()
700 sctp->sctp_dstoptslen = 0; in sctp_free()
702 ASSERT(sctp->sctp_dstoptslen == 0); in sctp_free()
703 if (sctp->sctp_rthdrdstopts != NULL) { in sctp_free()
704 mi_free(sctp->sctp_rthdrdstopts); in sctp_free()
705 sctp->sctp_rthdrdstopts = NULL; in sctp_free()
706 sctp->sctp_rthdrdstoptslen = 0; in sctp_free()
708 ASSERT(sctp->sctp_rthdrdstoptslen == 0); in sctp_free()
709 if (sctp->sctp_rthdr != NULL) { in sctp_free()
710 mi_free(sctp->sctp_rthdr); in sctp_free()
711 sctp->sctp_rthdr = NULL; in sctp_free()
712 sctp->sctp_rthdrlen = 0; in sctp_free()
714 ASSERT(sctp->sctp_rthdrlen == 0); in sctp_free()
715 sctp_headers_free(sctp); in sctp_free()
717 sctp->sctp_shutdown_faddr = NULL; in sctp_free()
719 if (sctp->sctp_err_chunks != NULL) { in sctp_free()
720 freemsg(sctp->sctp_err_chunks); in sctp_free()
721 sctp->sctp_err_chunks = NULL; in sctp_free()
722 sctp->sctp_err_len = 0; in sctp_free()
726 bzero(&sctp->sctp_bits, sizeof (sctp->sctp_bits)); in sctp_free()
729 SCTPS_UPDATE_MIB(sctps, sctpOutSCTPPkts, sctp->sctp_opkts); in sctp_free()
730 SCTPS_UPDATE_MIB(sctps, sctpOutCtrlChunks, sctp->sctp_obchunks); in sctp_free()
731 SCTPS_UPDATE_MIB(sctps, sctpOutOrderChunks, sctp->sctp_odchunks); in sctp_free()
732 SCTPS_UPDATE_MIB(sctps, sctpOutUnorderChunks, sctp->sctp_oudchunks); in sctp_free()
733 SCTPS_UPDATE_MIB(sctps, sctpRetransChunks, sctp->sctp_rxtchunks); in sctp_free()
734 SCTPS_UPDATE_MIB(sctps, sctpInSCTPPkts, sctp->sctp_ipkts); in sctp_free()
735 SCTPS_UPDATE_MIB(sctps, sctpInCtrlChunks, sctp->sctp_ibchunks); in sctp_free()
736 SCTPS_UPDATE_MIB(sctps, sctpInOrderChunks, sctp->sctp_idchunks); in sctp_free()
737 SCTPS_UPDATE_MIB(sctps, sctpInUnorderChunks, sctp->sctp_iudchunks); in sctp_free()
738 SCTPS_UPDATE_MIB(sctps, sctpFragUsrMsgs, sctp->sctp_fragdmsgs); in sctp_free()
739 SCTPS_UPDATE_MIB(sctps, sctpReasmUsrMsgs, sctp->sctp_reassmsgs); in sctp_free()
740 sctp->sctp_opkts = 0; in sctp_free()
741 sctp->sctp_obchunks = 0; in sctp_free()
742 sctp->sctp_odchunks = 0; in sctp_free()
743 sctp->sctp_oudchunks = 0; in sctp_free()
744 sctp->sctp_rxtchunks = 0; in sctp_free()
745 sctp->sctp_ipkts = 0; in sctp_free()
746 sctp->sctp_ibchunks = 0; in sctp_free()
747 sctp->sctp_idchunks = 0; in sctp_free()
748 sctp->sctp_iudchunks = 0; in sctp_free()
749 sctp->sctp_fragdmsgs = 0; in sctp_free()
750 sctp->sctp_reassmsgs = 0; in sctp_free()
751 sctp->sctp_outseqtsns = 0; in sctp_free()
752 sctp->sctp_osacks = 0; in sctp_free()
753 sctp->sctp_isacks = 0; in sctp_free()
754 sctp->sctp_idupchunks = 0; in sctp_free()
755 sctp->sctp_gapcnt = 0; in sctp_free()
756 sctp->sctp_cum_obchunks = 0; in sctp_free()
757 sctp->sctp_cum_odchunks = 0; in sctp_free()
758 sctp->sctp_cum_oudchunks = 0; in sctp_free()
759 sctp->sctp_cum_rxtchunks = 0; in sctp_free()
760 sctp->sctp_cum_ibchunks = 0; in sctp_free()
761 sctp->sctp_cum_idchunks = 0; in sctp_free()
762 sctp->sctp_cum_iudchunks = 0; in sctp_free()
764 sctp->sctp_autoclose = 0; in sctp_free()
765 sctp->sctp_tx_adaptation_code = 0; in sctp_free()
767 sctp->sctp_v6label_len = 0; in sctp_free()
768 sctp->sctp_v4label_len = 0; in sctp_free()
770 sctp->sctp_sctps = NULL; in sctp_free()
781 sctp_init_values(sctp_t *sctp, sctp_t *psctp, int sleep) in sctp_init_values() argument
785 sctp_stack_t *sctps = sctp->sctp_sctps; in sctp_init_values()
788 connp = sctp->sctp_connp; in sctp_init_values()
790 sctp->sctp_nsaddrs = 0; in sctp_init_values()
792 sctp->sctp_saddrs[cnt].ipif_count = 0; in sctp_init_values()
793 list_create(&sctp->sctp_saddrs[cnt].sctp_ipif_list, in sctp_init_values()
798 sctp->sctp_running = B_FALSE; in sctp_init_values()
799 sctp->sctp_state = SCTPS_IDLE; in sctp_init_values()
801 sctp->sctp_refcnt = 1; in sctp_init_values()
803 sctp->sctp_strikes = 0; in sctp_init_values()
805 sctp->sctp_last_mtu_probe = ddi_get_lbolt64(); in sctp_init_values()
806 sctp->sctp_mtu_probe_intvl = sctps->sctps_mtu_probe_interval; in sctp_init_values()
808 sctp->sctp_sack_gaps = 0; in sctp_init_values()
810 sctp->sctp_sack_toggle = sctps->sctps_deferred_acks_max; in sctp_init_values()
813 if (sctp->sctp_pad_mp == NULL) { in sctp_init_values()
815 sctp->sctp_pad_mp = allocb_wait(SCTP_ALIGN, BPRI_MED, in sctp_init_values()
818 sctp->sctp_pad_mp = allocb(SCTP_ALIGN, BPRI_MED); in sctp_init_values()
819 if (sctp->sctp_pad_mp == NULL) in sctp_init_values()
822 bzero(sctp->sctp_pad_mp->b_rptr, SCTP_ALIGN); in sctp_init_values()
836 sctp->sctp_upcalls = psctp->sctp_upcalls; in sctp_init_values()
838 sctp->sctp_cookie_lifetime = psctp->sctp_cookie_lifetime; in sctp_init_values()
840 sctp->sctp_cwnd_max = psctp->sctp_cwnd_max; in sctp_init_values()
841 sctp->sctp_rwnd = psctp->sctp_rwnd; in sctp_init_values()
842 sctp->sctp_arwnd = psctp->sctp_arwnd; in sctp_init_values()
843 sctp->sctp_pd_point = psctp->sctp_pd_point; in sctp_init_values()
844 sctp->sctp_rto_max = psctp->sctp_rto_max; in sctp_init_values()
845 sctp->sctp_rto_max_init = psctp->sctp_rto_max_init; in sctp_init_values()
846 sctp->sctp_rto_min = psctp->sctp_rto_min; in sctp_init_values()
847 sctp->sctp_rto_initial = psctp->sctp_rto_initial; in sctp_init_values()
848 sctp->sctp_pa_max_rxt = psctp->sctp_pa_max_rxt; in sctp_init_values()
849 sctp->sctp_pp_max_rxt = psctp->sctp_pp_max_rxt; in sctp_init_values()
850 sctp->sctp_max_init_rxt = psctp->sctp_max_init_rxt; in sctp_init_values()
852 sctp->sctp_def_stream = psctp->sctp_def_stream; in sctp_init_values()
853 sctp->sctp_def_flags = psctp->sctp_def_flags; in sctp_init_values()
854 sctp->sctp_def_ppid = psctp->sctp_def_ppid; in sctp_init_values()
855 sctp->sctp_def_context = psctp->sctp_def_context; in sctp_init_values()
856 sctp->sctp_def_timetolive = psctp->sctp_def_timetolive; in sctp_init_values()
858 sctp->sctp_num_istr = psctp->sctp_num_istr; in sctp_init_values()
859 sctp->sctp_num_ostr = psctp->sctp_num_ostr; in sctp_init_values()
861 sctp->sctp_hb_interval = psctp->sctp_hb_interval; in sctp_init_values()
862 sctp->sctp_autoclose = psctp->sctp_autoclose; in sctp_init_values()
863 sctp->sctp_tx_adaptation_code = psctp->sctp_tx_adaptation_code; in sctp_init_values()
866 sctp->sctp_bound_to_all = psctp->sctp_bound_to_all; in sctp_init_values()
867 sctp->sctp_cansleep = psctp->sctp_cansleep; in sctp_init_values()
868 sctp->sctp_send_adaptation = psctp->sctp_send_adaptation; in sctp_init_values()
869 sctp->sctp_ndelay = psctp->sctp_ndelay; in sctp_init_values()
870 sctp->sctp_events = psctp->sctp_events; in sctp_init_values()
875 sctp->sctp_cookie_lifetime = in sctp_init_values()
881 sctp->sctp_cwnd_max = sctps->sctps_cwnd_max_; in sctp_init_values()
882 sctp->sctp_rwnd = connp->conn_rcvbuf; in sctp_init_values()
883 sctp->sctp_arwnd = connp->conn_rcvbuf; in sctp_init_values()
884 sctp->sctp_pd_point = sctp->sctp_rwnd; in sctp_init_values()
885 sctp->sctp_rto_max = MSEC_TO_TICK(sctps->sctps_rto_maxg); in sctp_init_values()
886 sctp->sctp_rto_max_init = sctp->sctp_rto_max; in sctp_init_values()
887 sctp->sctp_rto_min = MSEC_TO_TICK(sctps->sctps_rto_ming); in sctp_init_values()
888 sctp->sctp_rto_initial = MSEC_TO_TICK( in sctp_init_values()
890 sctp->sctp_pa_max_rxt = sctps->sctps_pa_max_retr; in sctp_init_values()
891 sctp->sctp_pp_max_rxt = sctps->sctps_pp_max_retr; in sctp_init_values()
892 sctp->sctp_max_init_rxt = sctps->sctps_max_init_retr; in sctp_init_values()
894 sctp->sctp_num_istr = sctps->sctps_max_in_streams; in sctp_init_values()
895 sctp->sctp_num_ostr = sctps->sctps_initial_out_streams; in sctp_init_values()
897 sctp->sctp_hb_interval = in sctp_init_values()
911 if ((err = sctp_build_hdrs(sctp, sleep)) != 0) { in sctp_init_values()
916 sctp->sctp_understands_asconf = B_TRUE; in sctp_init_values()
917 sctp->sctp_understands_addip = B_TRUE; in sctp_init_values()
918 sctp->sctp_prsctp_aware = B_FALSE; in sctp_init_values()
920 sctp->sctp_connp->conn_ref = 1; in sctp_init_values()
922 sctp->sctp_prsctpdrop = 0; in sctp_init_values()
923 sctp->sctp_msgcount = 0; in sctp_init_values()
928 sctp_headers_free(sctp); in sctp_init_values()
938 sctp_icmp_verf(sctp_t *sctp, sctp_hdr_t *sh, mblk_t *mp) in sctp_icmp_verf() argument
953 if (verf == sctp->sctp_lvtag) { in sctp_icmp_verf()
966 sctp_update_pmtu(sctp_t *sctp, sctp_faddr_t *fp, boolean_t decrease_only) in sctp_update_pmtu() argument
972 if (sctp->sctp_state < SCTPS_ESTABLISHED) in sctp_update_pmtu()
986 mss = pmtu - conn_ipsec_length(sctp->sctp_connp); in sctp_update_pmtu()
988 mss -= sctp->sctp_hdr_len; in sctp_update_pmtu()
990 mss -= sctp->sctp_hdr6_len; in sctp_update_pmtu()
1023 if (mss < sctp->sctp_sctps->sctps_mss_min) in sctp_update_pmtu()
1037 if (fp == sctp->sctp_current) { in sctp_update_pmtu()
1038 sctp->sctp_ipha-> in sctp_update_pmtu()
1055 sctp_t *sctp = (sctp_t *)arg; in sctp_notify() local
1061 for (fp = sctp->sctp_faddrs; fp != NULL; fp = fp->sf_next) { in sctp_notify()
1066 sctp_update_pmtu(sctp, fp, B_FALSE); in sctp_notify()
1082 sctp_icmp_error(sctp_t *sctp, mblk_t *mp) in sctp_icmp_error() argument
1090 sctp_stack_t *sctps = sctp->sctp_sctps; in sctp_icmp_error()
1092 dprint(1, ("sctp_icmp_error: sctp=%p, mp=%p\n", (void *)sctp, in sctp_icmp_error()
1098 sctp_icmp_error_ipv6(sctp, mp); in sctp_icmp_error()
1139 fp = sctp_lookup_faddr(sctp, &dst); in sctp_icmp_error()
1143 sctp_update_pmtu(sctp, fp, B_TRUE); in sctp_icmp_error()
1152 sctp_rexmit(sctp, fp); in sctp_icmp_error()
1156 switch (sctp->sctp_state) { in sctp_icmp_error()
1160 if (!sctp_icmp_verf(sctp, sctph, mp)) { in sctp_icmp_error()
1164 sctp_assoc_event(sctp, SCTP_CANT_STR_ASSOC, 0, in sctp_icmp_error()
1166 sctp_clean_death(sctp, ECONNREFUSED); in sctp_icmp_error()
1173 sctp->sctp_client_errno = (icmph->icmph_code == in sctp_icmp_error()
1195 sctp_icmp_error_ipv6(sctp_t *sctp, mblk_t *mp) in sctp_icmp_error_ipv6() argument
1203 sctp_stack_t *sctps = sctp->sctp_sctps; in sctp_icmp_error_ipv6()
1244 fp = sctp_lookup_faddr(sctp, &ip6h->ip6_dst); in sctp_icmp_error_ipv6()
1249 sctp_update_pmtu(sctp, fp, B_TRUE); in sctp_icmp_error_ipv6()
1258 sctp_rexmit(sctp, fp); in sctp_icmp_error_ipv6()
1265 if (!sctp_icmp_verf(sctp, sctpha, mp)) { in sctp_icmp_error_ipv6()
1268 if (sctp->sctp_state == SCTPS_COOKIE_WAIT || in sctp_icmp_error_ipv6()
1269 sctp->sctp_state == SCTPS_COOKIE_ECHOED) { in sctp_icmp_error_ipv6()
1271 sctp_assoc_event(sctp, SCTP_CANT_STR_ASSOC, 0, in sctp_icmp_error_ipv6()
1273 sctp_clean_death(sctp, ECONNREFUSED); in sctp_icmp_error_ipv6()
1282 sctp->sctp_client_errno = EHOSTUNREACH; in sctp_icmp_error_ipv6()
1295 if (!sctp_icmp_verf(sctp, sctpha, mp)) { in sctp_icmp_error_ipv6()
1298 if (sctp->sctp_state == SCTPS_COOKIE_WAIT) { in sctp_icmp_error_ipv6()
1300 sctp_assoc_event(sctp, SCTP_CANT_STR_ASSOC, 0, in sctp_icmp_error_ipv6()
1302 sctp_clean_death(sctp, ECONNREFUSED); in sctp_icmp_error_ipv6()
1325 sctp_t *sctp, *psctp; in sctp_create() local
1375 sctp = CONN2SCTP(connp); in sctp_create()
1376 sctp->sctp_sctps = sctps; in sctp_create()
1378 if ((ack_mp = sctp_timer_alloc(sctp, sctp_ack_timer, sleep)) == NULL || in sctp_create()
1379 (hb_mp = sctp_timer_alloc(sctp, sctp_heartbeat_timer, in sctp_create()
1384 sctp->sctp_sctps = NULL; in sctp_create()
1389 sctp->sctp_ack_mp = ack_mp; in sctp_create()
1390 sctp->sctp_heartbeat_mp = hb_mp; in sctp_create()
1401 if (sctp_init_values(sctp, psctp, sleep) != 0) { in sctp_create()
1405 sctp->sctp_sctps = NULL; in sctp_create()
1409 sctp->sctp_cansleep = ((flags & SCTP_CAN_BLOCK) == SCTP_CAN_BLOCK); in sctp_create()
1411 sctp->sctp_mss = sctps->sctps_initial_mtu - ((family == AF_INET6) ? in sctp_create()
1412 sctp->sctp_hdr6_len : sctp->sctp_hdr_len); in sctp_create()
1424 if (sctp_dup_saddrs(psctp, sctp, sleep)) { in sctp_create()
1428 sctp_headers_free(sctp); in sctp_create()
1430 sctp->sctp_sctps = NULL; in sctp_create()
1441 sctp->sctp_state = SCTPS_BOUND; in sctp_create()
1468 (void) random_get_pseudo_bytes((uint8_t *)&sctp->sctp_lvtag, in sctp_create()
1469 sizeof (sctp->sctp_lvtag)); in sctp_create()
1470 if (sctp->sctp_lvtag == 0) in sctp_create()
1471 sctp->sctp_lvtag = (uint32_t)gethrtime(); in sctp_create()
1472 ASSERT(sctp->sctp_lvtag != 0); in sctp_create()
1474 sctp->sctp_ltsn = sctp->sctp_lvtag + 1; in sctp_create()
1475 sctp->sctp_lcsn = sctp->sctp_ltsn; in sctp_create()
1476 sctp->sctp_recovery_tsn = sctp->sctp_lastack_rxd = sctp->sctp_ltsn - 1; in sctp_create()
1477 sctp->sctp_adv_pap = sctp->sctp_lastack_rxd; in sctp_create()
1481 sctp->sctp_ulpd = ulpd; in sctp_create()
1484 sctp->sctp_upcalls = upcalls; in sctp_create()
1489 sbl->sbl_rxbuf = sctp->sctp_rwnd; in sctp_create()
1493 SCTP_LINK(sctp, sctps); in sctp_create()
1495 return (sctp); in sctp_create()
1774 sctp_find_next_tq(sctp_t *sctp) in sctp_find_next_tq() argument
1778 sctp_stack_t *sctps = sctp->sctp_sctps; in sctp_find_next_tq()
1790 if (taskq_dispatch(tq, sctp_process_recvq, sctp, in sctp_find_next_tq()
1792 sctp->sctp_recvq_tq = tq; in sctp_find_next_tq()
1806 if (taskq_dispatch(tq, sctp_process_recvq, sctp, TQ_NOSLEEP) != in sctp_find_next_tq()
1808 sctp->sctp_recvq_tq = tq; in sctp_find_next_tq()
1830 sctp_add_recvq(sctp_t *sctp, mblk_t *mp, boolean_t caller_hold_lock, in sctp_add_recvq() argument
1834 ip_stack_t *ipst = sctp->sctp_sctps->sctps_netstack->netstack_ip; in sctp_add_recvq()
1839 mutex_enter(&sctp->sctp_recvq_lock); in sctp_add_recvq()
1842 if (sctp->sctp_recvq_tq == NULL) { in sctp_add_recvq()
1843 ASSERT(sctp->sctp_recvq == NULL); in sctp_add_recvq()
1844 if (!sctp_find_next_tq(sctp)) { in sctp_add_recvq()
1846 mutex_exit(&sctp->sctp_recvq_lock); in sctp_add_recvq()
1853 SCTP_REFHOLD(sctp); in sctp_add_recvq()
1859 mutex_exit(&sctp->sctp_recvq_lock); in sctp_add_recvq()
1869 if (sctp->sctp_recvq == NULL) { in sctp_add_recvq()
1870 sctp->sctp_recvq = mp; in sctp_add_recvq()
1871 sctp->sctp_recvq_tail = mp; in sctp_add_recvq()
1873 sctp->sctp_recvq_tail->b_next = mp; in sctp_add_recvq()
1874 sctp->sctp_recvq_tail = mp; in sctp_add_recvq()
1878 mutex_exit(&sctp->sctp_recvq_lock); in sctp_add_recvq()
1884 sctp_t *sctp = (sctp_t *)arg; in sctp_process_recvq() local
1897 RUN_SCTP(sctp); in sctp_process_recvq()
1898 mutex_enter(&sctp->sctp_recvq_lock); in sctp_process_recvq()
1908 while ((mp = sctp->sctp_recvq) != NULL) { in sctp_process_recvq()
1911 sctp->sctp_recvq = mp->b_next; in sctp_process_recvq()
1912 mutex_exit(&sctp->sctp_recvq_lock); in sctp_process_recvq()
1929 sctp_icmp_error(sctp, data_mp); in sctp_process_recvq()
1931 sctp_input_data(sctp, data_mp, &iras); in sctp_process_recvq()
1934 mutex_enter(&sctp->sctp_recvq_lock); in sctp_process_recvq()
1937 sctp->sctp_recvq_tail = NULL; in sctp_process_recvq()
1938 sctp->sctp_recvq_tq = NULL; in sctp_process_recvq()
1940 mutex_exit(&sctp->sctp_recvq_lock); in sctp_process_recvq()
1942 WAKE_SCTP(sctp); in sctp_process_recvq()
1949 SCTP_REFRELE(sctp); in sctp_process_recvq()
1957 sctp_t *sctp = (sctp_t *)&connp[1]; in sctp_conn_cache_constructor() local
1961 bzero(buf, (char *)&sctp[1] - (char *)buf); in sctp_conn_cache_constructor()
1963 mutex_init(&sctp->sctp_reflock, NULL, MUTEX_DEFAULT, NULL); in sctp_conn_cache_constructor()
1964 mutex_init(&sctp->sctp_lock, NULL, MUTEX_DEFAULT, NULL); in sctp_conn_cache_constructor()
1965 mutex_init(&sctp->sctp_recvq_lock, NULL, MUTEX_DEFAULT, NULL); in sctp_conn_cache_constructor()
1966 cv_init(&sctp->sctp_cv, NULL, CV_DEFAULT, NULL); in sctp_conn_cache_constructor()
1968 rw_init(&sctp->sctp_saddrs[cnt].ipif_hash_lock, NULL, in sctp_conn_cache_constructor()
1976 connp->conn_sctp = sctp; in sctp_conn_cache_constructor()
1977 sctp->sctp_connp = connp; in sctp_conn_cache_constructor()
1995 sctp_t *sctp = (sctp_t *)&connp[1]; in sctp_conn_cache_destructor() local
1998 ASSERT(sctp->sctp_connp == connp); in sctp_conn_cache_destructor()
1999 ASSERT(!MUTEX_HELD(&sctp->sctp_lock)); in sctp_conn_cache_destructor()
2000 ASSERT(!MUTEX_HELD(&sctp->sctp_reflock)); in sctp_conn_cache_destructor()
2001 ASSERT(!MUTEX_HELD(&sctp->sctp_recvq_lock)); in sctp_conn_cache_destructor()
2003 ASSERT(sctp->sctp_conn_hash_next == NULL); in sctp_conn_cache_destructor()
2004 ASSERT(sctp->sctp_conn_hash_prev == NULL); in sctp_conn_cache_destructor()
2005 ASSERT(sctp->sctp_listen_hash_next == NULL); in sctp_conn_cache_destructor()
2006 ASSERT(sctp->sctp_listen_hash_prev == NULL); in sctp_conn_cache_destructor()
2007 ASSERT(sctp->sctp_listen_tfp == NULL); in sctp_conn_cache_destructor()
2008 ASSERT(sctp->sctp_conn_tfp == NULL); in sctp_conn_cache_destructor()
2010 ASSERT(sctp->sctp_faddrs == NULL); in sctp_conn_cache_destructor()
2011 ASSERT(sctp->sctp_nsaddrs == 0); in sctp_conn_cache_destructor()
2013 ASSERT(sctp->sctp_ulpd == NULL); in sctp_conn_cache_destructor()
2015 ASSERT(sctp->sctp_lastfaddr == NULL); in sctp_conn_cache_destructor()
2016 ASSERT(sctp->sctp_primary == NULL); in sctp_conn_cache_destructor()
2017 ASSERT(sctp->sctp_current == NULL); in sctp_conn_cache_destructor()
2018 ASSERT(sctp->sctp_lastdata == NULL); in sctp_conn_cache_destructor()
2020 ASSERT(sctp->sctp_xmit_head == NULL); in sctp_conn_cache_destructor()
2021 ASSERT(sctp->sctp_xmit_tail == NULL); in sctp_conn_cache_destructor()
2022 ASSERT(sctp->sctp_xmit_unsent == NULL); in sctp_conn_cache_destructor()
2023 ASSERT(sctp->sctp_xmit_unsent_tail == NULL); in sctp_conn_cache_destructor()
2025 ASSERT(sctp->sctp_ostrcntrs == NULL); in sctp_conn_cache_destructor()
2027 ASSERT(sctp->sctp_sack_info == NULL); in sctp_conn_cache_destructor()
2028 ASSERT(sctp->sctp_ack_mp == NULL); in sctp_conn_cache_destructor()
2029 ASSERT(sctp->sctp_instr == NULL); in sctp_conn_cache_destructor()
2031 ASSERT(sctp->sctp_iphc == NULL); in sctp_conn_cache_destructor()
2032 ASSERT(sctp->sctp_iphc6 == NULL); in sctp_conn_cache_destructor()
2033 ASSERT(sctp->sctp_ipha == NULL); in sctp_conn_cache_destructor()
2034 ASSERT(sctp->sctp_ip6h == NULL); in sctp_conn_cache_destructor()
2035 ASSERT(sctp->sctp_sctph == NULL); in sctp_conn_cache_destructor()
2036 ASSERT(sctp->sctp_sctph6 == NULL); in sctp_conn_cache_destructor()
2038 ASSERT(sctp->sctp_cookie_mp == NULL); in sctp_conn_cache_destructor()
2040 ASSERT(sctp->sctp_refcnt == 0); in sctp_conn_cache_destructor()
2041 ASSERT(sctp->sctp_timer_mp == NULL); in sctp_conn_cache_destructor()
2042 ASSERT(sctp->sctp_connp->conn_ref == 0); in sctp_conn_cache_destructor()
2043 ASSERT(sctp->sctp_heartbeat_mp == NULL); in sctp_conn_cache_destructor()
2044 ASSERT(sctp->sctp_ptpbhn == NULL && sctp->sctp_bind_hash == NULL); in sctp_conn_cache_destructor()
2046 ASSERT(sctp->sctp_shutdown_faddr == NULL); in sctp_conn_cache_destructor()
2048 ASSERT(sctp->sctp_cxmit_list == NULL); in sctp_conn_cache_destructor()
2050 ASSERT(sctp->sctp_recvq == NULL); in sctp_conn_cache_destructor()
2051 ASSERT(sctp->sctp_recvq_tail == NULL); in sctp_conn_cache_destructor()
2052 ASSERT(sctp->sctp_recvq_tq == NULL); in sctp_conn_cache_destructor()
2058 if (sctp->sctp_pad_mp != NULL) { in sctp_conn_cache_destructor()
2059 freeb(sctp->sctp_pad_mp); in sctp_conn_cache_destructor()
2060 sctp->sctp_pad_mp = NULL; in sctp_conn_cache_destructor()
2063 mutex_destroy(&sctp->sctp_reflock); in sctp_conn_cache_destructor()
2064 mutex_destroy(&sctp->sctp_lock); in sctp_conn_cache_destructor()
2065 mutex_destroy(&sctp->sctp_recvq_lock); in sctp_conn_cache_destructor()
2066 cv_destroy(&sctp->sctp_cv); in sctp_conn_cache_destructor()
2068 rw_destroy(&sctp->sctp_saddrs[cnt].ipif_hash_lock); in sctp_conn_cache_destructor()