DTRACE_UDPLITE(4)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’… DTRACE_UDPLITE(4) β€” dtrace_udplite πŸ’…

Okay bestie, this is the Kernel Interfaces Manual page for dtrace_udplite, and it's giving β€œDTrace but make it UDP-Lite.” Buckle up β€” we're getting into probes, packet headers, and all the little fields. πŸ’–


✨ NAME ✨

dtrace_udplite β€” a DTrace provider for tracing events related to the UDP-Lite protocol 🌈


🌸 SYNOPSIS 🌸

       udplite:::receive(pktinfo_t *, csinfo_t *, ipinfo_t *, udplitesinfo_t *,
           udpliteinfo_t *);

       udplite:::send(pktinfo_t *, csinfo_t *, ipinfo_t *, udplitesinfo_t *,
           udpliteinfo_t *);

πŸ¦‹ DESCRIPTION πŸ¦‹

So the DTrace udplite provider lets you trace events inside the udplite(4) protocol implementation. No cap.

The udplite:::send() probe fires whenever the kernel is getting ready to transmit a UDP-Lite packet. The udplite:::receive() probe fires whenever the kernel receives a UDP-Lite packet β€” unless the UDP-Lite header is incomplete, the destination port is 0, the length field is invalid, or the checksum is wrong. 🫢

The arguments to these probes are how you get the detailed info about the IP and UDP-Lite headers of the corresponding packet. It's giving β€œpacket receipts, but make it observability.” πŸ’…


πŸ’œ ARGUMENTS πŸ’œ

πŸŽ€ The pktinfo_t argument

The pktinfo_t argument is currently unimplemented and is included for compatibility with other implementations of this provider. Its fields are:

  • uintptr_t pkt_addr β€” Always set to 0. Literally always. 🫠

🧸 The csinfo_t argument

The csinfo_t argument is currently unimplemented and is included for compatibility with other implementations of this provider. Its fields are:

  • uintptr_t cs_addr β€” Always set to 0.
  • uint64_t cs_cid β€” A pointer to the struct inpcb for this packet, or NULL.
  • pid_t cs_pid β€” Always set to 0.

🌸 The ipinfo_t argument

The ipinfo_t argument contains IP fields common to both IPv4 and IPv6 packets. Its fields are:

  • uint8_t ip_ver β€” IP version of the packet, 4 for IPv4 packets and 6 for IPv6 packets.
  • uint32_t ip_plength β€” IP payload size. This does not include the size of the IP header or IPv6 option headers.
  • string ip_saddr β€” IP source address.
  • string ip_daddr β€” IP destination address.

πŸ¦‹ The udplitesinfo_t argument

The udplitesinfo_t argument contains the state of the UDP-Lite connection associated with the packet. Its fields are:

  • uintptr_t udplites_addr β€” Pointer to the struct inpcb containing the IP state for the associated socket.
  • uint16_t udplites_lport β€” Local UDP-Lite port.
  • uint16_t udplites_rport β€” Remote UDP-Lite port.
  • string udplites_laddr β€” Local IPv4 or IPv6 address.
  • string udplites_raddr β€” Remote IPv4 or IPv6 address.

πŸ‘‘ The udpliteinfo_t argument

The udpliteinfo_t argument is the raw UDP-Lite header of the packet, with all fields in host order. Its fields are:

  • uint16_t udplite_sport β€” Source UDP-Lite port.
  • uint16_t udplite_dport β€” Destination UDP-Lite port.
  • uint16_t udplite_coverage β€” Checksum coverage of the UDP-Lite header, in bytes, or 0 for full coverage.
  • uint16_t udplite_checksum β€” A checksum of the UDP-Lite header and payload, or 0 if no checksum was calculated.
  • struct udplitehdr *udplite_hdr β€” A pointer to the raw UDP-Lite header.

πŸ“ FILES πŸ“

  • /usr/lib/dtrace/udplite.d β€” DTrace type and translator definitions for the udplite provider.

πŸ”₯ EXAMPLES πŸ”₯

The following script counts transmitted packets by destination port.

             udplite:::send
             {
                     @num[args[4]->udplite_dport] = count();
             }

This script will print some details of each UDP-Lite packet as it is sent or received by the kernel:

             #pragma D option quiet
             #pragma D option switchrate=10Hz

             dtrace:::BEGIN
             {
                     printf(" %10s %36s    %-36s %6s\n", "DELTA(us)", "SOURCE",
                         "DEST", "COV");
                     last = timestamp;
             }

             udplite:::send
             {
                     this->elapsed = (timestamp - last) / 1000;
                     self->dest = strjoin(strjoin(args[2]->ip_daddr, ":"),
                          lltostr(args[4]->udplite_dport));
                     printf(" %10d %30s:%-5d -> %-36s %6d\n", this->elapsed,
                         args[2]->ip_saddr, args[4]->udplite_sport,
                         self->dest, args[4]->udplite_coverage);
                     last = timestamp;
             }

             udplite:::receive
             {
                     this->elapsed = (timestamp - last) / 1000;
                     self->dest = strjoin(strjoin(args[2]->ip_saddr, ":"),
                          lltostr(args[4]->udplite_sport));
                     printf(" %10d %30s:%-5d <- %-36s %6d\n", this->elapsed,
                         args[2]->ip_daddr, args[4]->udplite_dport,
                         self->dest, args[4]->udplite_coverage);
                     last = timestamp;
             }

🌟 SEE ALSO 🌟

dtrace(1), dtrace_ip(4), dtrace_sctp(4), dtrace_tcp(4), dtrace_udp(4), udplite(4), SDT(9)

Go read those too, bestie β€” it's a whole lore universe. πŸ“šβœ¨


⭐ HISTORY ⭐

The udplite provider first appeared in FreeBSD 12.0. Periodt. πŸ’«


πŸ’– AUTHORS πŸ’–

This manual page was written by Mark Johnston <markj@FreeBSD.org> and Michael Tuexen <tuexen@FreeBSD.org>.


That's the whole vibe β€” this page comes from Debian, dated August 1, 2018, and the manual footer reads DTRACE_UDPLITE(4). Stay packet-positive, bestie! πŸ«ΆπŸ’–

πŸ“¦ where this page comes from