Print this page
*** NO COMMENTS ***


   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #pragma ident   "%Z%%M% %I%     %E% SMI"
  27 
  28 #pragma D depends_on module ip
  29 #pragma D depends_on provider ip
  30 
  31 inline int IPH_DF = @IPH_DF@;
  32 #pragma D binding "1.0" IPH_DF
  33 inline int IPH_MF = @IPH_MF@;
  34 #pragma D binding "1.0" IPH_MF
  35 
  36 #pragma D binding "1.0" IPPROTO_IP
  37 inline int IPPROTO_IP = @IPPROTO_IP@;
  38 #pragma D binding "1.0" IPPROTO_HOPOPTS
  39 inline int IPPROTO_HOPOPTS = @IPPROTO_HOPOPTS@;
  40 #pragma D binding "1.0" IPPROTO_ICMP
  41 inline int IPPROTO_ICMP = @IPPROTO_ICMP@;
  42 #pragma D binding "1.0" IPPROTO_IGMP


 166         in6_addr_t *ipv6_src;           /* source address */
 167         in6_addr_t *ipv6_dst;           /* destination address */
 168         string ipv6_saddr;              /* source address, string */
 169         string ipv6_daddr;              /* destination address, string */
 170         ip6_t *ipv6_hdr;                /* pointer to raw header */
 171 } ipv6info_t;
 172 
 173 /*
 174  * void_ip_t is a void pointer to either an IPv4 or IPv6 header.  It has
 175  * its own type name so that a translator can be determined.
 176  */
 177 typedef uintptr_t void_ip_t;
 178 
 179 /*
 180  * __dtrace_ipsr_ill_t is used by the translator to take an ill_t plus an
 181  * additional arg6 from the ip:::send and ip:::recieve probes, and translate
 182  * them to an ifinfo_t.
 183  */
 184 typedef ill_t __dtrace_ipsr_ill_t;
 185 







 186 #pragma D binding "1.0" translator
 187 translator pktinfo_t < mblk_t *M > {
 188         pkt_addr = NULL;
 189 };
 190 
 191 #pragma D binding "1.0" translator
 192 translator csinfo_t < conn_t *C > {
 193         cs_addr = NULL;
 194 };
 195 
 196 #pragma D binding "1.0" translator
 197 translator ipinfo_t < ipha_t *I > {
 198         ip_ver = I->ipha_version_and_hdr_length >> 4;
 199         ip_plength = ntohs(I->ipha_length) -
 200             ((I->ipha_version_and_hdr_length & 0xf) << 2);
 201         ip_saddr = inet_ntoa(&I->ipha_src);
 202         ip_daddr = inet_ntoa(&I->ipha_dst);
 203 };
 204 
 205 #pragma D binding "1.0" translator


 209         ip_saddr = inet_ntoa6(&I->ip6_src);
 210         ip_daddr = inet_ntoa6(&I->ip6_dst);
 211 };
 212 
 213 #pragma D binding "1.0" translator
 214 translator ipinfo_t < void_ip_t *I > {
 215         ip_ver = I != NULL ? *(uint8_t *)I >> 4 : 0;
 216         ip_plength = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
 217             ntohs(((ipha_t *)I)->ipha_length) -
 218             ((((ipha_t *)I)->ipha_version_and_hdr_length & 0xf) << 2) :
 219             *(uint8_t *)I >> 4 == 6 ?
 220             ntohs(((ip6_t *)I)->ip6_ctlun.ip6_un1.ip6_un1_plen) : 0) : 0;
 221         ip_saddr = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
 222             inet_ntoa(&((ipha_t *)I)->ipha_src) : *(uint8_t *)I >> 4 == 6 ?
 223             inet_ntoa6(&((ip6_t *)I)->ip6_src) : "<unknown>") : "<unknown>";
 224         ip_daddr = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
 225             inet_ntoa(&((ipha_t *)I)->ipha_dst) : *(uint8_t *)I >> 4 == 6 ?
 226             inet_ntoa6(&((ip6_t *)I)->ip6_dst) : "<unknown>") : "<unknown>";
 227 };
 228 












 229 #pragma D binding "1.0" translator
 230 translator ifinfo_t < __dtrace_ipsr_ill_t *I > {
 231         if_name = I != NULL ? stringof(I->ill_name) : "<null>";
 232         if_ipstack = I != NULL ? I->ill_ipst->ips_netstack->netstack_stackid
 233             : 0;
 234         if_local = arg6;                /* probe dependent */
 235         if_addr = (uintptr_t)I;
 236 };
 237 
 238 #pragma D binding "1.0" translator
 239 translator ipv4info_t < ipha_t *I > {
 240         ipv4_ver = I != NULL ? I->ipha_version_and_hdr_length >> 4 : 0;
 241         ipv4_ihl = I != NULL ? (I->ipha_version_and_hdr_length & 0xf) << 2 : 0;
 242         ipv4_tos = I != NULL ? I->ipha_type_of_service : 0;
 243         ipv4_length = I != NULL ? ntohs(I->ipha_length) : 0;
 244         ipv4_ident = I != NULL ? ntohs(I->ipha_ident) : 0;
 245         ipv4_flags = I != NULL ? ntohs(I->ipha_fragment_offset_and_flags) >>
 246             12 : 0;
 247         ipv4_offset = I != NULL ? ntohs(I->ipha_fragment_offset_and_flags) &
 248             0x0fff : 0;




   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #pragma ident   "%Z%%M% %I%     %E% SMI"
  27 
  28 #pragma D depends_on module ip
  29 #pragma D depends_on provider ip
  30 
  31 inline int IPH_DF = @IPH_DF@;
  32 #pragma D binding "1.0" IPH_DF
  33 inline int IPH_MF = @IPH_MF@;
  34 #pragma D binding "1.0" IPH_MF
  35 
  36 #pragma D binding "1.0" IPPROTO_IP
  37 inline int IPPROTO_IP = @IPPROTO_IP@;
  38 #pragma D binding "1.0" IPPROTO_HOPOPTS
  39 inline int IPPROTO_HOPOPTS = @IPPROTO_HOPOPTS@;
  40 #pragma D binding "1.0" IPPROTO_ICMP
  41 inline int IPPROTO_ICMP = @IPPROTO_ICMP@;
  42 #pragma D binding "1.0" IPPROTO_IGMP


 166         in6_addr_t *ipv6_src;           /* source address */
 167         in6_addr_t *ipv6_dst;           /* destination address */
 168         string ipv6_saddr;              /* source address, string */
 169         string ipv6_daddr;              /* destination address, string */
 170         ip6_t *ipv6_hdr;                /* pointer to raw header */
 171 } ipv6info_t;
 172 
 173 /*
 174  * void_ip_t is a void pointer to either an IPv4 or IPv6 header.  It has
 175  * its own type name so that a translator can be determined.
 176  */
 177 typedef uintptr_t void_ip_t;
 178 
 179 /*
 180  * __dtrace_ipsr_ill_t is used by the translator to take an ill_t plus an
 181  * additional arg6 from the ip:::send and ip:::recieve probes, and translate
 182  * them to an ifinfo_t.
 183  */
 184 typedef ill_t __dtrace_ipsr_ill_t;
 185 
 186 /*
 187  * __dtrace_tcpf_ipinfo_t is used by the translators to construct an
 188  * ipinfo_t during tcp fusion, from a tcp_t plus an additional arg4 for
 189  * the payload bytes.
 190  */
 191 typedef tcp_t __dtrace_tcpf_ipinfo_t;
 192 
 193 #pragma D binding "1.0" translator
 194 translator pktinfo_t < mblk_t *M > {
 195         pkt_addr = NULL;
 196 };
 197 
 198 #pragma D binding "1.0" translator
 199 translator csinfo_t < conn_t *C > {
 200         cs_addr = NULL;
 201 };
 202 
 203 #pragma D binding "1.0" translator
 204 translator ipinfo_t < ipha_t *I > {
 205         ip_ver = I->ipha_version_and_hdr_length >> 4;
 206         ip_plength = ntohs(I->ipha_length) -
 207             ((I->ipha_version_and_hdr_length & 0xf) << 2);
 208         ip_saddr = inet_ntoa(&I->ipha_src);
 209         ip_daddr = inet_ntoa(&I->ipha_dst);
 210 };
 211 
 212 #pragma D binding "1.0" translator


 216         ip_saddr = inet_ntoa6(&I->ip6_src);
 217         ip_daddr = inet_ntoa6(&I->ip6_dst);
 218 };
 219 
 220 #pragma D binding "1.0" translator
 221 translator ipinfo_t < void_ip_t *I > {
 222         ip_ver = I != NULL ? *(uint8_t *)I >> 4 : 0;
 223         ip_plength = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
 224             ntohs(((ipha_t *)I)->ipha_length) -
 225             ((((ipha_t *)I)->ipha_version_and_hdr_length & 0xf) << 2) :
 226             *(uint8_t *)I >> 4 == 6 ?
 227             ntohs(((ip6_t *)I)->ip6_ctlun.ip6_un1.ip6_un1_plen) : 0) : 0;
 228         ip_saddr = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
 229             inet_ntoa(&((ipha_t *)I)->ipha_src) : *(uint8_t *)I >> 4 == 6 ?
 230             inet_ntoa6(&((ip6_t *)I)->ip6_src) : "<unknown>") : "<unknown>";
 231         ip_daddr = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
 232             inet_ntoa(&((ipha_t *)I)->ipha_dst) : *(uint8_t *)I >> 4 == 6 ?
 233             inet_ntoa6(&((ip6_t *)I)->ip6_dst) : "<unknown>") : "<unknown>";
 234 };
 235 
 236 #pragma D binding "1.0" translator
 237 translator ipinfo_t < __dtrace_tcpf_ipinfo_t *T > {
 238         ip_ver = T->tcp_ipversion;
 239         ip_plength = arg4;              /* probe dependent */
 240         ip_saddr = inet_ntoa6(probename == "send" ?
 241             &T->tcp_connp->connua_v6addr.connua_laddr :
 242             &T->tcp_connp->connua_v6addr.connua_faddr);
 243         ip_daddr = inet_ntoa6(probename == "send" ?
 244             &T->tcp_connp->connua_v6addr.connua_faddr :
 245             &T->tcp_connp->connua_v6addr.connua_laddr);
 246 };
 247 
 248 #pragma D binding "1.0" translator
 249 translator ifinfo_t < __dtrace_ipsr_ill_t *I > {
 250         if_name = I != NULL ? stringof(I->ill_name) : "<null>";
 251         if_ipstack = I != NULL ? I->ill_ipst->ips_netstack->netstack_stackid
 252             : 0;
 253         if_local = arg6;                /* probe dependent */
 254         if_addr = (uintptr_t)I;
 255 };
 256 
 257 #pragma D binding "1.0" translator
 258 translator ipv4info_t < ipha_t *I > {
 259         ipv4_ver = I != NULL ? I->ipha_version_and_hdr_length >> 4 : 0;
 260         ipv4_ihl = I != NULL ? (I->ipha_version_and_hdr_length & 0xf) << 2 : 0;
 261         ipv4_tos = I != NULL ? I->ipha_type_of_service : 0;
 262         ipv4_length = I != NULL ? ntohs(I->ipha_length) : 0;
 263         ipv4_ident = I != NULL ? ntohs(I->ipha_ident) : 0;
 264         ipv4_flags = I != NULL ? ntohs(I->ipha_fragment_offset_and_flags) >>
 265             12 : 0;
 266         ipv4_offset = I != NULL ? ntohs(I->ipha_fragment_offset_and_flags) &
 267             0x0fff : 0;