Deleted Added
full compact
ip.d (254889) ip.d (266082)
1/*
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

--- 4 unchanged lines hidden (view full) ---

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 *
1/*
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

--- 4 unchanged lines hidden (view full) ---

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 * $FreeBSD: head/cddl/lib/libdtrace/ip.d 254889 2013-08-25 21:54:41Z markj $
21 * $FreeBSD: head/cddl/lib/libdtrace/ip.d 266082 2014-05-14 19:02:00Z markj $
22 */
23/*
24 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
25 * Copyright (c) 2013 Mark Johnston <markj@freebsd.org>
26 */
27
28#pragma D depends_on provider ip
29

--- 90 unchanged lines hidden (view full) ---

120 uint8_t ipv6_hlim; /* hop limit */
121 in6_addr_t *ipv6_src; /* source address */
122 in6_addr_t *ipv6_dst; /* destination address */
123 string ipv6_saddr; /* source address, string */
124 string ipv6_daddr; /* destination address, string */
125 ip6_t *ipv6_hdr; /* pointer to raw header */
126} ipv6info_t;
127
22 */
23/*
24 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
25 * Copyright (c) 2013 Mark Johnston <markj@freebsd.org>
26 */
27
28#pragma D depends_on provider ip
29

--- 90 unchanged lines hidden (view full) ---

120 uint8_t ipv6_hlim; /* hop limit */
121 in6_addr_t *ipv6_src; /* source address */
122 in6_addr_t *ipv6_dst; /* destination address */
123 string ipv6_saddr; /* source address, string */
124 string ipv6_daddr; /* destination address, string */
125 ip6_t *ipv6_hdr; /* pointer to raw header */
126} ipv6info_t;
127
128#pragma D binding "1.0" IPPROTO_IP
128#pragma D binding "1.5" IPPROTO_IP
129inline short IPPROTO_IP = 0;
129inline short IPPROTO_IP = 0;
130#pragma D binding "1.0" IPPROTO_ICMP
130#pragma D binding "1.5" IPPROTO_ICMP
131inline short IPPROTO_ICMP = 1;
131inline short IPPROTO_ICMP = 1;
132#pragma D binding "1.0" IPPROTO_IGMP
132#pragma D binding "1.5" IPPROTO_IGMP
133inline short IPPROTO_IGMP = 2;
133inline short IPPROTO_IGMP = 2;
134#pragma D binding "1.0" IPPROTO_IPV4
134#pragma D binding "1.5" IPPROTO_IPV4
135inline short IPPROTO_IPV4 = 4;
135inline short IPPROTO_IPV4 = 4;
136#pragma D binding "1.0" IPPROTO_TCP
136#pragma D binding "1.5" IPPROTO_TCP
137inline short IPPROTO_TCP = 6;
137inline short IPPROTO_TCP = 6;
138#pragma D binding "1.0" IPPROTO_UDP
138#pragma D binding "1.5" IPPROTO_UDP
139inline short IPPROTO_UDP = 17;
139inline short IPPROTO_UDP = 17;
140#pragma D binding "1.0" IPPROTO_IPV6
140#pragma D binding "1.5" IPPROTO_IPV6
141inline short IPPROTO_IPV6 = 41;
141inline short IPPROTO_IPV6 = 41;
142#pragma D binding "1.0" IPPROTO_ROUTING
142#pragma D binding "1.5" IPPROTO_ROUTING
143inline short IPPROTO_ROUTING = 43;
143inline short IPPROTO_ROUTING = 43;
144#pragma D binding "1.0" IPPROTO_FRAGMENT
144#pragma D binding "1.5" IPPROTO_FRAGMENT
145inline short IPPROTO_FRAGMENT = 44;
145inline short IPPROTO_FRAGMENT = 44;
146#pragma D binding "1.0" IPPROTO_RSVP
146#pragma D binding "1.5" IPPROTO_RSVP
147inline short IPPROTO_RSVP = 46;
147inline short IPPROTO_RSVP = 46;
148#pragma D binding "1.0" IPPROTO_GRE
148#pragma D binding "1.5" IPPROTO_GRE
149inline short IPPROTO_GRE = 47;
149inline short IPPROTO_GRE = 47;
150#pragma D binding "1.0" IPPROTO_ESP
150#pragma D binding "1.5" IPPROTO_ESP
151inline short IPPROTO_ESP = 50;
151inline short IPPROTO_ESP = 50;
152#pragma D binding "1.0" IPPROTO_AH
152#pragma D binding "1.5" IPPROTO_AH
153inline short IPPROTO_AH = 51;
153inline short IPPROTO_AH = 51;
154#pragma D binding "1.0" IPPROTO_MOBILE
154#pragma D binding "1.5" IPPROTO_MOBILE
155inline short IPPROTO_MOBILE = 55;
155inline short IPPROTO_MOBILE = 55;
156#pragma D binding "1.0" IPPROTO_ICMPV6
156#pragma D binding "1.5" IPPROTO_ICMPV6
157inline short IPPROTO_ICMPV6 = 58;
157inline short IPPROTO_ICMPV6 = 58;
158#pragma D binding "1.0" IPPROTO_DSTOPTS
158#pragma D binding "1.5" IPPROTO_DSTOPTS
159inline short IPPROTO_DSTOPTS = 60;
159inline short IPPROTO_DSTOPTS = 60;
160#pragma D binding "1.0" IPPROTO_ETHERIP
160#pragma D binding "1.5" IPPROTO_ETHERIP
161inline short IPPROTO_ETHERIP = 97;
161inline short IPPROTO_ETHERIP = 97;
162#pragma D binding "1.0" IPPROTO_PIM
162#pragma D binding "1.5" IPPROTO_PIM
163inline short IPPROTO_PIM = 103;
163inline short IPPROTO_PIM = 103;
164#pragma D binding "1.0" IPPROTO_IPCOMP
164#pragma D binding "1.5" IPPROTO_IPCOMP
165inline short IPPROTO_IPCOMP = 108;
165inline short IPPROTO_IPCOMP = 108;
166#pragma D binding "1.0" IPPROTO_SCTP
166#pragma D binding "1.5" IPPROTO_SCTP
167inline short IPPROTO_SCTP = 132;
167inline short IPPROTO_SCTP = 132;
168#pragma D binding "1.0" IPPROTO_RAW
168#pragma D binding "1.5" IPPROTO_RAW
169inline short IPPROTO_RAW = 255;
170
171inline uint8_t INP_IPV4 = 0x01;
172inline uint8_t INP_IPV6 = 0x02;
173
169inline short IPPROTO_RAW = 255;
170
171inline uint8_t INP_IPV4 = 0x01;
172inline uint8_t INP_IPV6 = 0x02;
173
174#pragma D binding "1.0" protocols
174#pragma D binding "1.5" protocols
175inline string protocols[int proto] =
176 proto == IPPROTO_IP ? "IP" :
177 proto == IPPROTO_ICMP ? "ICMP" :
178 proto == IPPROTO_IGMP ? "IGMP" :
179 proto == IPPROTO_IPV4 ? "IPV4" :
180 proto == IPPROTO_TCP ? "TCP" :
181 proto == IPPROTO_UDP ? "UDP" :
182 proto == IPPROTO_IPV6 ? "IPV6" :

