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 ↓ 12 lines elided ↑ open up ↑
 553  556          int                     idx;
 554  557          mib2_sctp_t             sctp_mib;
 555  558  
 556  559          /*
 557  560           * Make copies of the original message.
 558  561           * mpctl will hold SCTP counters,
 559  562           * mp_conn_ctl will hold list of connections.
 560  563           */
 561  564          mp_ret = copymsg(mpctl);
 562  565          mp_conn_ctl = copymsg(mpctl);
      566 +        mp_pidnode_ctl = copymsg(mpctl);
 563  567          mp_local_ctl = copymsg(mpctl);
 564  568          mp_rem_ctl = copymsg(mpctl);
 565  569          mp_attr_ctl = copymsg(mpctl);
 566  570  
 567  571          mpdata = mpctl->b_cont;
 568  572  
 569      -        if (mp_conn_ctl == NULL || mp_local_ctl == NULL ||
 570      -            mp_rem_ctl == NULL || mp_attr_ctl == NULL || mpdata == NULL) {
      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) {
 571  576                  freemsg(mp_attr_ctl);
 572  577                  freemsg(mp_rem_ctl);
 573  578                  freemsg(mp_local_ctl);
      579 +                freemsg(mp_pidnode_ctl);
 574  580                  freemsg(mp_conn_ctl);
 575  581                  freemsg(mp_ret);
 576  582                  freemsg(mpctl);
 577  583                  return (NULL);
 578  584          }
 579  585          mp_conn_data = mp_conn_ctl->b_cont;
      586 +        mp_pidnode_data = mp_pidnode_ctl->b_cont;
 580  587          mp_local_data = mp_local_ctl->b_cont;
 581  588          mp_rem_data = mp_rem_ctl->b_cont;
 582  589          mp_attr_data = mp_attr_ctl->b_cont;
 583  590  
 584  591          bzero(&sctp_mib, sizeof (sctp_mib));
 585  592  
 586  593          /* hostname address parameters are not supported in Solaris */
 587  594          sce.sctpAssocRemHostName.o_length = 0;
 588  595          sce.sctpAssocRemHostName.o_bytes[0] = 0;
 589  596  
↓ open down ↓ 206 lines elided ↑ open up ↑
 796  803                  sce.sctpAssocRtxChunks = sctp->sctp_T3expire;
 797  804                  sce.sctpAssocStartTime = sctp->sctp_assoc_start_time;
 798  805                  sce.sctpConnEntryInfo.ce_sendq = sctp->sctp_unacked +
 799  806                      sctp->sctp_unsent;
 800  807                  sce.sctpConnEntryInfo.ce_recvq = sctp->sctp_rxqueued;
 801  808                  sce.sctpConnEntryInfo.ce_swnd = sctp->sctp_frwnd;
 802  809                  sce.sctpConnEntryInfo.ce_rwnd = sctp->sctp_rwnd;
 803  810                  sce.sctpConnEntryInfo.ce_mss = sctp->sctp_mss;
 804  811                  (void) snmp_append_data2(mp_conn_data, &mp_conn_tail,
 805  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 +
 806  820                  mlp.tme_connidx = idx++;
 807  821                  if (needattr)
 808  822                          (void) snmp_append_data2(mp_attr_ctl->b_cont,
 809  823                              &mp_attr_tail, (char *)&mlp, sizeof (mlp));
 810  824  next_sctp:
 811  825                  sctp_prev = sctp;
 812  826                  mutex_enter(&sctps->sctps_g_lock);
 813  827                  sctp = list_next(&sctps->sctps_g_list, sctp);
 814  828          }
 815  829          mutex_exit(&sctps->sctps_g_lock);
↓ open down ↓ 9 lines elided ↑ open up ↑
 825  839          optp->len = msgdsize(mpdata);
 826  840          qreply(q, mpctl);
 827  841  
 828  842          /* table of connections... */
 829  843          optp = (struct opthdr *)&mp_conn_ctl->b_rptr[
 830  844              sizeof (struct T_optmgmt_ack)];
 831  845          optp->level = MIB2_SCTP;
 832  846          optp->name = MIB2_SCTP_CONN;
 833  847          optp->len = msgdsize(mp_conn_data);
 834  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);
 835  857  
 836  858          /* assoc local address table */
 837  859          optp = (struct opthdr *)&mp_local_ctl->b_rptr[
 838  860              sizeof (struct T_optmgmt_ack)];
 839  861          optp->level = MIB2_SCTP;
 840  862          optp->name = MIB2_SCTP_CONN_LOCAL;
 841  863          optp->len = msgdsize(mp_local_data);
 842  864          qreply(q, mp_local_ctl);
 843  865  
 844  866          /* assoc remote address table */
↓ open down ↓ 125 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX