Print this page
XXXX adding PID information to netstat output
@@ -51,16 +51,20 @@
udp_snmp_get(queue_t *q, mblk_t *mpctl, boolean_t legacy_req)
{
mblk_t *mpdata;
mblk_t *mp_conn_ctl;
mblk_t *mp_attr_ctl;
+ mblk_t *mp_pidnode_ctl;
mblk_t *mp6_conn_ctl;
mblk_t *mp6_attr_ctl;
+ mblk_t *mp6_pidnode_ctl;
mblk_t *mp_conn_tail;
mblk_t *mp_attr_tail;
+ mblk_t *mp_pidnode_tail;
mblk_t *mp6_conn_tail;
mblk_t *mp6_attr_tail;
+ mblk_t *mp6_pidnode_tail;
struct opthdr *optp;
mib2_udpEntry_t ude;
mib2_udp6Entry_t ude6;
mib2_transportMLPEntry_t mlp;
int state;
@@ -76,26 +80,30 @@
udp_stack_t *us = connp->conn_netstack->netstack_udp;
mblk_t *mp2ctl;
mib2_udp_t udp_mib;
size_t udp_mib_size, ude_size, ude6_size;
-
/*
* make a copy of the original message
*/
mp2ctl = copymsg(mpctl);
mp_conn_ctl = mp_attr_ctl = mp6_conn_ctl = NULL;
if (mpctl == NULL ||
(mpdata = mpctl->b_cont) == NULL ||
(mp_conn_ctl = copymsg(mpctl)) == NULL ||
(mp_attr_ctl = copymsg(mpctl)) == NULL ||
+ (mp_pidnode_ctl = copymsg(mpctl)) == NULL ||
(mp6_conn_ctl = copymsg(mpctl)) == NULL ||
- (mp6_attr_ctl = copymsg(mpctl)) == NULL) {
+ (mp6_attr_ctl = copymsg(mpctl)) == NULL ||
+ (mp6_pidnode_ctl = copymsg(mpctl)) == NULL) {
freemsg(mp_conn_ctl);
freemsg(mp_attr_ctl);
+ freemsg(mp_pidnode_ctl);
freemsg(mp6_conn_ctl);
+ freemsg(mp6_attr_ctl);
+ freemsg(mp6_pidnode_ctl);
freemsg(mpctl);
freemsg(mp2ctl);
return (0);
}
@@ -133,10 +141,11 @@
(void) snmp_append_data(mpdata, (char *)&udp_mib, udp_mib_size);
optp->len = msgdsize(mpdata);
qreply(q, mpctl);
mp_conn_tail = mp_attr_tail = mp6_conn_tail = mp6_attr_tail = NULL;
+ mp_pidnode_tail = mp6_pidnode_tail = NULL;
v4_conn_idx = v6_conn_idx = 0;
for (i = 0; i < CONN_G_HASH_SIZE; i++) {
connfp = &ipst->ips_ipcl_globalhash_fanout[i];
connp = NULL;
@@ -247,10 +256,17 @@
connp->conn_cpid;
ude.udpCreationTime = connp->conn_open_time;
(void) snmp_append_data2(mp_conn_ctl->b_cont,
&mp_conn_tail, (char *)&ude, ude_size);
+
+ (void) snmp_append_data2(mp_pidnode_ctl->b_cont,
+ &mp_pidnode_tail, (char *)&ude, ude_size);
+
+ (void) snmp_append_mblk2(mp_pidnode_ctl->b_cont,
+ &mp_pidnode_tail, conn_get_pid_mblk(connp));
+
mlp.tme_connidx = v4_conn_idx++;
if (needattr)
(void) snmp_append_data2(
mp_attr_ctl->b_cont, &mp_attr_tail,
(char *)&mlp, sizeof (mlp));
@@ -290,10 +306,19 @@
connp->conn_cpid;
ude6.udp6CreationTime = connp->conn_open_time;
(void) snmp_append_data2(mp6_conn_ctl->b_cont,
&mp6_conn_tail, (char *)&ude6, ude6_size);
+
+ (void) snmp_append_data2(
+ mp6_pidnode_ctl->b_cont, &mp6_pidnode_tail,
+ (char *)&ude6, ude6_size);
+
+ (void) snmp_append_mblk2(
+ mp6_pidnode_ctl->b_cont, &mp6_pidnode_tail,
+ conn_get_pid_mblk(connp));
+
mlp.tme_connidx = v6_conn_idx++;
if (needattr)
(void) snmp_append_data2(
mp6_attr_ctl->b_cont,
&mp6_attr_tail, (char *)&mlp,
@@ -319,10 +344,21 @@
if (optp->len == 0)
freemsg(mp_attr_ctl);
else
qreply(q, mp_attr_ctl);
+ /* table of EXPER_XPORT_PROC_INFO ipv4 */
+ optp = (struct opthdr *)&mp_pidnode_ctl->b_rptr[
+ sizeof (struct T_optmgmt_ack)];
+ optp->level = MIB2_UDP;
+ optp->name = EXPER_XPORT_PROC_INFO;
+ optp->len = msgdsize(mp_pidnode_ctl->b_cont);
+ if (optp->len == 0)
+ freemsg(mp_pidnode_ctl);
+ else
+ qreply(q, mp_pidnode_ctl);
+
/* IPv6 UDP endpoints */
optp = (struct opthdr *)&mp6_conn_ctl->b_rptr[
sizeof (struct T_optmgmt_ack)];
optp->level = MIB2_UDP6;
optp->name = MIB2_UDP6_ENTRY;
@@ -338,10 +374,21 @@
if (optp->len == 0)
freemsg(mp6_attr_ctl);
else
qreply(q, mp6_attr_ctl);
+ /* table of EXPER_XPORT_PROC_INFO ipv6 */
+ optp = (struct opthdr *)&mp6_pidnode_ctl->b_rptr[
+ sizeof (struct T_optmgmt_ack)];
+ optp->level = MIB2_UDP6;
+ optp->name = EXPER_XPORT_PROC_INFO;
+ optp->len = msgdsize(mp6_pidnode_ctl->b_cont);
+ if (optp->len == 0)
+ freemsg(mp6_pidnode_ctl);
+ else
+ qreply(q, mp6_pidnode_ctl);
+
return (mp2ctl);
}
/*
* Return 0 if invalid set request, 1 otherwise, including non-udp requests.