--- 12 unchanged lines hidden (view full) ---

195 proto == IPPROTO_SCTP ? "SCTP" :
196 proto == IPPROTO_RAW ? "RAW" :
197 "<unknown>";
198
199/*
200 * This field is always NULL according to the current definition of the ip
201 * probes.
202 */
175inline string protocols[int proto] =
176 proto == IPPROTO_IP ? "IP" :
177 proto == IPPROTO_ICMP ? "ICMP" :
178 proto == IPPROTO_IGMP ? "IGMP" :
179 proto == IPPROTO_IPV4 ? "IPV4" :
180 proto == IPPROTO_TCP ? "TCP" :
181 proto == IPPROTO_UDP ? "UDP" :
182 proto == IPPROTO_IPV6 ? "IPV6" :

--- 12 unchanged lines hidden (view full) ---

195 proto == IPPROTO_SCTP ? "SCTP" :
196 proto == IPPROTO_RAW ? "RAW" :
197 "<unknown>";
198
199/*
200 * This field is always NULL according to the current definition of the ip
201 * probes.
202 */
203#pragma D binding "1.0" translator
203#pragma D binding "1.5" translator
204translator pktinfo_t < void *p > {
205 pkt_addr = NULL;
206};
207
204translator pktinfo_t < void *p > {
205 pkt_addr = NULL;
206};
207
208#pragma D binding "1.0" translator
208#pragma D binding "1.5" translator
209translator csinfo_t < void *p > {
210 cs_addr = NULL;
211 cs_cid = (uint64_t)p;
212 cs_pid = 0;
213 cs_zoneid = 0;
214};
215
209translator csinfo_t < void *p > {
210 cs_addr = NULL;
211 cs_cid = (uint64_t)p;
212 cs_pid = 0;
213 cs_zoneid = 0;
214};
215
216#pragma D binding "1.0" translator
216#pragma D binding "1.6.3" translator
217translator csinfo_t < struct inpcb *p > {
218 cs_addr = NULL;
219 cs_cid = (uint64_t)p;
220 cs_pid = 0; /* XXX */
221 cs_zoneid = 0;
222};
223
217translator csinfo_t < struct inpcb *p > {
218 cs_addr = NULL;
219 cs_cid = (uint64_t)p;
220 cs_pid = 0; /* XXX */
221 cs_zoneid = 0;
222};
223
224#pragma D binding "1.0" translator
224#pragma D binding "1.5" translator
225translator ipinfo_t < uint8_t *p > {
226 ip_ver = p == NULL ? 0 : ((struct ip *)p)->ip_v;
227 ip_plength = p == NULL ? 0 :
228 ((struct ip *)p)->ip_v == 4 ?
229 ntohs(((struct ip *)p)->ip_len) - (((struct ip *)p)->ip_hl << 2):
230 ntohs(((struct ip6_hdr *)p)->ip6_ctlun.ip6_un1.ip6_un1_plen);
231 ip_saddr = p == NULL ? 0 :
232 ((struct ip *)p)->ip_v == 4 ?
233 inet_ntoa(&((struct ip *)p)->ip_src.s_addr) :
234 inet_ntoa6(&((struct ip6_hdr *)p)->ip6_src);
235 ip_daddr = p == NULL ? 0 :
236 ((struct ip *)p)->ip_v == 4 ?
237 inet_ntoa(&((struct ip *)p)->ip_dst.s_addr) :
238 inet_ntoa6(&((struct ip6_hdr *)p)->ip6_dst);
239};
240
225translator ipinfo_t < uint8_t *p > {
226 ip_ver = p == NULL ? 0 : ((struct ip *)p)->ip_v;
227 ip_plength = p == NULL ? 0 :
228 ((struct ip *)p)->ip_v == 4 ?
229 ntohs(((struct ip *)p)->ip_len) - (((struct ip *)p)->ip_hl << 2):
230 ntohs(((struct ip6_hdr *)p)->ip6_ctlun.ip6_un1.ip6_un1_plen);
231 ip_saddr = p == NULL ? 0 :
232 ((struct ip *)p)->ip_v == 4 ?
233 inet_ntoa(&((struct ip *)p)->ip_src.s_addr) :
234 inet_ntoa6(&((struct ip6_hdr *)p)->ip6_src);
235 ip_daddr = p == NULL ? 0 :
236 ((struct ip *)p)->ip_v == 4 ?
237 inet_ntoa(&((struct ip *)p)->ip_dst.s_addr) :
238 inet_ntoa6(&((struct ip6_hdr *)p)->ip6_dst);
239};
240
241#pragma D binding "1.0" IFF_LOOPBACK
241#pragma D binding "1.5" IFF_LOOPBACK
242inline int IFF_LOOPBACK = 0x8;
243
242inline int IFF_LOOPBACK = 0x8;
243
244#pragma D binding "1.0" translator
244#pragma D binding "1.5" translator
245translator ifinfo_t < struct ifnet *p > {
246 if_name = p->if_xname;
247 if_local = (p->if_flags & IFF_LOOPBACK) == 0 ? 0 : 1;
248 if_addr = (uintptr_t)p;
249};
250
245translator ifinfo_t < struct ifnet *p > {
246 if_name = p->if_xname;
247 if_local = (p->if_flags & IFF_LOOPBACK) == 0 ? 0 : 1;
248 if_addr = (uintptr_t)p;
249};
250
251#pragma D binding "1.0" translator
251#pragma D binding "1.5" translator
252translator ipv4info_t < struct ip *p > {
253 ipv4_ver = p == NULL ? 0 : p->ip_v;
254 ipv4_ihl = p == NULL ? 0 : p->ip_hl;
255 ipv4_tos = p == NULL ? 0 : p->ip_tos;
256 ipv4_length = p == NULL ? 0 : ntohs(p->ip_len);
257 ipv4_ident = p == NULL ? 0 : ntohs(p->ip_id);
258 ipv4_flags = p == NULL ? 0 : (p->ip_off & 0xe000);
259 ipv4_offset = p == NULL ? 0 : p->ip_off;
260 ipv4_ttl = p == NULL ? 0 : p->ip_ttl;
261 ipv4_protocol = p == NULL ? 0 : p->ip_p;
262 ipv4_protostr = p == NULL ? "<null>" : protocols[p->ip_p];
263 ipv4_checksum = p == NULL ? 0 : ntohs(p->ip_sum);
264 ipv4_src = p == NULL ? 0 : (ipaddr_t)ntohl(p->ip_src.s_addr);
265 ipv4_dst = p == NULL ? 0 : (ipaddr_t)ntohl(p->ip_dst.s_addr);
266 ipv4_saddr = p == NULL ? 0 : inet_ntoa(&p->ip_src.s_addr);
267 ipv4_daddr = p == NULL ? 0 : inet_ntoa(&p->ip_dst.s_addr);
268 ipv4_hdr = (ipha_t *)p;
269};
270
252translator ipv4info_t < struct ip *p > {
253 ipv4_ver = p == NULL ? 0 : p->ip_v;
254 ipv4_ihl = p == NULL ? 0 : p->ip_hl;
255 ipv4_tos = p == NULL ? 0 : p->ip_tos;
256 ipv4_length = p == NULL ? 0 : ntohs(p->ip_len);
257 ipv4_ident = p == NULL ? 0 : ntohs(p->ip_id);
258 ipv4_flags = p == NULL ? 0 : (p->ip_off & 0xe000);
259 ipv4_offset = p == NULL ? 0 : p->ip_off;
260 ipv4_ttl = p == NULL ? 0 : p->ip_ttl;
261 ipv4_protocol = p == NULL ? 0 : p->ip_p;
262 ipv4_protostr = p == NULL ? "<null>" : protocols[p->ip_p];
263 ipv4_checksum = p == NULL ? 0 : ntohs(p->ip_sum);
264 ipv4_src = p == NULL ? 0 : (ipaddr_t)ntohl(p->ip_src.s_addr);
265 ipv4_dst = p == NULL ? 0 : (ipaddr_t)ntohl(p->ip_dst.s_addr);
266 ipv4_saddr = p == NULL ? 0 : inet_ntoa(&p->ip_src.s_addr);
267 ipv4_daddr = p == NULL ? 0 : inet_ntoa(&p->ip_dst.s_addr);
268 ipv4_hdr = (ipha_t *)p;
269};
270
271#pragma D binding "1.0" translator
271#pragma D binding "1.5" translator
272translator ipv6info_t < struct ip6_hdr *p > {
273 ipv6_ver = p == NULL ? 0 : (ntohl(p->ip6_ctlun.ip6_un1.ip6_un1_flow) & 0xf0000000) >> 28;
274 ipv6_tclass = p == NULL ? 0 : (ntohl(p->ip6_ctlun.ip6_un1.ip6_un1_flow) & 0x0ff00000) >> 20;
275 ipv6_flow = p == NULL ? 0 : ntohl(p->ip6_ctlun.ip6_un1.ip6_un1_flow) & 0x000fffff;
276 ipv6_plen = p == NULL ? 0 : ntohs(p->ip6_ctlun.ip6_un1.ip6_un1_plen);
277 ipv6_nexthdr = p == NULL ? 0 : p->ip6_ctlun.ip6_un1.ip6_un1_nxt;
278 ipv6_nextstr = p == NULL ? "<null>" : protocols[p->ip6_ctlun.ip6_un1.ip6_un1_nxt];
279 ipv6_hlim = p == NULL ? 0 : p->ip6_ctlun.ip6_un1.ip6_un1_hlim;
280 ipv6_src = p == NULL ? 0 : (in6_addr_t *)&p->ip6_src;
281 ipv6_dst = p == NULL ? 0 : (in6_addr_t *)&p->ip6_dst;
282 ipv6_saddr = p == NULL ? 0 : inet_ntoa6(&p->ip6_src);
283 ipv6_daddr = p == NULL ? 0 : inet_ntoa6(&p->ip6_dst);
284 ipv6_hdr = (ip6_t *)p;
285};
272translator ipv6info_t < struct ip6_hdr *p > {
273 ipv6_ver = p == NULL ? 0 : (ntohl(p->ip6_ctlun.ip6_un1.ip6_un1_flow) & 0xf0000000) >> 28;
274 ipv6_tclass = p == NULL ? 0 : (ntohl(p->ip6_ctlun.ip6_un1.ip6_un1_flow) & 0x0ff00000) >> 20;
275 ipv6_flow = p == NULL ? 0 : ntohl(p->ip6_ctlun.ip6_un1.ip6_un1_flow) & 0x000fffff;
276 ipv6_plen = p == NULL ? 0 : ntohs(p->ip6_ctlun.ip6_un1.ip6_un1_plen);
277 ipv6_nexthdr = p == NULL ? 0 : p->ip6_ctlun.ip6_un1.ip6_un1_nxt;
278 ipv6_nextstr = p == NULL ? "<null>" : protocols[p->ip6_ctlun.ip6_un1.ip6_un1_nxt];
279 ipv6_hlim = p == NULL ? 0 : p->ip6_ctlun.ip6_un1.ip6_un1_hlim;
280 ipv6_src = p == NULL ? 0 : (in6_addr_t *)&p->ip6_src;
281 ipv6_dst = p == NULL ? 0 : (in6_addr_t *)&p->ip6_dst;
282 ipv6_saddr = p == NULL ? 0 : inet_ntoa6(&p->ip6_src);
283 ipv6_daddr = p == NULL ? 0 : inet_ntoa6(&p->ip6_dst);
284 ipv6_hdr = (ip6_t *)p;
285};