]> The Tcpdump Group git mirrors - libpcap/blob - pcap-common.c
CHANGES: move some items to a new "Building and testing" section. [skip ci]
[libpcap] / pcap-common.c
1 /*
2 * Copyright (c) 1993, 1994, 1995, 1996, 1997
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
16 * written permission.
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * pcap-common.c - common code for pcap and pcapng files
22 */
23
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27
28 #include <pcap-types.h>
29
30 #include "pcap-int.h"
31 #include "extract.h"
32 #include "pcap/sll.h"
33 #include "pcap/usb.h"
34 #include "pcap/nflog.h"
35 #include "pcap/can_socketcan.h"
36
37 #include "pflog.h"
38
39 #include "pcap-common.h"
40
41 /*
42 * We don't write DLT_* values to capture files, because they're not the
43 * same on all platforms.
44 *
45 * Unfortunately, the various flavors of BSD have not always used the same
46 * numerical values for the same data types, and various patches to
47 * libpcap for non-BSD OSes have added their own DLT_* codes for link
48 * layer encapsulation types seen on those OSes, and those codes have had,
49 * in some cases, values that were also used, on other platforms, for other
50 * link layer encapsulation types.
51 *
52 * This means that capture files of a type whose numerical DLT_* code
53 * means different things on different BSDs, or with different versions
54 * of libpcap, can't always be read on systems other than those like
55 * the one running on the machine on which the capture was made.
56 *
57 * Instead, we define here a set of LINKTYPE_* codes, and map DLT_* codes
58 * to LINKTYPE_* codes when writing a savefile header, and map LINKTYPE_*
59 * codes to DLT_* codes when reading a savefile header.
60 *
61 * For those DLT_* codes that have, as far as we know, the same values on
62 * all platforms (DLT_NULL through DLT_FDDI), we define LINKTYPE_xxx as
63 * DLT_xxx; that way, captures of those types can still be read by
64 * versions of libpcap that map LINKTYPE_* values to DLT_* values, and
65 * captures of those types written by versions of libpcap that map DLT_
66 * values to LINKTYPE_ values can still be read by older versions
67 * of libpcap.
68 *
69 * The other LINKTYPE_* codes are given values starting at 100, in the
70 * hopes that no DLT_* code will be given one of those values.
71 *
72 * In order to ensure that a given LINKTYPE_* code's value will refer to
73 * the same encapsulation type on all platforms, you should not allocate
74 * a new LINKTYPE_* value without consulting
75 * "tcpdump-workers@lists.tcpdump.org". The tcpdump developers will
76 * allocate a value for you, and will not subsequently allocate it to
77 * anybody else; that value will be added to the "pcap.h" in the
78 * tcpdump.org Git repository, so that a future libpcap release will
79 * include it.
80 *
81 * You should, if possible, also contribute patches to libpcap and tcpdump
82 * to handle the new encapsulation type, so that they can also be checked
83 * into the tcpdump.org Git repository and so that they will appear in
84 * future libpcap and tcpdump releases.
85 *
86 * Do *NOT* assume that any values after the largest value in this file
87 * are available; you might not have the most up-to-date version of this
88 * file, and new values after that one might have been assigned. Also,
89 * do *NOT* use any values below 100 - those might already have been
90 * taken by one (or more!) organizations.
91 *
92 * Any platform that defines additional DLT_* codes should:
93 *
94 * request a LINKTYPE_* code and value from tcpdump.org,
95 * as per the above;
96 *
97 * add, in their version of libpcap, an entry to map
98 * those DLT_* codes to the corresponding LINKTYPE_*
99 * code;
100 *
101 * redefine, in their "net/bpf.h", any DLT_* values
102 * that collide with the values used by their additional
103 * DLT_* codes, to remove those collisions (but without
104 * making them collide with any of the LINKTYPE_*
105 * values equal to 50 or above; they should also avoid
106 * defining DLT_* values that collide with those
107 * LINKTYPE_* values, either).
108 */
109 #define LINKTYPE_NULL DLT_NULL
110 #define LINKTYPE_ETHERNET DLT_EN10MB /* also for 100Mb and up */
111 #define LINKTYPE_EXP_ETHERNET DLT_EN3MB /* 3Mb experimental Ethernet */
112 #define LINKTYPE_AX25 DLT_AX25
113 #define LINKTYPE_PRONET DLT_PRONET
114 #define LINKTYPE_CHAOS DLT_CHAOS
115 #define LINKTYPE_IEEE802_5 DLT_IEEE802 /* DLT_IEEE802 is used for 802.5 Token Ring */
116 #define LINKTYPE_ARCNET_BSD DLT_ARCNET /* BSD-style headers */
117 #define LINKTYPE_SLIP DLT_SLIP
118 #define LINKTYPE_PPP DLT_PPP
119 #define LINKTYPE_FDDI DLT_FDDI
120
121 /*
122 * LINKTYPE_PPP is for use when there might, or might not, be an RFC 1662
123 * PPP in HDLC-like framing header (with 0xff 0x03 before the PPP protocol
124 * field) at the beginning of the packet.
125 *
126 * This is for use when there is always such a header; the address field
127 * might be 0xff, for regular PPP, or it might be an address field for Cisco
128 * point-to-point with HDLC framing as per section 4.3.1 of RFC 1547 ("Cisco
129 * HDLC"). This is, for example, what you get with NetBSD's DLT_PPP_SERIAL.
130 *
131 * We give it the same value as NetBSD's DLT_PPP_SERIAL, in the hopes that
132 * nobody else will choose a DLT_ value of 50, and so that DLT_PPP_SERIAL
133 * captures will be written out with a link type that NetBSD's tcpdump
134 * can read.
135 */
136 #define LINKTYPE_PPP_HDLC 50 /* PPP in HDLC-like framing */
137
138 #define LINKTYPE_PPP_ETHER 51 /* NetBSD PPP-over-Ethernet */
139
140 #define LINKTYPE_SYMANTEC_FIREWALL 99 /* Symantec Enterprise Firewall */
141
142 /*
143 * These correspond to DLT_s that have different values on different
144 * platforms; we map between these values in capture files and
145 * the DLT_ values as returned by pcap_datalink() and passed to
146 * pcap_open_dead().
147 */
148 #define LINKTYPE_ATM_RFC1483 100 /* LLC/SNAP-encapsulated ATM */
149 #define LINKTYPE_RAW 101 /* raw IP */
150 #define LINKTYPE_SLIP_BSDOS 102 /* BSD/OS SLIP BPF header */
151 #define LINKTYPE_PPP_BSDOS 103 /* BSD/OS PPP BPF header */
152
153 /*
154 * Values starting with 104 are used for newly-assigned link-layer
155 * header type values; for those link-layer header types, the DLT_
156 * value returned by pcap_datalink() and passed to pcap_open_dead(),
157 * and the LINKTYPE_ value that appears in capture files, are the
158 * same.
159 *
160 * LINKTYPE_MATCHING_MIN is the lowest such value; LINKTYPE_MATCHING_MAX
161 * is the highest such value.
162 */
163 #define LINKTYPE_MATCHING_MIN 104 /* lowest value in the "matching" range */
164
165 #define LINKTYPE_C_HDLC 104 /* Cisco HDLC */
166 #define LINKTYPE_IEEE802_11 105 /* IEEE 802.11 (wireless) */
167 #define LINKTYPE_ATM_CLIP 106 /* Linux Classical IP over ATM */
168 #define LINKTYPE_FRELAY 107 /* Frame Relay */
169 #define LINKTYPE_LOOP 108 /* OpenBSD loopback */
170 #define LINKTYPE_ENC 109 /* OpenBSD IPSEC enc */
171
172 /*
173 * These two types are reserved for future use.
174 */
175 #define LINKTYPE_LANE8023 110 /* ATM LANE + 802.3 */
176 #define LINKTYPE_HIPPI 111 /* NetBSD HIPPI */
177
178 /*
179 * Used for NetBSD DLT_HDLC; from looking at the one driver in NetBSD
180 * that uses it, it's Cisco HDLC, so it's the same as DLT_C_HDLC/
181 * LINKTYPE_C_HDLC, but we define a separate value to avoid some
182 * compatibility issues with programs on NetBSD.
183 *
184 * All code should treat LINKTYPE_NETBSD_HDLC and LINKTYPE_C_HDLC the same.
185 */
186 #define LINKTYPE_NETBSD_HDLC 112 /* NetBSD HDLC framing */
187
188 #define LINKTYPE_LINUX_SLL 113 /* Linux cooked socket capture */
189 #define LINKTYPE_LTALK 114 /* Apple LocalTalk hardware */
190 #define LINKTYPE_ECONET 115 /* Acorn Econet */
191
192 /*
193 * Reserved for use with OpenBSD ipfilter.
194 */
195 #define LINKTYPE_IPFILTER 116
196
197 #define LINKTYPE_PFLOG 117 /* OpenBSD DLT_PFLOG */
198 #define LINKTYPE_CISCO_IOS 118 /* For Cisco-internal use */
199 #define LINKTYPE_IEEE802_11_PRISM 119 /* 802.11 plus Prism II monitor mode radio metadata header */
200 #define LINKTYPE_IEEE802_11_AIRONET 120 /* 802.11 plus FreeBSD Aironet driver radio metadata header */
201
202 /*
203 * Reserved for Siemens HiPath HDLC.
204 */
205 #define LINKTYPE_HHDLC 121
206
207 #define LINKTYPE_IP_OVER_FC 122 /* RFC 2625 IP-over-Fibre Channel */
208 #define LINKTYPE_SUNATM 123 /* Solaris+SunATM */
209
210 /*
211 * Reserved as per request from Kent Dahlgren <kent@praesum.com>
212 * for private use.
213 */
214 #define LINKTYPE_RIO 124 /* RapidIO */
215 #define LINKTYPE_PCI_EXP 125 /* PCI Express */
216 #define LINKTYPE_AURORA 126 /* Xilinx Aurora link layer */
217
218 #define LINKTYPE_IEEE802_11_RADIOTAP 127 /* 802.11 plus radiotap radio metadata header */
219
220 /*
221 * Reserved for the TZSP encapsulation, as per request from
222 * Chris Waters <chris.waters@networkchemistry.com>
223 * TZSP is a generic encapsulation for any other link type,
224 * which includes a means to include meta-information
225 * with the packet, e.g. signal strength and channel
226 * for 802.11 packets.
227 */
228 #define LINKTYPE_TZSP 128 /* Tazmen Sniffer Protocol */
229
230 #define LINKTYPE_ARCNET_LINUX 129 /* Linux-style headers */
231
232 /*
233 * Juniper-private data link types, as per request from
234 * Hannes Gredler <hannes@juniper.net>. The corresponding
235 * DLT_s are used for passing on chassis-internal
236 * metainformation such as QOS profiles, etc..
237 */
238 #define LINKTYPE_JUNIPER_MLPPP 130
239 #define LINKTYPE_JUNIPER_MLFR 131
240 #define LINKTYPE_JUNIPER_ES 132
241 #define LINKTYPE_JUNIPER_GGSN 133
242 #define LINKTYPE_JUNIPER_MFR 134
243 #define LINKTYPE_JUNIPER_ATM2 135
244 #define LINKTYPE_JUNIPER_SERVICES 136
245 #define LINKTYPE_JUNIPER_ATM1 137
246
247 #define LINKTYPE_APPLE_IP_OVER_IEEE1394 138 /* Apple IP-over-IEEE 1394 cooked header */
248
249 #define LINKTYPE_MTP2_WITH_PHDR 139
250 #define LINKTYPE_MTP2 140
251 #define LINKTYPE_MTP3 141
252 #define LINKTYPE_SCCP 142
253
254 #define LINKTYPE_DOCSIS 143 /* DOCSIS MAC frames */
255
256 #define LINKTYPE_LINUX_IRDA 144 /* Linux-IrDA */
257
258 /*
259 * Reserved for IBM SP switch and IBM Next Federation switch.
260 */
261 #define LINKTYPE_IBM_SP 145
262 #define LINKTYPE_IBM_SN 146
263
264 /*
265 * Reserved for private use. If you have some link-layer header type
266 * that you want to use within your organization, with the capture files
267 * using that link-layer header type not ever be sent outside your
268 * organization, you can use these values.
269 *
270 * No libpcap release will use these for any purpose, nor will any
271 * tcpdump release use them, either.
272 *
273 * Do *NOT* use these in capture files that you expect anybody not using
274 * your private versions of capture-file-reading tools to read; in
275 * particular, do *NOT* use them in products, otherwise you may find that
276 * people won't be able to use tcpdump, or snort, or Ethereal, or... to
277 * read capture files from your firewall/intrusion detection/traffic
278 * monitoring/etc. appliance, or whatever product uses that LINKTYPE_ value,
279 * and you may also find that the developers of those applications will
280 * not accept patches to let them read those files.
281 *
282 * Also, do not use them if somebody might send you a capture using them
283 * for *their* private type and tools using them for *your* private type
284 * would have to read them.
285 *
286 * Instead, in those cases, ask "tcpdump-workers@lists.tcpdump.org" for a
287 * new DLT_ and LINKTYPE_ value, as per the comment in pcap/bpf.h, and use
288 * the type you're given.
289 */
290 #define LINKTYPE_USER0 147
291 #define LINKTYPE_USER1 148
292 #define LINKTYPE_USER2 149
293 #define LINKTYPE_USER3 150
294 #define LINKTYPE_USER4 151
295 #define LINKTYPE_USER5 152
296 #define LINKTYPE_USER6 153
297 #define LINKTYPE_USER7 154
298 #define LINKTYPE_USER8 155
299 #define LINKTYPE_USER9 156
300 #define LINKTYPE_USER10 157
301 #define LINKTYPE_USER11 158
302 #define LINKTYPE_USER12 159
303 #define LINKTYPE_USER13 160
304 #define LINKTYPE_USER14 161
305 #define LINKTYPE_USER15 162
306
307 /*
308 * For future use with 802.11 captures - defined by AbsoluteValue
309 * Systems to store a number of bits of link-layer information
310 * including radio information:
311 *
312 * http://www.shaftnet.org/~pizza/software/capturefrm.txt
313 */
314 #define LINKTYPE_IEEE802_11_AVS 163 /* 802.11 plus AVS radio metadata header */
315
316 /*
317 * Juniper-private data link type, as per request from
318 * Hannes Gredler <hannes@juniper.net>. The corresponding
319 * DLT_s are used for passing on chassis-internal
320 * metainformation such as QOS profiles, etc..
321 */
322 #define LINKTYPE_JUNIPER_MONITOR 164
323
324 /*
325 * BACnet MS/TP frames.
326 */
327 #define LINKTYPE_BACNET_MS_TP 165
328
329 /*
330 * Another PPP variant as per request from Karsten Keil <kkeil@suse.de>.
331 *
332 * This is used in some OSes to allow a kernel socket filter to distinguish
333 * between incoming and outgoing packets, on a socket intended to
334 * supply pppd with outgoing packets so it can do dial-on-demand and
335 * hangup-on-lack-of-demand; incoming packets are filtered out so they
336 * don't cause pppd to hold the connection up (you don't want random
337 * input packets such as port scans, packets from old lost connections,
338 * etc. to force the connection to stay up).
339 *
340 * The first byte of the PPP header (0xff03) is modified to accommodate
341 * the direction - 0x00 = IN, 0x01 = OUT.
342 */
343 #define LINKTYPE_PPP_PPPD 166
344
345 /*
346 * Juniper-private data link type, as per request from
347 * Hannes Gredler <hannes@juniper.net>. The DLT_s are used
348 * for passing on chassis-internal metainformation such as
349 * QOS profiles, cookies, etc..
350 */
351 #define LINKTYPE_JUNIPER_PPPOE 167
352 #define LINKTYPE_JUNIPER_PPPOE_ATM 168
353
354 #define LINKTYPE_GPRS_LLC 169 /* GPRS LLC */
355 #define LINKTYPE_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */
356 #define LINKTYPE_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */
357
358 /*
359 * Requested by Oolan Zimmer <oz@gcom.com> for use in Gcom's T1/E1 line
360 * monitoring equipment.
361 */
362 #define LINKTYPE_GCOM_T1E1 172
363 #define LINKTYPE_GCOM_SERIAL 173
364
365 /*
366 * Juniper-private data link type, as per request from
367 * Hannes Gredler <hannes@juniper.net>. The DLT_ is used
368 * for internal communication to Physical Interface Cards (PIC)
369 */
370 #define LINKTYPE_JUNIPER_PIC_PEER 174
371
372 /*
373 * Link types requested by Gregor Maier <gregor@endace.com> of Endace
374 * Measurement Systems. They add an ERF header (see
375 * https://www.endace.com/support/EndaceRecordFormat.pdf) in front of
376 * the link-layer header.
377 */
378 #define LINKTYPE_ERF_ETH 175 /* Ethernet */
379 #define LINKTYPE_ERF_POS 176 /* Packet-over-SONET */
380
381 /*
382 * Requested by Daniele Orlandi <daniele@orlandi.com> for raw LAPD
383 * for vISDN (http://www.orlandi.com/visdn/). Its link-layer header
384 * includes additional information before the LAPD header, so it's
385 * not necessarily a generic LAPD header.
386 */
387 #define LINKTYPE_LINUX_LAPD 177
388
389 /*
390 * Juniper-private data link type, as per request from
391 * Hannes Gredler <hannes@juniper.net>.
392 * The Link Types are used for prepending meta-information
393 * like interface index, interface name
394 * before standard Ethernet, PPP, Frelay & C-HDLC Frames
395 */
396 #define LINKTYPE_JUNIPER_ETHER 178
397 #define LINKTYPE_JUNIPER_PPP 179
398 #define LINKTYPE_JUNIPER_FRELAY 180
399 #define LINKTYPE_JUNIPER_CHDLC 181
400
401 /*
402 * Multi Link Frame Relay (FRF.16)
403 */
404 #define LINKTYPE_MFR 182
405
406 /*
407 * Juniper-private data link type, as per request from
408 * Hannes Gredler <hannes@juniper.net>.
409 * The DLT_ is used for internal communication with a
410 * voice Adapter Card (PIC)
411 */
412 #define LINKTYPE_JUNIPER_VP 183
413
414 /*
415 * Arinc 429 frames.
416 * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
417 * Every frame contains a 32bit A429 label.
418 * More documentation on Arinc 429 can be found at
419 * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf
420 */
421 #define LINKTYPE_A429 184
422
423 /*
424 * Arinc 653 Interpartition Communication messages.
425 * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
426 * Please refer to the A653-1 standard for more information.
427 */
428 #define LINKTYPE_A653_ICM 185
429
430 /*
431 * This used to be "USB packets, beginning with a USB setup header;
432 * requested by Paolo Abeni <paolo.abeni@email.it>."
433 *
434 * However, that header didn't work all that well - it left out some
435 * useful information - and was abandoned in favor of the DLT_USB_LINUX
436 * header.
437 *
438 * This is now used by FreeBSD for its BPF taps for USB; that has its
439 * own headers. So it is written, so it is done.
440 */
441 #define LINKTYPE_USB_FREEBSD 186
442
443 /*
444 * Bluetooth HCI UART transport layer (part H:4); requested by
445 * Paolo Abeni.
446 */
447 #define LINKTYPE_BLUETOOTH_HCI_H4 187
448
449 /*
450 * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz
451 * <cruz_petagay@bah.com>.
452 */
453 #define LINKTYPE_IEEE802_16_MAC_CPS 188
454
455 /*
456 * USB packets, beginning with a Linux USB header; requested by
457 * Paolo Abeni <paolo.abeni@email.it>.
458 */
459 #define LINKTYPE_USB_LINUX 189
460
461 /*
462 * Controller Area Network (CAN) v. 2.0B packets.
463 * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
464 * Used to dump CAN packets coming from a CAN Vector board.
465 * More documentation on the CAN v2.0B frames can be found at
466 * http://www.can-cia.org/downloads/?269
467 */
468 #define LINKTYPE_CAN20B 190
469
470 /*
471 * IEEE 802.15.4, with address fields padded, as is done by Linux
472 * drivers; requested by Juergen Schimmer.
473 */
474 #define LINKTYPE_IEEE802_15_4_LINUX 191
475
476 /*
477 * Per Packet Information encapsulated packets.
478 * LINKTYPE_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
479 */
480 #define LINKTYPE_PPI 192
481
482 /*
483 * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header;
484 * requested by Charles Clancy.
485 */
486 #define LINKTYPE_IEEE802_16_MAC_CPS_RADIO 193
487
488 /*
489 * Juniper-private data link type, as per request from
490 * Hannes Gredler <hannes@juniper.net>.
491 * The DLT_ is used for internal communication with a
492 * integrated service module (ISM).
493 */
494 #define LINKTYPE_JUNIPER_ISM 194
495
496 /*
497 * IEEE 802.15.4, exactly as it appears in the spec (no padding, no
498 * nothing), and with the FCS at the end of the frame; requested by
499 * Mikko Saarnivala <mikko.saarnivala@sensinode.com>.
500 *
501 * This should only be used if the FCS is present at the end of the
502 * frame; if the frame has no FCS, DLT_IEEE802_15_4_NOFCS should be
503 * used.
504 */
505 #define LINKTYPE_IEEE802_15_4_WITHFCS 195
506
507 /*
508 * Various link-layer types, with a pseudo-header, for SITA
509 * (https://www.sita.aero/); requested by Fulko Hew (fulko.hew@gmail.com).
510 */
511 #define LINKTYPE_SITA 196
512
513 /*
514 * Various link-layer types, with a pseudo-header, for Endace DAG cards;
515 * encapsulates Endace ERF records. Requested by Stephen Donnelly
516 * <stephen@endace.com>.
517 */
518 #define LINKTYPE_ERF 197
519
520 /*
521 * Special header prepended to Ethernet packets when capturing from a
522 * u10 Networks board. Requested by Phil Mulholland
523 * <phil@u10networks.com>.
524 */
525 #define LINKTYPE_RAIF1 198
526
527 /*
528 * IPMB packet for IPMI, beginning with a 2-byte header, followed by
529 * the I2C slave address, followed by the netFn and LUN, etc..
530 * Requested by Chanthy Toeung <chanthy.toeung@ca.kontron.com>.
531 *
532 * XXX - its DLT_ value used to be called DLT_IPMB, back when we got the
533 * impression from the email thread requesting it that the packet
534 * had no extra 2-byte header. We've renamed it; if anybody used
535 * DLT_IPMB and assumed no 2-byte header, this will cause the compile
536 * to fail, at which point we'll have to figure out what to do about
537 * the two header types using the same DLT_/LINKTYPE_ value. If that
538 * doesn't happen, we'll assume nobody used it and that the redefinition
539 * is safe.
540 */
541 #define LINKTYPE_IPMB_KONTRON 199
542
543 /*
544 * Juniper-private data link type, as per request from
545 * Hannes Gredler <hannes@juniper.net>.
546 * The DLT_ is used for capturing data on a secure tunnel interface.
547 */
548 #define LINKTYPE_JUNIPER_ST 200
549
550 /*
551 * Bluetooth HCI UART transport layer (part H:4), with pseudo-header
552 * that includes direction information; requested by Paolo Abeni.
553 */
554 #define LINKTYPE_BLUETOOTH_HCI_H4_WITH_PHDR 201
555
556 /*
557 * AX.25 packet with a 1-byte KISS header; see
558 *
559 * http://www.ax25.net/kiss.htm
560 *
561 * as per Richard Stearn <richard@rns-stearn.demon.co.uk>.
562 */
563 #define LINKTYPE_AX25_KISS 202
564
565 /*
566 * LAPD packets from an ISDN channel, starting with the address field,
567 * with no pseudo-header.
568 * Requested by Varuna De Silva <varunax@gmail.com>.
569 */
570 #define LINKTYPE_LAPD 203
571
572 /*
573 * PPP, with a one-byte direction pseudo-header prepended - zero means
574 * "received by this host", non-zero (any non-zero value) means "sent by
575 * this host" - as per Will Barker <w.barker@zen.co.uk>.
576 */
577 #define LINKTYPE_PPP_WITH_DIR 204 /* Don't confuse with LINKTYPE_PPP_PPPD */
578
579 /*
580 * Cisco HDLC, with a one-byte direction pseudo-header prepended - zero
581 * means "received by this host", non-zero (any non-zero value) means
582 * "sent by this host" - as per Will Barker <w.barker@zen.co.uk>.
583 */
584 #define LINKTYPE_C_HDLC_WITH_DIR 205 /* Cisco HDLC */
585
586 /*
587 * Frame Relay, with a one-byte direction pseudo-header prepended - zero
588 * means "received by this host" (DCE -> DTE), non-zero (any non-zero
589 * value) means "sent by this host" (DTE -> DCE) - as per Will Barker
590 * <w.barker@zen.co.uk>.
591 */
592 #define LINKTYPE_FRELAY_WITH_DIR 206 /* Frame Relay */
593
594 /*
595 * LAPB, with a one-byte direction pseudo-header prepended - zero means
596 * "received by this host" (DCE -> DTE), non-zero (any non-zero value)
597 * means "sent by this host" (DTE -> DCE)- as per Will Barker
598 * <w.barker@zen.co.uk>.
599 */
600 #define LINKTYPE_LAPB_WITH_DIR 207 /* LAPB */
601
602 /*
603 * 208 is reserved for an as-yet-unspecified proprietary link-layer
604 * type, as requested by Will Barker.
605 */
606
607 /*
608 * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman
609 * <avn@pigeonpoint.com>.
610 */
611 #define LINKTYPE_IPMB_LINUX 209
612
613 /*
614 * FlexRay automotive bus - http://www.flexray.com/ - as requested
615 * by Hannes Kaelber <hannes.kaelber@x2e.de>.
616 */
617 #define LINKTYPE_FLEXRAY 210
618
619 /*
620 * Media Oriented Systems Transport (MOST) bus for multimedia
621 * transport - https://www.mostcooperation.com/ - as requested
622 * by Hannes Kaelber <hannes.kaelber@x2e.de>.
623 */
624 #define LINKTYPE_MOST 211
625
626 /*
627 * Local Interconnect Network (LIN) bus for vehicle networks -
628 * http://www.lin-subbus.org/ - as requested by Hannes Kaelber
629 * <hannes.kaelber@x2e.de>.
630 */
631 #define LINKTYPE_LIN 212
632
633 /*
634 * X2E-private data link type used for serial line capture,
635 * as requested by Hannes Kaelber <hannes.kaelber@x2e.de>.
636 */
637 #define LINKTYPE_X2E_SERIAL 213
638
639 /*
640 * X2E-private data link type used for the Xoraya data logger
641 * family, as requested by Hannes Kaelber <hannes.kaelber@x2e.de>.
642 */
643 #define LINKTYPE_X2E_XORAYA 214
644
645 /*
646 * IEEE 802.15.4, exactly as it appears in the spec (no padding, no
647 * nothing), but with the PHY-level data for non-ASK PHYs (4 octets
648 * of 0 as preamble, one octet of SFD, one octet of frame length+
649 * reserved bit, and then the MAC-layer data, starting with the
650 * frame control field).
651 *
652 * Requested by Max Filippov <jcmvbkbc@gmail.com>.
653 */
654 #define LINKTYPE_IEEE802_15_4_NONASK_PHY 215
655
656 /*
657 * David Gibson <david@gibson.dropbear.id.au> requested this for
658 * captures from the Linux kernel /dev/input/eventN devices. This
659 * is used to communicate keystrokes and mouse movements from the
660 * Linux kernel to display systems, such as Xorg.
661 */
662 #define LINKTYPE_LINUX_EVDEV 216
663
664 /*
665 * GSM Um and Abis interfaces, preceded by a "gsmtap" header.
666 *
667 * Requested by Harald Welte <laforge@gnumonks.org>.
668 */
669 #define LINKTYPE_GSMTAP_UM 217
670 #define LINKTYPE_GSMTAP_ABIS 218
671
672 /*
673 * MPLS, with an MPLS label as the link-layer header.
674 * Requested by Michele Marchetto <michele@openbsd.org> on behalf
675 * of OpenBSD.
676 */
677 #define LINKTYPE_MPLS 219
678
679 /*
680 * USB packets, beginning with a Linux USB header, with the USB header
681 * padded to 64 bytes; required for memory-mapped access.
682 */
683 #define LINKTYPE_USB_LINUX_MMAPPED 220
684
685 /*
686 * DECT packets, with a pseudo-header; requested by
687 * Matthias Wenzel <tcpdump@mazzoo.de>.
688 */
689 #define LINKTYPE_DECT 221
690
691 /*
692 * From: "Lidwa, Eric (GSFC-582.0)[SGT INC]" <eric.lidwa-1@nasa.gov>
693 * Date: Mon, 11 May 2009 11:18:30 -0500
694 *
695 * DLT_AOS. We need it for AOS Space Data Link Protocol.
696 * I have already written dissectors for but need an OK from
697 * legal before I can submit a patch.
698 *
699 */
700 #define LINKTYPE_AOS 222
701
702 /*
703 * Wireless HART (Highway Addressable Remote Transducer)
704 * From the HART Communication Foundation
705 * IES/PAS 62591
706 *
707 * Requested by Sam Roberts <vieuxtech@gmail.com>.
708 */
709 #define LINKTYPE_WIHART 223
710
711 /*
712 * Fibre Channel FC-2 frames, beginning with a Frame_Header.
713 * Requested by Kahou Lei <kahou82@gmail.com>.
714 */
715 #define LINKTYPE_FC_2 224
716
717 /*
718 * Fibre Channel FC-2 frames, beginning with an encoding of the
719 * SOF, and ending with an encoding of the EOF.
720 *
721 * The encodings represent the frame delimiters as 4-byte sequences
722 * representing the corresponding ordered sets, with K28.5
723 * represented as 0xBC, and the D symbols as the corresponding
724 * byte values; for example, SOFi2, which is K28.5 - D21.5 - D1.2 - D21.2,
725 * is represented as 0xBC 0xB5 0x55 0x55.
726 *
727 * Requested by Kahou Lei <kahou82@gmail.com>.
728 */
729 #define LINKTYPE_FC_2_WITH_FRAME_DELIMS 225
730
731 /*
732 * Solaris ipnet pseudo-header; requested by Darren Reed <Darren.Reed@Sun.COM>.
733 *
734 * The pseudo-header starts with a one-byte version number; for version 2,
735 * the pseudo-header is:
736 *
737 * struct dl_ipnetinfo {
738 * uint8_t dli_version;
739 * uint8_t dli_family;
740 * uint16_t dli_htype;
741 * uint32_t dli_pktlen;
742 * uint32_t dli_ifindex;
743 * uint32_t dli_grifindex;
744 * uint32_t dli_zsrc;
745 * uint32_t dli_zdst;
746 * };
747 *
748 * dli_version is 2 for the current version of the pseudo-header.
749 *
750 * dli_family is a Solaris address family value, so it's 2 for IPv4
751 * and 26 for IPv6.
752 *
753 * dli_htype is a "hook type" - 0 for incoming packets, 1 for outgoing
754 * packets, and 2 for packets arriving from another zone on the same
755 * machine.
756 *
757 * dli_pktlen is the length of the packet data following the pseudo-header
758 * (so the captured length minus dli_pktlen is the length of the
759 * pseudo-header, assuming the entire pseudo-header was captured).
760 *
761 * dli_ifindex is the interface index of the interface on which the
762 * packet arrived.
763 *
764 * dli_grifindex is the group interface index number (for IPMP interfaces).
765 *
766 * dli_zsrc is the zone identifier for the source of the packet.
767 *
768 * dli_zdst is the zone identifier for the destination of the packet.
769 *
770 * A zone number of 0 is the global zone; a zone number of 0xffffffff
771 * means that the packet arrived from another host on the network, not
772 * from another zone on the same machine.
773 *
774 * An IPv4 or IPv6 datagram follows the pseudo-header; dli_family indicates
775 * which of those it is.
776 */
777 #define LINKTYPE_IPNET 226
778
779 /*
780 * CAN (Controller Area Network) frames, with a pseudo-header as supplied
781 * by Linux SocketCAN, and with multi-byte numerical fields in that header
782 * in big-endian byte order.
783 *
784 * See Documentation/networking/can.txt in the Linux source.
785 *
786 * Requested by Felix Obenhuber <felix@obenhuber.de>.
787 */
788 #define LINKTYPE_CAN_SOCKETCAN 227
789
790 /*
791 * Raw IPv4/IPv6; different from DLT_RAW in that the DLT_ value specifies
792 * whether it's v4 or v6. Requested by Darren Reed <Darren.Reed@Sun.COM>.
793 */
794 #define LINKTYPE_IPV4 228
795 #define LINKTYPE_IPV6 229
796
797 /*
798 * IEEE 802.15.4, exactly as it appears in the spec (no padding, no
799 * nothing), and with no FCS at the end of the frame; requested by
800 * Jon Smirl <jonsmirl@gmail.com>.
801 */
802 #define LINKTYPE_IEEE802_15_4_NOFCS 230
803
804 /*
805 * Raw D-Bus:
806 *
807 * https://www.freedesktop.org/wiki/Software/dbus
808 *
809 * messages:
810 *
811 * https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages
812 *
813 * starting with the endianness flag, followed by the message type, etc.,
814 * but without the authentication handshake before the message sequence:
815 *
816 * https://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol
817 *
818 * Requested by Martin Vidner <martin@vidner.net>.
819 */
820 #define LINKTYPE_DBUS 231
821
822 /*
823 * Juniper-private data link type, as per request from
824 * Hannes Gredler <hannes@juniper.net>.
825 */
826 #define LINKTYPE_JUNIPER_VS 232
827 #define LINKTYPE_JUNIPER_SRX_E2E 233
828 #define LINKTYPE_JUNIPER_FIBRECHANNEL 234
829
830 /*
831 * DVB-CI (DVB Common Interface for communication between a PC Card
832 * module and a DVB receiver). See
833 *
834 * https://www.kaiser.cx/pcap-dvbci.html
835 *
836 * for the specification.
837 *
838 * Requested by Martin Kaiser <martin@kaiser.cx>.
839 */
840 #define LINKTYPE_DVB_CI 235
841
842 /*
843 * Variant of 3GPP TS 27.010 multiplexing protocol. Requested
844 * by Hans-Christoph Schemmel <hans-christoph.schemmel@cinterion.com>.
845 */
846 #define LINKTYPE_MUX27010 236
847
848 /*
849 * STANAG 5066 D_PDUs. Requested by M. Baris Demiray
850 * <barisdemiray@gmail.com>.
851 */
852 #define LINKTYPE_STANAG_5066_D_PDU 237
853
854 /*
855 * Juniper-private data link type, as per request from
856 * Hannes Gredler <hannes@juniper.net>.
857 */
858 #define LINKTYPE_JUNIPER_ATM_CEMIC 238
859
860 /*
861 * NetFilter LOG messages
862 * (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets)
863 *
864 * Requested by Jakub Zawadzki <darkjames-ws@darkjames.pl>
865 */
866 #define LINKTYPE_NFLOG 239
867
868 /*
869 * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type
870 * for Ethernet packets with a 4-byte pseudo-header and always
871 * with the payload including the FCS, as supplied by their
872 * netANALYZER hardware and software.
873 *
874 * Requested by Holger P. Frommer <HPfrommer@hilscher.com>
875 */
876 #define LINKTYPE_NETANALYZER 240
877
878 /*
879 * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type
880 * for Ethernet packets with a 4-byte pseudo-header and FCS and
881 * 1 byte of SFD, as supplied by their netANALYZER hardware and
882 * software.
883 *
884 * Requested by Holger P. Frommer <HPfrommer@hilscher.com>
885 */
886 #define LINKTYPE_NETANALYZER_TRANSPARENT 241
887
888 /*
889 * IP-over-InfiniBand, as specified by RFC 4391.
890 *
891 * Requested by Petr Sumbera <petr.sumbera@oracle.com>.
892 */
893 #define LINKTYPE_IPOIB 242
894
895 /*
896 * MPEG-2 transport stream (ISO 13818-1/ITU-T H.222.0).
897 *
898 * Requested by Guy Martin <gmsoft@tuxicoman.be>.
899 */
900 #define LINKTYPE_MPEG_2_TS 243
901
902 /*
903 * ng4T GmbH's UMTS Iub/Iur-over-ATM and Iub/Iur-over-IP format as
904 * used by their ng40 protocol tester.
905 *
906 * Requested by Jens Grimmer <jens.grimmer@ng4t.com>.
907 */
908 #define LINKTYPE_NG40 244
909
910 /*
911 * Pseudo-header giving adapter number and flags, followed by an NFC
912 * (Near-Field Communications) Logical Link Control Protocol (LLCP) PDU,
913 * as specified by NFC Forum Logical Link Control Protocol Technical
914 * Specification LLCP 1.1.
915 *
916 * Requested by Mike Wakerly <mikey@google.com>.
917 */
918 #define LINKTYPE_NFC_LLCP 245
919
920 /*
921 * pfsync output; DLT_PFSYNC is 18, which collides with DLT_CIP in
922 * SuSE 6.3, on OpenBSD, NetBSD, DragonFly BSD, and macOS, and
923 * is 121, which collides with DLT_HHDLC, in FreeBSD. We pick a
924 * shiny new link-layer header type value that doesn't collide with
925 * anything, in the hopes that future pfsync savefiles, if any,
926 * won't require special hacks to distinguish from other savefiles.
927 *
928 */
929 #define LINKTYPE_PFSYNC 246
930
931 /*
932 * Raw InfiniBand packets, starting with the Local Routing Header.
933 *
934 * Requested by Oren Kladnitsky <orenk@mellanox.com>.
935 */
936 #define LINKTYPE_INFINIBAND 247
937
938 /*
939 * SCTP, with no lower-level protocols (i.e., no IPv4 or IPv6).
940 *
941 * Requested by Michael Tuexen <Michael.Tuexen@lurchi.franken.de>.
942 */
943 #define LINKTYPE_SCTP 248
944
945 /*
946 * USB packets, beginning with a USBPcap header.
947 *
948 * Requested by Tomasz Mon <desowin@gmail.com>
949 */
950 #define LINKTYPE_USBPCAP 249
951
952 /*
953 * Schweitzer Engineering Laboratories "RTAC" product serial-line
954 * packets.
955 *
956 * Requested by Chris Bontje <chris_bontje@selinc.com>.
957 */
958 #define LINKTYPE_RTAC_SERIAL 250
959
960 /*
961 * Bluetooth Low Energy air interface link-layer packets.
962 *
963 * Requested by Mike Kershaw <dragorn@kismetwireless.net>.
964 */
965 #define LINKTYPE_BLUETOOTH_LE_LL 251
966
967 /*
968 * Link-layer header type for upper-protocol layer PDU saves from wireshark.
969 *
970 * the actual contents are determined by two TAGs stored with each
971 * packet:
972 * EXP_PDU_TAG_LINKTYPE the link type (LINKTYPE_ value) of the
973 * original packet.
974 *
975 * EXP_PDU_TAG_PROTO_NAME the name of the wireshark dissector
976 * that can make sense of the data stored.
977 */
978 #define LINKTYPE_WIRESHARK_UPPER_PDU 252
979
980 /*
981 * Link-layer header type for the netlink protocol (nlmon devices).
982 */
983 #define LINKTYPE_NETLINK 253
984
985 /*
986 * Bluetooth Linux Monitor headers for the BlueZ stack.
987 */
988 #define LINKTYPE_BLUETOOTH_LINUX_MONITOR 254
989
990 /*
991 * Bluetooth Basic Rate/Enhanced Data Rate baseband packets, as
992 * captured by Ubertooth.
993 */
994 #define LINKTYPE_BLUETOOTH_BREDR_BB 255
995
996 /*
997 * Bluetooth Low Energy link layer packets, as captured by Ubertooth.
998 */
999 #define LINKTYPE_BLUETOOTH_LE_LL_WITH_PHDR 256
1000
1001 /*
1002 * PROFIBUS data link layer.
1003 */
1004 #define LINKTYPE_PROFIBUS_DL 257
1005
1006 /*
1007 * Apple's DLT_PKTAP headers.
1008 *
1009 * Sadly, the folks at Apple either had no clue that the DLT_USERn values
1010 * are for internal use within an organization and partners only, and
1011 * didn't know that the right way to get a link-layer header type is to
1012 * ask tcpdump.org for one, or knew and didn't care, so they just
1013 * used DLT_USER2, which causes problems for everything except for
1014 * their version of tcpdump.
1015 *
1016 * So I'll just give them one; hopefully this will show up in a
1017 * libpcap release in time for them to get this into 10.10 Big Sur
1018 * or whatever Mavericks' successor is called. LINKTYPE_PKTAP
1019 * will be 258 *even on macOS*; that is *intentional*, so that
1020 * PKTAP files look the same on *all* OSes (different OSes can have
1021 * different numerical values for a given DLT_, but *MUST NOT* have
1022 * different values for what goes in a file, as files can be moved
1023 * between OSes!).
1024 */
1025 #define LINKTYPE_PKTAP 258
1026
1027 /*
1028 * Ethernet packets preceded by a header giving the last 6 octets
1029 * of the preamble specified by 802.3-2012 Clause 65, section
1030 * 65.1.3.2 "Transmit".
1031 */
1032 #define LINKTYPE_EPON 259
1033
1034 /*
1035 * IPMI trace packets, as specified by Table 3-20 "Trace Data Block Format"
1036 * in the PICMG HPM.2 specification.
1037 */
1038 #define LINKTYPE_IPMI_HPM_2 260
1039
1040 /*
1041 * per Joshua Wright <jwright@hasborg.com>, formats for Zwave captures.
1042 */
1043 #define LINKTYPE_ZWAVE_R1_R2 261
1044 #define LINKTYPE_ZWAVE_R3 262
1045
1046 /*
1047 * per Steve Karg <skarg@users.sourceforge.net>, formats for Wattstopper
1048 * Digital Lighting Management room bus serial protocol captures.
1049 */
1050 #define LINKTYPE_WATTSTOPPER_DLM 263
1051
1052 /*
1053 * ISO 14443 contactless smart card messages.
1054 */
1055 #define LINKTYPE_ISO_14443 264
1056
1057 /*
1058 * Radio data system (RDS) groups. IEC 62106.
1059 * Per Jonathan Brucker <jonathan.brucke@gmail.com>.
1060 */
1061 #define LINKTYPE_RDS 265
1062
1063 /*
1064 * USB packets, beginning with a Darwin (macOS, etc.) header.
1065 */
1066 #define LINKTYPE_USB_DARWIN 266
1067
1068 /*
1069 * OpenBSD DLT_OPENFLOW.
1070 */
1071 #define LINKTYPE_OPENFLOW 267
1072
1073 /*
1074 * SDLC frames containing SNA PDUs.
1075 */
1076 #define LINKTYPE_SDLC 268
1077
1078 /*
1079 * per "Selvig, Bjorn" <b.selvig@ti.com> used for
1080 * TI protocol sniffer.
1081 */
1082 #define LINKTYPE_TI_LLN_SNIFFER 269
1083
1084 /*
1085 * per: Erik de Jong <erikdejong at gmail.com> for
1086 * https://github.com/eriknl/LoRaTap/releases/tag/v0.1
1087 */
1088 #define LINKTYPE_LORATAP 270
1089
1090 /*
1091 * per: Stefanha at gmail.com for
1092 * https://lists.sandelman.ca/pipermail/tcpdump-workers/2017-May/000772.html
1093 * and: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/vsockmon.h
1094 * for: https://qemu-project.org/Features/VirtioVsock
1095 */
1096 #define LINKTYPE_VSOCK 271
1097
1098 /*
1099 * Nordic Semiconductor Bluetooth LE sniffer.
1100 */
1101 #define LINKTYPE_NORDIC_BLE 272
1102
1103 /*
1104 * Excentis DOCSIS 3.1 RF sniffer (XRA-31)
1105 * per: bruno.verstuyft at excentis.com
1106 * https://www.xra31.com/xra-header
1107 */
1108 #define LINKTYPE_DOCSIS31_XRA31 273
1109
1110 /*
1111 * mPackets, as specified by IEEE 802.3br Figure 99-4, starting
1112 * with the preamble and always ending with a CRC field.
1113 */
1114 #define LINKTYPE_ETHERNET_MPACKET 274
1115
1116 /*
1117 * DisplayPort AUX channel monitoring data as specified by VESA
1118 * DisplayPort(DP) Standard preceded by a pseudo-header.
1119 * per dirk.eibach at gdsys.cc
1120 */
1121 #define LINKTYPE_DISPLAYPORT_AUX 275
1122
1123 /*
1124 * Linux cooked sockets v2.
1125 */
1126 #define LINKTYPE_LINUX_SLL2 276
1127
1128 /*
1129 * Sercos Monitor, per Manuel Jacob <manuel.jacob at steinbeis-stg.de>
1130 */
1131 #define LINKTYPE_SERCOS_MONITOR 277
1132
1133 /*
1134 * OpenVizsla http://openvizsla.org is open source USB analyzer hardware.
1135 * It consists of FPGA with attached USB phy and FTDI chip for streaming
1136 * the data to the host PC.
1137 *
1138 * Current OpenVizsla data encapsulation format is described here:
1139 * https://github.com/matwey/libopenvizsla/wiki/OpenVizsla-protocol-description
1140 *
1141 */
1142 #define LINKTYPE_OPENVIZSLA 278
1143
1144 /*
1145 * The Elektrobit High Speed Capture and Replay (EBHSCR) protocol is produced
1146 * by a PCIe Card for interfacing high speed automotive interfaces.
1147 *
1148 * The specification for this frame format can be found at:
1149 * https://www.elektrobit.com/ebhscr
1150 *
1151 * for Guenter.Ebermann at elektrobit.com
1152 *
1153 */
1154 #define LINKTYPE_EBHSCR 279
1155
1156 /*
1157 * The https://fd.io vpp graph dispatch tracer produces pcap trace files
1158 * in the format documented here:
1159 * https://fdio-vpp.readthedocs.io/en/latest/gettingstarted/developers/vnet.html#graph-dispatcher-pcap-tracing
1160 */
1161 #define LINKTYPE_VPP_DISPATCH 280
1162
1163 /*
1164 * Broadcom Ethernet switches (ROBO switch) 4 bytes proprietary tagging format.
1165 */
1166 #define LINKTYPE_DSA_TAG_BRCM 281
1167 #define LINKTYPE_DSA_TAG_BRCM_PREPEND 282
1168
1169 /*
1170 * IEEE 802.15.4 with pseudo-header and optional meta-data TLVs, PHY payload
1171 * exactly as it appears in the spec (no padding, no nothing), and FCS if
1172 * specified by FCS Type TLV; requested by James Ko <jck@exegin.com>.
1173 * Specification at https://github.com/jkcko/ieee802.15.4-tap
1174 */
1175 #define LINKTYPE_IEEE802_15_4_TAP 283
1176
1177 /*
1178 * Marvell (Ethertype) Distributed Switch Architecture proprietary tagging format.
1179 */
1180 #define LINKTYPE_DSA_TAG_DSA 284
1181 #define LINKTYPE_DSA_TAG_EDSA 285
1182
1183 /*
1184 * Payload of lawful intercept packets using the ELEE protocol;
1185 * https://socket.hr/draft-dfranusic-opsawg-elee-00.xml
1186 * https://xml2rfc.tools.ietf.org/cgi-bin/xml2rfc.cgi?url=https://socket.hr/draft-dfranusic-opsawg-elee-00.xml&modeAsFormat=html/ascii
1187 */
1188 #define LINKTYPE_ELEE 286
1189
1190 /*
1191 * Serial frames transmitted between a host and a Z-Wave chip.
1192 */
1193 #define LINKTYPE_Z_WAVE_SERIAL 287
1194
1195 /*
1196 * USB 2.0, 1.1, and 1.0 packets as transmitted over the cable.
1197 */
1198 #define LINKTYPE_USB_2_0 288
1199
1200 /*
1201 * ATSC Link-Layer Protocol (A/330) packets.
1202 */
1203 #define LINKTYPE_ATSC_ALP 289
1204
1205 #define LINKTYPE_MATCHING_MAX 289 /* highest value in the "matching" range */
1206
1207 /*
1208 * The DLT_ and LINKTYPE_ values in the "matching" range should be the
1209 * same, so DLT_MATCHING_MAX and LINKTYPE_MATCHING_MAX should be the
1210 * same.
1211 */
1212 #if LINKTYPE_MATCHING_MAX != DLT_MATCHING_MAX
1213 #error The LINKTYPE_ matching range does not match the DLT_ matching range
1214 #endif
1215
1216 static struct linktype_map {
1217 int dlt;
1218 int linktype;
1219 } map[] = {
1220 /*
1221 * These DLT_* codes have LINKTYPE_* codes with values identical
1222 * to the values of the corresponding DLT_* code.
1223 */
1224 { DLT_NULL, LINKTYPE_NULL },
1225 { DLT_EN10MB, LINKTYPE_ETHERNET },
1226 { DLT_EN3MB, LINKTYPE_EXP_ETHERNET },
1227 { DLT_AX25, LINKTYPE_AX25 },
1228 { DLT_PRONET, LINKTYPE_PRONET },
1229 { DLT_CHAOS, LINKTYPE_CHAOS },
1230 { DLT_IEEE802, LINKTYPE_IEEE802_5 },
1231 { DLT_ARCNET, LINKTYPE_ARCNET_BSD },
1232 { DLT_SLIP, LINKTYPE_SLIP },
1233 { DLT_PPP, LINKTYPE_PPP },
1234 { DLT_FDDI, LINKTYPE_FDDI },
1235 { DLT_SYMANTEC_FIREWALL, LINKTYPE_SYMANTEC_FIREWALL },
1236
1237 /*
1238 * These DLT_* codes have different values on different
1239 * platforms; we map them to LINKTYPE_* codes that
1240 * have values that should never be equal to any DLT_*
1241 * code.
1242 */
1243 #ifdef DLT_FR
1244 /* BSD/OS Frame Relay */
1245 { DLT_FR, LINKTYPE_FRELAY },
1246 #endif
1247
1248 { DLT_ATM_RFC1483, LINKTYPE_ATM_RFC1483 },
1249 { DLT_RAW, LINKTYPE_RAW },
1250 { DLT_SLIP_BSDOS, LINKTYPE_SLIP_BSDOS },
1251 { DLT_PPP_BSDOS, LINKTYPE_PPP_BSDOS },
1252 { DLT_HDLC, LINKTYPE_NETBSD_HDLC },
1253
1254 /* BSD/OS Cisco HDLC */
1255 { DLT_C_HDLC, LINKTYPE_C_HDLC },
1256
1257 /*
1258 * These DLT_* codes are not on all platforms, but, so far,
1259 * there don't appear to be any platforms that define
1260 * other codes with those values; we map them to
1261 * different LINKTYPE_* values anyway, just in case.
1262 */
1263
1264 /* Linux ATM Classical IP */
1265 { DLT_ATM_CLIP, LINKTYPE_ATM_CLIP },
1266
1267 /* NetBSD sync/async serial PPP (or Cisco HDLC) */
1268 { DLT_PPP_SERIAL, LINKTYPE_PPP_HDLC },
1269
1270 /* NetBSD PPP over Ethernet */
1271 { DLT_PPP_ETHER, LINKTYPE_PPP_ETHER },
1272
1273 /*
1274 * All LINKTYPE_ values between LINKTYPE_MATCHING_MIN
1275 * and LINKTYPE_MATCHING_MAX are mapped to identical
1276 * DLT_ values.
1277 */
1278
1279 { -1, -1 }
1280 };
1281
1282 int
1283 dlt_to_linktype(int dlt)
1284 {
1285 int i;
1286
1287 /*
1288 * DLTs that, on some platforms, have values in the matching range
1289 * but that *don't* have the same value as the corresponding
1290 * LINKTYPE because, for some reason, not all OSes have the
1291 * same value for that DLT (note that the DLT's value might be
1292 * outside the matching range on some of those OSes).
1293 */
1294 if (dlt == DLT_PFSYNC)
1295 return (LINKTYPE_PFSYNC);
1296 if (dlt == DLT_PKTAP)
1297 return (LINKTYPE_PKTAP);
1298
1299 /*
1300 * For all other values in the matching range, the DLT
1301 * value is the same as the LINKTYPE value.
1302 */
1303 if (dlt >= DLT_MATCHING_MIN && dlt <= DLT_MATCHING_MAX)
1304 return (dlt);
1305
1306 /*
1307 * Map the values outside that range.
1308 */
1309 for (i = 0; map[i].dlt != -1; i++) {
1310 if (map[i].dlt == dlt)
1311 return (map[i].linktype);
1312 }
1313
1314 /*
1315 * If we don't have a mapping for this DLT, return an
1316 * error; that means that this is a value with no corresponding
1317 * LINKTYPE, and we need to assign one.
1318 */
1319 return (-1);
1320 }
1321
1322 int
1323 linktype_to_dlt(int linktype)
1324 {
1325 int i;
1326
1327 /*
1328 * LINKTYPEs in the matching range that *don't*
1329 * have the same value as the corresponding DLTs
1330 * because, for some reason, not all OSes have the
1331 * same value for that DLT.
1332 */
1333 if (linktype == LINKTYPE_PFSYNC)
1334 return (DLT_PFSYNC);
1335 if (linktype == LINKTYPE_PKTAP)
1336 return (DLT_PKTAP);
1337
1338 /*
1339 * For all other values in the matching range, except for
1340 * LINKTYPE_ATM_CLIP, the LINKTYPE value is the same as
1341 * the DLT value.
1342 *
1343 * LINKTYPE_ATM_CLIP is a special case. DLT_ATM_CLIP is
1344 * not on all platforms, but, so far, there don't appear
1345 * to be any platforms that define it as anything other
1346 * than 19; we define LINKTYPE_ATM_CLIP as something
1347 * other than 19, just in case. That value is in the
1348 * matching range, so we have to check for it.
1349 */
1350 if (linktype >= LINKTYPE_MATCHING_MIN &&
1351 linktype <= LINKTYPE_MATCHING_MAX &&
1352 linktype != LINKTYPE_ATM_CLIP)
1353 return (linktype);
1354
1355 /*
1356 * Map the values outside that range.
1357 */
1358 for (i = 0; map[i].linktype != -1; i++) {
1359 if (map[i].linktype == linktype)
1360 return (map[i].dlt);
1361 }
1362
1363 /*
1364 * If we don't have an entry for this LINKTYPE, return
1365 * the link type value; it may be a DLT from an newer
1366 * version of libpcap.
1367 */
1368 return linktype;
1369 }
1370
1371 /*
1372 * Return the maximum snapshot length for a given DLT_ value.
1373 *
1374 * For most link-layer types, we use MAXIMUM_SNAPLEN.
1375 *
1376 * For DLT_DBUS, the maximum is 128MiB, as per
1377 *
1378 * https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages
1379 *
1380 * For DLT_EBHSCR, the maximum is 8MiB, as per
1381 *
1382 * https://www.elektrobit.com/ebhscr
1383 *
1384 * For DLT_USBPCAP, the maximum is 1MiB, as per
1385 *
1386 * https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=15985
1387 */
1388 u_int
1389 max_snaplen_for_dlt(int dlt)
1390 {
1391 switch (dlt) {
1392
1393 case DLT_DBUS:
1394 return 128*1024*1024;
1395
1396 case DLT_EBHSCR:
1397 return 8*1024*1024;
1398
1399 case DLT_USBPCAP:
1400 return 1024*1024;
1401
1402 default:
1403 return MAXIMUM_SNAPLEN;
1404 }
1405 }
1406
1407 /*
1408 * Most versions of the DLT_PFLOG pseudo-header have UID and PID fields
1409 * that are saved in host byte order.
1410 *
1411 * When reading a DLT_PFLOG packet, we need to convert those fields from
1412 * the byte order of the host that wrote the file to this host's byte
1413 * order.
1414 */
1415 static void
1416 swap_pflog_header(const struct pcap_pkthdr *hdr, u_char *buf)
1417 {
1418 u_int caplen = hdr->caplen;
1419 u_int length = hdr->len;
1420 u_int pfloghdr_length;
1421 struct pfloghdr *pflhdr = (struct pfloghdr *)buf;
1422
1423 if (caplen < (u_int) (offsetof(struct pfloghdr, uid) + sizeof pflhdr->uid) ||
1424 length < (u_int) (offsetof(struct pfloghdr, uid) + sizeof pflhdr->uid)) {
1425 /* Not enough data to have the uid field */
1426 return;
1427 }
1428
1429 pfloghdr_length = pflhdr->length;
1430
1431 if (pfloghdr_length < (u_int) (offsetof(struct pfloghdr, uid) + sizeof pflhdr->uid)) {
1432 /* Header doesn't include uid field */
1433 return;
1434 }
1435 pflhdr->uid = SWAPLONG(pflhdr->uid);
1436
1437 if (caplen < (u_int) (offsetof(struct pfloghdr, pid) + sizeof pflhdr->pid) ||
1438 length < (u_int) (offsetof(struct pfloghdr, pid) + sizeof pflhdr->pid)) {
1439 /* Not enough data to have the pid field */
1440 return;
1441 }
1442 if (pfloghdr_length < (u_int) (offsetof(struct pfloghdr, pid) + sizeof pflhdr->pid)) {
1443 /* Header doesn't include pid field */
1444 return;
1445 }
1446 pflhdr->pid = SWAPLONG(pflhdr->pid);
1447
1448 if (caplen < (u_int) (offsetof(struct pfloghdr, rule_uid) + sizeof pflhdr->rule_uid) ||
1449 length < (u_int) (offsetof(struct pfloghdr, rule_uid) + sizeof pflhdr->rule_uid)) {
1450 /* Not enough data to have the rule_uid field */
1451 return;
1452 }
1453 if (pfloghdr_length < (u_int) (offsetof(struct pfloghdr, rule_uid) + sizeof pflhdr->rule_uid)) {
1454 /* Header doesn't include rule_uid field */
1455 return;
1456 }
1457 pflhdr->rule_uid = SWAPLONG(pflhdr->rule_uid);
1458
1459 if (caplen < (u_int) (offsetof(struct pfloghdr, rule_pid) + sizeof pflhdr->rule_pid) ||
1460 length < (u_int) (offsetof(struct pfloghdr, rule_pid) + sizeof pflhdr->rule_pid)) {
1461 /* Not enough data to have the rule_pid field */
1462 return;
1463 }
1464 if (pfloghdr_length < (u_int) (offsetof(struct pfloghdr, rule_pid) + sizeof pflhdr->rule_pid)) {
1465 /* Header doesn't include rule_pid field */
1466 return;
1467 }
1468 pflhdr->rule_pid = SWAPLONG(pflhdr->rule_pid);
1469 }
1470
1471 /*
1472 * DLT_LINUX_SLL packets with a protocol type of LINUX_SLL_P_CAN or
1473 * LINUX_SLL_P_CANFD have SocketCAN headers in front of the payload,
1474 * with the CAN ID being in host byte order.
1475 *
1476 * When reading a DLT_LINUX_SLL packet, we need to check for those
1477 * packets and convert the CAN ID from the byte order of the host that
1478 * wrote the file to this host's byte order.
1479 */
1480 static void
1481 swap_linux_sll_header(const struct pcap_pkthdr *hdr, u_char *buf)
1482 {
1483 u_int caplen = hdr->caplen;
1484 u_int length = hdr->len;
1485 struct sll_header *shdr = (struct sll_header *)buf;
1486 uint16_t protocol;
1487 pcap_can_socketcan_hdr *chdr;
1488
1489 if (caplen < (u_int) sizeof(struct sll_header) ||
1490 length < (u_int) sizeof(struct sll_header)) {
1491 /* Not enough data to have the protocol field */
1492 return;
1493 }
1494
1495 protocol = EXTRACT_BE_U_2(&shdr->sll_protocol);
1496 if (protocol != LINUX_SLL_P_CAN && protocol != LINUX_SLL_P_CANFD)
1497 return;
1498
1499 /*
1500 * SocketCAN packet; fix up the packet's header.
1501 */
1502 chdr = (pcap_can_socketcan_hdr *)(buf + sizeof(struct sll_header));
1503 if (caplen < (u_int) sizeof(struct sll_header) + sizeof(chdr->can_id) ||
1504 length < (u_int) sizeof(struct sll_header) + sizeof(chdr->can_id)) {
1505 /* Not enough data to have the CAN ID */
1506 return;
1507 }
1508 chdr->can_id = SWAPLONG(chdr->can_id);
1509 }
1510
1511 /*
1512 * The same applies for DLT_LINUX_SLL2.
1513 */
1514 static void
1515 swap_linux_sll2_header(const struct pcap_pkthdr *hdr, u_char *buf)
1516 {
1517 u_int caplen = hdr->caplen;
1518 u_int length = hdr->len;
1519 struct sll2_header *shdr = (struct sll2_header *)buf;
1520 uint16_t protocol;
1521 pcap_can_socketcan_hdr *chdr;
1522
1523 if (caplen < (u_int) sizeof(struct sll2_header) ||
1524 length < (u_int) sizeof(struct sll2_header)) {
1525 /* Not enough data to have the protocol field */
1526 return;
1527 }
1528
1529 protocol = EXTRACT_BE_U_2(&shdr->sll2_protocol);
1530 if (protocol != LINUX_SLL_P_CAN && protocol != LINUX_SLL_P_CANFD)
1531 return;
1532
1533 /*
1534 * SocketCAN packet; fix up the packet's header.
1535 */
1536 chdr = (pcap_can_socketcan_hdr *)(buf + sizeof(struct sll2_header));
1537 if (caplen < (u_int) sizeof(struct sll2_header) + sizeof(chdr->can_id) ||
1538 length < (u_int) sizeof(struct sll2_header) + sizeof(chdr->can_id)) {
1539 /* Not enough data to have the CAN ID */
1540 return;
1541 }
1542 chdr->can_id = SWAPLONG(chdr->can_id);
1543 }
1544
1545 /*
1546 * The DLT_USB_LINUX and DLT_USB_LINUX_MMAPPED headers are in host
1547 * byte order when capturing (it's supplied directly from a
1548 * memory-mapped buffer shared by the kernel).
1549 *
1550 * When reading a DLT_USB_LINUX or DLT_USB_LINUX_MMAPPED packet, we
1551 * need to convert it from the byte order of the host that wrote the
1552 * file to this host's byte order.
1553 */
1554 static void
1555 swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf,
1556 int header_len_64_bytes)
1557 {
1558 pcap_usb_header_mmapped *uhdr = (pcap_usb_header_mmapped *)buf;
1559 bpf_u_int32 offset = 0;
1560
1561 /*
1562 * "offset" is the offset *past* the field we're swapping;
1563 * we skip the field *before* checking to make sure
1564 * the captured data length includes the entire field.
1565 */
1566
1567 /*
1568 * The URB id is a totally opaque value; do we really need to
1569 * convert it to the reading host's byte order???
1570 */
1571 offset += 8; /* skip past id */
1572 if (hdr->caplen < offset)
1573 return;
1574 uhdr->id = SWAPLL(uhdr->id);
1575
1576 offset += 4; /* skip past various 1-byte fields */
1577
1578 offset += 2; /* skip past bus_id */
1579 if (hdr->caplen < offset)
1580 return;
1581 uhdr->bus_id = SWAPSHORT(uhdr->bus_id);
1582
1583 offset += 2; /* skip past various 1-byte fields */
1584
1585 offset += 8; /* skip past ts_sec */
1586 if (hdr->caplen < offset)
1587 return;
1588 uhdr->ts_sec = SWAPLL(uhdr->ts_sec);
1589
1590 offset += 4; /* skip past ts_usec */
1591 if (hdr->caplen < offset)
1592 return;
1593 uhdr->ts_usec = SWAPLONG(uhdr->ts_usec);
1594
1595 offset += 4; /* skip past status */
1596 if (hdr->caplen < offset)
1597 return;
1598 uhdr->status = SWAPLONG(uhdr->status);
1599
1600 offset += 4; /* skip past urb_len */
1601 if (hdr->caplen < offset)
1602 return;
1603 uhdr->urb_len = SWAPLONG(uhdr->urb_len);
1604
1605 offset += 4; /* skip past data_len */
1606 if (hdr->caplen < offset)
1607 return;
1608 uhdr->data_len = SWAPLONG(uhdr->data_len);
1609
1610 if (uhdr->transfer_type == URB_ISOCHRONOUS) {
1611 offset += 4; /* skip past s.iso.error_count */
1612 if (hdr->caplen < offset)
1613 return;
1614 uhdr->s.iso.error_count = SWAPLONG(uhdr->s.iso.error_count);
1615
1616 offset += 4; /* skip past s.iso.numdesc */
1617 if (hdr->caplen < offset)
1618 return;
1619 uhdr->s.iso.numdesc = SWAPLONG(uhdr->s.iso.numdesc);
1620 } else
1621 offset += 8; /* skip USB setup header */
1622
1623 /*
1624 * With the old header, there are no isochronous descriptors
1625 * after the header.
1626 *
1627 * With the new header, the actual number of descriptors in
1628 * the header is not s.iso.numdesc, it's ndesc - only the
1629 * first N descriptors, for some value of N, are put into
1630 * the header, and ndesc is set to the actual number copied.
1631 * In addition, if s.iso.numdesc is negative, no descriptors
1632 * are captured, and ndesc is set to 0.
1633 */
1634 if (header_len_64_bytes) {
1635 /*
1636 * This is either the "version 1" header, with
1637 * 16 bytes of additional fields at the end, or
1638 * a "version 0" header from a memory-mapped
1639 * capture, with 16 bytes of zeroed-out padding
1640 * at the end. Byte swap them as if this were
1641 * a "version 1" header.
1642 */
1643 offset += 4; /* skip past interval */
1644 if (hdr->caplen < offset)
1645 return;
1646 uhdr->interval = SWAPLONG(uhdr->interval);
1647
1648 offset += 4; /* skip past start_frame */
1649 if (hdr->caplen < offset)
1650 return;
1651 uhdr->start_frame = SWAPLONG(uhdr->start_frame);
1652
1653 offset += 4; /* skip past xfer_flags */
1654 if (hdr->caplen < offset)
1655 return;
1656 uhdr->xfer_flags = SWAPLONG(uhdr->xfer_flags);
1657
1658 offset += 4; /* skip past ndesc */
1659 if (hdr->caplen < offset)
1660 return;
1661 uhdr->ndesc = SWAPLONG(uhdr->ndesc);
1662
1663 if (uhdr->transfer_type == URB_ISOCHRONOUS) {
1664 /* swap the values in struct linux_usb_isodesc */
1665 usb_isodesc *pisodesc;
1666 uint32_t i;
1667
1668 pisodesc = (usb_isodesc *)(void *)(buf+offset);
1669 for (i = 0; i < uhdr->ndesc; i++) {
1670 offset += 4; /* skip past status */
1671 if (hdr->caplen < offset)
1672 return;
1673 pisodesc->status = SWAPLONG(pisodesc->status);
1674
1675 offset += 4; /* skip past offset */
1676 if (hdr->caplen < offset)
1677 return;
1678 pisodesc->offset = SWAPLONG(pisodesc->offset);
1679
1680 offset += 4; /* skip past len */
1681 if (hdr->caplen < offset)
1682 return;
1683 pisodesc->len = SWAPLONG(pisodesc->len);
1684
1685 offset += 4; /* skip past padding */
1686
1687 pisodesc++;
1688 }
1689 }
1690 }
1691 }
1692
1693 /*
1694 * The DLT_NFLOG "packets" have a mixture of big-endian and host-byte-order
1695 * data. They begin with a fixed-length header with big-endian fields,
1696 * followed by a set of TLVs, where the type and length are in host
1697 * byte order but the values are either big-endian or are a raw byte
1698 * sequence that's the same regardless of the host's byte order.
1699 *
1700 * When reading a DLT_NFLOG packet, we need to convert the type and
1701 * length values from the byte order of the host that wrote the file
1702 * to the byte order of this host.
1703 */
1704 static void
1705 swap_nflog_header(const struct pcap_pkthdr *hdr, u_char *buf)
1706 {
1707 u_char *p = buf;
1708 nflog_hdr_t *nfhdr = (nflog_hdr_t *)buf;
1709 nflog_tlv_t *tlv;
1710 u_int caplen = hdr->caplen;
1711 u_int length = hdr->len;
1712 uint16_t size;
1713
1714 if (caplen < (u_int) sizeof(nflog_hdr_t) ||
1715 length < (u_int) sizeof(nflog_hdr_t)) {
1716 /* Not enough data to have any TLVs. */
1717 return;
1718 }
1719
1720 if (nfhdr->nflog_version != 0) {
1721 /* Unknown NFLOG version */
1722 return;
1723 }
1724
1725 length -= sizeof(nflog_hdr_t);
1726 caplen -= sizeof(nflog_hdr_t);
1727 p += sizeof(nflog_hdr_t);
1728
1729 while (caplen >= sizeof(nflog_tlv_t)) {
1730 tlv = (nflog_tlv_t *) p;
1731
1732 /* Swap the type and length. */
1733 tlv->tlv_type = SWAPSHORT(tlv->tlv_type);
1734 tlv->tlv_length = SWAPSHORT(tlv->tlv_length);
1735
1736 /* Get the length of the TLV. */
1737 size = tlv->tlv_length;
1738 if (size % 4 != 0)
1739 size += 4 - size % 4;
1740
1741 /* Is the TLV's length less than the minimum? */
1742 if (size < sizeof(nflog_tlv_t)) {
1743 /* Yes. Give up now. */
1744 return;
1745 }
1746
1747 /* Do we have enough data for the full TLV? */
1748 if (caplen < size || length < size) {
1749 /* No. */
1750 return;
1751 }
1752
1753 /* Skip over the TLV. */
1754 length -= size;
1755 caplen -= size;
1756 p += size;
1757 }
1758 }
1759
1760 void
1761 swap_pseudo_headers(int linktype, struct pcap_pkthdr *hdr, u_char *data)
1762 {
1763 /*
1764 * Convert pseudo-headers from the byte order of
1765 * the host on which the file was saved to our
1766 * byte order, as necessary.
1767 */
1768 switch (linktype) {
1769
1770 case DLT_PFLOG:
1771 swap_pflog_header(hdr, data);
1772 break;
1773
1774 case DLT_LINUX_SLL:
1775 swap_linux_sll_header(hdr, data);
1776 break;
1777
1778 case DLT_LINUX_SLL2:
1779 swap_linux_sll2_header(hdr, data);
1780 break;
1781
1782 case DLT_USB_LINUX:
1783 swap_linux_usb_header(hdr, data, 0);
1784 break;
1785
1786 case DLT_USB_LINUX_MMAPPED:
1787 swap_linux_usb_header(hdr, data, 1);
1788 break;
1789
1790 case DLT_NFLOG:
1791 swap_nflog_header(hdr, data);
1792 break;
1793 }
1794 }