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