511 {
512 if (ksp != NULL) {
513 ASSERT(stackid == (netstackid_t)(uintptr_t)ksp->ks_private);
514 kstat_delete_netstack(ksp, stackid);
515 }
516 }
517
518 /*
519 * Return SNMP global stats in buffer in mpdata.
520 * Return associatiation table in mp_conn_data,
521 * local address table in mp_local_data, and
522 * remote address table in mp_rem_data.
523 */
524 mblk_t *
525 sctp_snmp_get_mib2(queue_t *q, mblk_t *mpctl, sctp_stack_t *sctps)
526 {
527 mblk_t *mpdata, *mp_ret;
528 mblk_t *mp_conn_ctl = NULL;
529 mblk_t *mp_conn_data;
530 mblk_t *mp_conn_tail = NULL;
531 mblk_t *mp_local_ctl = NULL;
532 mblk_t *mp_local_data;
533 mblk_t *mp_local_tail = NULL;
534 mblk_t *mp_rem_ctl = NULL;
535 mblk_t *mp_rem_data;
536 mblk_t *mp_rem_tail = NULL;
537 mblk_t *mp_attr_ctl = NULL;
538 mblk_t *mp_attr_data;
539 mblk_t *mp_attr_tail = NULL;
540 struct opthdr *optp;
541 sctp_t *sctp, *sctp_prev = NULL;
542 sctp_faddr_t *fp;
543 mib2_sctpConnEntry_t sce;
544 mib2_sctpConnLocalEntry_t scle;
545 mib2_sctpConnRemoteEntry_t scre;
546 mib2_transportMLPEntry_t mlp;
547 int i;
548 int l;
549 int scanned = 0;
550 zoneid_t zoneid = Q_TO_CONN(q)->conn_zoneid;
551 conn_t *connp;
552 boolean_t needattr;
553 int idx;
554 mib2_sctp_t sctp_mib;
555
556 /*
557 * Make copies of the original message.
558 * mpctl will hold SCTP counters,
559 * mp_conn_ctl will hold list of connections.
560 */
561 mp_ret = copymsg(mpctl);
562 mp_conn_ctl = copymsg(mpctl);
563 mp_local_ctl = copymsg(mpctl);
564 mp_rem_ctl = copymsg(mpctl);
565 mp_attr_ctl = copymsg(mpctl);
566
567 mpdata = mpctl->b_cont;
568
569 if (mp_conn_ctl == NULL || mp_local_ctl == NULL ||
570 mp_rem_ctl == NULL || mp_attr_ctl == NULL || mpdata == NULL) {
571 freemsg(mp_attr_ctl);
572 freemsg(mp_rem_ctl);
573 freemsg(mp_local_ctl);
574 freemsg(mp_conn_ctl);
575 freemsg(mp_ret);
576 freemsg(mpctl);
577 return (NULL);
578 }
579 mp_conn_data = mp_conn_ctl->b_cont;
580 mp_local_data = mp_local_ctl->b_cont;
581 mp_rem_data = mp_rem_ctl->b_cont;
582 mp_attr_data = mp_attr_ctl->b_cont;
583
584 bzero(&sctp_mib, sizeof (sctp_mib));
585
586 /* hostname address parameters are not supported in Solaris */
587 sce.sctpAssocRemHostName.o_length = 0;
588 sce.sctpAssocRemHostName.o_bytes[0] = 0;
589
590 /* build table of connections -- need count in fixed part */
591
592 idx = 0;
593 mutex_enter(&sctps->sctps_g_lock);
594 sctp = list_head(&sctps->sctps_g_list);
595 while (sctp != NULL) {
596 mutex_enter(&sctp->sctp_reflock);
597 if (sctp->sctp_condemned) {
598 mutex_exit(&sctp->sctp_reflock);
599 sctp = list_next(&sctps->sctps_g_list, sctp);
786 }
787 WAKE_SCTP(sctp);
788 sce.sctpAssocState = sctp_snmp_state(sctp);
789 sce.sctpAssocInStreams = sctp->sctp_num_istr;
790 sce.sctpAssocOutStreams = sctp->sctp_num_ostr;
791 sce.sctpAssocMaxRetr = sctp->sctp_pa_max_rxt;
792 /* A 0 here indicates that no primary process is known */
793 sce.sctpAssocPrimProcess = 0;
794 sce.sctpAssocT1expired = sctp->sctp_T1expire;
795 sce.sctpAssocT2expired = sctp->sctp_T2expire;
796 sce.sctpAssocRtxChunks = sctp->sctp_T3expire;
797 sce.sctpAssocStartTime = sctp->sctp_assoc_start_time;
798 sce.sctpConnEntryInfo.ce_sendq = sctp->sctp_unacked +
799 sctp->sctp_unsent;
800 sce.sctpConnEntryInfo.ce_recvq = sctp->sctp_rxqueued;
801 sce.sctpConnEntryInfo.ce_swnd = sctp->sctp_frwnd;
802 sce.sctpConnEntryInfo.ce_rwnd = sctp->sctp_rwnd;
803 sce.sctpConnEntryInfo.ce_mss = sctp->sctp_mss;
804 (void) snmp_append_data2(mp_conn_data, &mp_conn_tail,
805 (char *)&sce, sizeof (sce));
806 mlp.tme_connidx = idx++;
807 if (needattr)
808 (void) snmp_append_data2(mp_attr_ctl->b_cont,
809 &mp_attr_tail, (char *)&mlp, sizeof (mlp));
810 next_sctp:
811 sctp_prev = sctp;
812 mutex_enter(&sctps->sctps_g_lock);
813 sctp = list_next(&sctps->sctps_g_list, sctp);
814 }
815 mutex_exit(&sctps->sctps_g_lock);
816 if (sctp_prev != NULL)
817 SCTP_REFRELE(sctp_prev);
818
819 sctp_sum_mib(sctps, &sctp_mib);
820
821 optp = (struct opthdr *)&mpctl->b_rptr[sizeof (struct T_optmgmt_ack)];
822 optp->level = MIB2_SCTP;
823 optp->name = 0;
824 (void) snmp_append_data(mpdata, (char *)&sctp_mib, sizeof (sctp_mib));
825 optp->len = msgdsize(mpdata);
826 qreply(q, mpctl);
827
828 /* table of connections... */
829 optp = (struct opthdr *)&mp_conn_ctl->b_rptr[
830 sizeof (struct T_optmgmt_ack)];
831 optp->level = MIB2_SCTP;
832 optp->name = MIB2_SCTP_CONN;
833 optp->len = msgdsize(mp_conn_data);
834 qreply(q, mp_conn_ctl);
835
836 /* assoc local address table */
837 optp = (struct opthdr *)&mp_local_ctl->b_rptr[
838 sizeof (struct T_optmgmt_ack)];
839 optp->level = MIB2_SCTP;
840 optp->name = MIB2_SCTP_CONN_LOCAL;
841 optp->len = msgdsize(mp_local_data);
842 qreply(q, mp_local_ctl);
843
844 /* assoc remote address table */
845 optp = (struct opthdr *)&mp_rem_ctl->b_rptr[
846 sizeof (struct T_optmgmt_ack)];
847 optp->level = MIB2_SCTP;
848 optp->name = MIB2_SCTP_CONN_REMOTE;
849 optp->len = msgdsize(mp_rem_data);
850 qreply(q, mp_rem_ctl);
851
852 /* table of MLP attributes */
853 optp = (struct opthdr *)&mp_attr_ctl->b_rptr[
854 sizeof (struct T_optmgmt_ack)];
|
511 {
512 if (ksp != NULL) {
513 ASSERT(stackid == (netstackid_t)(uintptr_t)ksp->ks_private);
514 kstat_delete_netstack(ksp, stackid);
515 }
516 }
517
518 /*
519 * Return SNMP global stats in buffer in mpdata.
520 * Return associatiation table in mp_conn_data,
521 * local address table in mp_local_data, and
522 * remote address table in mp_rem_data.
523 */
524 mblk_t *
525 sctp_snmp_get_mib2(queue_t *q, mblk_t *mpctl, sctp_stack_t *sctps)
526 {
527 mblk_t *mpdata, *mp_ret;
528 mblk_t *mp_conn_ctl = NULL;
529 mblk_t *mp_conn_data;
530 mblk_t *mp_conn_tail = NULL;
531 mblk_t *mp_pidnode_ctl = NULL;
532 mblk_t *mp_pidnode_data;
533 mblk_t *mp_pidnode_tail = NULL;
534 mblk_t *mp_local_ctl = NULL;
535 mblk_t *mp_local_data;
536 mblk_t *mp_local_tail = NULL;
537 mblk_t *mp_rem_ctl = NULL;
538 mblk_t *mp_rem_data;
539 mblk_t *mp_rem_tail = NULL;
540 mblk_t *mp_attr_ctl = NULL;
541 mblk_t *mp_attr_data;
542 mblk_t *mp_attr_tail = NULL;
543 struct opthdr *optp;
544 sctp_t *sctp, *sctp_prev = NULL;
545 sctp_faddr_t *fp;
546 mib2_sctpConnEntry_t sce;
547 mib2_sctpConnLocalEntry_t scle;
548 mib2_sctpConnRemoteEntry_t scre;
549 mib2_transportMLPEntry_t mlp;
550 int i;
551 int l;
552 int scanned = 0;
553 zoneid_t zoneid = Q_TO_CONN(q)->conn_zoneid;
554 conn_t *connp;
555 boolean_t needattr;
556 int idx;
557 mib2_sctp_t sctp_mib;
558
559 /*
560 * Make copies of the original message.
561 * mpctl will hold SCTP counters,
562 * mp_conn_ctl will hold list of connections.
563 */
564 mp_ret = copymsg(mpctl);
565 mp_conn_ctl = copymsg(mpctl);
566 mp_pidnode_ctl = copymsg(mpctl);
567 mp_local_ctl = copymsg(mpctl);
568 mp_rem_ctl = copymsg(mpctl);
569 mp_attr_ctl = copymsg(mpctl);
570
571 mpdata = mpctl->b_cont;
572
573 if (mp_conn_ctl == NULL || mp_pidnode_ctl == NULL ||
574 mp_local_ctl == NULL || mp_rem_ctl == NULL || mp_attr_ctl == NULL ||
575 mpdata == NULL) {
576 freemsg(mp_attr_ctl);
577 freemsg(mp_rem_ctl);
578 freemsg(mp_local_ctl);
579 freemsg(mp_pidnode_ctl);
580 freemsg(mp_conn_ctl);
581 freemsg(mp_ret);
582 freemsg(mpctl);
583 return (NULL);
584 }
585 mp_conn_data = mp_conn_ctl->b_cont;
586 mp_pidnode_data = mp_pidnode_ctl->b_cont;
587 mp_local_data = mp_local_ctl->b_cont;
588 mp_rem_data = mp_rem_ctl->b_cont;
589 mp_attr_data = mp_attr_ctl->b_cont;
590
591 bzero(&sctp_mib, sizeof (sctp_mib));
592
593 /* hostname address parameters are not supported in Solaris */
594 sce.sctpAssocRemHostName.o_length = 0;
595 sce.sctpAssocRemHostName.o_bytes[0] = 0;
596
597 /* build table of connections -- need count in fixed part */
598
599 idx = 0;
600 mutex_enter(&sctps->sctps_g_lock);
601 sctp = list_head(&sctps->sctps_g_list);
602 while (sctp != NULL) {
603 mutex_enter(&sctp->sctp_reflock);
604 if (sctp->sctp_condemned) {
605 mutex_exit(&sctp->sctp_reflock);
606 sctp = list_next(&sctps->sctps_g_list, sctp);
793 }
794 WAKE_SCTP(sctp);
795 sce.sctpAssocState = sctp_snmp_state(sctp);
796 sce.sctpAssocInStreams = sctp->sctp_num_istr;
797 sce.sctpAssocOutStreams = sctp->sctp_num_ostr;
798 sce.sctpAssocMaxRetr = sctp->sctp_pa_max_rxt;
799 /* A 0 here indicates that no primary process is known */
800 sce.sctpAssocPrimProcess = 0;
801 sce.sctpAssocT1expired = sctp->sctp_T1expire;
802 sce.sctpAssocT2expired = sctp->sctp_T2expire;
803 sce.sctpAssocRtxChunks = sctp->sctp_T3expire;
804 sce.sctpAssocStartTime = sctp->sctp_assoc_start_time;
805 sce.sctpConnEntryInfo.ce_sendq = sctp->sctp_unacked +
806 sctp->sctp_unsent;
807 sce.sctpConnEntryInfo.ce_recvq = sctp->sctp_rxqueued;
808 sce.sctpConnEntryInfo.ce_swnd = sctp->sctp_frwnd;
809 sce.sctpConnEntryInfo.ce_rwnd = sctp->sctp_rwnd;
810 sce.sctpConnEntryInfo.ce_mss = sctp->sctp_mss;
811 (void) snmp_append_data2(mp_conn_data, &mp_conn_tail,
812 (char *)&sce, sizeof (sce));
813
814 (void) snmp_append_data2(mp_pidnode_data, &mp_pidnode_tail,
815 (char *)&sce, sizeof (sce));
816
817 (void) snmp_append_mblk2(mp_pidnode_data, &mp_pidnode_tail,
818 conn_get_pid_mblk(connp));
819
820 mlp.tme_connidx = idx++;
821 if (needattr)
822 (void) snmp_append_data2(mp_attr_ctl->b_cont,
823 &mp_attr_tail, (char *)&mlp, sizeof (mlp));
824 next_sctp:
825 sctp_prev = sctp;
826 mutex_enter(&sctps->sctps_g_lock);
827 sctp = list_next(&sctps->sctps_g_list, sctp);
828 }
829 mutex_exit(&sctps->sctps_g_lock);
830 if (sctp_prev != NULL)
831 SCTP_REFRELE(sctp_prev);
832
833 sctp_sum_mib(sctps, &sctp_mib);
834
835 optp = (struct opthdr *)&mpctl->b_rptr[sizeof (struct T_optmgmt_ack)];
836 optp->level = MIB2_SCTP;
837 optp->name = 0;
838 (void) snmp_append_data(mpdata, (char *)&sctp_mib, sizeof (sctp_mib));
839 optp->len = msgdsize(mpdata);
840 qreply(q, mpctl);
841
842 /* table of connections... */
843 optp = (struct opthdr *)&mp_conn_ctl->b_rptr[
844 sizeof (struct T_optmgmt_ack)];
845 optp->level = MIB2_SCTP;
846 optp->name = MIB2_SCTP_CONN;
847 optp->len = msgdsize(mp_conn_data);
848 qreply(q, mp_conn_ctl);
849
850 /* table of EXPER_XPORT_PROC_INFO */
851 optp = (struct opthdr *)&mp_pidnode_ctl->b_rptr[
852 sizeof (struct T_optmgmt_ack)];
853 optp->level = MIB2_SCTP;
854 optp->name = EXPER_XPORT_PROC_INFO;
855 optp->len = msgdsize(mp_pidnode_data);
856 qreply(q, mp_pidnode_ctl);
857
858 /* assoc local address table */
859 optp = (struct opthdr *)&mp_local_ctl->b_rptr[
860 sizeof (struct T_optmgmt_ack)];
861 optp->level = MIB2_SCTP;
862 optp->name = MIB2_SCTP_CONN_LOCAL;
863 optp->len = msgdsize(mp_local_data);
864 qreply(q, mp_local_ctl);
865
866 /* assoc remote address table */
867 optp = (struct opthdr *)&mp_rem_ctl->b_rptr[
868 sizeof (struct T_optmgmt_ack)];
869 optp->level = MIB2_SCTP;
870 optp->name = MIB2_SCTP_CONN_REMOTE;
871 optp->len = msgdsize(mp_rem_data);
872 qreply(q, mp_rem_ctl);
873
874 /* table of MLP attributes */
875 optp = (struct opthdr *)&mp_attr_ctl->b_rptr[
876 sizeof (struct T_optmgmt_ack)];
|