Print this page
XXXX adding PID information to netstat output

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/sctp/sctp_snmp.c
          +++ new/usr/src/uts/common/inet/sctp/sctp_snmp.c
↓ open down ↓ 520 lines elided ↑ open up ↑
 521  521   * local address table in mp_local_data, and
 522  522   * remote address table in mp_rem_data.
 523  523   */
 524  524  mblk_t *
 525  525  sctp_snmp_get_mib2(queue_t *q, mblk_t *mpctl, sctp_stack_t *sctps)
 526  526  {
 527  527          mblk_t                  *mpdata, *mp_ret;
 528  528          mblk_t                  *mp_conn_ctl = NULL;
 529  529          mblk_t                  *mp_conn_data;
 530  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;
 531  534          mblk_t                  *mp_local_ctl = NULL;
 532  535          mblk_t                  *mp_local_data;
 533  536          mblk_t                  *mp_local_tail = NULL;
 534  537          mblk_t                  *mp_rem_ctl = NULL;
 535  538          mblk_t                  *mp_rem_data;
 536  539          mblk_t                  *mp_rem_tail = NULL;
 537  540          mblk_t                  *mp_attr_ctl = NULL;
 538  541          mblk_t                  *mp_attr_data;
 539  542          mblk_t                  *mp_attr_tail = NULL;
 540  543          struct opthdr           *optp;
↓ open down ↓ 5 lines elided ↑ open up ↑
 546  549          mib2_transportMLPEntry_t        mlp;
 547  550          int                     i;
 548  551          int                     l;
 549  552          int                     scanned = 0;
 550  553          zoneid_t                zoneid = Q_TO_CONN(q)->conn_zoneid;
 551  554          conn_t                  *connp;
 552  555          boolean_t               needattr;
 553  556          int                     idx;
 554  557          mib2_sctp_t             sctp_mib;
 555  558  
      559 +
      560 +        conn_pid_node_list_hdr_t        *cph;
      561 +
 556  562          /*
 557  563           * Make copies of the original message.
 558  564           * mpctl will hold SCTP counters,
 559  565           * mp_conn_ctl will hold list of connections.
 560  566           */
 561  567          mp_ret = copymsg(mpctl);
 562  568          mp_conn_ctl = copymsg(mpctl);
      569 +        mp_pidnode_ctl = copymsg(mpctl);
 563  570          mp_local_ctl = copymsg(mpctl);
 564  571          mp_rem_ctl = copymsg(mpctl);
 565  572          mp_attr_ctl = copymsg(mpctl);
 566  573  
 567  574          mpdata = mpctl->b_cont;
 568  575  
 569      -        if (mp_conn_ctl == NULL || mp_local_ctl == NULL ||
 570      -            mp_rem_ctl == NULL || mp_attr_ctl == NULL || mpdata == NULL) {
      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) {
 571  579                  freemsg(mp_attr_ctl);
 572  580                  freemsg(mp_rem_ctl);
 573  581                  freemsg(mp_local_ctl);
      582 +                freemsg(mp_pidnode_ctl);
 574  583                  freemsg(mp_conn_ctl);
 575  584                  freemsg(mp_ret);
 576  585                  freemsg(mpctl);
 577  586                  return (NULL);
 578  587          }
 579  588          mp_conn_data = mp_conn_ctl->b_cont;
      589 +        mp_pidnode_data = mp_pidnode_ctl->b_cont;
 580  590          mp_local_data = mp_local_ctl->b_cont;
 581  591          mp_rem_data = mp_rem_ctl->b_cont;
 582  592          mp_attr_data = mp_attr_ctl->b_cont;
 583  593  
 584  594          bzero(&sctp_mib, sizeof (sctp_mib));
 585  595  
 586  596          /* hostname address parameters are not supported in Solaris */
 587  597          sce.sctpAssocRemHostName.o_length = 0;
 588  598          sce.sctpAssocRemHostName.o_bytes[0] = 0;
 589  599  
↓ open down ↓ 206 lines elided ↑ open up ↑
 796  806                  sce.sctpAssocRtxChunks = sctp->sctp_T3expire;
 797  807                  sce.sctpAssocStartTime = sctp->sctp_assoc_start_time;
 798  808                  sce.sctpConnEntryInfo.ce_sendq = sctp->sctp_unacked +
 799  809                      sctp->sctp_unsent;
 800  810                  sce.sctpConnEntryInfo.ce_recvq = sctp->sctp_rxqueued;
 801  811                  sce.sctpConnEntryInfo.ce_swnd = sctp->sctp_frwnd;
 802  812                  sce.sctpConnEntryInfo.ce_rwnd = sctp->sctp_rwnd;
 803  813                  sce.sctpConnEntryInfo.ce_mss = sctp->sctp_mss;
 804  814                  (void) snmp_append_data2(mp_conn_data, &mp_conn_tail,
 805  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 */
 806  827                  mlp.tme_connidx = idx++;
 807  828                  if (needattr)
 808  829                          (void) snmp_append_data2(mp_attr_ctl->b_cont,
 809  830                              &mp_attr_tail, (char *)&mlp, sizeof (mlp));
 810  831  next_sctp:
 811  832                  sctp_prev = sctp;
 812  833                  mutex_enter(&sctps->sctps_g_lock);
 813  834                  sctp = list_next(&sctps->sctps_g_list, sctp);
 814  835          }
 815  836          mutex_exit(&sctps->sctps_g_lock);
↓ open down ↓ 9 lines elided ↑ open up ↑
 825  846          optp->len = msgdsize(mpdata);
 826  847          qreply(q, mpctl);
 827  848  
 828  849          /* table of connections... */
 829  850          optp = (struct opthdr *)&mp_conn_ctl->b_rptr[
 830  851              sizeof (struct T_optmgmt_ack)];
 831  852          optp->level = MIB2_SCTP;
 832  853          optp->name = MIB2_SCTP_CONN;
 833  854          optp->len = msgdsize(mp_conn_data);
 834  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);
 835  864  
 836  865          /* assoc local address table */
 837  866          optp = (struct opthdr *)&mp_local_ctl->b_rptr[
 838  867              sizeof (struct T_optmgmt_ack)];
 839  868          optp->level = MIB2_SCTP;
 840  869          optp->name = MIB2_SCTP_CONN_LOCAL;
 841  870          optp->len = msgdsize(mp_local_data);
 842  871          qreply(q, mp_local_ctl);
 843  872  
 844  873          /* assoc remote address table */
↓ open down ↓ 125 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX