DTRACE_IP(4) | Device Drivers Manual | DTRACE_IP(4) |
dtrace_ip
— a
DTrace provider for tracing events related to the IPv4 and IPv6
protocols
ip:::receive
(pktinfo_t
*, csinfo_t *,
ipinfo_t *,
ifinfo_t *,
ipv4info_t *,
ipv6info_t *);
ip:::send
(pktinfo_t
*, csinfo_t *,
ipinfo_t *,
ifinfo_t *,
ipv4info_t *,
ipv6info_t *);
The DTrace ip
provider allows users to
trace events in the ip(4) and ip6(4)
protocol implementations. The
ip:::send
()
probe fires whenever the kernel prepares to transmit an IP packet, and the
ip:::receive
()
probe fires whenever the kernel receives an IP packet. The arguments to
these probes can be used to obtain detailed information about the IP headers
of the corresponding packet, as well as the network interface on which the
packet was sent or received. Unlike the dtrace_tcp(4) and
dtrace_udp(4) providers, ip
provider probes are triggered by forwarded packets. That is, the probes will
fire on packets that are not destined to the local host.
The pktinfo_t argument is currently unimplemented and is included for compatibility with other implementations of this provider. Its fields are:
The csinfo_t argument is currently unimplemented and is included for compatibility with other implementations of this provider. Its fields are:
NULL
.The ipinfo_t argument contains IP fields common to both IPv4 and IPv6 packets. Its fields are:
The ifinfo_t argument
describes the outgoing and incoming interfaces for the packet in the
ip:::send
()
and
ip:::receive
()
probes respectively. Its fields are:
The ipv4info_t argument contains
the fields of the IP header for IPv4 packets. This argument is
NULL
for IPv6 packets. DTrace scripts should use the
ip_ver
()
field in the ipinfo_t argument to determine whether to
use this argument. Its fields are:
The ipv6info_t argument
contains the fields of the IP header for IPv6 packets. Its fields are not
set for IPv4 packets; as with the ipv4info_t argument,
the
ip_ver
()
field should be used to determine whether this argument is valid. Its fields
are:
ip
provider.The following script counts received packets by remote host address.
ip:::receive { @num[args[2]->ip_saddr] = count(); }
This script will print some details of each IP packet as it is sent or received by the kernel:
#pragma D option quiet #pragma D option switchrate=10Hz dtrace:::BEGIN { printf(" %10s %30s %-30s %8s %6s\n", "DELTA(us)", "SOURCE", "DEST", "INT", "BYTES"); last = timestamp; } ip:::send { this->elapsed = (timestamp - last) / 1000; printf(" %10d %30s -> %-30s %8s %6d\n", this->elapsed, args[2]->ip_saddr, args[2]->ip_daddr, args[3]->if_name, args[2]->ip_plength); last = timestamp; } ip:::receive { this->elapsed = (timestamp - last) / 1000; printf(" %10d %30s <- %-30s %8s %6d\n", this->elapsed, args[2]->ip_daddr, args[2]->ip_saddr, args[3]->if_name, args[2]->ip_plength); last = timestamp; }
This provider is compatible with the ip
providers found in Solaris and Darwin.
dtrace(1), dtrace_tcp(4), dtrace_udp(4), ip(4), ip6(4), ifnet(9), SDT(9)
The ip
provider first appeared in
FreeBSD 10.0.
This manual page was written by Mark Johnston <markj@FreeBSD.org>.
September 14, 2015 | Debian |