udp Provider

Skip to end of metadata
Go to start of metadata

udp Provider

The udp provider provides probes for tracing the UDP protocol.

This provider integrated into Solaris Nevada build 142.

Top

Probes

The udp probes are described in the table below.

udp Probes
Probe Description
send Probe that fires whenever UDP sends a datagram.
receive Probe that fires whenever UDP receives a datagram.

The send and receive probes trace datagrams on physical interfaces and also packets on loopback interfaces that are processed by udp.
Top

Arguments

The argument types for the udp probes are listed in the table below. The arguments are described in the following section.

udp Probe Arguments
Probe args[0] args[1] args[2] args[3] args[4]
send pktinfo_t * csinfo_t * ipinfo_t * udpsinfo_t * udpinfo_t *
receive pktinfo_t * csinfo_t * ipinfo_t * udpsinfo_t * udpinfo_t *

Top

pktinfo_t structure

The pktinfo_t structure is where packet ID info can be made available for deeper analysis if packet IDs become supported by the kernel in the future.
The pkt_addr member is currently always NULL.

typedef struct pktinfo {
        uintptr_t pkt_addr;             /* currently always NULL */
} pktinfo_t;

Top

csinfo_t structure

The csinfo_t structure is where connection state info is made available. It contains a unique (system-wide) connection ID, and the process ID and zone ID associated with the connection.

typedef struct csinfo {
        uintptr_t cs_addr;
	uint64_t cs_cid;
	pid_t cs_pid;
	zoneid_t cs_zoneid;
 } csinfo_t;
csinfo_t Members
cs_addr Address of translated ip_xmit_attr_t *.
cs_cid Connection id. A unique per-connection identifier which identifies the connection during its lifetime.
cs_pid Process ID associated with the connection.
cs_zoneid Zone ID associated with the connection.

Top

ipinfo_t structure

The ipinfo_t structure contains common IP info for both IPv4 and IPv6.

typedef struct ipinfo {
        uint8_t ip_ver;                 /* IP version (4, 6) */
        uint16_t ip_plength;            /* payload length */
        string ip_saddr;                /* source address */
        string ip_daddr;                /* destination address */
} ipinfo_t;

These values are read at the time the probe fired in UDP, and so ip_plength is the expected IP payload length - however the IP layer may add headers (such as AH and ESP) which will increase the actual payload length. To examine this, also trace packets using the ip provider.

ipinfo_t Members
ip_ver IP version number. Currently either 4 or 6.
ip_plength Payload length in bytes. This is the length of the packet at the time of tracing, excluding the IP header.
ip_saddr Source IP address, as a string. For IPv4 this is a dotted decimal quad, IPv6 follows RFC-1884 convention 2 with lower case hexadecimal digits.
ip_daddr Destination IP address, as a string. For IPv4 this is a dotted decimal quad, IPv6 follows RFC-1884 convention 2 with lower case hexadecimal digits.

Top

udpsinfo_t structure

The udpsinfo_t structure contains udp state info.

typedef struct udpsinfo {
        uintptr_t       udps_addr;
	uint16_t	upds_lport;	/* local port */
	uint16_t	udps_fport;	/* remote port */
	string	        udps_laddr;	/* local address, as a string */
	string	        udps_faddr;	/* remote address, as a string */
} udpsinfo_t;
udpsinfo_t Members
udps_addr Address of translated udp_t *.
udps_lport local port associated with the UDP connection.
udps_fport remote port associated with the UDP connection.
udps_laddr local address associated with the UDP connection, as a string
udps_fport remote address associated with the UDP connection, as a string

Top

udpinfo_t structure

The udpinfo_t structure is a DTrace translated version of the UDP header.

typedef struct udpinfo {
	uint16_t udp_sport;             /* source port */
	uint16_t udp_dport;             /* destination port */
	uint16_t udp_length;            /* total length */
	uint16_t udp_checksum;          /* headers + data checksum */
	udpha_t *udp_hdr;               /* raw UDP header */
} udpinfo_t;
udpinfo_t Members
udp_sport UDP source port.
udp_dport UDP destination port.
udp_length Payload length in bytes.
udp_checksum Checksum of UDP header and payload.
udp_hdr Pointer to raw UDP header at time of tracing.

See RFC-768 for a detailed explanation of the standard UDP header fields and flags.

Top

Examples

Some simple examples of udp provider usage follow.

Packets by host address

This DTrace one-liner counts UDP received packets by host address:

# dtrace -n 'udp:::receive { @[args[2]->ip_saddr] = count(); }'
dtrace: description 'udp:::receive ' matched 5 probes
^C

  127.0.0.1                                                         7
  fe80::214:4fff:fe8d:59aa                                         14
  192.168.2.30                                                     43
  192.168.1.109                                                    44
  192.168.2.88                                                   3722

The output above shows that 7 UDP packets were recieved from 127.0.0.1, 14 UDP packets from the IPv6 host fe80::214:4fff:fe8d:59aa, etc.

Packets by local port

This DTrace one-liner counts UDP received packets by the local UDP port:

# dtrace -n 'udp:::receive { @[args[4]->udp_dport] = count(); }'
dtrace: description 'udp:::receive ' matched 1 probe
^C

 33294                1
 33822                1
 38961                1
 44433                1
 46258                1
 46317                1
 47511                1
 50581                1
 54685                1
 56491                1
 59056                1
 62171                1
 62769                1
 64231                1

The output above shows that 1 packet was received for port 33294, 1 packet was received for port 33822, etc.

Sent size distribution

This DTrace one-liner prints distribution plots of IP payload size by destination, for UDP sends:

# dtrace -n 'udp:::send { @[args[2]->ip_daddr] = quantize(args[2]->ip_plength); }'
dtrace: description 'udp:::send ' matched 6 probes
^C

  129.156.86.11                                     
           value  ------------- Distribution ------------- count    
              16 |                                         0        
              32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 14       
              64 |                                         0        


Top

udp Stability

The udp provider uses DTrace's stability mechanism to describe its stabilities, as shown in the following table. For more information about the stability mechanism, see Chapter 39, Stability.

Element Name stability Data stability Dependency class
Provider Evolving Evolving ISA
Module Private Private Unknown
Function Private Private Unknown
Name Evolving Evolving ISA
Arguments Evolving Evolving ISA
Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Oct 23, 2013

    In udpsinfo_t structure,
    typedef struct udpsinfo {
    uintptr_t udps_addr;
    uint16_t upds_lport; /* local port */
    uint16_t udps_fport; /* remote port */
    string udps_laddr; /* local address, as a string */
    string udps_faddr; /* remote address, as a string */
    } udpsinfo_t;
    "udps_fport" shoud be "udps_rport", "upds_lport" should be "udps_lport".

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Oracle community and they might not be employed or in any way formally affiliated with Oracle. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Oracle nor any other party necessarily agrees with them.