Print this page
3903 DTrace SCTP Provider
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.
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 22 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 */
24 24
25 25 #pragma D depends_on module ip
26 26 #pragma D depends_on provider ip
27 27
28 28 inline int IPH_DF = @IPH_DF@;
29 29 #pragma D binding "1.5" IPH_DF
30 30 inline int IPH_MF = @IPH_MF@;
31 31 #pragma D binding "1.5" IPH_MF
32 32
33 33 #pragma D binding "1.5" IPPROTO_IP
34 34 inline int IPPROTO_IP = @IPPROTO_IP@;
35 35 #pragma D binding "1.5" IPPROTO_HOPOPTS
36 36 inline int IPPROTO_HOPOPTS = @IPPROTO_HOPOPTS@;
37 37 #pragma D binding "1.5" IPPROTO_ICMP
38 38 inline int IPPROTO_ICMP = @IPPROTO_ICMP@;
39 39 #pragma D binding "1.5" IPPROTO_IGMP
40 40 inline int IPPROTO_IGMP = @IPPROTO_IGMP@;
41 41 #pragma D binding "1.5" IPPROTO_GGP
42 42 inline int IPPROTO_GGP = @IPPROTO_GGP@;
43 43 #pragma D binding "1.5" IPPROTO_ENCAP
44 44 inline int IPPROTO_ENCAP = @IPPROTO_ENCAP@;
45 45 #pragma D binding "1.5" IPPROTO_TCP
46 46 inline int IPPROTO_TCP = @IPPROTO_TCP@;
47 47 #pragma D binding "1.5" IPPROTO_EGP
48 48 inline int IPPROTO_EGP = @IPPROTO_EGP@;
49 49 #pragma D binding "1.5" IPPROTO_PUP
50 50 inline int IPPROTO_PUP = @IPPROTO_PUP@;
51 51 #pragma D binding "1.5" IPPROTO_UDP
52 52 inline int IPPROTO_UDP = @IPPROTO_UDP@;
53 53 #pragma D binding "1.5" IPPROTO_IDP
54 54 inline int IPPROTO_IDP = @IPPROTO_IDP@;
55 55 #pragma D binding "1.5" IPPROTO_IPV6
56 56 inline int IPPROTO_IPV6 = @IPPROTO_IPV6@;
57 57 #pragma D binding "1.5" IPPROTO_ROUTING
58 58 inline int IPPROTO_ROUTING = @IPPROTO_ROUTING@;
59 59 #pragma D binding "1.5" IPPROTO_FRAGMENT
60 60 inline int IPPROTO_FRAGMENT = @IPPROTO_FRAGMENT@;
61 61 #pragma D binding "1.5" IPPROTO_RSVP
62 62 inline int IPPROTO_RSVP = @IPPROTO_RSVP@;
63 63 #pragma D binding "1.5" IPPROTO_ESP
64 64 inline int IPPROTO_ESP = @IPPROTO_ESP@;
65 65 #pragma D binding "1.5" IPPROTO_AH
66 66 inline int IPPROTO_AH = @IPPROTO_AH@;
67 67 #pragma D binding "1.5" IPPROTO_ICMPV6
68 68 inline int IPPROTO_ICMPV6 = @IPPROTO_ICMPV6@;
69 69 #pragma D binding "1.5" IPPROTO_NONE
70 70 inline int IPPROTO_NONE = @IPPROTO_NONE@;
71 71 #pragma D binding "1.5" IPPROTO_DSTOPTS
72 72 inline int IPPROTO_DSTOPTS = @IPPROTO_DSTOPTS@;
73 73 #pragma D binding "1.5" IPPROTO_HELLO
74 74 inline int IPPROTO_HELLO = @IPPROTO_HELLO@;
75 75 #pragma D binding "1.5" IPPROTO_ND
76 76 inline int IPPROTO_ND = @IPPROTO_ND@;
77 77 #pragma D binding "1.5" IPPROTO_EON
78 78 inline int IPPROTO_EON = @IPPROTO_EON@;
79 79 #pragma D binding "1.5" IPPROTO_OSPF
80 80 inline int IPPROTO_OSPF = @IPPROTO_OSPF@;
81 81 #pragma D binding "1.5" IPPROTO_PIM
82 82 inline int IPPROTO_PIM = @IPPROTO_PIM@;
83 83 #pragma D binding "1.5" IPPROTO_SCTP
84 84 inline int IPPROTO_SCTP = @IPPROTO_SCTP@;
85 85 #pragma D binding "1.5" IPPROTO_RAW
86 86 inline int IPPROTO_RAW = @IPPROTO_RAW@;
87 87 #pragma D binding "1.5" IPPROTO_MAX
88 88 inline int IPPROTO_MAX = @IPPROTO_MAX@;
89 89
90 90 /*
91 91 * pktinfo is where packet ID info can be made available for deeper
92 92 * analysis if packet IDs become supported by the kernel in the future.
93 93 * The pkt_addr member is currently always NULL.
94 94 */
95 95 typedef struct pktinfo {
96 96 uintptr_t pkt_addr;
97 97 } pktinfo_t;
98 98
99 99 /*
100 100 * csinfo is where connection state info is made available.
101 101 */
102 102 typedef struct csinfo {
103 103 uintptr_t cs_addr;
104 104 uint64_t cs_cid;
105 105 pid_t cs_pid;
106 106 zoneid_t cs_zoneid;
107 107 } csinfo_t;
108 108
109 109 /*
110 110 * ipinfo contains common IP info for both IPv4 and IPv6.
111 111 */
112 112 typedef struct ipinfo {
113 113 uint8_t ip_ver; /* IP version (4, 6) */
114 114 uint32_t ip_plength; /* payload length */
115 115 string ip_saddr; /* source address */
116 116 string ip_daddr; /* destination address */
117 117 } ipinfo_t;
118 118
119 119 /*
120 120 * ifinfo contains network interface info.
121 121 */
122 122 typedef struct ifinfo {
123 123 string if_name; /* interface name */
124 124 int8_t if_local; /* is delivered locally */
125 125 netstackid_t if_ipstack; /* ipstack ID */
126 126 uintptr_t if_addr; /* pointer to raw ill_t */
127 127 } ifinfo_t;
128 128
129 129 /*
130 130 * ipv4info is a translated version of the IPv4 header (with raw pointer).
131 131 * These values are NULL if the packet is not IPv4.
132 132 */
133 133 typedef struct ipv4info {
134 134 uint8_t ipv4_ver; /* IP version (4) */
135 135 uint8_t ipv4_ihl; /* header length, bytes */
136 136 uint8_t ipv4_tos; /* type of service field */
137 137 uint16_t ipv4_length; /* length (header + payload) */
138 138 uint16_t ipv4_ident; /* identification */
139 139 uint8_t ipv4_flags; /* IP flags */
140 140 uint16_t ipv4_offset; /* fragment offset */
141 141 uint8_t ipv4_ttl; /* time to live */
142 142 uint8_t ipv4_protocol; /* next level protocol */
143 143 string ipv4_protostr; /* next level protocol, as a string */
144 144 uint16_t ipv4_checksum; /* header checksum */
145 145 ipaddr_t ipv4_src; /* source address */
146 146 ipaddr_t ipv4_dst; /* destination address */
147 147 string ipv4_saddr; /* source address, string */
148 148 string ipv4_daddr; /* destination address, string */
149 149 ipha_t *ipv4_hdr; /* pointer to raw header */
150 150 } ipv4info_t;
151 151
152 152 /*
153 153 * ipv6info is a translated version of the IPv6 header (with raw pointer).
154 154 * These values are NULL if the packet is not IPv6.
155 155 */
156 156 typedef struct ipv6info {
157 157 uint8_t ipv6_ver; /* IP version (6) */
158 158 uint8_t ipv6_tclass; /* traffic class */
159 159 uint32_t ipv6_flow; /* flow label */
160 160 uint16_t ipv6_plen; /* payload length */
161 161 uint8_t ipv6_nexthdr; /* next header protocol */
162 162 string ipv6_nextstr; /* next header protocol, as a string */
163 163 uint8_t ipv6_hlim; /* hop limit */
164 164 in6_addr_t *ipv6_src; /* source address */
165 165 in6_addr_t *ipv6_dst; /* destination address */
166 166 string ipv6_saddr; /* source address, string */
167 167 string ipv6_daddr; /* destination address, string */
168 168 ip6_t *ipv6_hdr; /* pointer to raw header */
↓ open down ↓ |
168 lines elided |
↑ open up ↑ |
169 169 } ipv6info_t;
170 170
171 171 /*
172 172 * void_ip_t is a void pointer to either an IPv4 or IPv6 header. It has
173 173 * its own type name so that a translator can be determined.
174 174 */
175 175 typedef uintptr_t void_ip_t;
176 176
177 177 /*
178 178 * __dtrace_ipsr_ill_t is used by the translator to take an ill_t plus an
179 - * additional arg6 from the ip:::send and ip:::recieve probes, and translate
179 + * additional arg6 from the ip:::send and ip:::receive probes, and translate
180 180 * them to an ifinfo_t.
181 181 */
182 182 typedef ill_t __dtrace_ipsr_ill_t;
183 183
184 184 /*
185 185 * __dtrace_tcp_void_ip_t is used by the translator to take either the
186 186 * non-NULL void_ip_t * passed in or, if it is NULL, uses arg3 (tcp_t *)
187 - * from the tcp:::send and tcp:::recieve probes to translate to an ipinfo_t.
187 + * from the tcp:::send and tcp:::receive probes to translate to an ipinfo_t.
188 188 * When no headers are available in the TCP fusion case for tcp:::send
189 189 * and tcp:::receive case, this allows us to present the consumer with header
190 190 * data based on the tcp_t * content in order to hide the implementation
191 191 * details of TCP fusion.
192 192 */
193 193 typedef void * __dtrace_tcp_void_ip_t;
194 194
195 195 #pragma D binding "1.5" translator
196 196 translator pktinfo_t < mblk_t *M > {
197 197 pkt_addr = NULL;
198 198 };
199 199
200 200 #pragma D binding "1.5" translator
201 201 translator csinfo_t < conn_t *C > {
202 202 cs_addr = NULL;
203 203 };
204 204
205 205 #pragma D binding "1.6.3" translator
206 206 translator csinfo_t < ip_xmit_attr_t *C > {
207 207 cs_addr = (uintptr_t)C;
208 208 cs_cid = C ? C->ixa_conn_id : NULL;
209 209 cs_pid = C ? C->ixa_cpid : -1;
210 210 cs_zoneid = C ?
211 211 (C->ixa_ipst == NULL || C->ixa_ipst->ips_netstack == NULL ||
212 212 C->ixa_ipst->ips_netstack->netstack_stackid ==
213 213 @GLOBAL_NETSTACKID@ ||
214 214 C->ixa_cred == NULL ||
215 215 C->ixa_cred->cr_zone == NULL ||
216 216 C->ixa_cred->cr_uid == -1 ?
217 217 C->ixa_zoneid : C->ixa_cred->cr_zone->zone_id) : -1;
218 218 };
219 219
220 220 #pragma D binding "1.5" translator
221 221 translator ipinfo_t < ipha_t *I > {
222 222 ip_ver = I->ipha_version_and_hdr_length >> 4;
223 223 ip_plength = ntohs(I->ipha_length) -
224 224 ((I->ipha_version_and_hdr_length & 0xf) << 2);
225 225 ip_saddr = inet_ntoa(&I->ipha_src);
226 226 ip_daddr = inet_ntoa(&I->ipha_dst);
227 227 };
228 228
229 229 #pragma D binding "1.5" translator
230 230 translator ipinfo_t < ip6_t *I > {
231 231 ip_ver = *(uint8_t *)I >> 4;
232 232 ip_plength = ntohs(I->ip6_ctlun.ip6_un1.ip6_un1_plen);
233 233 ip_saddr = inet_ntoa6(&I->ip6_src);
234 234 ip_daddr = inet_ntoa6(&I->ip6_dst);
235 235 };
236 236
237 237 #pragma D binding "1.5" translator
238 238 translator ipinfo_t < void_ip_t *I > {
239 239 ip_ver = I != NULL ? *(uint8_t *)I >> 4 : 0;
240 240 ip_plength = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
241 241 ntohs(((ipha_t *)I)->ipha_length) -
242 242 ((((ipha_t *)I)->ipha_version_and_hdr_length & 0xf) << 2) :
243 243 *(uint8_t *)I >> 4 == 6 ?
244 244 ntohs(((ip6_t *)I)->ip6_ctlun.ip6_un1.ip6_un1_plen) : 0) : 0;
245 245 ip_saddr = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
246 246 inet_ntoa(&((ipha_t *)I)->ipha_src) : *(uint8_t *)I >> 4 == 6 ?
247 247 inet_ntoa6(&((ip6_t *)I)->ip6_src) : "<unknown>") : "<unknown>";
248 248 ip_daddr = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
249 249 inet_ntoa(&((ipha_t *)I)->ipha_dst) : *(uint8_t *)I >> 4 == 6 ?
250 250 inet_ntoa6(&((ip6_t *)I)->ip6_dst) : "<unknown>") : "<unknown>";
251 251 };
252 252
253 253 #pragma D binding "1.5" translator
254 254 translator ifinfo_t < __dtrace_ipsr_ill_t *I > {
255 255 if_name = I != NULL ? stringof(I->ill_name) : "<null>";
256 256 if_ipstack = I != NULL ? I->ill_ipst->ips_netstack->netstack_stackid
257 257 : 0;
258 258 if_local = arg6; /* probe dependent */
259 259 if_addr = (uintptr_t)I;
260 260 };
261 261
262 262 /*
263 263 * Translate to an ipinfo_t * from either the non-NULL void_ip_t * passed in,
264 264 * or use arg3 (tcp_t *) to fabricate ip header info.
265 265 */
266 266 #pragma D binding "1.6.3" translator
267 267 translator ipinfo_t < __dtrace_tcp_void_ip_t *I > {
268 268 ip_ver = I != NULL ? *(uint8_t *)I >> 4 :
269 269 arg3 != NULL ? ((tcp_t *)arg3)->tcp_connp->conn_ipversion : 0;
270 270 ip_plength =
271 271 I != NULL && *(uint8_t *)I >> 4 == 4 ?
272 272 ntohs(((ipha_t *)I)->ipha_length) -
273 273 ((((ipha_t *)I)->ipha_version_and_hdr_length & 0xf) << 2) :
274 274 I != NULL && *(uint8_t *)I >> 4 == 6 ?
275 275 ntohs(((ip6_t *)I)->ip6_ctlun.ip6_un1.ip6_un1_plen) :
276 276 I != NULL ? 0 :
277 277 arg3 != NULL && probename == "send" ?
278 278 ((tcp_t *)arg3)->tcp_last_sent_len + @TCP_MIN_HEADER_LENGTH@ :
279 279 arg3 != NULL && probename == "receive" ?
280 280 ((tcp_t *)arg3)->tcp_last_recv_len + @TCP_MIN_HEADER_LENGTH@ :
281 281 0;
282 282 ip_saddr =
283 283 I != NULL && *(uint8_t *)I >> 4 == 4 ?
284 284 inet_ntoa(&((ipha_t *)I)->ipha_src) :
285 285 I != NULL && *(uint8_t *)I >> 4 == 6 ?
286 286 inet_ntoa6(&((ip6_t *)I)->ip6_src) :
287 287 I != NULL ? "<unknown>" :
288 288 arg3 != NULL && probename == "send" ?
289 289 inet_ntoa6(&((tcp_t *)arg3)->tcp_connp->connua_v6addr.connua_laddr):
290 290 arg3 != NULL && probename == "receive" ?
291 291 inet_ntoa6(&((tcp_t *)arg3)->tcp_connp->connua_v6addr.connua_faddr):
292 292 "<unknown>";
293 293 ip_daddr =
294 294 I != NULL && *(uint8_t *)I >> 4 == 4 ?
295 295 inet_ntoa(&((ipha_t *)I)->ipha_dst) :
296 296 I != NULL && *(uint8_t *)I >> 4 == 6 ?
297 297 inet_ntoa6(&((ip6_t *)I)->ip6_dst) :
298 298 I != NULL ? "<unknown>" :
299 299 arg3 != NULL && probename == "send" ?
300 300 inet_ntoa6(&((tcp_t *)arg3)->tcp_connp->connua_v6addr.connua_faddr):
301 301 arg3 != NULL && probename == "receive" ?
302 302 inet_ntoa6(&((tcp_t *)arg3)->tcp_connp->connua_v6addr.connua_laddr):
303 303 "<unknown>";
304 304 };
305 305
306 306 #pragma D binding "1.5" translator
307 307 translator ipv4info_t < ipha_t *I > {
308 308 ipv4_ver = I != NULL ? I->ipha_version_and_hdr_length >> 4 : 0;
309 309 ipv4_ihl = I != NULL ? (I->ipha_version_and_hdr_length & 0xf) << 2 : 0;
310 310 ipv4_tos = I != NULL ? I->ipha_type_of_service : 0;
311 311 ipv4_length = I != NULL ? ntohs(I->ipha_length) : 0;
312 312 ipv4_ident = I != NULL ? ntohs(I->ipha_ident) : 0;
313 313 ipv4_flags = I != NULL ? ntohs(I->ipha_fragment_offset_and_flags) >>
314 314 12 : 0;
315 315 ipv4_offset = I != NULL ? ntohs(I->ipha_fragment_offset_and_flags) &
316 316 0x0fff : 0;
317 317 ipv4_ttl = I != NULL ? I->ipha_ttl : 0;
318 318 ipv4_protocol = I != NULL ? I->ipha_protocol : 0;
319 319 ipv4_protostr = I == NULL ? "<null>" :
320 320 I->ipha_protocol == IPPROTO_TCP ? "TCP" :
321 321 I->ipha_protocol == IPPROTO_UDP ? "UDP" :
322 322 I->ipha_protocol == IPPROTO_IP ? "IP" :
323 323 I->ipha_protocol == IPPROTO_ICMP ? "ICMP" :
324 324 I->ipha_protocol == IPPROTO_IGMP ? "IGMP" :
325 325 I->ipha_protocol == IPPROTO_EGP ? "EGP" :
326 326 I->ipha_protocol == IPPROTO_IPV6 ? "IPv6" :
327 327 I->ipha_protocol == IPPROTO_ROUTING ? "ROUTE" :
328 328 I->ipha_protocol == IPPROTO_ESP ? "ESP" :
329 329 I->ipha_protocol == IPPROTO_AH ? "AH" :
330 330 I->ipha_protocol == IPPROTO_ICMPV6 ? "ICMPv6" :
331 331 I->ipha_protocol == IPPROTO_OSPF ? "OSPF" :
332 332 I->ipha_protocol == IPPROTO_SCTP ? "SCTP" :
333 333 I->ipha_protocol == IPPROTO_RAW ? "RAW" :
334 334 lltostr((uint64_t)I->ipha_protocol);
335 335 ipv4_checksum = I != NULL ? ntohs(I->ipha_hdr_checksum) : 0;
336 336 ipv4_src = I != NULL ? I->ipha_src : 0;
337 337 ipv4_dst = I != NULL ? I->ipha_dst : 0;
338 338 ipv4_saddr = I != NULL ? inet_ntoa(&I->ipha_src) : "<null>";
339 339 ipv4_daddr = I != NULL ? inet_ntoa(&I->ipha_dst) : "<null>";
340 340 ipv4_hdr = I;
341 341 };
342 342
343 343 #pragma D binding "1.5" translator
344 344 translator ipv6info_t < ip6_t *I > {
345 345 ipv6_ver = I != NULL ? I->ip6_ctlun.ip6_un2_vfc >> 4 : 0;
346 346 ipv6_tclass = I != NULL ? ((I->ip6_ctlun.ip6_un1.ip6_un1_flow &&
347 347 0x0fffffff) >> 20) : 0;
348 348 ipv6_flow = I != NULL ? I->ip6_ctlun.ip6_un1.ip6_un1_flow &&
349 349 0x000fffff : 0;
350 350 ipv6_plen = I != NULL ? ntohs(I->ip6_ctlun.ip6_un1.ip6_un1_plen) : 0;
351 351 ipv6_nexthdr = I != NULL ? I->ip6_ctlun.ip6_un1.ip6_un1_nxt : 0;
352 352 ipv6_nextstr = I == NULL ? "<null>" :
353 353 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_TCP ? "TCP" :
354 354 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_UDP ? "UDP" :
355 355 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_IP ? "IP" :
356 356 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_ICMP ? "ICMP" :
357 357 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_IGMP ? "IGMP" :
358 358 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_EGP ? "EGP" :
359 359 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_IPV6 ? "IPv6" :
360 360 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_ROUTING ? "ROUTE" :
361 361 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_ESP ? "ESP" :
362 362 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_AH ? "AH" :
363 363 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_ICMPV6 ? "ICMPv6" :
364 364 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_OSPF ? "OSPF" :
365 365 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_SCTP ? "SCTP" :
366 366 I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_RAW ? "RAW" :
367 367 lltostr((uint64_t)I->ip6_ctlun.ip6_un1.ip6_un1_nxt);
368 368 ipv6_hlim = I != NULL ? I->ip6_ctlun.ip6_un1.ip6_un1_hlim : 0;
369 369 ipv6_src = I != NULL ? &I->ip6_src : 0;
370 370 ipv6_dst = I != NULL ? &I->ip6_dst : 0;
371 371 ipv6_saddr = I != NULL ? inet_ntoa6(&I->ip6_src) : "<null>";
372 372 ipv6_daddr = I != NULL ? inet_ntoa6(&I->ip6_dst) : "<null>";
373 373 ipv6_hdr = I;
374 374 };
↓ open down ↓ |
177 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX