Lines Matching defs:sctp

160 	sctp_t		*sctp;
168 sctp = list_head(&sctps->sctps_g_list);
169 while (sctp != NULL) {
173 mutex_enter(&sctp->sctp_reflock);
174 if (sctp->sctp_condemned || sctp->sctp_state <= SCTPS_LISTEN) {
175 mutex_exit(&sctp->sctp_reflock);
176 sctp = list_next(&sctps->sctps_g_list, sctp);
179 sctp->sctp_refcnt++;
180 mutex_exit(&sctp->sctp_reflock);
184 RUN_SCTP(sctp);
185 ssize = sizeof (in6_addr_t) * sctp->sctp_nsaddrs;
186 fsize = sizeof (in6_addr_t) * sctp->sctp_nfaddrs;
191 WAKE_SCTP(sctp);
196 SCTP_REFRELE(sctp);
200 sctp_get_saddr_list(sctp, slist, ssize);
201 sctp_get_faddr_list(sctp, flist, fsize);
202 cl_sctpi.cl_sctpi_nladdr = sctp->sctp_nsaddrs;
203 cl_sctpi.cl_sctpi_nfaddr = sctp->sctp_nfaddrs;
204 cl_sctpi.cl_sctpi_family = sctp->sctp_connp->conn_family;
209 cl_sctpi.cl_sctpi_state = sctp->sctp_state;
210 cl_sctpi.cl_sctpi_lport = sctp->sctp_connp->conn_lport;
211 cl_sctpi.cl_sctpi_fport = sctp->sctp_connp->conn_fport;
212 cl_sctpi.cl_sctpi_handle = (cl_sctp_handle_t)sctp;
213 WAKE_SCTP(sctp);
219 SCTP_REFRELE(sctp);
223 sctp_prev = sctp;
225 sctp = list_next(&sctps->sctps_g_list, sctp);
238 sctp_t *sctp;
246 for (sctp = tf->tf_sctp; sctp != NULL; sctp =
247 sctp->sctp_conn_hash_next) {
248 connp = sctp->sctp_connp;
259 for (fp = sctp->sctp_faddrs; fp != NULL; fp = fp->sf_next) {
264 if (sctp_saddr_lookup(sctp, laddr, 0)
266 SCTP_REFHOLD(sctp);
268 return (sctp);
278 return (sctp);
285 sctp_t *sctp;
295 for (sctp = tf->tf_sctp; sctp; sctp = sctp->sctp_listen_hash_next) {
296 connp = sctp->sctp_connp;
307 if (sctp_saddr_lookup(sctp, laddr, 0) != NULL) {
308 SCTP_REFHOLD(sctp);
316 return (sctp);
324 sctp_t *sctp;
326 sctp = sctp_conn_match(&src, 1, dst, ports, zoneid, iraflags, sctps);
327 if (sctp == NULL) {
329 sctp = listen_match(dst, ports, zoneid, iraflags, sctps);
330 if (sctp == NULL)
333 return (sctp->sctp_connp);
353 sctp_t *sctp;
366 * quickly return the matched sctp.
368 if ((sctp = sctp_conn_match(&srcp, 1, dstp, ports, zoneid, iraflags,
370 return (sctp);
462 sctp = sctp_conn_match(addrbuf, nfaddr, dstp, ports,
477 return (sctp);
481 * Fanout to a sctp instance.
489 sctp_t *sctp;
491 sctp = sctp_lookup_by_faddrs(mp, sctph, src, dst, ports, zoneid,
493 if (sctp == NULL) {
495 sctp = listen_match(dst, ports, zoneid, iraflags, sctps);
496 if (sctp == NULL)
506 sctp->sctp_connp)) {
511 conn_t *, sctp->sctp_connp, mblk_t *, mp);
512 SCTP_REFRELE(sctp);
521 return (sctp->sctp_connp);
532 sctp_t *sctp;
571 sctp = CONN2SCTP(connp);
584 SCTP_REFRELE(sctp);
591 mutex_enter(&sctp->sctp_lock);
592 if (sctp->sctp_running) {
593 sctp_add_recvq(sctp, mp, B_FALSE, ira);
594 mutex_exit(&sctp->sctp_lock);
596 sctp->sctp_running = B_TRUE;
597 mutex_exit(&sctp->sctp_lock);
599 mutex_enter(&sctp->sctp_recvq_lock);
600 if (sctp->sctp_recvq != NULL) {
601 sctp_add_recvq(sctp, mp, B_TRUE, ira);
602 mutex_exit(&sctp->sctp_recvq_lock);
603 WAKE_SCTP(sctp);
605 mutex_exit(&sctp->sctp_recvq_lock);
607 sctp_icmp_error(sctp, mp);
609 sctp_input_data(sctp, mp, ira);
611 WAKE_SCTP(sctp);
614 SCTP_REFRELE(sctp);
620 sctp_conn_hash_remove(sctp_t *sctp)
622 sctp_tf_t *tf = sctp->sctp_conn_tfp;
632 (*cl_sctp_disconnect)(sctp->sctp_connp->conn_family,
633 (cl_sctp_handle_t)sctp);
638 if (tf->tf_sctp == sctp) {
639 tf->tf_sctp = sctp->sctp_conn_hash_next;
640 if (sctp->sctp_conn_hash_next) {
641 ASSERT(tf->tf_sctp->sctp_conn_hash_prev == sctp);
645 ASSERT(sctp->sctp_conn_hash_prev);
646 ASSERT(sctp->sctp_conn_hash_prev->sctp_conn_hash_next == sctp);
647 sctp->sctp_conn_hash_prev->sctp_conn_hash_next =
648 sctp->sctp_conn_hash_next;
650 if (sctp->sctp_conn_hash_next) {
651 ASSERT(sctp->sctp_conn_hash_next->sctp_conn_hash_prev
652 == sctp);
653 sctp->sctp_conn_hash_next->sctp_conn_hash_prev =
654 sctp->sctp_conn_hash_prev;
657 sctp->sctp_conn_hash_next = NULL;
658 sctp->sctp_conn_hash_prev = NULL;
659 sctp->sctp_conn_tfp = NULL;
664 sctp_conn_hash_insert(sctp_tf_t *tf, sctp_t *sctp, int caller_holds_lock)
666 if (sctp->sctp_conn_tfp) {
667 sctp_conn_hash_remove(sctp);
676 sctp->sctp_conn_hash_next = tf->tf_sctp;
678 tf->tf_sctp->sctp_conn_hash_prev = sctp;
680 sctp->sctp_conn_hash_prev = NULL;
681 tf->tf_sctp = sctp;
682 sctp->sctp_conn_tfp = tf;
689 sctp_listen_hash_remove(sctp_t *sctp)
691 sctp_tf_t *tf = sctp->sctp_listen_tfp;
692 conn_t *connp = sctp->sctp_connp;
705 ssize = sizeof (in6_addr_t) * sctp->sctp_nsaddrs;
707 sctp_get_saddr_list(sctp, slist, ssize);
709 sctp->sctp_nsaddrs, connp->conn_lport);
715 if (tf->tf_sctp == sctp) {
716 tf->tf_sctp = sctp->sctp_listen_hash_next;
717 if (sctp->sctp_listen_hash_next != NULL) {
718 ASSERT(tf->tf_sctp->sctp_listen_hash_prev == sctp);
722 ASSERT(sctp->sctp_listen_hash_prev);
723 ASSERT(sctp->sctp_listen_hash_prev->sctp_listen_hash_next ==
724 sctp);
725 ASSERT(sctp->sctp_listen_hash_next == NULL ||
726 sctp->sctp_listen_hash_next->sctp_listen_hash_prev == sctp);
728 sctp->sctp_listen_hash_prev->sctp_listen_hash_next =
729 sctp->sctp_listen_hash_next;
731 if (sctp->sctp_listen_hash_next != NULL) {
732 sctp_t *next = sctp->sctp_listen_hash_next;
734 ASSERT(next->sctp_listen_hash_prev == sctp);
736 sctp->sctp_listen_hash_prev;
739 sctp->sctp_listen_hash_next = NULL;
740 sctp->sctp_listen_hash_prev = NULL;
741 sctp->sctp_listen_tfp = NULL;
746 sctp_listen_hash_insert(sctp_tf_t *tf, sctp_t *sctp)
748 conn_t *connp = sctp->sctp_connp;
750 if (sctp->sctp_listen_tfp) {
751 sctp_listen_hash_remove(sctp);
755 sctp->sctp_listen_hash_next = tf->tf_sctp;
757 tf->tf_sctp->sctp_listen_hash_prev = sctp;
759 sctp->sctp_listen_hash_prev = NULL;
760 tf->tf_sctp = sctp;
761 sctp->sctp_listen_tfp = tf;
771 ssize = sizeof (in6_addr_t) * sctp->sctp_nsaddrs;
773 sctp_get_saddr_list(sctp, slist, ssize);
775 sctp->sctp_nsaddrs, connp->conn_lport);
786 sctp_bind_hash_insert(sctp_tf_t *tbf, sctp_t *sctp, int caller_holds_lock)
791 if (sctp->sctp_ptpbhn != NULL) {
793 sctp_bind_hash_remove(sctp);
803 sctpnext->sctp_ptpbhn = &sctp->sctp_bind_hash;
805 sctp->sctp_bind_hash = sctpnext;
806 sctp->sctp_ptpbhn = sctpp;
807 sctpp[0] = sctp;
809 sctp->sctp_bind_lockp = &tbf->tf_lock;
818 sctp_bind_hash_remove(sctp_t *sctp)
823 lockp = sctp->sctp_bind_lockp;
825 if (sctp->sctp_ptpbhn == NULL)
830 if (sctp->sctp_ptpbhn) {
831 sctpnext = sctp->sctp_bind_hash;
833 sctpnext->sctp_ptpbhn = sctp->sctp_ptpbhn;
834 sctp->sctp_bind_hash = NULL;
836 *sctp->sctp_ptpbhn = sctpnext;
837 sctp->sctp_ptpbhn = NULL;
840 sctp->sctp_bind_lockp = NULL;
852 * Returns with a SCTP_REFHOLD sctp structure. Caller must do a SCTP_REFRELE.
858 sctp_t *sctp;
863 for (sctp = tf->tf_sctp; sctp != NULL;
864 sctp = sctp->sctp_conn_hash_next) {
865 if (*ports != sctp->sctp_connp->conn_ports ||
866 sctp->sctp_state < min_state) {
871 for (fp = sctp->sctp_faddrs; fp != NULL; fp = fp->sf_next) {
888 if (sctp_compare_saddrs(sctp1, sctp) <= SCTP_ADDR_OVERLAP) {
896 if (sctp != NULL) {
897 SCTP_REFHOLD(sctp);
899 return (sctp);