Hi,

Steffen Weiberle wrote:
Using Solaris 10, so no IP provider, I am trying to figure out when a
connection attempt is failing in a client. The connect() statement takes
a file descriptor, which is an integer and has no connection details.
Since I don't know if the connect is closely preceded with a bind() or a new connection may be attempted with the same socket, and thus I won't be capturing the bin, I can't rely on it to get the sockaddr structure.

(The event happens very infrequently, maybe once a day)

So I am trying tcp_connect FBT probe.

fbt::tcp_connect:entry
{
       printf("execname: %s \n", execname);
       self->sockaddr = args[1];

       printf("family: %x \n", self->sockaddr->sa_family);
}

However, I get

# /var/tmp/connect.d
dtrace: failed to compile script /var/tmp/connect.d: line 32: sa_family
is not a member of struct msgb

Note is says 'msgb', not 'sockaddr'.
Try:

   self->sockaddr = (struct sockaddr *) args[1]->b_rptr;

struct msgb is a STREAMS mblk_t.

max


I got the args[1] from the OpenSolaris source code (and maybe that is my
problem, since I am running on Solaris 10--did the code change that
much?--seems unlikely)

http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/inet/tcp/tcp_socket.c#232

Any good way to grab the IPv4 address and port number on an entry so I
can have it in the situation the connect() fails?

Thanks
Steffen


_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to