Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Aug 2013 11:36:13 -0400
From:      George Neville-Neil <gnn@freebsd.org>
To:        Mark Johnston <markj@freebsd.org>
Cc:        freebsd-net@freebsd.org, freebsd-dtrace@freebsd.org
Subject:   Re: DTrace network providers
Message-ID:  <5CA94104-0489-4DD2-8EC2-D42FF7339E39@freebsd.org>
In-Reply-To: <20130821045926.GA17196@raichu>
References:  <20130821045926.GA17196@raichu>

next in thread | previous in thread | raw e-mail | index | archive | help

On Aug 21, 2013, at 1:00 , Mark Johnston <markj@freebsd.org> wrote:

> Hello!
>=20
> I've ported the ip, tcp and udp DTrace providers to FreeBSD, following
> the Solaris documentation here:
>=20
> https://wikis.oracle.com/display/DTrace/ip+Provider
> https://wikis.oracle.com/display/DTrace/tcp+Provider
> https://wikis.oracle.com/display/DTrace/udp+Provider
>=20
> My implementation of these providers makes use of dynamic translators,
> for which FreeBSD support was added in r254468; this patch won't =
compile
> with earlier revisions. The use of dynamic translators means that
> existing DTrace scripts which use these providers will just work when =
run
> on FreeBSD - no modifications needed. In particular, all of the =
examples
> in the links above will work properly on FreeBSD with my diff.
>=20
> I've collected a bunch of example scripts for these providers and =
placed
> them here:
>=20
> http://people.freebsd.org/~markj/dtrace/network-providers/
>=20
> To run one you just need to execute "dtrace -s <script>".
>=20
> In general these providers make it trivial to monitor or count packets
> and bytes on a per-host/port/protocol/interface basis. One can also do
> neat things like watch TCP connection state transitions in real time
> (tcpstate.d) and measure connection latency. All of the probes
> correspond to logical events in their respective protocol
> implementations; all of the providers have send and receive probes, =
and
> the tcp provider has a few more.
>=20
> I didn't have to make any major changes to add support for these
> providers, but I've made a few small tweaks:
>=20
> 1. Add a little helper function for TCP state changes instead of
>   sprinkling a bunch of SDT_PROBE calls throughout the code.
> 2. Set the IPv6 payload size in TCP and UDP before calling =
ip6_output().
>   This is done for the send probes so that the ipinfo_t argument
>   can be used to get the payload size. It's not quite correct since it
>   doesn't include the length of IPv6 option headers (they aren't known
>   yet), but I think that's ok for the purposes of these providers.
> 3. Set the IPv4 header version in udp_output(). This is already done =
for
>   IPv6.
>=20
> I'm hoping that none of this (or the rest of the diff) is =
controversial,
> but I wanted to make sure, so any review would be really appreciated.
>=20
> The patch is here:
>=20
> =
http://people.freebsd.org/~markj/patches/network-providers/network-provide=
rs-1.diff
>=20
> It depends on r254468. To use it, just recompile the kernel (assuming
> that KDTRACE_HOOKS is enabled) and copy
> $SRC/cddl/lib/libdtrace/{ip,tcp,udp}.d (added by the patch) to
> /usr/lib/dtrace. Then the example scripts I linked above should just
> work.
>=20

Excellent work.  I'll test these today.

Best,
George





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5CA94104-0489-4DD2-8EC2-D42FF7339E39>