xref: /freebsd/share/man/man4/dtrace_udplite.4 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1*7bda9663SMichael Tuexen.\" Copyright (c) 2015 Mark Johnston <markj@FreeBSD.org>
2*7bda9663SMichael Tuexen.\" Copyright (c) 2018 Michael Tuexen <tuexen@FreeBSD.org>
3*7bda9663SMichael Tuexen.\" All rights reserved.
4*7bda9663SMichael Tuexen.\"
5*7bda9663SMichael Tuexen.\" Redistribution and use in source and binary forms, with or without
6*7bda9663SMichael Tuexen.\" modification, are permitted provided that the following conditions
7*7bda9663SMichael Tuexen.\" are met:
8*7bda9663SMichael Tuexen.\" 1. Redistributions of source code must retain the above copyright
9*7bda9663SMichael Tuexen.\"    notice, this list of conditions and the following disclaimer.
10*7bda9663SMichael Tuexen.\" 2. Redistributions in binary form must reproduce the above copyright
11*7bda9663SMichael Tuexen.\"    notice, this list of conditions and the following disclaimer in the
12*7bda9663SMichael Tuexen.\"    documentation and/or other materials provided with the distribution.
13*7bda9663SMichael Tuexen.\"
14*7bda9663SMichael Tuexen.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15*7bda9663SMichael Tuexen.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16*7bda9663SMichael Tuexen.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17*7bda9663SMichael Tuexen.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18*7bda9663SMichael Tuexen.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19*7bda9663SMichael Tuexen.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20*7bda9663SMichael Tuexen.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21*7bda9663SMichael Tuexen.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22*7bda9663SMichael Tuexen.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23*7bda9663SMichael Tuexen.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24*7bda9663SMichael Tuexen.\" SUCH DAMAGE.
25*7bda9663SMichael Tuexen.\"
26*7bda9663SMichael Tuexen.Dd August 1, 2018
27*7bda9663SMichael Tuexen.Dt DTRACE_UDPLITE 4
28*7bda9663SMichael Tuexen.Os
29*7bda9663SMichael Tuexen.Sh NAME
30*7bda9663SMichael Tuexen.Nm dtrace_udplite
31*7bda9663SMichael Tuexen.Nd a DTrace provider for tracing events related to the UDP-Lite protocol
32*7bda9663SMichael Tuexen.Sh SYNOPSIS
33*7bda9663SMichael Tuexen.Fn udplite:::receive "pktinfo_t *" "csinfo_t *" "ipinfo_t *" "udplitesinfo_t *" \
34*7bda9663SMichael Tuexen    "udpliteinfo_t *"
35*7bda9663SMichael Tuexen.Fn udplite:::send "pktinfo_t *" "csinfo_t *" "ipinfo_t *" "udplitesinfo_t *" \
36*7bda9663SMichael Tuexen    "udpliteinfo_t *"
37*7bda9663SMichael Tuexen.Sh DESCRIPTION
38*7bda9663SMichael TuexenThe DTrace
39*7bda9663SMichael Tuexen.Nm udplite
40*7bda9663SMichael Tuexenprovider allows users to trace events in the
41*7bda9663SMichael Tuexen.Xr udplite 4
42*7bda9663SMichael Tuexenprotocol implementation.
43*7bda9663SMichael TuexenThe
44*7bda9663SMichael Tuexen.Fn udplite:::send
45*7bda9663SMichael Tuexenprobe fires whenever the kernel prepares to transmit a UDP-Lite packet, and the
46*7bda9663SMichael Tuexen.Fn udplite:::receive
47*7bda9663SMichael Tuexenprobe fires whenever the kernel receives a UDP-Lite packet, unless
48*7bda9663SMichael Tuexenthe UDP-Lite header is incomplete,
49*7bda9663SMichael Tuexenthe destination port is 0,
50*7bda9663SMichael Tuexenthe length field is invalid,
51*7bda9663SMichael Tuexenor the checksum is wrong.
52*7bda9663SMichael TuexenThe arguments to these probes can be used to obtain detailed information about
53*7bda9663SMichael Tuexenthe IP and UDP-Lite headers of the corresponding packet.
54*7bda9663SMichael Tuexen.Sh ARGUMENTS
55*7bda9663SMichael TuexenThe
56*7bda9663SMichael Tuexen.Vt pktinfo_t
57*7bda9663SMichael Tuexenargument is currently unimplemented and is included for compatibility with other
58*7bda9663SMichael Tuexenimplementations of this provider.
59*7bda9663SMichael TuexenIts fields are:
60*7bda9663SMichael Tuexen.Bl -tag -width "uintptr_t pkt_addr" -offset indent
61*7bda9663SMichael Tuexen.It Vt uintptr_t pkt_addr
62*7bda9663SMichael TuexenAlways set to 0.
63*7bda9663SMichael Tuexen.El
64*7bda9663SMichael Tuexen.Pp
65*7bda9663SMichael TuexenThe
66*7bda9663SMichael Tuexen.Vt csinfo_t
67*7bda9663SMichael Tuexenargument is currently unimplemented and is included for compatibility with other
68*7bda9663SMichael Tuexenimplementations of this provider.
69*7bda9663SMichael TuexenIts fields are:
70*7bda9663SMichael Tuexen.Bl -tag -width "uintptr_t cs_addr" -offset indent
71*7bda9663SMichael Tuexen.It Vt uintptr_t cs_addr
72*7bda9663SMichael TuexenAlways set to 0.
73*7bda9663SMichael Tuexen.It Vt uint64_t cs_cid
74*7bda9663SMichael TuexenA pointer to the
75*7bda9663SMichael Tuexen.Vt struct inpcb
76*7bda9663SMichael Tuexenfor this packet, or
77*7bda9663SMichael Tuexen.Dv NULL .
78*7bda9663SMichael Tuexen.It Vt pid_t cs_pid
79*7bda9663SMichael TuexenAlways set to 0.
80*7bda9663SMichael Tuexen.El
81*7bda9663SMichael Tuexen.Pp
82*7bda9663SMichael TuexenThe
83*7bda9663SMichael Tuexen.Vt ipinfo_t
84*7bda9663SMichael Tuexenargument contains IP fields common to both IPv4 and IPv6 packets.
85*7bda9663SMichael TuexenIts fields are:
86*7bda9663SMichael Tuexen.Bl -tag -width "uint32_t ip_plength" -offset indent
87*7bda9663SMichael Tuexen.It Vt uint8_t ip_ver
88*7bda9663SMichael TuexenIP version of the packet, 4 for IPv4 packets and 6 for IPv6 packets.
89*7bda9663SMichael Tuexen.It Vt uint32_t ip_plength
90*7bda9663SMichael TuexenIP payload size.
91*7bda9663SMichael TuexenThis does not include the size of the IP header or IPv6 option headers.
92*7bda9663SMichael Tuexen.It Vt string ip_saddr
93*7bda9663SMichael TuexenIP source address.
94*7bda9663SMichael Tuexen.It Vt string ip_daddr
95*7bda9663SMichael TuexenIP destination address.
96*7bda9663SMichael Tuexen.El
97*7bda9663SMichael Tuexen.Pp
98*7bda9663SMichael TuexenThe
99*7bda9663SMichael Tuexen.Vt udplitesinfo_t
100*7bda9663SMichael Tuexenargument contains the state of the UDP-Lite connection associated with the packet.
101*7bda9663SMichael TuexenIts fields are:
102*7bda9663SMichael Tuexen.Bl -tag -width "uintptr_t udplites_addr" -offset indent
103*7bda9663SMichael Tuexen.It Vt uintptr_t udplites_addr
104*7bda9663SMichael TuexenPointer to the
105*7bda9663SMichael Tuexen.Vt struct inpcb
106*7bda9663SMichael Tuexencontaining the IP state for the associated socket.
107*7bda9663SMichael Tuexen.It Vt uint16_t udplites_lport
108*7bda9663SMichael TuexenLocal UDP-Lite port.
109*7bda9663SMichael Tuexen.It Vt uint16_t udplites_rport
110*7bda9663SMichael TuexenRemote UDP-Lite port.
111*7bda9663SMichael Tuexen.It Vt string udplites_laddr
112*7bda9663SMichael TuexenLocal IPv4 or IPv6 address.
113*7bda9663SMichael Tuexen.It Vt string udplites_raddr
114*7bda9663SMichael TuexenRemote IPv4 or IPv6 address.
115*7bda9663SMichael Tuexen.El
116*7bda9663SMichael Tuexen.Pp
117*7bda9663SMichael TuexenThe
118*7bda9663SMichael Tuexen.Vt udpliteinfo_t
119*7bda9663SMichael Tuexenargument is the raw UDP-Lite header of the packet, with all fields in host order.
120*7bda9663SMichael TuexenIts fields are:
121*7bda9663SMichael Tuexen.Bl -tag -width "struct udplitehdr *udplite_hdr" -offset indent
122*7bda9663SMichael Tuexen.It Vt uint16_t udplite_sport
123*7bda9663SMichael TuexenSource UDP-Lite port.
124*7bda9663SMichael Tuexen.It Vt uint16_t udplite_dport
125*7bda9663SMichael TuexenDestination UDP-Lite port.
126*7bda9663SMichael Tuexen.It Vt uint16_t udplite_coverage
127*7bda9663SMichael TuexenChecksum coverage of the UDP-Lite header, in bytes, or 0 for full coverage.
128*7bda9663SMichael Tuexen.It Vt uint16_t udplite_checksum
129*7bda9663SMichael TuexenA checksum of the UDP-Lite header and payload, or 0 if no checksum was calculated.
130*7bda9663SMichael Tuexen.It Vt struct udplitehdr *udplite_hdr
131*7bda9663SMichael TuexenA pointer to the raw UDP-Lite header.
132*7bda9663SMichael Tuexen.El
133*7bda9663SMichael Tuexen.Sh FILES
134*7bda9663SMichael Tuexen.Bl -tag -width "/usr/lib/dtrace/udplite.d" -compact
135*7bda9663SMichael Tuexen.It Pa /usr/lib/dtrace/udplite.d
136*7bda9663SMichael TuexenDTrace type and translator definitions for the
137*7bda9663SMichael Tuexen.Nm udplite
138*7bda9663SMichael Tuexenprovider.
139*7bda9663SMichael Tuexen.El
140*7bda9663SMichael Tuexen.Sh EXAMPLES
141*7bda9663SMichael TuexenThe following script counts transmitted packets by destination port.
142*7bda9663SMichael Tuexen.Bd -literal -offset indent
143*7bda9663SMichael Tuexenudplite:::send
144*7bda9663SMichael Tuexen{
145*7bda9663SMichael Tuexen        @num[args[4]->udplite_dport] = count();
146*7bda9663SMichael Tuexen}
147*7bda9663SMichael Tuexen.Ed
148*7bda9663SMichael Tuexen.Pp
149*7bda9663SMichael TuexenThis script will print some details of each UDP-Lite packet as it is sent or received
150*7bda9663SMichael Tuexenby the kernel:
151*7bda9663SMichael Tuexen.Bd -literal -offset indent
152*7bda9663SMichael Tuexen#pragma D option quiet
153*7bda9663SMichael Tuexen#pragma D option switchrate=10Hz
154*7bda9663SMichael Tuexen
155*7bda9663SMichael Tuexendtrace:::BEGIN
156*7bda9663SMichael Tuexen{
157*7bda9663SMichael Tuexen        printf(" %10s %36s    %-36s %6s\\n", "DELTA(us)", "SOURCE",
158*7bda9663SMichael Tuexen            "DEST", "COV");
159*7bda9663SMichael Tuexen        last = timestamp;
160*7bda9663SMichael Tuexen}
161*7bda9663SMichael Tuexen
162*7bda9663SMichael Tuexenudplite:::send
163*7bda9663SMichael Tuexen{
164*7bda9663SMichael Tuexen        this->elapsed = (timestamp - last) / 1000;
165*7bda9663SMichael Tuexen        self->dest = strjoin(strjoin(args[2]->ip_daddr, ":"),
166*7bda9663SMichael Tuexen             lltostr(args[4]->udplite_dport));
167*7bda9663SMichael Tuexen        printf(" %10d %30s:%-5d -> %-36s %6d\\n", this->elapsed,
168*7bda9663SMichael Tuexen            args[2]->ip_saddr, args[4]->udplite_sport,
169*7bda9663SMichael Tuexen            self->dest, args[4]->udplite_coverage);
170*7bda9663SMichael Tuexen        last = timestamp;
171*7bda9663SMichael Tuexen}
172*7bda9663SMichael Tuexen
173*7bda9663SMichael Tuexenudplite:::receive
174*7bda9663SMichael Tuexen{
175*7bda9663SMichael Tuexen        this->elapsed = (timestamp - last) / 1000;
176*7bda9663SMichael Tuexen        self->dest = strjoin(strjoin(args[2]->ip_saddr, ":"),
177*7bda9663SMichael Tuexen             lltostr(args[4]->udplite_sport));
178*7bda9663SMichael Tuexen        printf(" %10d %30s:%-5d <- %-36s %6d\\n", this->elapsed,
179*7bda9663SMichael Tuexen            args[2]->ip_daddr, args[4]->udplite_dport,
180*7bda9663SMichael Tuexen            self->dest, args[4]->udplite_coverage);
181*7bda9663SMichael Tuexen        last = timestamp;
182*7bda9663SMichael Tuexen}
183*7bda9663SMichael Tuexen.Ed
184*7bda9663SMichael Tuexen.Sh SEE ALSO
185*7bda9663SMichael Tuexen.Xr dtrace 1 ,
186*7bda9663SMichael Tuexen.Xr dtrace_ip 4 ,
187*7bda9663SMichael Tuexen.Xr dtrace_sctp 4 ,
188*7bda9663SMichael Tuexen.Xr dtrace_tcp 4 ,
189*7bda9663SMichael Tuexen.Xr dtrace_udp 4 ,
190*7bda9663SMichael Tuexen.Xr udplite 4 ,
191*7bda9663SMichael Tuexen.Xr SDT 9
192*7bda9663SMichael Tuexen.Sh HISTORY
193*7bda9663SMichael TuexenThe
194*7bda9663SMichael Tuexen.Nm udplite
195*7bda9663SMichael Tuexenprovider first appeared in
196*7bda9663SMichael Tuexen.Fx
197*7bda9663SMichael Tuexen12.0.
198*7bda9663SMichael Tuexen.Sh AUTHORS
199*7bda9663SMichael TuexenThis manual page was written by
200*7bda9663SMichael Tuexen.An Mark Johnston Aq Mt markj@FreeBSD.org
201*7bda9663SMichael Tuexenand
202*7bda9663SMichael Tuexen.An Michael Tuexen Aq Mt tuexen@FreeBSD.org .
203