Print this page
XXXX adding PID information to netstat output

@@ -526,10 +526,13 @@
 {
         mblk_t                  *mpdata, *mp_ret;
         mblk_t                  *mp_conn_ctl = NULL;
         mblk_t                  *mp_conn_data;
         mblk_t                  *mp_conn_tail = NULL;
+        mblk_t                  *mp_pidnode_ctl = NULL;
+        mblk_t                  *mp_pidnode_data;
+        mblk_t                  *mp_pidnode_tail = NULL;
         mblk_t                  *mp_local_ctl = NULL;
         mblk_t                  *mp_local_data;
         mblk_t                  *mp_local_tail = NULL;
         mblk_t                  *mp_rem_ctl = NULL;
         mblk_t                  *mp_rem_data;

@@ -558,27 +561,31 @@
          * mpctl will hold SCTP counters,
          * mp_conn_ctl will hold list of connections.
          */
         mp_ret = copymsg(mpctl);
         mp_conn_ctl = copymsg(mpctl);
+        mp_pidnode_ctl = copymsg(mpctl);
         mp_local_ctl = copymsg(mpctl);
         mp_rem_ctl = copymsg(mpctl);
         mp_attr_ctl = copymsg(mpctl);
 
         mpdata = mpctl->b_cont;
 
-        if (mp_conn_ctl == NULL || mp_local_ctl == NULL ||
-            mp_rem_ctl == NULL || mp_attr_ctl == NULL || mpdata == NULL) {
+        if (mp_conn_ctl == NULL || mp_pidnode_ctl == NULL ||
+            mp_local_ctl == NULL || mp_rem_ctl == NULL || mp_attr_ctl == NULL ||
+            mpdata == NULL) {
                 freemsg(mp_attr_ctl);
                 freemsg(mp_rem_ctl);
                 freemsg(mp_local_ctl);
+                freemsg(mp_pidnode_ctl);
                 freemsg(mp_conn_ctl);
                 freemsg(mp_ret);
                 freemsg(mpctl);
                 return (NULL);
         }
         mp_conn_data = mp_conn_ctl->b_cont;
+        mp_pidnode_data = mp_pidnode_ctl->b_cont;
         mp_local_data = mp_local_ctl->b_cont;
         mp_rem_data = mp_rem_ctl->b_cont;
         mp_attr_data = mp_attr_ctl->b_cont;
 
         bzero(&sctp_mib, sizeof (sctp_mib));

@@ -801,10 +808,17 @@
                 sce.sctpConnEntryInfo.ce_swnd = sctp->sctp_frwnd;
                 sce.sctpConnEntryInfo.ce_rwnd = sctp->sctp_rwnd;
                 sce.sctpConnEntryInfo.ce_mss = sctp->sctp_mss;
                 (void) snmp_append_data2(mp_conn_data, &mp_conn_tail,
                     (char *)&sce, sizeof (sce));
+
+                (void) snmp_append_data2(mp_pidnode_data, &mp_pidnode_tail,
+                    (char *)&sce, sizeof (sce));
+
+                (void) snmp_append_mblk2(mp_pidnode_data, &mp_pidnode_tail,
+                    conn_get_pid_mblk(connp));
+
                 mlp.tme_connidx = idx++;
                 if (needattr)
                         (void) snmp_append_data2(mp_attr_ctl->b_cont,
                             &mp_attr_tail, (char *)&mlp, sizeof (mlp));
 next_sctp:

@@ -831,10 +845,18 @@
         optp->level = MIB2_SCTP;
         optp->name = MIB2_SCTP_CONN;
         optp->len = msgdsize(mp_conn_data);
         qreply(q, mp_conn_ctl);
 
+        /* table of EXPER_XPORT_PROC_INFO */
+        optp = (struct opthdr *)&mp_pidnode_ctl->b_rptr[
+            sizeof (struct T_optmgmt_ack)];
+        optp->level = MIB2_SCTP;
+        optp->name = EXPER_XPORT_PROC_INFO;
+        optp->len = msgdsize(mp_pidnode_data);
+        qreply(q, mp_pidnode_ctl);
+
         /* assoc local address table */
         optp = (struct opthdr *)&mp_local_ctl->b_rptr[
             sizeof (struct T_optmgmt_ack)];
         optp->level = MIB2_SCTP;
         optp->name = MIB2_SCTP_CONN_LOCAL;