Print this page
*** NO COMMENTS ***
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/lib/libdtrace/common/ip.d.in
+++ new/usr/src/lib/libdtrace/common/ip.d.in
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
|
↓ open down ↓ |
11 lines elided |
↑ open up ↑ |
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 - * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
22 + * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26 #pragma ident "%Z%%M% %I% %E% SMI"
27 27
28 28 #pragma D depends_on module ip
29 29 #pragma D depends_on provider ip
30 30
31 31 inline int IPH_DF = @IPH_DF@;
32 32 #pragma D binding "1.0" IPH_DF
33 33 inline int IPH_MF = @IPH_MF@;
34 34 #pragma D binding "1.0" IPH_MF
35 35
36 36 #pragma D binding "1.0" IPPROTO_IP
37 37 inline int IPPROTO_IP = @IPPROTO_IP@;
38 38 #pragma D binding "1.0" IPPROTO_HOPOPTS
39 39 inline int IPPROTO_HOPOPTS = @IPPROTO_HOPOPTS@;
40 40 #pragma D binding "1.0" IPPROTO_ICMP
41 41 inline int IPPROTO_ICMP = @IPPROTO_ICMP@;
42 42 #pragma D binding "1.0" IPPROTO_IGMP
43 43 inline int IPPROTO_IGMP = @IPPROTO_IGMP@;
44 44 #pragma D binding "1.0" IPPROTO_GGP
45 45 inline int IPPROTO_GGP = @IPPROTO_GGP@;
46 46 #pragma D binding "1.0" IPPROTO_ENCAP
47 47 inline int IPPROTO_ENCAP = @IPPROTO_ENCAP@;
48 48 #pragma D binding "1.0" IPPROTO_TCP
49 49 inline int IPPROTO_TCP = @IPPROTO_TCP@;
50 50 #pragma D binding "1.0" IPPROTO_EGP
51 51 inline int IPPROTO_EGP = @IPPROTO_EGP@;
52 52 #pragma D binding "1.0" IPPROTO_PUP
53 53 inline int IPPROTO_PUP = @IPPROTO_PUP@;
54 54 #pragma D binding "1.0" IPPROTO_UDP
55 55 inline int IPPROTO_UDP = @IPPROTO_UDP@;
56 56 #pragma D binding "1.0" IPPROTO_IDP
57 57 inline int IPPROTO_IDP = @IPPROTO_IDP@;
58 58 #pragma D binding "1.0" IPPROTO_IPV6
59 59 inline int IPPROTO_IPV6 = @IPPROTO_IPV6@;
60 60 #pragma D binding "1.0" IPPROTO_ROUTING
61 61 inline int IPPROTO_ROUTING = @IPPROTO_ROUTING@;
62 62 #pragma D binding "1.0" IPPROTO_FRAGMENT
63 63 inline int IPPROTO_FRAGMENT = @IPPROTO_FRAGMENT@;
64 64 #pragma D binding "1.0" IPPROTO_RSVP
65 65 inline int IPPROTO_RSVP = @IPPROTO_RSVP@;
66 66 #pragma D binding "1.0" IPPROTO_ESP
67 67 inline int IPPROTO_ESP = @IPPROTO_ESP@;
68 68 #pragma D binding "1.0" IPPROTO_AH
69 69 inline int IPPROTO_AH = @IPPROTO_AH@;
70 70 #pragma D binding "1.0" IPPROTO_ICMPV6
71 71 inline int IPPROTO_ICMPV6 = @IPPROTO_ICMPV6@;
72 72 #pragma D binding "1.0" IPPROTO_NONE
73 73 inline int IPPROTO_NONE = @IPPROTO_NONE@;
74 74 #pragma D binding "1.0" IPPROTO_DSTOPTS
75 75 inline int IPPROTO_DSTOPTS = @IPPROTO_DSTOPTS@;
76 76 #pragma D binding "1.0" IPPROTO_HELLO
77 77 inline int IPPROTO_HELLO = @IPPROTO_HELLO@;
78 78 #pragma D binding "1.0" IPPROTO_ND
79 79 inline int IPPROTO_ND = @IPPROTO_ND@;
80 80 #pragma D binding "1.0" IPPROTO_EON
81 81 inline int IPPROTO_EON = @IPPROTO_EON@;
82 82 #pragma D binding "1.0" IPPROTO_OSPF
83 83 inline int IPPROTO_OSPF = @IPPROTO_OSPF@;
84 84 #pragma D binding "1.0" IPPROTO_PIM
85 85 inline int IPPROTO_PIM = @IPPROTO_PIM@;
86 86 #pragma D binding "1.0" IPPROTO_SCTP
87 87 inline int IPPROTO_SCTP = @IPPROTO_SCTP@;
88 88 #pragma D binding "1.0" IPPROTO_RAW
89 89 inline int IPPROTO_RAW = @IPPROTO_RAW@;
90 90 #pragma D binding "1.0" IPPROTO_MAX
91 91 inline int IPPROTO_MAX = @IPPROTO_MAX@;
92 92
93 93 /*
94 94 * pktinfo is where packet ID info can be made available for deeper
95 95 * analysis if packet IDs become supported by the kernel in the future.
96 96 * The pkt_addr member is currently always NULL.
97 97 */
98 98 typedef struct pktinfo {
99 99 uintptr_t pkt_addr;
100 100 } pktinfo_t;
101 101
102 102 /*
103 103 * csinfo is where connection state info can be made available if
104 104 * connection IDs become supported by the kernel in the future.
105 105 * The cs_addr member is currently always NULL.
106 106 */
107 107 typedef struct csinfo {
108 108 uintptr_t cs_addr;
109 109 } csinfo_t;
110 110
111 111 /*
112 112 * ipinfo contains common IP info for both IPv4 and IPv6.
113 113 */
114 114 typedef struct ipinfo {
115 115 uint8_t ip_ver; /* IP version (4, 6) */
116 116 uint32_t ip_plength; /* payload length */
117 117 string ip_saddr; /* source address */
118 118 string ip_daddr; /* destination address */
119 119 } ipinfo_t;
120 120
121 121 /*
122 122 * ifinfo contains network interface info.
123 123 */
124 124 typedef struct ifinfo {
125 125 string if_name; /* interface name */
126 126 int8_t if_local; /* is delivered locally */
127 127 netstackid_t if_ipstack; /* ipstack ID */
128 128 uintptr_t if_addr; /* pointer to raw ill_t */
129 129 } ifinfo_t;
130 130
131 131 /*
132 132 * ipv4info is a translated version of the IPv4 header (with raw pointer).
133 133 * These values are NULL if the packet is not IPv4.
134 134 */
135 135 typedef struct ipv4info {
136 136 uint8_t ipv4_ver; /* IP version (4) */
137 137 uint8_t ipv4_ihl; /* header length, bytes */
138 138 uint8_t ipv4_tos; /* type of service field */
139 139 uint16_t ipv4_length; /* length (header + payload) */
140 140 uint16_t ipv4_ident; /* identification */
141 141 uint8_t ipv4_flags; /* IP flags */
142 142 uint16_t ipv4_offset; /* fragment offset */
143 143 uint8_t ipv4_ttl; /* time to live */
144 144 uint8_t ipv4_protocol; /* next level protocol */
145 145 string ipv4_protostr; /* next level protocol, as a string */
146 146 uint16_t ipv4_checksum; /* header checksum */
147 147 ipaddr_t ipv4_src; /* source address */
148 148 ipaddr_t ipv4_dst; /* destination address */
149 149 string ipv4_saddr; /* source address, string */
150 150 string ipv4_daddr; /* destination address, string */
151 151 ipha_t *ipv4_hdr; /* pointer to raw header */
152 152 } ipv4info_t;
153 153
154 154 /*
155 155 * ipv6info is a translated version of the IPv6 header (with raw pointer).
156 156 * These values are NULL if the packet is not IPv6.
157 157 */
158 158 typedef struct ipv6info {
159 159 uint8_t ipv6_ver; /* IP version (6) */
160 160 uint8_t ipv6_tclass; /* traffic class */
161 161 uint32_t ipv6_flow; /* flow label */
162 162 uint16_t ipv6_plen; /* payload length */
163 163 uint8_t ipv6_nexthdr; /* next header protocol */
164 164 string ipv6_nextstr; /* next header protocol, as a string */
165 165 uint8_t ipv6_hlim; /* hop limit */
166 166 in6_addr_t *ipv6_src; /* source address */
167 167 in6_addr_t *ipv6_dst; /* destination address */
168 168 string ipv6_saddr; /* source address, string */
169 169 string ipv6_daddr; /* destination address, string */
170 170 ip6_t *ipv6_hdr; /* pointer to raw header */
171 171 } ipv6info_t;
172 172
173 173 /*
174 174 * void_ip_t is a void pointer to either an IPv4 or IPv6 header. It has
175 175 * its own type name so that a translator can be determined.
|
↓ open down ↓ |
143 lines elided |
↑ open up ↑ |
176 176 */
177 177 typedef uintptr_t void_ip_t;
178 178
179 179 /*
180 180 * __dtrace_ipsr_ill_t is used by the translator to take an ill_t plus an
181 181 * additional arg6 from the ip:::send and ip:::recieve probes, and translate
182 182 * them to an ifinfo_t.
183 183 */
184 184 typedef ill_t __dtrace_ipsr_ill_t;
185 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 +
186 193 #pragma D binding "1.0" translator
187 194 translator pktinfo_t < mblk_t *M > {
188 195 pkt_addr = NULL;
189 196 };
190 197
191 198 #pragma D binding "1.0" translator
192 199 translator csinfo_t < conn_t *C > {
193 200 cs_addr = NULL;
194 201 };
195 202
196 203 #pragma D binding "1.0" translator
197 204 translator ipinfo_t < ipha_t *I > {
198 205 ip_ver = I->ipha_version_and_hdr_length >> 4;
199 206 ip_plength = ntohs(I->ipha_length) -
200 207 ((I->ipha_version_and_hdr_length & 0xf) << 2);
201 208 ip_saddr = inet_ntoa(&I->ipha_src);
202 209 ip_daddr = inet_ntoa(&I->ipha_dst);
203 210 };
204 211
205 212 #pragma D binding "1.0" translator
206 213 translator ipinfo_t < ip6_t *I > {
207 214 ip_ver = *(uint8_t *)I >> 4;
208 215 ip_plength = ntohs(I->ip6_ctlun.ip6_un1.ip6_un1_plen);
209 216 ip_saddr = inet_ntoa6(&I->ip6_src);
210 217 ip_daddr = inet_ntoa6(&I->ip6_dst);
211 218 };
212 219
213 220 #pragma D binding "1.0" translator
214 221 translator ipinfo_t < void_ip_t *I > {
215 222 ip_ver = I != NULL ? *(uint8_t *)I >> 4 : 0;
216 223 ip_plength = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
217 224 ntohs(((ipha_t *)I)->ipha_length) -
218 225 ((((ipha_t *)I)->ipha_version_and_hdr_length & 0xf) << 2) :
|
↓ open down ↓ |
23 lines elided |
↑ open up ↑ |
219 226 *(uint8_t *)I >> 4 == 6 ?
220 227 ntohs(((ip6_t *)I)->ip6_ctlun.ip6_un1.ip6_un1_plen) : 0) : 0;
221 228 ip_saddr = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
222 229 inet_ntoa(&((ipha_t *)I)->ipha_src) : *(uint8_t *)I >> 4 == 6 ?
223 230 inet_ntoa6(&((ip6_t *)I)->ip6_src) : "<unknown>") : "<unknown>";
224 231 ip_daddr = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
225 232 inet_ntoa(&((ipha_t *)I)->ipha_dst) : *(uint8_t *)I >> 4 == 6 ?
226 233 inet_ntoa6(&((ip6_t *)I)->ip6_dst) : "<unknown>") : "<unknown>";
227 234 };
228 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 +
229 248 #pragma D binding "1.0" translator
230 249 translator ifinfo_t < __dtrace_ipsr_ill_t *I > {
231 250 if_name = I != NULL ? stringof(I->ill_name) : "<null>";
232 251 if_ipstack = I != NULL ? I->ill_ipst->ips_netstack->netstack_stackid
233 252 : 0;
234 253 if_local = arg6; /* probe dependent */
235 254 if_addr = (uintptr_t)I;
236 255 };
237 256
238 257 #pragma D binding "1.0" translator
239 258 translator ipv4info_t < ipha_t *I > {
240 259 ipv4_ver = I != NULL ? I->ipha_version_and_hdr_length >> 4 : 0;
241 260 ipv4_ihl = I != NULL ? (I->ipha_version_and_hdr_length & 0xf) << 2 : 0;
242 261 ipv4_tos = I != NULL ? I->ipha_type_of_service : 0;
243 262 ipv4_length = I != NULL ? ntohs(I->ipha_length) : 0;
244 263 ipv4_ident = I != NULL ? ntohs(I->ipha_ident) : 0;
245 264 ipv4_flags = I != NULL ? ntohs(I->ipha_fragment_offset_and_flags) >>
246 265 12 : 0;
247 266 ipv4_offset = I != NULL ? ntohs(I->ipha_fragment_offset_and_flags) &
248 267 0x0fff : 0;
249 268 ipv4_ttl = I != NULL ? I->ipha_ttl : 0;
250 269 ipv4_protocol = I != NULL ? I->ipha_protocol : 0;
251 270 ipv4_protostr = I == NULL ? "<null>" :
252 271 I->ipha_protocol == IPPROTO_TCP ? "TCP" :
253 272 I->ipha_protocol == IPPROTO_UDP ? "UDP" :
254 273 I->ipha_protocol == IPPROTO_IP ? "IP" :
255 274 I->ipha_protocol == IPPROTO_ICMP ? "ICMP" :
256 275 I->ipha_protocol == IPPROTO_IGMP ? "IGMP" :
257 276 I->ipha_protocol == IPPROTO_EGP ? "EGP" :
258 277 I->ipha_protocol == IPPROTO_IPV6 ? "IPv6" :
259 278 I->ipha_protocol == IPPROTO_ROUTING ? "ROUTE" :
260 279 I->ipha_protocol == IPPROTO_ESP ? "ESP" :
261 280 I->ipha_protocol == IPPROTO_AH ? "AH" :
262 281 I->ipha_protocol == IPPROTO_ICMPV6 ? "ICMPv6" :
263 282 I->ipha_protocol == IPPROTO_OSPF ? "OSPF" :
264 283 I->ipha_protocol == IPPROTO_SCTP ? "SCTP" :
265 284 I->ipha_protocol == IPPROTO_RAW ? "RAW" :
266 285 lltostr((uint64_t)I->ipha_protocol);
267 286 ipv4_checksum = I != NULL ? ntohs(I->ipha_hdr_checksum) : 0;
268 287 ipv4_src = I != NULL ? I->ipha_src : 0;
269 288 ipv4_dst = I != NULL ? I->ipha_dst : 0;
270 289 ipv4_saddr = I != NULL ? inet_ntoa(&I->ipha_src) : "<null>";
271 290 ipv4_daddr = I != NULL ? inet_ntoa(&I->ipha_dst) : "<null>";
272 291 ipv4_hdr = I;
273 292 };
274 293
275 294 #pragma D binding "1.0" translator
276 295 translator ipv6info_t < ip6_t *I > {
277 296 ipv6_ver = I != NULL ? I->ip6_ctlun.ip6_un2_vfc >> 4 : 0;
278 297 ipv6_tclass = I != NULL ? ((I->ip6_ctlun.ip6_un1.ip6_un1_flow &&
279 298 0x0fffffff) >> 20) : 0;
280 299 ipv6_flow = I != NULL ? I->ip6_ctlun.ip6_un1.ip6_un1_flow &&
281 300 0x000fffff : 0;
282 301 ipv6_plen = I != NULL ? ntohs(I->ip6_ctlun.ip6_un1.ip6_un1_plen) : 0;
283 302 ipv6_nexthdr = I != NULL ? I->ip6_ctlun.ip6_un1.ip6_un1_nxt : 0;
284 303 ipv6_nextstr = I == NULL ? "<null>" :
285 304 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_TCP ? "TCP" :
286 305 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_UDP ? "UDP" :
287 306 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_IP ? "IP" :
288 307 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_ICMP ? "ICMP" :
289 308 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_IGMP ? "IGMP" :
290 309 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_EGP ? "EGP" :
291 310 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_IPV6 ? "IPv6" :
292 311 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_ROUTING ? "ROUTE" :
293 312 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_ESP ? "ESP" :
294 313 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_AH ? "AH" :
295 314 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_ICMPV6 ? "ICMPv6" :
296 315 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_OSPF ? "OSPF" :
297 316 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_SCTP ? "SCTP" :
298 317 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_RAW ? "RAW" :
299 318 lltostr((uint64_t)I->ip6_ctlun.ip6_un1.ip6_un1_nxt);
300 319 ipv6_hlim = I != NULL ? I->ip6_ctlun.ip6_un1.ip6_un1_hlim : 0;
301 320 ipv6_src = I != NULL ? &I->ip6_src : 0;
302 321 ipv6_dst = I != NULL ? &I->ip6_dst : 0;
303 322 ipv6_saddr = I != NULL ? inet_ntoa6(&I->ip6_src) : "<null>";
304 323 ipv6_daddr = I != NULL ? inet_ntoa6(&I->ip6_dst) : "<null>";
305 324 ipv6_hdr = I;
306 325 };
|
↓ open down ↓ |
68 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX