DTRACE_UDPLITE(4)

πŸ’– NAME πŸ’–

dtrace_udplite β€” a DTrace provider for tracing events related to the UDP-Lite protocol πŸ’…

okay bestie so this is a section 4 page from the Kernel Interfaces Manual, and it's literally all about the DTrace provider that lets you peek at UDP-Lite stuff happening in the kernel ✨


πŸŽ€ 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 πŸ¦‹

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. πŸ™ˆ (sorry bestie, those ones just don't make it to the probe)

The arguments to these probes are your besties for getting super detailed info about the IP and UDP-Lite headers of the packet in question. it's giving forensic scientist πŸ”


✨ ARGUMENTS ✨

🌸 pktinfo_t

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

  • uintptr_t pkt_addr β€” always set to 0.

🌸 csinfo_t

The csinfo_t argument is also currently unimplemented and likewise just there 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.

🌸 ipinfo_t

The ipinfo_t argument carries the IP fields that are 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. Heads up: 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.

🌸 udplitesinfo_t

The udplitesinfo_t argument holds 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.

🌸 udpliteinfo_t

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. the blueprint, fr fr 🧚

πŸ’œ EXAMPLES πŸ’œ

This lil script right here counts transmitted packets by destination port. iconic behaviour:

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

And this one prints some details of every UDP-Lite packet as it's 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)

like, go read those too, they're all in the same friend group πŸ’–


πŸ“œ HISTORY πŸ“œ

The udplite provider first appeared in FreeBSD 12.0. a whole era ✨


🫢 AUTHORS 🫢

This manual page was written by Mark Johnston <markj@FreeBSD.org> and Michael Tuexen <tuexen@FreeBSD.org>. absolute legends, no notes πŸ’…


and that's the whole page, bestie!! πŸ¦‹ this one shipped from Debian, dated August 1, 2018, and it lives in the manual as DTRACE_UDPLITE(4). mwah, slay, periodt πŸ’–πŸŽ€πŸŒΈ

πŸ“¦ where this page comes from