In order to test my changes in IPsec SA expiration handling I'd like to get a list of processes/connections which experience TCP retransmissions (to see if they belong in the group of processes which transfer the data using the SAs).

Thanks to the MIB probes in ip module this is easy to accomplish for the latter case but I am not able to get a process name out of tcp_t/conn_t/sonode et al. The pid of the process is stashed in conn_t so this is fine but I'd like to get the execname as well. Sadly, the pid2proc mdb dcmd simulated in dtrace cannot be used here, I think.

Any ideas ?


v.

PS: the script itself is here:

#pragma D option quiet

/* from usr/src/uts/common/inet/ipclassifier.h */
#define conn_tcp        conn_proto_priv.cp_tcp

/*
 * Use hard-coded list of functions which can do
 *   BUMP_MIB(&tcps->tcps_mib, tcpRetransSegs);
 */
fbt:ip:tcp_timer:entry
{
        self->tcp = ((conn_t *)arg0)->conn_tcp;
        /* useful tcp_t members:
         * ipha_t       *tcp_ipha;
         * ip6_t        *tcp_ip6h;
         * tcpha_t      *tcp_tcpha;
         */
}

fbt:ip:tcp_timer:return
/self->tcp/
{
        self->tcp = 0;
}

/* XXX */
fbt:ip:tcp_input_data:entry
{
}

/* XXX */
fbt:ip:tcp_ss_rexmit:entry
{
}

/* XXX */
fbt:ip:tcp_sack_rxmit:entry
{
}

mib:ip::tcpRetransSegs
/self->tcp != 0/
{
        /* use backpointer from tcp_t to conn_t to get more info */
        this->family = self->tcp->tcp_connp->conn_family;
        this->pid = self->tcp->tcp_connp->conn_cpid;

        /* src port */
        this->lport = ntohs(self->tcp->tcp_tcpha->tha_lport);
        /* dst port */
        this->fport = ntohs(self->tcp->tcp_tcpha->tha_fport);

        /* src addr */
        this->laddr = inet_ntop(this->family,
            (void *)&self->tcp->tcp_ipha->ipha_src);
        /* dst addr */
        this->faddr = inet_ntop(this->family,
            (void *)&self->tcp->tcp_ipha->ipha_dst);

        /* print the data (XXX execname) */
        printf("%s (%d): src: %s:%d dst: %s:%d\n", execname, this->pid,
            this->laddr, this->lport,
            this->faddr, this->fport);
}
_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to