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 conn_pid_node_list_hdr_t *cph;
561
562 /*
563 * Make copies of the original message.
564 * mpctl will hold SCTP counters,
565 * mp_conn_ctl will hold list of connections.
566 */
567 mp_ret = copymsg(mpctl);
568 mp_conn_ctl = copymsg(mpctl);
569 mp_pidnode_ctl = copymsg(mpctl);
570 mp_local_ctl = copymsg(mpctl);
571 mp_rem_ctl = copymsg(mpctl);
572 mp_attr_ctl = copymsg(mpctl);
573
574 mpdata = mpctl->b_cont;
575
576 if (mp_conn_ctl == NULL || mp_pidnode_ctl == NULL ||
577 mp_local_ctl == NULL || mp_rem_ctl == NULL || mp_attr_ctl == NULL ||
578 mpdata == NULL) {
579 freemsg(mp_attr_ctl);
580 freemsg(mp_rem_ctl);
581 freemsg(mp_local_ctl);
582 freemsg(mp_pidnode_ctl);
583 freemsg(mp_conn_ctl);
584 freemsg(mp_ret);
585 freemsg(mpctl);
586 return (NULL);
587 }
588 mp_conn_data = mp_conn_ctl->b_cont;
589 mp_pidnode_data = mp_pidnode_ctl->b_cont;
590 mp_local_data = mp_local_ctl->b_cont;
591 mp_rem_data = mp_rem_ctl->b_cont;
592 mp_attr_data = mp_attr_ctl->b_cont;
593
594 bzero(&sctp_mib, sizeof (sctp_mib));
595
596 /* hostname address parameters are not supported in Solaris */
597 sce.sctpAssocRemHostName.o_length = 0;
598 sce.sctpAssocRemHostName.o_bytes[0] = 0;
599
600 /* build table of connections -- need count in fixed part */
601
602 idx = 0;
603 mutex_enter(&sctps->sctps_g_lock);
604 sctp = list_head(&sctps->sctps_g_list);
605 while (sctp != NULL) {
606 mutex_enter(&sctp->sctp_reflock);
607 if (sctp->sctp_condemned) {
608 mutex_exit(&sctp->sctp_reflock);
609 sctp = list_next(&sctps->sctps_g_list, sctp);
796 }
797 WAKE_SCTP(sctp);
798 sce.sctpAssocState = sctp_snmp_state(sctp);
799 sce.sctpAssocInStreams = sctp->sctp_num_istr;
800 sce.sctpAssocOutStreams = sctp->sctp_num_ostr;
801 sce.sctpAssocMaxRetr = sctp->sctp_pa_max_rxt;
802 /* A 0 here indicates that no primary process is known */
803 sce.sctpAssocPrimProcess = 0;
804 sce.sctpAssocT1expired = sctp->sctp_T1expire;
805 sce.sctpAssocT2expired = sctp->sctp_T2expire;
806 sce.sctpAssocRtxChunks = sctp->sctp_T3expire;
807 sce.sctpAssocStartTime = sctp->sctp_assoc_start_time;
808 sce.sctpConnEntryInfo.ce_sendq = sctp->sctp_unacked +
809 sctp->sctp_unsent;
810 sce.sctpConnEntryInfo.ce_recvq = sctp->sctp_rxqueued;
811 sce.sctpConnEntryInfo.ce_swnd = sctp->sctp_frwnd;
812 sce.sctpConnEntryInfo.ce_rwnd = sctp->sctp_rwnd;
813 sce.sctpConnEntryInfo.ce_mss = sctp->sctp_mss;
814 (void) snmp_append_data2(mp_conn_data, &mp_conn_tail,
815 (char *)&sce, sizeof (sce));
816 /* my data */
817 (void) snmp_append_data2(mp_pidnode_data, &mp_pidnode_tail,
818 (char *)&sce, sizeof (sce));
819
820 cph = conn_get_pid_list(connp);
821
822 (void) snmp_append_data2(mp_pidnode_data, &mp_pidnode_tail,
823 (char *)cph, cph->cph_tot_size);
824
825 kmem_free(cph, cph->cph_tot_size);
826 /* end of my data */
827 mlp.tme_connidx = idx++;
828 if (needattr)
829 (void) snmp_append_data2(mp_attr_ctl->b_cont,
830 &mp_attr_tail, (char *)&mlp, sizeof (mlp));
831 next_sctp:
832 sctp_prev = sctp;
833 mutex_enter(&sctps->sctps_g_lock);
834 sctp = list_next(&sctps->sctps_g_list, sctp);
835 }
836 mutex_exit(&sctps->sctps_g_lock);
837 if (sctp_prev != NULL)
838 SCTP_REFRELE(sctp_prev);
839
840 sctp_sum_mib(sctps, &sctp_mib);
841
842 optp = (struct opthdr *)&mpctl->b_rptr[sizeof (struct T_optmgmt_ack)];
843 optp->level = MIB2_SCTP;
844 optp->name = 0;
845 (void) snmp_append_data(mpdata, (char *)&sctp_mib, sizeof (sctp_mib));
846 optp->len = msgdsize(mpdata);
847 qreply(q, mpctl);
848
849 /* table of connections... */
850 optp = (struct opthdr *)&mp_conn_ctl->b_rptr[
851 sizeof (struct T_optmgmt_ack)];
852 optp->level = MIB2_SCTP;
853 optp->name = MIB2_SCTP_CONN;
854 optp->len = msgdsize(mp_conn_data);
855 qreply(q, mp_conn_ctl);
856
857 /* table of EXPER_XPORT_PROC_INFO */
858 optp = (struct opthdr *)&mp_pidnode_ctl->b_rptr[
859 sizeof (struct T_optmgmt_ack)];
860 optp->level = MIB2_SCTP;
861 optp->name = EXPER_XPORT_PROC_INFO;
862 optp->len = msgdsize(mp_pidnode_data);
863 qreply(q, mp_pidnode_ctl);
864
865 /* assoc local address table */
866 optp = (struct opthdr *)&mp_local_ctl->b_rptr[
867 sizeof (struct T_optmgmt_ack)];
868 optp->level = MIB2_SCTP;
869 optp->name = MIB2_SCTP_CONN_LOCAL;
870 optp->len = msgdsize(mp_local_data);
871 qreply(q, mp_local_ctl);
872
873 /* assoc remote address table */
874 optp = (struct opthdr *)&mp_rem_ctl->b_rptr[
875 sizeof (struct T_optmgmt_ack)];
876 optp->level = MIB2_SCTP;
877 optp->name = MIB2_SCTP_CONN_REMOTE;
878 optp->len = msgdsize(mp_rem_data);
879 qreply(q, mp_rem_ctl);
880
881 /* table of MLP attributes */
882 optp = (struct opthdr *)&mp_attr_ctl->b_rptr[
883 sizeof (struct T_optmgmt_ack)];
|