Steffen Weiberle
2010-May-05 12:21 UTC
[dtrace-discuss] ?: DTrace of connection establishment attempts for destination address/port
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''. 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
Jim Mauro
2010-May-05 13:20 UTC
[dtrace-discuss] ?: DTrace of connection establishment attempts for destination address/port
Hi Steffen - I actually think that code did change quite a bit from s10 to nv. I''m not sure what you need to do, but you may want to grab Brendan''s DTraceToolKit and have a look at tcptop and tcpsnoop, and have a look at how Brendan did it for s10. Thanks, /jim On May 5, 2010, at 8:21 AM, 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''. > > 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 at opensolaris.org
max at bruningsystems.com
2010-May-05 13:57 UTC
[dtrace-discuss] ?: DTrace of connection establishment attempts for destination address/port
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 at opensolaris.org >
Steffen Weiberle
2010-May-05 19:33 UTC
[dtrace-discuss] ?: DTrace of connection establishment attempts for destination address/port
On 05/05/10 09:20, Jim Mauro wrote:> Hi Steffen - I actually think that code did change quite a bit > from s10 to nv. > > I''m not sure what you need to do, but you may want to grab > Brendan''s DTraceToolKit and have a look at tcptop and > tcpsnoop, and have a look at how Brendan did it for s10. >Hi Jim, thanks. I did. In the tcp_connect in tcptop he only used arg0. The connections did not have anything that I could see. Just tried to run the two, and neither works on 10/09 :( Steffen> Thanks, > /jim > > On May 5, 2010, at 8:21 AM, 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''. >> >> 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 at opensolaris.org >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20100505/62748872/attachment.html>
Alan Maguire
2010-May-06 07:25 UTC
[dtrace-discuss] ?: DTrace of connection establishment attempts for destination address/port
On 05/05/2010 13:21, 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. >Just wanted to note that this sort of thing will become easier (for Nevada at least) when the tcp provider delivers (which should be soon): tcp:::connect-refused { printf("connection refused: pid %d, remote host/port %s/%d\n", args[1]->cs_pid, args[3]->tcps_raddr, args[3]->tcps_rport); } Alan> (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''. > > 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 at opensolaris.org