2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#pragma D depends_on module ip
2N/A#pragma D depends_on provider ip
2N/A
2N/Ainline int IPH_DF = @IPH_DF@;
2N/A#pragma D binding "1.5" IPH_DF
2N/Ainline int IPH_MF = @IPH_MF@;
2N/A#pragma D binding "1.5" IPH_MF
2N/A
2N/A#pragma D binding "1.5" IPPROTO_IP
2N/Ainline int IPPROTO_IP = @IPPROTO_IP@;
2N/A#pragma D binding "1.5" IPPROTO_HOPOPTS
2N/Ainline int IPPROTO_HOPOPTS = @IPPROTO_HOPOPTS@;
2N/A#pragma D binding "1.5" IPPROTO_ICMP
2N/Ainline int IPPROTO_ICMP = @IPPROTO_ICMP@;
2N/A#pragma D binding "1.5" IPPROTO_IGMP
2N/Ainline int IPPROTO_IGMP = @IPPROTO_IGMP@;
2N/A#pragma D binding "1.5" IPPROTO_GGP
2N/Ainline int IPPROTO_GGP = @IPPROTO_GGP@;
2N/A#pragma D binding "1.5" IPPROTO_ENCAP
2N/Ainline int IPPROTO_ENCAP = @IPPROTO_ENCAP@;
2N/A#pragma D binding "1.5" IPPROTO_TCP
2N/Ainline int IPPROTO_TCP = @IPPROTO_TCP@;
2N/A#pragma D binding "1.5" IPPROTO_EGP
2N/Ainline int IPPROTO_EGP = @IPPROTO_EGP@;
2N/A#pragma D binding "1.5" IPPROTO_PUP
2N/Ainline int IPPROTO_PUP = @IPPROTO_PUP@;
2N/A#pragma D binding "1.5" IPPROTO_UDP
2N/Ainline int IPPROTO_UDP = @IPPROTO_UDP@;
2N/A#pragma D binding "1.5" IPPROTO_IDP
2N/Ainline int IPPROTO_IDP = @IPPROTO_IDP@;
2N/A#pragma D binding "1.5" IPPROTO_IPV6
2N/Ainline int IPPROTO_IPV6 = @IPPROTO_IPV6@;
2N/A#pragma D binding "1.5" IPPROTO_ROUTING
2N/Ainline int IPPROTO_ROUTING = @IPPROTO_ROUTING@;
2N/A#pragma D binding "1.5" IPPROTO_FRAGMENT
2N/Ainline int IPPROTO_FRAGMENT = @IPPROTO_FRAGMENT@;
2N/A#pragma D binding "1.5" IPPROTO_RSVP
2N/Ainline int IPPROTO_RSVP = @IPPROTO_RSVP@;
2N/A#pragma D binding "1.5" IPPROTO_ESP
2N/Ainline int IPPROTO_ESP = @IPPROTO_ESP@;
2N/A#pragma D binding "1.5" IPPROTO_AH
2N/Ainline int IPPROTO_AH = @IPPROTO_AH@;
2N/A#pragma D binding "1.5" IPPROTO_ICMPV6
2N/Ainline int IPPROTO_ICMPV6 = @IPPROTO_ICMPV6@;
2N/A#pragma D binding "1.5" IPPROTO_NONE
2N/Ainline int IPPROTO_NONE = @IPPROTO_NONE@;
2N/A#pragma D binding "1.5" IPPROTO_DSTOPTS
2N/Ainline int IPPROTO_DSTOPTS = @IPPROTO_DSTOPTS@;
2N/A#pragma D binding "1.5" IPPROTO_HELLO
2N/Ainline int IPPROTO_HELLO = @IPPROTO_HELLO@;
2N/A#pragma D binding "1.5" IPPROTO_ND
2N/Ainline int IPPROTO_ND = @IPPROTO_ND@;
2N/A#pragma D binding "1.5" IPPROTO_EON
2N/Ainline int IPPROTO_EON = @IPPROTO_EON@;
2N/A#pragma D binding "1.5" IPPROTO_OSPF
2N/Ainline int IPPROTO_OSPF = @IPPROTO_OSPF@;
2N/A#pragma D binding "1.5" IPPROTO_PIM
2N/Ainline int IPPROTO_PIM = @IPPROTO_PIM@;
2N/A#pragma D binding "1.5" IPPROTO_SCTP
2N/Ainline int IPPROTO_SCTP = @IPPROTO_SCTP@;
2N/A#pragma D binding "1.5" IPPROTO_RAW
2N/Ainline int IPPROTO_RAW = @IPPROTO_RAW@;
2N/A#pragma D binding "1.5" IPPROTO_MAX
2N/Ainline int IPPROTO_MAX = @IPPROTO_MAX@;
2N/A
2N/A/*
2N/A * pktinfo is where packet ID info can be made available for deeper
2N/A * analysis if packet IDs become supported by the kernel in the future.
2N/A * The pkt_addr member is currently always NULL.
2N/A */
2N/Atypedef struct pktinfo {
2N/A uintptr_t pkt_addr;
2N/A} pktinfo_t;
2N/A
2N/A/*
2N/A * csinfo is where connection state info is made available.
2N/A */
2N/Atypedef struct csinfo {
2N/A uintptr_t cs_addr;
2N/A uint64_t cs_cid;
2N/A pid_t cs_pid;
2N/A zoneid_t cs_zoneid;
2N/A} csinfo_t;
2N/A
2N/A/*
2N/A * ipinfo contains common IP info for both IPv4 and IPv6.
2N/A */
2N/Atypedef struct ipinfo {
2N/A uint8_t ip_ver; /* IP version (4, 6) */
2N/A uint32_t ip_plength; /* payload length */
2N/A string ip_saddr; /* source address */
2N/A string ip_daddr; /* destination address */
2N/A} ipinfo_t;
2N/A
2N/A/*
2N/A * ifinfo contains network interface info.
2N/A */
2N/Atypedef struct ifinfo {
2N/A string if_name; /* interface name */
2N/A int8_t if_local; /* is delivered locally */
2N/A netstackid_t if_ipstack; /* ipstack ID */
2N/A uintptr_t if_addr; /* pointer to raw ill_t */
2N/A} ifinfo_t;
2N/A
2N/A/*
2N/A * ipv4info is a translated version of the IPv4 header (with raw pointer).
2N/A * These values are NULL if the packet is not IPv4.
2N/A */
2N/Atypedef struct ipv4info {
2N/A uint8_t ipv4_ver; /* IP version (4) */
2N/A uint8_t ipv4_ihl; /* header length, bytes */
2N/A uint8_t ipv4_tos; /* type of service field */
2N/A uint16_t ipv4_length; /* length (header + payload) */
2N/A uint16_t ipv4_ident; /* identification */
2N/A uint8_t ipv4_flags; /* IP flags */
2N/A uint16_t ipv4_offset; /* fragment offset */
2N/A uint8_t ipv4_ttl; /* time to live */
2N/A uint8_t ipv4_protocol; /* next level protocol */
2N/A string ipv4_protostr; /* next level protocol, as a string */
2N/A uint16_t ipv4_checksum; /* header checksum */
2N/A ipaddr_t ipv4_src; /* source address */
2N/A ipaddr_t ipv4_dst; /* destination address */
2N/A string ipv4_saddr; /* source address, string */
2N/A string ipv4_daddr; /* destination address, string */
2N/A ipha_t *ipv4_hdr; /* pointer to raw header */
2N/A} ipv4info_t;
2N/A
2N/A/*
2N/A * ipv6info is a translated version of the IPv6 header (with raw pointer).
2N/A * These values are NULL if the packet is not IPv6.
2N/A */
2N/Atypedef struct ipv6info {
2N/A uint8_t ipv6_ver; /* IP version (6) */
2N/A uint8_t ipv6_tclass; /* traffic class */
2N/A uint32_t ipv6_flow; /* flow label */
2N/A uint16_t ipv6_plen; /* payload length */
2N/A uint8_t ipv6_nexthdr; /* next header protocol */
2N/A string ipv6_nextstr; /* next header protocol, as a string */
2N/A uint8_t ipv6_hlim; /* hop limit */
2N/A in6_addr_t *ipv6_src; /* source address */
2N/A in6_addr_t *ipv6_dst; /* destination address */
2N/A string ipv6_saddr; /* source address, string */
2N/A string ipv6_daddr; /* destination address, string */
2N/A ip6_t *ipv6_hdr; /* pointer to raw header */
2N/A} ipv6info_t;
2N/A
2N/A/*
2N/A * void_ip_t is a void pointer to either an IPv4 or IPv6 header. It has
2N/A * its own type name so that a translator can be determined.
2N/A */
2N/Atypedef uintptr_t void_ip_t;
2N/A
2N/A/*
2N/A * __dtrace_ipsr_ill_t is used by the translator to take an ill_t plus an
2N/A * additional arg6 from the ip:::send and ip:::recieve probes, and translate
2N/A * them to an ifinfo_t.
2N/A */
2N/Atypedef ill_t __dtrace_ipsr_ill_t;
2N/A
2N/A/*
2N/A * __dtrace_tcp_void_ip_t is used by the translator to take either the
2N/A * non-NULL void_ip_t * passed in or, if it is NULL, uses arg3 (tcp_t *)
2N/A * from the tcp:::send and tcp:::recieve probes to translate to an ipinfo_t.
2N/A * When no headers are available in the TCP fusion case for tcp:::send
2N/A * and tcp:::receive case, this allows us to present the consumer with header
2N/A * data based on the tcp_t * content in order to hide the implementation
2N/A * details of TCP fusion.
2N/A */
2N/Atypedef void * __dtrace_tcp_void_ip_t;
2N/A
2N/A#pragma D binding "1.5" translator
2N/Atranslator pktinfo_t < mblk_t *M > {
2N/A pkt_addr = NULL;
2N/A};
2N/A
2N/A#pragma D binding "1.5" translator
2N/Atranslator csinfo_t < conn_t *C > {
2N/A cs_addr = NULL;
2N/A};
2N/A
2N/A#pragma D binding "1.6.3" translator
2N/Atranslator csinfo_t < ip_xmit_attr_t *C > {
2N/A cs_addr = (uintptr_t)C;
2N/A cs_cid = C ? C->ixa_conn_id : NULL;
2N/A cs_pid = C ? C->ixa_cpid : -1;
2N/A cs_zoneid = C ?
2N/A (C->ixa_ipst == NULL || C->ixa_ipst->ips_netstack == NULL ||
2N/A C->ixa_ipst->ips_netstack->netstack_stackid ==
2N/A @GLOBAL_NETSTACKID@ ||
2N/A C->ixa_cred == NULL ||
2N/A C->ixa_cred->cr_zone == NULL ||
2N/A C->ixa_cred->cr_uid == -1 ?
2N/A C->ixa_zoneid : C->ixa_cred->cr_zone->zone_id) : -1;
2N/A};
2N/A
2N/A#pragma D binding "1.5" translator
2N/Atranslator ipinfo_t < ipha_t *I > {
2N/A ip_ver = I->ipha_version_and_hdr_length >> 4;
2N/A ip_plength = ntohs(I->ipha_length) -
2N/A ((I->ipha_version_and_hdr_length & 0xf) << 2);
2N/A ip_saddr = inet_ntoa(&I->ipha_src);
2N/A ip_daddr = inet_ntoa(&I->ipha_dst);
2N/A};
2N/A
2N/A#pragma D binding "1.5" translator
2N/Atranslator ipinfo_t < ip6_t *I > {
2N/A ip_ver = *(uint8_t *)I >> 4;
2N/A ip_plength = ntohs(I->ip6_ctlun.ip6_un1.ip6_un1_plen);
2N/A ip_saddr = inet_ntoa6(&I->ip6_src);
2N/A ip_daddr = inet_ntoa6(&I->ip6_dst);
2N/A};
2N/A
2N/A#pragma D binding "1.5" translator
2N/Atranslator ipinfo_t < void_ip_t *I > {
2N/A ip_ver = I != NULL ? *(uint8_t *)I >> 4 : 0;
2N/A ip_plength = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
2N/A ntohs(((ipha_t *)I)->ipha_length) -
2N/A ((((ipha_t *)I)->ipha_version_and_hdr_length & 0xf) << 2) :
2N/A *(uint8_t *)I >> 4 == 6 ?
2N/A ntohs(((ip6_t *)I)->ip6_ctlun.ip6_un1.ip6_un1_plen) : 0) : 0;
2N/A ip_saddr = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
2N/A inet_ntoa(&((ipha_t *)I)->ipha_src) : *(uint8_t *)I >> 4 == 6 ?
2N/A inet_ntoa6(&((ip6_t *)I)->ip6_src) : "<unknown>") : "<unknown>";
2N/A ip_daddr = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
2N/A inet_ntoa(&((ipha_t *)I)->ipha_dst) : *(uint8_t *)I >> 4 == 6 ?
2N/A inet_ntoa6(&((ip6_t *)I)->ip6_dst) : "<unknown>") : "<unknown>";
2N/A};
2N/A
2N/A#pragma D binding "1.5" translator
2N/Atranslator ifinfo_t < __dtrace_ipsr_ill_t *I > {
2N/A if_name = I != NULL ? stringof(I->ill_name) : "<null>";
2N/A if_ipstack = I != NULL ? I->ill_ipst->ips_netstack->netstack_stackid
2N/A : 0;
2N/A if_local = arg6; /* probe dependent */
2N/A if_addr = (uintptr_t)I;
2N/A};
2N/A
2N/A/*
2N/A * Translate to an ipinfo_t * from either the non-NULL void_ip_t * passed in,
2N/A * or use arg3 (tcp_t *) to fabricate ip header info.
2N/A */
2N/A#pragma D binding "1.6.3" translator
2N/Atranslator ipinfo_t < __dtrace_tcp_void_ip_t *I > {
2N/A ip_ver = I != NULL ? *(uint8_t *)I >> 4 :
2N/A arg3 != NULL ? ((tcp_t *)arg3)->tcp_connp->conn_ipversion : 0;
2N/A ip_plength =
2N/A I != NULL && *(uint8_t *)I >> 4 == 4 ?
2N/A ntohs(((ipha_t *)I)->ipha_length) -
2N/A ((((ipha_t *)I)->ipha_version_and_hdr_length & 0xf) << 2) :
2N/A I != NULL && *(uint8_t *)I >> 4 == 6 ?
2N/A ntohs(((ip6_t *)I)->ip6_ctlun.ip6_un1.ip6_un1_plen) :
2N/A I != NULL ? 0 :
2N/A arg3 != NULL && probename == "send" ?
2N/A ((tcp_t *)arg3)->tcp_last_sent_len + @TCP_MIN_HEADER_LENGTH@ :
2N/A arg3 != NULL && probename == "receive" ?
2N/A ((tcp_t *)arg3)->tcp_last_recv_len + @TCP_MIN_HEADER_LENGTH@ :
2N/A 0;
2N/A ip_saddr =
2N/A I != NULL && *(uint8_t *)I >> 4 == 4 ?
2N/A inet_ntoa(&((ipha_t *)I)->ipha_src) :
2N/A I != NULL && *(uint8_t *)I >> 4 == 6 ?
2N/A inet_ntoa6(&((ip6_t *)I)->ip6_src) :
2N/A I != NULL ? "<unknown>" :
2N/A arg3 != NULL && probename == "send" ?
2N/A inet_ntoa6(&((tcp_t *)arg3)->tcp_connp->connua_v6addr.connua_laddr):
2N/A arg3 != NULL && probename == "receive" ?
2N/A inet_ntoa6(&((tcp_t *)arg3)->tcp_connp->connua_v6addr.connua_faddr):
2N/A "<unknown>";
2N/A ip_daddr =
2N/A I != NULL && *(uint8_t *)I >> 4 == 4 ?
2N/A inet_ntoa(&((ipha_t *)I)->ipha_dst) :
2N/A I != NULL && *(uint8_t *)I >> 4 == 6 ?
2N/A inet_ntoa6(&((ip6_t *)I)->ip6_dst) :
2N/A I != NULL ? "<unknown>" :
2N/A arg3 != NULL && probename == "send" ?
2N/A inet_ntoa6(&((tcp_t *)arg3)->tcp_connp->connua_v6addr.connua_faddr):
2N/A arg3 != NULL && probename == "receive" ?
2N/A inet_ntoa6(&((tcp_t *)arg3)->tcp_connp->connua_v6addr.connua_laddr):
2N/A "<unknown>";
2N/A};
2N/A
2N/A#pragma D binding "1.5" translator
2N/Atranslator ipv4info_t < ipha_t *I > {
2N/A ipv4_ver = I != NULL ? I->ipha_version_and_hdr_length >> 4 : 0;
2N/A ipv4_ihl = I != NULL ? (I->ipha_version_and_hdr_length & 0xf) << 2 : 0;
2N/A ipv4_tos = I != NULL ? I->ipha_type_of_service : 0;
2N/A ipv4_length = I != NULL ? ntohs(I->ipha_length) : 0;
2N/A ipv4_ident = I != NULL ? ntohs(I->ipha_ident) : 0;
2N/A ipv4_flags = I != NULL ? ntohs(I->ipha_fragment_offset_and_flags) >>
2N/A 12 : 0;
2N/A ipv4_offset = I != NULL ? ntohs(I->ipha_fragment_offset_and_flags) &
2N/A 0x0fff : 0;
2N/A ipv4_ttl = I != NULL ? I->ipha_ttl : 0;
2N/A ipv4_protocol = I != NULL ? I->ipha_protocol : 0;
2N/A ipv4_protostr = I == NULL ? "<null>" :
2N/A I->ipha_protocol == IPPROTO_TCP ? "TCP" :
2N/A I->ipha_protocol == IPPROTO_UDP ? "UDP" :
2N/A I->ipha_protocol == IPPROTO_IP ? "IP" :
2N/A I->ipha_protocol == IPPROTO_ICMP ? "ICMP" :
2N/A I->ipha_protocol == IPPROTO_IGMP ? "IGMP" :
2N/A I->ipha_protocol == IPPROTO_EGP ? "EGP" :
2N/A I->ipha_protocol == IPPROTO_IPV6 ? "IPv6" :
2N/A I->ipha_protocol == IPPROTO_ROUTING ? "ROUTE" :
2N/A I->ipha_protocol == IPPROTO_ESP ? "ESP" :
2N/A I->ipha_protocol == IPPROTO_AH ? "AH" :
2N/A I->ipha_protocol == IPPROTO_ICMPV6 ? "ICMPv6" :
2N/A I->ipha_protocol == IPPROTO_OSPF ? "OSPF" :
2N/A I->ipha_protocol == IPPROTO_SCTP ? "SCTP" :
2N/A I->ipha_protocol == IPPROTO_RAW ? "RAW" :
2N/A lltostr((uint64_t)I->ipha_protocol);
2N/A ipv4_checksum = I != NULL ? ntohs(I->ipha_hdr_checksum) : 0;
2N/A ipv4_src = I != NULL ? I->ipha_src : 0;
2N/A ipv4_dst = I != NULL ? I->ipha_dst : 0;
2N/A ipv4_saddr = I != NULL ? inet_ntoa(&I->ipha_src) : "<null>";
2N/A ipv4_daddr = I != NULL ? inet_ntoa(&I->ipha_dst) : "<null>";
2N/A ipv4_hdr = I;
2N/A};
2N/A
2N/A#pragma D binding "1.5" translator
2N/Atranslator ipv6info_t < ip6_t *I > {
2N/A ipv6_ver = I != NULL ? I->ip6_ctlun.ip6_un2_vfc >> 4 : 0;
2N/A ipv6_tclass = I != NULL ? ((I->ip6_ctlun.ip6_un1.ip6_un1_flow &&
2N/A 0x0fffffff) >> 20) : 0;
2N/A ipv6_flow = I != NULL ? I->ip6_ctlun.ip6_un1.ip6_un1_flow &&
2N/A 0x000fffff : 0;
2N/A ipv6_plen = I != NULL ? ntohs(I->ip6_ctlun.ip6_un1.ip6_un1_plen) : 0;
2N/A ipv6_nexthdr = I != NULL ? I->ip6_ctlun.ip6_un1.ip6_un1_nxt : 0;
2N/A ipv6_nextstr = I == NULL ? "<null>" :
2N/A I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_TCP ? "TCP" :
2N/A I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_UDP ? "UDP" :
2N/A I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_IP ? "IP" :
2N/A I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_ICMP ? "ICMP" :
2N/A I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_IGMP ? "IGMP" :
2N/A I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_EGP ? "EGP" :
2N/A I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_IPV6 ? "IPv6" :
2N/A I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_ROUTING ? "ROUTE" :
2N/A I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_ESP ? "ESP" :
2N/A I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_AH ? "AH" :
2N/A I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_ICMPV6 ? "ICMPv6" :
2N/A I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_OSPF ? "OSPF" :
2N/A I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_SCTP ? "SCTP" :
2N/A I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_RAW ? "RAW" :
2N/A lltostr((uint64_t)I->ip6_ctlun.ip6_un1.ip6_un1_nxt);
2N/A ipv6_hlim = I != NULL ? I->ip6_ctlun.ip6_un1.ip6_un1_hlim : 0;
2N/A ipv6_src = I != NULL ? &I->ip6_src : 0;
2N/A ipv6_dst = I != NULL ? &I->ip6_dst : 0;
2N/A ipv6_saddr = I != NULL ? inet_ntoa6(&I->ip6_src) : "<null>";
2N/A ipv6_daddr = I != NULL ? inet_ntoa6(&I->ip6_dst) : "<null>";
2N/A ipv6_hdr = I;
2N/A};