2 * Copyright (c) 1993, 1994, 1995, 1996, 1997
3 * The Regents of the University of California. All rights reserved.
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
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.
21 * pcap-common.c - common code for pcap and pcapng files
26 #include <pcap-types.h>
30 #include "pcap-common.h"
33 * We don't write DLT_* values to capture files, because they're not the
34 * same on all platforms.
36 * Unfortunately, the various flavors of BSD have not always used the same
37 * numerical values for the same data types, and various patches to
38 * libpcap for non-BSD OSes have added their own DLT_* codes for link
39 * layer encapsulation types seen on those OSes, and those codes have had,
40 * in some cases, values that were also used, on other platforms, for other
41 * link layer encapsulation types.
43 * This means that capture files of a type whose numerical DLT_* code
44 * means different things on different BSDs, or with different versions
45 * of libpcap, can't always be read on systems other than those like
46 * the one running on the machine on which the capture was made.
48 * Instead, we define here a set of LINKTYPE_* codes, and map DLT_* codes
49 * to LINKTYPE_* codes when writing a savefile header, and map LINKTYPE_*
50 * codes to DLT_* codes when reading a savefile header.
52 * For those DLT_* codes that have, as far as we know, the same values on
53 * all platforms (DLT_NULL through DLT_FDDI), we define LINKTYPE_xxx as
54 * DLT_xxx; that way, captures of those types can still be read by
55 * versions of libpcap that map LINKTYPE_* values to DLT_* values, and
56 * captures of those types written by versions of libpcap that map DLT_
57 * values to LINKTYPE_ values can still be read by older versions
60 * The other LINKTYPE_* codes are given values starting at 100, in the
61 * hopes that no DLT_* code will be given one of those values.
63 * In order to ensure that a given LINKTYPE_* code's value will refer to
64 * the same encapsulation type on all platforms, you should not allocate
65 * a new LINKTYPE_* value without consulting
66 * "tcpdump-workers@lists.tcpdump.org". The tcpdump developers will
67 * allocate a value for you, and will not subsequently allocate it to
68 * anybody else; that value will be added to the "pcap.h" in the
69 * tcpdump.org Git repository, so that a future libpcap release will
72 * You should, if possible, also contribute patches to libpcap and tcpdump
73 * to handle the new encapsulation type, so that they can also be checked
74 * into the tcpdump.org Git repository and so that they will appear in
75 * future libpcap and tcpdump releases.
77 * Do *NOT* assume that any values after the largest value in this file
78 * are available; you might not have the most up-to-date version of this
79 * file, and new values after that one might have been assigned. Also,
80 * do *NOT* use any values below 100 - those might already have been
81 * taken by one (or more!) organizations.
83 * Any platform that defines additional DLT_* codes should:
85 * request a LINKTYPE_* code and value from tcpdump.org,
88 * add, in their version of libpcap, an entry to map
89 * those DLT_* codes to the corresponding LINKTYPE_*
92 * redefine, in their "net/bpf.h", any DLT_* values
93 * that collide with the values used by their additional
94 * DLT_* codes, to remove those collisions (but without
95 * making them collide with any of the LINKTYPE_*
96 * values equal to 50 or above; they should also avoid
97 * defining DLT_* values that collide with those
98 * LINKTYPE_* values, either).
102 * These values the DLT_ values for which are the same on all platforms,
103 * and that have been defined by <net/bpf.h> for ages.
105 * For those, the LINKTYPE_ values are equal to the DLT_ values.
107 * LINKTYPE_LOW_MATCHING_MIN is the lowest such value;
108 * LINKTYPE_LOW_MATCHING_MAX is the highest such value.
110 #define LINKTYPE_LOW_MATCHING_MIN 0 /* lowest value in this "matching" range */
111 #define LINKTYPE_NULL DLT_NULL
112 #define LINKTYPE_ETHERNET DLT_EN10MB /* also for 100Mb and up */
113 #define LINKTYPE_EXP_ETHERNET DLT_EN3MB /* 3Mb experimental Ethernet */
114 #define LINKTYPE_AX25 DLT_AX25
115 #define LINKTYPE_PRONET DLT_PRONET
116 #define LINKTYPE_CHAOS DLT_CHAOS
117 #define LINKTYPE_IEEE802_5 DLT_IEEE802 /* DLT_IEEE802 is used for 802.5 Token Ring */
118 #define LINKTYPE_ARCNET_BSD DLT_ARCNET /* BSD-style headers */
119 #define LINKTYPE_SLIP DLT_SLIP
120 #define LINKTYPE_PPP DLT_PPP
121 #define LINKTYPE_FDDI DLT_FDDI
123 #define LINKTYPE_LOW_MATCHING_MAX LINKTYPE_FDDI /* highest value in this "matching" range */
126 * LINKTYPE_PPP is for use when there might, or might not, be an RFC 1662
127 * PPP in HDLC-like framing header (with 0xff 0x03 before the PPP protocol
128 * field) at the beginning of the packet.
130 * This is for use when there is always such a header; the address field
131 * might be 0xff, for regular PPP, or it might be an address field for Cisco
132 * point-to-point with HDLC framing as per section 4.3.1 of RFC 1547 ("Cisco
133 * HDLC"). This is, for example, what you get with NetBSD's DLT_PPP_SERIAL.
135 * We give it the same value as NetBSD's DLT_PPP_SERIAL, in the hopes that
136 * nobody else will choose a DLT_ value of 50, and so that DLT_PPP_SERIAL
137 * captures will be written out with a link type that NetBSD's tcpdump
140 #define LINKTYPE_PPP_HDLC 50 /* PPP in HDLC-like framing */
142 #define LINKTYPE_PPP_ETHER 51 /* NetBSD PPP-over-Ethernet */
144 #define LINKTYPE_SYMANTEC_FIREWALL 99 /* Symantec Enterprise Firewall */
147 * These correspond to DLT_s that have different values on different
148 * platforms; we map between these values in capture files and
149 * the DLT_ values as returned by pcap_datalink() and passed to
152 #define LINKTYPE_ATM_RFC1483 100 /* LLC/SNAP-encapsulated ATM */
153 #define LINKTYPE_RAW 101 /* raw IP */
154 #define LINKTYPE_SLIP_BSDOS 102 /* BSD/OS SLIP BPF header */
155 #define LINKTYPE_PPP_BSDOS 103 /* BSD/OS PPP BPF header */
158 * Values starting with 104 are used for newly-assigned link-layer
159 * header type values; for those link-layer header types, the DLT_
160 * value returned by pcap_datalink() and passed to pcap_open_dead(),
161 * and the LINKTYPE_ value that appears in capture files, are the
164 * LINKTYPE_HIGH_MATCHING_MIN is the lowest such value;
165 * LINKTYPE_HIGH_MATCHING_MAX is the highest such value.
167 #define LINKTYPE_HIGH_MATCHING_MIN 104 /* lowest value in the "matching" range */
169 #define LINKTYPE_C_HDLC 104 /* Cisco HDLC */
170 #define LINKTYPE_IEEE802_11 105 /* IEEE 802.11 (wireless) */
171 #define LINKTYPE_ATM_CLIP 106 /* Linux Classical IP over ATM */
172 #define LINKTYPE_FRELAY 107 /* Frame Relay */
173 #define LINKTYPE_LOOP 108 /* OpenBSD loopback */
174 #define LINKTYPE_ENC 109 /* OpenBSD IPSEC enc */
177 * These two types are reserved for future use.
179 #define LINKTYPE_LANE8023 110 /* ATM LANE + 802.3 */
180 #define LINKTYPE_HIPPI 111 /* NetBSD HIPPI */
183 * Used for NetBSD DLT_HDLC; from looking at the one driver in NetBSD
184 * that uses it, it's Cisco HDLC, so it's the same as DLT_C_HDLC/
185 * LINKTYPE_C_HDLC, but we define a separate value to avoid some
186 * compatibility issues with programs on NetBSD.
188 * All code should treat LINKTYPE_NETBSD_HDLC and LINKTYPE_C_HDLC the same.
190 #define LINKTYPE_NETBSD_HDLC 112 /* NetBSD HDLC framing */
192 #define LINKTYPE_LINUX_SLL 113 /* Linux cooked socket capture */
193 #define LINKTYPE_LTALK 114 /* Apple LocalTalk hardware */
194 #define LINKTYPE_ECONET 115 /* Acorn Econet */
197 * Reserved for use with OpenBSD ipfilter.
199 #define LINKTYPE_IPFILTER 116
201 #define LINKTYPE_PFLOG 117 /* OpenBSD DLT_PFLOG */
202 #define LINKTYPE_CISCO_IOS 118 /* For Cisco-internal use */
203 #define LINKTYPE_IEEE802_11_PRISM 119 /* 802.11 plus Prism II monitor mode radio metadata header */
204 #define LINKTYPE_IEEE802_11_AIRONET 120 /* 802.11 plus FreeBSD Aironet driver radio metadata header */
207 * Reserved for Siemens HiPath HDLC.
209 #define LINKTYPE_HHDLC 121
211 #define LINKTYPE_IP_OVER_FC 122 /* RFC 2625 IP-over-Fibre Channel */
212 #define LINKTYPE_SUNATM 123 /* Solaris+SunATM */
215 * Reserved as per request from Kent Dahlgren <kent@praesum.com>
218 #define LINKTYPE_RIO 124 /* RapidIO */
219 #define LINKTYPE_PCI_EXP 125 /* PCI Express */
220 #define LINKTYPE_AURORA 126 /* Xilinx Aurora link layer */
222 #define LINKTYPE_IEEE802_11_RADIOTAP 127 /* 802.11 plus radiotap radio metadata header */
225 * Reserved for the TZSP encapsulation, as per request from
226 * Chris Waters <chris.waters@networkchemistry.com>
227 * TZSP is a generic encapsulation for any other link type,
228 * which includes a means to include meta-information
229 * with the packet, e.g. signal strength and channel
230 * for 802.11 packets.
232 #define LINKTYPE_TZSP 128 /* Tazmen Sniffer Protocol */
234 #define LINKTYPE_ARCNET_LINUX 129 /* Linux-style headers */
237 * Juniper-private data link types, as per request from
238 * Hannes Gredler <hannes@juniper.net>. The corresponding
239 * DLT_s are used for passing on chassis-internal
240 * metainformation such as QOS profiles, etc..
242 #define LINKTYPE_JUNIPER_MLPPP 130
243 #define LINKTYPE_JUNIPER_MLFR 131
244 #define LINKTYPE_JUNIPER_ES 132
245 #define LINKTYPE_JUNIPER_GGSN 133
246 #define LINKTYPE_JUNIPER_MFR 134
247 #define LINKTYPE_JUNIPER_ATM2 135
248 #define LINKTYPE_JUNIPER_SERVICES 136
249 #define LINKTYPE_JUNIPER_ATM1 137
251 #define LINKTYPE_APPLE_IP_OVER_IEEE1394 138 /* Apple IP-over-IEEE 1394 cooked header */
253 #define LINKTYPE_MTP2_WITH_PHDR 139
254 #define LINKTYPE_MTP2 140
255 #define LINKTYPE_MTP3 141
256 #define LINKTYPE_SCCP 142
258 #define LINKTYPE_DOCSIS 143 /* DOCSIS MAC frames */
260 #define LINKTYPE_LINUX_IRDA 144 /* Linux-IrDA */
263 * Reserved for IBM SP switch and IBM Next Federation switch.
265 #define LINKTYPE_IBM_SP 145
266 #define LINKTYPE_IBM_SN 146
269 * Reserved for private use. If you have some link-layer header type
270 * that you want to use within your organization, with the capture files
271 * using that link-layer header type not ever be sent outside your
272 * organization, you can use these values.
274 * No libpcap release will use these for any purpose, nor will any
275 * tcpdump release use them, either.
277 * Do *NOT* use these in capture files that you expect anybody not using
278 * your private versions of capture-file-reading tools to read; in
279 * particular, do *NOT* use them in products, otherwise you may find that
280 * people won't be able to use tcpdump, or snort, or Ethereal, or... to
281 * read capture files from your firewall/intrusion detection/traffic
282 * monitoring/etc. appliance, or whatever product uses that LINKTYPE_ value,
283 * and you may also find that the developers of those applications will
284 * not accept patches to let them read those files.
286 * Also, do not use them if somebody might send you a capture using them
287 * for *their* private type and tools using them for *your* private type
288 * would have to read them.
290 * Instead, in those cases, ask "tcpdump-workers@lists.tcpdump.org" for a
291 * new DLT_ and LINKTYPE_ value, as per the comment in pcap/bpf.h, and use
292 * the type you're given.
294 #define LINKTYPE_USER0 147
295 #define LINKTYPE_USER1 148
296 #define LINKTYPE_USER2 149
297 #define LINKTYPE_USER3 150
298 #define LINKTYPE_USER4 151
299 #define LINKTYPE_USER5 152
300 #define LINKTYPE_USER6 153
301 #define LINKTYPE_USER7 154
302 #define LINKTYPE_USER8 155
303 #define LINKTYPE_USER9 156
304 #define LINKTYPE_USER10 157
305 #define LINKTYPE_USER11 158
306 #define LINKTYPE_USER12 159
307 #define LINKTYPE_USER13 160
308 #define LINKTYPE_USER14 161
309 #define LINKTYPE_USER15 162
312 * For future use with 802.11 captures - defined by AbsoluteValue
313 * Systems to store a number of bits of link-layer information
314 * including radio information:
316 * http://www.shaftnet.org/~pizza/software/capturefrm.txt
318 #define LINKTYPE_IEEE802_11_AVS 163 /* 802.11 plus AVS radio metadata header */
321 * Juniper-private data link type, as per request from
322 * Hannes Gredler <hannes@juniper.net>. The corresponding
323 * DLT_s are used for passing on chassis-internal
324 * metainformation such as QOS profiles, etc..
326 #define LINKTYPE_JUNIPER_MONITOR 164
329 * BACnet MS/TP frames.
331 #define LINKTYPE_BACNET_MS_TP 165
334 * Another PPP variant as per request from Karsten Keil <kkeil@suse.de>.
336 * This is used in some OSes to allow a kernel socket filter to distinguish
337 * between incoming and outgoing packets, on a socket intended to
338 * supply pppd with outgoing packets so it can do dial-on-demand and
339 * hangup-on-lack-of-demand; incoming packets are filtered out so they
340 * don't cause pppd to hold the connection up (you don't want random
341 * input packets such as port scans, packets from old lost connections,
342 * etc. to force the connection to stay up).
344 * The first byte of the PPP header (0xff03) is modified to accommodate
345 * the direction - 0x00 = IN, 0x01 = OUT.
347 #define LINKTYPE_PPP_PPPD 166
350 * Juniper-private data link type, as per request from
351 * Hannes Gredler <hannes@juniper.net>. The DLT_s are used
352 * for passing on chassis-internal metainformation such as
353 * QOS profiles, cookies, etc..
355 #define LINKTYPE_JUNIPER_PPPOE 167
356 #define LINKTYPE_JUNIPER_PPPOE_ATM 168
358 #define LINKTYPE_GPRS_LLC 169 /* GPRS LLC */
359 #define LINKTYPE_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */
360 #define LINKTYPE_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */
363 * Requested by Oolan Zimmer <oz@gcom.com> for use in Gcom's T1/E1 line
364 * monitoring equipment.
366 #define LINKTYPE_GCOM_T1E1 172
367 #define LINKTYPE_GCOM_SERIAL 173
370 * Juniper-private data link type, as per request from
371 * Hannes Gredler <hannes@juniper.net>. The DLT_ is used
372 * for internal communication to Physical Interface Cards (PIC)
374 #define LINKTYPE_JUNIPER_PIC_PEER 174
377 * Link types requested by Gregor Maier <gregor@endace.com> of Endace
378 * Measurement Systems. They add an ERF header (see
379 * https://www.endace.com/support/EndaceRecordFormat.pdf) in front of
380 * the link-layer header.
382 #define LINKTYPE_ERF_ETH 175 /* Ethernet */
383 #define LINKTYPE_ERF_POS 176 /* Packet-over-SONET */
386 * Requested by Daniele Orlandi <daniele@orlandi.com> for raw LAPD
387 * for vISDN (http://www.orlandi.com/visdn/). Its link-layer header
388 * includes additional information before the LAPD header, so it's
389 * not necessarily a generic LAPD header.
391 #define LINKTYPE_LINUX_LAPD 177
394 * Juniper-private data link type, as per request from
395 * Hannes Gredler <hannes@juniper.net>.
396 * The Link Types are used for prepending meta-information
397 * like interface index, interface name
398 * before standard Ethernet, PPP, Frelay & C-HDLC Frames
400 #define LINKTYPE_JUNIPER_ETHER 178
401 #define LINKTYPE_JUNIPER_PPP 179
402 #define LINKTYPE_JUNIPER_FRELAY 180
403 #define LINKTYPE_JUNIPER_CHDLC 181
406 * Multi Link Frame Relay (FRF.16)
408 #define LINKTYPE_MFR 182
411 * Juniper-private data link type, as per request from
412 * Hannes Gredler <hannes@juniper.net>.
413 * The DLT_ is used for internal communication with a
414 * voice Adapter Card (PIC)
416 #define LINKTYPE_JUNIPER_VP 183
420 * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
421 * Every frame contains a 32bit A429 label.
422 * More documentation on Arinc 429 can be found at
423 * https://web.archive.org/web/20040616233302/https://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf
425 #define LINKTYPE_A429 184
428 * Arinc 653 Interpartition Communication messages.
429 * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
430 * Please refer to the A653-1 standard for more information.
432 #define LINKTYPE_A653_ICM 185
435 * This used to be "USB packets, beginning with a USB setup header;
436 * requested by Paolo Abeni <paolo.abeni@email.it>."
438 * However, that header didn't work all that well - it left out some
439 * useful information - and was abandoned in favor of the DLT_USB_LINUX
442 * This is now used by FreeBSD for its BPF taps for USB; that has its
443 * own headers. So it is written, so it is done.
445 #define LINKTYPE_USB_FREEBSD 186
448 * Bluetooth HCI UART transport layer (part H:4); requested by
451 #define LINKTYPE_BLUETOOTH_HCI_H4 187
454 * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz
455 * <cruz_petagay@bah.com>.
457 #define LINKTYPE_IEEE802_16_MAC_CPS 188
460 * USB packets, beginning with a Linux USB header; requested by
461 * Paolo Abeni <paolo.abeni@email.it>.
463 #define LINKTYPE_USB_LINUX 189
466 * Controller Area Network (CAN) v. 2.0B packets.
467 * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
468 * Used to dump CAN packets coming from a CAN Vector board.
469 * More documentation on the CAN v2.0B frames can be found at
470 * http://www.can-cia.org/downloads/?269
472 #define LINKTYPE_CAN20B 190
475 * IEEE 802.15.4, with address fields padded, as is done by Linux
476 * drivers; requested by Juergen Schimmer.
478 #define LINKTYPE_IEEE802_15_4_LINUX 191
481 * Per Packet Information encapsulated packets.
482 * LINKTYPE_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.
484 #define LINKTYPE_PPI 192
487 * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header;
488 * requested by Charles Clancy.
490 #define LINKTYPE_IEEE802_16_MAC_CPS_RADIO 193
493 * Juniper-private data link type, as per request from
494 * Hannes Gredler <hannes@juniper.net>.
495 * The DLT_ is used for internal communication with a
496 * integrated service module (ISM).
498 #define LINKTYPE_JUNIPER_ISM 194
501 * IEEE 802.15.4, exactly as it appears in the spec (no padding, no
502 * nothing), and with the FCS at the end of the frame; requested by
503 * Mikko Saarnivala <mikko.saarnivala@sensinode.com>.
505 * This should only be used if the FCS is present at the end of the
506 * frame; if the frame has no FCS, DLT_IEEE802_15_4_NOFCS should be
509 #define LINKTYPE_IEEE802_15_4_WITHFCS 195
512 * Various link-layer types, with a pseudo-header, for SITA
513 * (https://www.sita.aero/); requested by Fulko Hew (fulko.hew@gmail.com).
515 #define LINKTYPE_SITA 196
518 * Various link-layer types, with a pseudo-header, for Endace DAG cards;
519 * encapsulates Endace ERF records. Requested by Stephen Donnelly
520 * <stephen@endace.com>.
522 #define LINKTYPE_ERF 197
525 * Special header prepended to Ethernet packets when capturing from a
526 * u10 Networks board. Requested by Phil Mulholland
527 * <phil@u10networks.com>.
529 #define LINKTYPE_RAIF1 198
532 * IPMB packet for IPMI, beginning with a 2-byte header, followed by
533 * the I2C slave address, followed by the netFn and LUN, etc..
534 * Requested by Chanthy Toeung <chanthy.toeung@ca.kontron.com>.
536 * XXX - its DLT_ value used to be called DLT_IPMB, back when we got the
537 * impression from the email thread requesting it that the packet
538 * had no extra 2-byte header. We've renamed it; if anybody used
539 * DLT_IPMB and assumed no 2-byte header, this will cause the compile
540 * to fail, at which point we'll have to figure out what to do about
541 * the two header types using the same DLT_/LINKTYPE_ value. If that
542 * doesn't happen, we'll assume nobody used it and that the redefinition
545 #define LINKTYPE_IPMB_KONTRON 199
548 * Juniper-private data link type, as per request from
549 * Hannes Gredler <hannes@juniper.net>.
550 * The DLT_ is used for capturing data on a secure tunnel interface.
552 #define LINKTYPE_JUNIPER_ST 200
555 * Bluetooth HCI UART transport layer (part H:4), with pseudo-header
556 * that includes direction information; requested by Paolo Abeni.
558 #define LINKTYPE_BLUETOOTH_HCI_H4_WITH_PHDR 201
561 * AX.25 packet with a 1-byte KISS header; see
563 * http://www.ax25.net/kiss.htm
565 * as per Richard Stearn <richard@rns-stearn.demon.co.uk>.
567 #define LINKTYPE_AX25_KISS 202
570 * LAPD packets from an ISDN channel, starting with the address field,
571 * with no pseudo-header.
572 * Requested by Varuna De Silva <varunax@gmail.com>.
574 #define LINKTYPE_LAPD 203
577 * PPP, with a one-byte direction pseudo-header prepended - zero means
578 * "received by this host", non-zero (any non-zero value) means "sent by
579 * this host" - as per Will Barker <w.barker@zen.co.uk>.
581 #define LINKTYPE_PPP_WITH_DIR 204 /* Don't confuse with LINKTYPE_PPP_PPPD */
584 * Cisco HDLC, with a one-byte direction pseudo-header prepended - zero
585 * means "received by this host", non-zero (any non-zero value) means
586 * "sent by this host" - as per Will Barker <w.barker@zen.co.uk>.
588 #define LINKTYPE_C_HDLC_WITH_DIR 205 /* Cisco HDLC */
591 * Frame Relay, with a one-byte direction pseudo-header prepended - zero
592 * means "received by this host" (DCE -> DTE), non-zero (any non-zero
593 * value) means "sent by this host" (DTE -> DCE) - as per Will Barker
594 * <w.barker@zen.co.uk>.
596 #define LINKTYPE_FRELAY_WITH_DIR 206 /* Frame Relay */
599 * LAPB, with a one-byte direction pseudo-header prepended - zero means
600 * "received by this host" (DCE -> DTE), non-zero (any non-zero value)
601 * means "sent by this host" (DTE -> DCE)- as per Will Barker
602 * <w.barker@zen.co.uk>.
604 #define LINKTYPE_LAPB_WITH_DIR 207 /* LAPB */
607 * 208 is reserved for an as-yet-unspecified proprietary link-layer
608 * type, as requested by Will Barker.
612 * I2C with a Linux-specific pseudo-header; as requested by Alexey Neyman
613 * <avn@pigeonpoint.com>.
615 * In the discussion, starting at
617 * https://seclists.org/tcpdump/2007/q4/127
619 * the original idea that it was a link-layer type for I2C, but,
620 * as it was proposed as a way to capture IPMB-over-I2C, and
621 * the conclusion was that reserving it for IPMB-over-I2C meant
622 * that analyzers could just assume the traffic was IPMB.
624 * However, it was later used for HDMI DDC traffic, so there's
625 * no point in pretending that it's IPMB-only any more, so we
626 * renamed it to a name suggested earlier in the discussion,
627 * namely LINKTYPE_I2C_LINUX/DLT_I2C_LINUX, as the header was,
628 * at least originally, Linux-specific.
630 #define LINKTYPE_I2C_LINUX 209
633 * FlexRay automotive bus - http://www.flexray.com/ - as requested
634 * by Hannes Kaelber <hannes.kaelber@x2e.de>.
636 #define LINKTYPE_FLEXRAY 210
639 * Media Oriented Systems Transport (MOST) bus for multimedia
640 * transport - https://www.mostcooperation.com/ - as requested
641 * by Hannes Kaelber <hannes.kaelber@x2e.de>.
643 #define LINKTYPE_MOST 211
646 * Local Interconnect Network (LIN) bus for vehicle networks -
647 * http://www.lin-subbus.org/ - as requested by Hannes Kaelber
648 * <hannes.kaelber@x2e.de>.
650 #define LINKTYPE_LIN 212
653 * X2E-private data link type used for serial line capture,
654 * as requested by Hannes Kaelber <hannes.kaelber@x2e.de>.
656 #define LINKTYPE_X2E_SERIAL 213
659 * X2E-private data link type used for the Xoraya data logger
660 * family, as requested by Hannes Kaelber <hannes.kaelber@x2e.de>.
662 #define LINKTYPE_X2E_XORAYA 214
665 * IEEE 802.15.4, exactly as it appears in the spec (no padding, no
666 * nothing), but with the PHY-level data for non-ASK PHYs (4 octets
667 * of 0 as preamble, one octet of SFD, one octet of frame length+
668 * reserved bit, and then the MAC-layer data, starting with the
669 * frame control field).
671 * Requested by Max Filippov <jcmvbkbc@gmail.com>.
673 #define LINKTYPE_IEEE802_15_4_NONASK_PHY 215
676 * David Gibson <david@gibson.dropbear.id.au> requested this for
677 * captures from the Linux kernel /dev/input/eventN devices. This
678 * is used to communicate keystrokes and mouse movements from the
679 * Linux kernel to display systems, such as Xorg.
681 #define LINKTYPE_LINUX_EVDEV 216
684 * GSM Um and Abis interfaces, preceded by a "gsmtap" header.
686 * Requested by Harald Welte <laforge@gnumonks.org>.
688 #define LINKTYPE_GSMTAP_UM 217
689 #define LINKTYPE_GSMTAP_ABIS 218
692 * MPLS, with an MPLS label as the link-layer header.
693 * Requested by Michele Marchetto <michele@openbsd.org> on behalf
696 #define LINKTYPE_MPLS 219
699 * USB packets, beginning with a Linux USB header, with the USB header
700 * padded to 64 bytes; required for memory-mapped access.
702 #define LINKTYPE_USB_LINUX_MMAPPED 220
705 * DECT packets, with a pseudo-header; requested by
706 * Matthias Wenzel <tcpdump@mazzoo.de>.
708 #define LINKTYPE_DECT 221
711 * From: "Lidwa, Eric (GSFC-582.0)[SGT INC]" <eric.lidwa-1@nasa.gov>
712 * Date: Mon, 11 May 2009 11:18:30 -0500
714 * DLT_AOS. We need it for AOS Space Data Link Protocol.
715 * I have already written dissectors for but need an OK from
716 * legal before I can submit a patch.
719 #define LINKTYPE_AOS 222
722 * WirelessHART (Highway Addressable Remote Transducer)
723 * From the HART Communication Foundation
726 * Requested by Sam Roberts <vieuxtech@gmail.com>.
728 #define LINKTYPE_WIHART 223
731 * Fibre Channel FC-2 frames, beginning with a Frame_Header.
732 * Requested by Kahou Lei <kahou82@gmail.com>.
734 #define LINKTYPE_FC_2 224
737 * Fibre Channel FC-2 frames, beginning with an encoding of the
738 * SOF, and ending with an encoding of the EOF.
740 * The encodings represent the frame delimiters as 4-byte sequences
741 * representing the corresponding ordered sets, with K28.5
742 * represented as 0xBC, and the D symbols as the corresponding
743 * byte values; for example, SOFi2, which is K28.5 - D21.5 - D1.2 - D21.2,
744 * is represented as 0xBC 0xB5 0x55 0x55.
746 * Requested by Kahou Lei <kahou82@gmail.com>.
748 #define LINKTYPE_FC_2_WITH_FRAME_DELIMS 225
751 * Solaris ipnet pseudo-header; requested by Darren Reed <Darren.Reed@Sun.COM>.
753 * The pseudo-header starts with a one-byte version number; for version 2,
754 * the pseudo-header is:
756 * struct dl_ipnetinfo {
757 * uint8_t dli_version;
758 * uint8_t dli_family;
759 * uint16_t dli_htype;
760 * uint32_t dli_pktlen;
761 * uint32_t dli_ifindex;
762 * uint32_t dli_grifindex;
767 * dli_version is 2 for the current version of the pseudo-header.
769 * dli_family is a Solaris address family value, so it's 2 for IPv4
772 * dli_htype is a "hook type" - 0 for incoming packets, 1 for outgoing
773 * packets, and 2 for packets arriving from another zone on the same
776 * dli_pktlen is the length of the packet data following the pseudo-header
777 * (so the captured length minus dli_pktlen is the length of the
778 * pseudo-header, assuming the entire pseudo-header was captured).
780 * dli_ifindex is the interface index of the interface on which the
783 * dli_grifindex is the group interface index number (for IPMP interfaces).
785 * dli_zsrc is the zone identifier for the source of the packet.
787 * dli_zdst is the zone identifier for the destination of the packet.
789 * A zone number of 0 is the global zone; a zone number of 0xffffffff
790 * means that the packet arrived from another host on the network, not
791 * from another zone on the same machine.
793 * An IPv4 or IPv6 datagram follows the pseudo-header; dli_family indicates
794 * which of those it is.
796 #define LINKTYPE_IPNET 226
799 * CAN (Controller Area Network) frames, with a pseudo-header as supplied
800 * by Linux SocketCAN, and with multi-byte numerical fields in that header
801 * in big-endian byte order.
803 * See Documentation/networking/can.txt in the Linux source.
805 * Requested by Felix Obenhuber <felix@obenhuber.de>.
807 #define LINKTYPE_CAN_SOCKETCAN 227
810 * Raw IPv4/IPv6; different from DLT_RAW in that the DLT_ value specifies
811 * whether it's v4 or v6. Requested by Darren Reed <Darren.Reed@Sun.COM>.
813 #define LINKTYPE_IPV4 228
814 #define LINKTYPE_IPV6 229
817 * IEEE 802.15.4, exactly as it appears in the spec (no padding, no
818 * nothing), and with no FCS at the end of the frame; requested by
819 * Jon Smirl <jonsmirl@gmail.com>.
821 #define LINKTYPE_IEEE802_15_4_NOFCS 230
826 * https://www.freedesktop.org/wiki/Software/dbus
830 * https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages
832 * starting with the endianness flag, followed by the message type, etc.,
833 * but without the authentication handshake before the message sequence:
835 * https://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol
837 * Requested by Martin Vidner <martin@vidner.net>.
839 #define LINKTYPE_DBUS 231
842 * Juniper-private data link type, as per request from
843 * Hannes Gredler <hannes@juniper.net>.
845 #define LINKTYPE_JUNIPER_VS 232
846 #define LINKTYPE_JUNIPER_SRX_E2E 233
847 #define LINKTYPE_JUNIPER_FIBRECHANNEL 234
850 * DVB-CI (DVB Common Interface for communication between a PC Card
851 * module and a DVB receiver). See
853 * https://www.kaiser.cx/pcap-dvbci.html
855 * for the specification.
857 * Requested by Martin Kaiser <martin@kaiser.cx>.
859 #define LINKTYPE_DVB_CI 235
862 * Variant of 3GPP TS 27.010 multiplexing protocol. Requested
863 * by Hans-Christoph Schemmel <hans-christoph.schemmel@cinterion.com>.
865 #define LINKTYPE_MUX27010 236
868 * STANAG 5066 D_PDUs. Requested by M. Baris Demiray
869 * <barisdemiray@gmail.com>.
871 #define LINKTYPE_STANAG_5066_D_PDU 237
874 * Juniper-private data link type, as per request from
875 * Hannes Gredler <hannes@juniper.net>.
877 #define LINKTYPE_JUNIPER_ATM_CEMIC 238
880 * NetFilter LOG messages
881 * (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets)
883 * Requested by Jakub Zawadzki <darkjames-ws@darkjames.pl>
885 #define LINKTYPE_NFLOG 239
888 * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type
889 * for Ethernet packets with a 4-byte pseudo-header and always
890 * with the payload including the FCS, as supplied by their
891 * netANALYZER hardware and software.
893 * Requested by Holger P. Frommer <HPfrommer@hilscher.com>
895 #define LINKTYPE_NETANALYZER 240
898 * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type
899 * for Ethernet packets with a 4-byte pseudo-header and FCS and
900 * 1 byte of SFD, as supplied by their netANALYZER hardware and
903 * Requested by Holger P. Frommer <HPfrommer@hilscher.com>
905 #define LINKTYPE_NETANALYZER_TRANSPARENT 241
908 * IP-over-InfiniBand, as specified by RFC 4391.
910 * Requested by Petr Sumbera <petr.sumbera@oracle.com>.
912 #define LINKTYPE_IPOIB 242
915 * MPEG-2 transport stream (ISO 13818-1/ITU-T H.222.0).
917 * Requested by Guy Martin <gmsoft@tuxicoman.be>.
919 #define LINKTYPE_MPEG_2_TS 243
922 * ng4T GmbH's UMTS Iub/Iur-over-ATM and Iub/Iur-over-IP format as
923 * used by their ng40 protocol tester.
925 * Requested by Jens Grimmer <jens.grimmer@ng4t.com>.
927 #define LINKTYPE_NG40 244
930 * Pseudo-header giving adapter number and flags, followed by an NFC
931 * (Near-Field Communications) Logical Link Control Protocol (LLCP) PDU,
932 * as specified by NFC Forum Logical Link Control Protocol Technical
933 * Specification LLCP 1.1.
935 * Requested by Mike Wakerly <mikey@google.com>.
937 #define LINKTYPE_NFC_LLCP 245
940 * pfsync output; DLT_PFSYNC is 18, which collides with DLT_CIP in
941 * SuSE 6.3, on OpenBSD, NetBSD, DragonFly BSD, and macOS, and
942 * is 121, which collides with DLT_HHDLC, in FreeBSD. We pick a
943 * shiny new link-layer header type value that doesn't collide with
944 * anything, in the hopes that future pfsync savefiles, if any,
945 * won't require special hacks to distinguish from other savefiles.
947 #define LINKTYPE_PFSYNC 246
950 * Raw InfiniBand packets, starting with the Local Routing Header.
952 * Requested by Oren Kladnitsky <orenk@mellanox.com>.
954 #define LINKTYPE_INFINIBAND 247
957 * SCTP, with no lower-level protocols (i.e., no IPv4 or IPv6).
959 * Requested by Michael Tuexen <Michael.Tuexen@lurchi.franken.de>.
961 #define LINKTYPE_SCTP 248
964 * USB packets, beginning with a USBPcap header.
966 * Requested by Tomasz Mon <desowin@gmail.com>
968 #define LINKTYPE_USBPCAP 249
971 * Schweitzer Engineering Laboratories "RTAC" product serial-line
974 * Requested by Chris Bontje <chris_bontje@selinc.com>.
976 #define LINKTYPE_RTAC_SERIAL 250
979 * Bluetooth Low Energy air interface link-layer packets.
981 * Requested by Mike Kershaw <dragorn@kismetwireless.net>.
983 #define LINKTYPE_BLUETOOTH_LE_LL 251
986 * Link-layer header type for upper-protocol layer PDU saves from wireshark.
988 * the actual contents are determined by two TAGs, one or more of
989 * which is stored with each packet:
991 * EXP_PDU_TAG_DISSECTOR_NAME the name of the Wireshark dissector
992 * that can make sense of the data stored.
994 * EXP_PDU_TAG_HEUR_DISSECTOR_NAME the name of the Wireshark heuristic
995 * dissector that can make sense of the
998 #define LINKTYPE_WIRESHARK_UPPER_PDU 252
1001 * Link-layer header type for the netlink protocol (nlmon devices).
1003 #define LINKTYPE_NETLINK 253
1006 * Bluetooth Linux Monitor headers for the BlueZ stack.
1008 #define LINKTYPE_BLUETOOTH_LINUX_MONITOR 254
1011 * Bluetooth Basic Rate/Enhanced Data Rate baseband packets, as
1012 * captured by Ubertooth.
1014 #define LINKTYPE_BLUETOOTH_BREDR_BB 255
1017 * Bluetooth Low Energy link layer packets, as captured by Ubertooth.
1019 #define LINKTYPE_BLUETOOTH_LE_LL_WITH_PHDR 256
1022 * PROFIBUS data link layer.
1024 #define LINKTYPE_PROFIBUS_DL 257
1027 * Apple's DLT_PKTAP headers.
1029 * Sadly, the folks at Apple either had no clue that the DLT_USERn values
1030 * are for internal use within an organization and partners only, and
1031 * didn't know that the right way to get a link-layer header type is to
1032 * ask tcpdump.org for one, or knew and didn't care, so they just
1033 * used DLT_USER2, which causes problems for everything except for
1034 * their version of tcpdump.
1036 * So I'll just give them one; hopefully this will show up in a
1037 * libpcap release in time for them to get this into 10.10 Big Sur
1038 * or whatever Mavericks' successor is called. LINKTYPE_PKTAP
1039 * will be 258 *even on macOS*; that is *intentional*, so that
1040 * PKTAP files look the same on *all* OSes (different OSes can have
1041 * different numerical values for a given DLT_, but *MUST NOT* have
1042 * different values for what goes in a file, as files can be moved
1045 #define LINKTYPE_PKTAP 258
1048 * Ethernet packets preceded by a header giving the last 6 octets
1049 * of the preamble specified by 802.3-2012 Clause 65, section
1050 * 65.1.3.2 "Transmit".
1052 #define LINKTYPE_EPON 259
1055 * IPMI trace packets, as specified by Table 3-20 "Trace Data Block Format"
1056 * in the PICMG HPM.2 specification.
1058 #define LINKTYPE_IPMI_HPM_2 260
1061 * per Joshua Wright <jwright@hasborg.com>, formats for Zwave captures.
1063 #define LINKTYPE_ZWAVE_R1_R2 261
1064 #define LINKTYPE_ZWAVE_R3 262
1067 * per Steve Karg <skarg@users.sourceforge.net>, formats for Wattstopper
1068 * Digital Lighting Management room bus serial protocol captures.
1070 #define LINKTYPE_WATTSTOPPER_DLM 263
1073 * ISO 14443 contactless smart card messages.
1075 #define LINKTYPE_ISO_14443 264
1078 * Radio data system (RDS) groups. IEC 62106.
1079 * Per Jonathan Brucker <jonathan.brucke@gmail.com>.
1081 #define LINKTYPE_RDS 265
1084 * USB packets, beginning with a Darwin (macOS, etc.) header.
1086 #define LINKTYPE_USB_DARWIN 266
1089 * OpenBSD DLT_OPENFLOW.
1091 #define LINKTYPE_OPENFLOW 267
1094 * SDLC frames containing SNA PDUs.
1096 #define LINKTYPE_SDLC 268
1099 * per "Selvig, Bjorn" <b.selvig@ti.com> used for
1100 * TI protocol sniffer.
1102 #define LINKTYPE_TI_LLN_SNIFFER 269
1105 * per: Erik de Jong <erikdejong at gmail.com> for
1106 * https://github.com/eriknl/LoRaTap/releases/tag/v0.1
1108 #define LINKTYPE_LORATAP 270
1111 * per: Stefanha at gmail.com for
1112 * https://lists.sandelman.ca/pipermail/tcpdump-workers/2017-May/000772.html
1113 * and: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/vsockmon.h
1114 * for: https://qemu-project.org/Features/VirtioVsock
1116 #define LINKTYPE_VSOCK 271
1119 * Nordic Semiconductor Bluetooth LE sniffer.
1121 #define LINKTYPE_NORDIC_BLE 272
1124 * Excentis DOCSIS 3.1 RF sniffer (XRA-31)
1125 * per: bruno.verstuyft at excentis.com
1126 * https://www.xra31.com/xra-header
1128 #define LINKTYPE_DOCSIS31_XRA31 273
1131 * mPackets, as specified by IEEE 802.3br Figure 99-4, starting
1132 * with the preamble and always ending with a CRC field.
1134 #define LINKTYPE_ETHERNET_MPACKET 274
1137 * DisplayPort AUX channel monitoring data as specified by VESA
1138 * DisplayPort(DP) Standard preceded by a pseudo-header.
1139 * per dirk.eibach at gdsys.cc
1141 #define LINKTYPE_DISPLAYPORT_AUX 275
1144 * Linux cooked sockets v2.
1146 #define LINKTYPE_LINUX_SLL2 276
1149 * Sercos Monitor, per Manuel Jacob <manuel.jacob at steinbeis-stg.de>
1151 #define LINKTYPE_SERCOS_MONITOR 277
1154 * OpenVizsla http://openvizsla.org is open source USB analyzer hardware.
1155 * It consists of FPGA with attached USB phy and FTDI chip for streaming
1156 * the data to the host PC.
1158 * Current OpenVizsla data encapsulation format is described here:
1159 * https://github.com/matwey/libopenvizsla/wiki/OpenVizsla-protocol-description
1162 #define LINKTYPE_OPENVIZSLA 278
1165 * The Elektrobit High Speed Capture and Replay (EBHSCR) protocol is produced
1166 * by a PCIe Card for interfacing high speed automotive interfaces.
1168 * The specification for this frame format can be found at:
1169 * https://www.elektrobit.com/ebhscr
1171 * for Guenter.Ebermann at elektrobit.com
1174 #define LINKTYPE_EBHSCR 279
1177 * The https://fd.io vpp graph dispatch tracer produces pcap trace files
1178 * in the format documented here:
1179 * https://fdio-vpp.readthedocs.io/en/latest/gettingstarted/developers/vnet.html#graph-dispatcher-pcap-tracing
1181 #define LINKTYPE_VPP_DISPATCH 280
1184 * Broadcom Ethernet switches (ROBO switch) 4 bytes proprietary tagging format.
1186 #define LINKTYPE_DSA_TAG_BRCM 281
1187 #define LINKTYPE_DSA_TAG_BRCM_PREPEND 282
1190 * IEEE 802.15.4 with pseudo-header and optional meta-data TLVs, PHY payload
1191 * exactly as it appears in the spec (no padding, no nothing), and FCS if
1192 * specified by FCS Type TLV; requested by James Ko <jck@exegin.com>.
1193 * Specification at https://github.com/jkcko/ieee802.15.4-tap
1195 #define LINKTYPE_IEEE802_15_4_TAP 283
1198 * Marvell (Ethertype) Distributed Switch Architecture proprietary tagging format.
1200 #define LINKTYPE_DSA_TAG_DSA 284
1201 #define LINKTYPE_DSA_TAG_EDSA 285
1204 * Payload of lawful intercept packets using the ELEE protocol;
1205 * https://socket.hr/draft-dfranusic-opsawg-elee-00.xml
1206 * https://xml2rfc.tools.ietf.org/cgi-bin/xml2rfc.cgi?url=https://socket.hr/draft-dfranusic-opsawg-elee-00.xml&modeAsFormat=html/ascii
1208 #define LINKTYPE_ELEE 286
1211 * Serial frames transmitted between a host and a Z-Wave chip.
1213 #define LINKTYPE_Z_WAVE_SERIAL 287
1216 * USB 2.0, 1.1, and 1.0 packets as transmitted over the cable.
1217 * Deprecated in favor of speed specific LINKTYPEs: LINKTYPE_USB_2_0_LOW_SPEED,
1218 * LINKTYPE_USB_2_0_FULL_SPEED and LINKTYPE_USB_2_0_HIGH_SPEED.
1220 #define LINKTYPE_USB_2_0 288
1223 * ATSC Link-Layer Protocol (A/330) packets.
1225 #define LINKTYPE_ATSC_ALP 289
1228 * Event Tracing for Windows messages.
1230 #define LINKTYPE_ETW 290
1233 * Hilscher Gesellschaft fuer Systemautomation mbH
1234 * netANALYZER NG hardware and software.
1236 * The specification for this footer can be found at:
1237 * https://kb.hilscher.com/x/brDJBw
1239 * Requested by Jan Adam <jadam@hilscher.com>
1241 #define LINKTYPE_NETANALYZER_NG 291
1244 * Serial NCP (Network Co-Processor) protocol for Zigbee stack ZBOSS
1246 * ZBOSS NCP protocol description: https://cloud.dsr-corporation.com/index.php/s/3isHzaNTTgtJebn
1247 * Header in pcap file: https://cloud.dsr-corporation.com/index.php/s/fiqSDorAAAZrsYB
1249 * Requested by Eugene Exarevsky <eugene.exarevsky@dsr-corporation.com>
1251 #define LINKTYPE_ZBOSS_NCP 292
1254 * USB 2.0, 1.1, and 1.0 packets as transmitted over the cable.
1256 #define LINKTYPE_USB_2_0_LOW_SPEED 293
1257 #define LINKTYPE_USB_2_0_FULL_SPEED 294
1258 #define LINKTYPE_USB_2_0_HIGH_SPEED 295
1261 * Auerswald Logger Protocol
1262 * description is provided on
1263 * https://github.com/Auerswald-GmbH/auerlog/blob/master/auerlog.txt
1264 * requested by Auerswald Developer Team <developer(at)auerswald.de>
1266 #define LINKTYPE_AUERSWALD_LOG 296
1269 * Z-Wave packets with a TAP meta-data header
1270 * https://gitlab.com/exegin/zwave-g9959-tap
1271 * requested on tcpdump-workers@
1273 #define LINKTYPE_ZWAVE_TAP 297
1276 * Silicon Labs debug channel protocol:
1278 #define LINKTYPE_SILABS_DEBUG_CHANNEL 298
1281 * Ultra-wideband (UWB) controller interface protocol (UCI).
1283 #define LINKTYPE_FIRA_UCI 299
1286 * MDB (Multi-Drop Bus) protocol between a vending machine controller and
1287 * peripherals inside the vending machine. See
1289 * https://www.kaiser.cx/pcap-mdb.html
1291 * for the specification.
1293 * Requested by Martin Kaiser <martin@kaiser.cx>.
1295 #define LINKTYPE_MDB 300
1298 * DECT-2020 New Radio (NR) - ETSI TS 103 636.
1299 * Requested by Stig Bjorlykke <stig@bjorlykke.org>.
1301 #define LINKTYPE_DECT_NR 301
1303 #define LINKTYPE_HIGH_MATCHING_MAX 301 /* highest value in the "matching" range */
1306 * The DLT_ and LINKTYPE_ values in the "matching" range should be the
1307 * same, so DLT_HIGH_MATCHING_MAX and LINKTYPE_HIGH_MATCHING_MAX should be the
1310 #if LINKTYPE_HIGH_MATCHING_MAX != DLT_HIGH_MATCHING_MAX
1311 #error The LINKTYPE_ high matching range does not match the DLT_ matching range
1315 * Map a DLT_* code to the corresponding LINKTYPE_* code.
1316 * Used to generate link-layer types written to savefiles.
1319 dlt_to_linktype(int dlt
)
1322 * All values in the low matching range were handed out before
1323 * assigning DLT_* codes became a free-for-all, so they're the
1324 * same on all platforms, and thus are given LINKTYPE_* codes
1325 * with the same numerical values as the corresponding DLT_*
1328 if (dlt
>= DLT_LOW_MATCHING_MIN
&& dlt
<= DLT_LOW_MATCHING_MAX
)
1331 #if DLT_PFSYNC != LINKTYPE_PFSYNC
1333 * DLT_PFSYNC has a code on several platforms that's in the
1334 * non-matching range, a code on FreeBSD that's in the high
1335 * matching range and that's *not* equal to LINKTYPE_PFSYNC,
1336 * and has a code on the rmaining platforms that's equal
1337 * to LINKTYPE_PFSYNC, which is in the high matching range.
1339 * Map it to LINKTYPE_PFSYNC if it's not equal to LINKTYPE_PFSYNC.
1341 if (dlt
== DLT_PFSYNC
)
1342 return (LINKTYPE_PFSYNC
);
1346 * DLT_PKTAP is defined as DLT_USER2 - which is in the high
1347 * matching range - on Darwin because Apple used DLT_USER2
1348 * on systems that users ran, not just as an internal thing.
1350 * We map it to LINKTYPE_PKTAP if it's not equal to LINKTYPE_PKTAP
1351 * so that DLT_PKTAP captures from Apple machines can be read by
1352 * software that either doesn't handle DLT_USER2 or that handles it
1353 * as something other than Apple PKTAP.
1355 #if DLT_PKTAP != LINKTYPE_PKTAP
1356 if (dlt
== DLT_PKTAP
)
1357 return (LINKTYPE_PKTAP
);
1361 * For all other DLT_* codes in the high matching range, the DLT
1362 * code value is the same as the LINKTYPE_* code value.
1364 if (dlt
>= DLT_HIGH_MATCHING_MIN
&& dlt
<= DLT_HIGH_MATCHING_MAX
)
1368 * These DLT_* codes have different values on different
1369 * platforms, so we assigned them LINKTYPE_* codes just
1370 * below the lower bound of the high matching range;
1371 * those values should never be equal to any DLT_*
1372 * code, so that should avoid collisions.
1374 * That way, for example, "raw IP" packets will have
1375 * LINKTYPE_RAW as the code in all savefiles for
1376 * which the code that writes them maps to that
1377 * value, regardless of the platform on which they
1378 * were written, so they should be readable on all
1379 * platforms without having to determine on which
1380 * platform they were written.
1382 * We map the DLT_* codes on this platform, whatever
1383 * it might be, to the corresponding LINKTYPE_* codes.
1385 if (dlt
== DLT_ATM_RFC1483
)
1386 return (LINKTYPE_ATM_RFC1483
);
1388 return (LINKTYPE_RAW
);
1389 if (dlt
== DLT_SLIP_BSDOS
)
1390 return (LINKTYPE_SLIP_BSDOS
);
1391 if (dlt
== DLT_PPP_BSDOS
)
1392 return (LINKTYPE_PPP_BSDOS
);
1395 * These DLT_* codes were originally defined on some platform,
1396 * and weren't defined on other platforms.
1398 * At least some of them have values, on at least one platform,
1399 * that collide with other DLT_* codes on other platforms, e.g.
1400 * DLT_LOOP, so we don't just define them, on all platforms,
1401 * as having the same value as on the original platform.
1403 * Therefore, we assigned new LINKTYPE_* codes to them, and,
1404 * on the platforms where they weren't originally defined,
1405 * define the DLT_* codes to have the same value as the
1406 * corresponding LINKTYPE_* codes.
1408 * This means that, for capture files with the original
1409 * platform's DLT_* code rather than the LINKTYPE_* code
1410 * as a link-layer type, we will recognize those types
1411 * on that platform, but not on other platforms.
1414 /* BSD/OS Frame Relay */
1416 return (LINKTYPE_FRELAY
);
1418 #if DLT_HDLC != LINKTYPE_NETBSD_HDLC
1420 if (dlt
== DLT_HDLC
)
1421 return (LINKTYPE_NETBSD_HDLC
);
1423 #if DLT_C_HDLC != LINKTYPE_C_HDLC
1424 /* BSD/OS Cisco HDLC */
1425 if (dlt
== DLT_C_HDLC
)
1426 return (LINKTYPE_C_HDLC
);
1428 #if DLT_LOOP != LINKTYPE_LOOP
1429 /* OpenBSD DLT_LOOP */
1430 if (dlt
== DLT_LOOP
)
1431 return (LINKTYPE_LOOP
);
1433 #if DLT_ENC != LINKTYPE_ENC
1434 /* OpenBSD DLT_ENC */
1436 return (LINKTYPE_ENC
);
1440 * These DLT_* codes are not on all platforms, but, so far,
1441 * there don't appear to be any platforms that define
1442 * other codes with those values; we map them to
1443 * different LINKTYPE_* codes anyway, just in case.
1445 /* Linux ATM Classical IP */
1446 if (dlt
== DLT_ATM_CLIP
)
1447 return (LINKTYPE_ATM_CLIP
);
1450 * A few other values, defined on some platforms, not in
1451 * either matching range, but not colliding with anything
1452 * else, so they're given the same LINKTYPE_* code as
1455 if (dlt
== DLT_REDBACK_SMARTEDGE
|| dlt
== DLT_PPP_SERIAL
||
1456 dlt
== DLT_PPP_ETHER
|| dlt
== DLT_SYMANTEC_FIREWALL
)
1460 * If we don't have a mapping for this DLT_* code, return an
1461 * error; that means that this is a DLT_* value with no
1462 * corresponding LINKTYPE_ value, and we need to assign one.
1468 * Map a LINKTYPE_* code to the corresponding DLT_* code.
1469 * Used to translate link-layer types in savefiles to the
1470 * DLT_* codes to provide to callers of libpcap.
1473 linktype_to_dlt(int linktype
)
1476 * All values in the low matching range were handed out before
1477 * assigning DLT_* codes became a free-for-all, so they're the
1478 * same on all platforms, and are thus used as the LINKTYPE_*
1479 * codes in capture files.
1481 if (linktype
>= LINKTYPE_LOW_MATCHING_MIN
&&
1482 linktype
<= LINKTYPE_LOW_MATCHING_MAX
)
1485 #if LINKTYPE_PFSYNC != DLT_PFSYNC
1487 * DLT_PFSYNC has a code on several platforms that's in the
1488 * non-matching range, a code on FreeBSD that's in the high
1489 * matching range and that's *not* equal to LINKTYPE_PFSYNC,
1490 * and has a code on the rmaining platforms that's equal
1491 * to LINKTYPE_PFSYNC, which is in the high matching range.
1493 * Map LINKTYPE_PFSYNC to whatever DLT_PFSYNC is on this
1494 * platform, if the two aren't equal.
1496 if (linktype
== LINKTYPE_PFSYNC
)
1497 return (DLT_PFSYNC
);
1501 * DLT_PKTAP is defined as DLT_USER2 - which is in the high
1502 * matching range - on Darwin because Apple used DLT_USER2
1503 * on systems that users ran, not just as an internal thing.
1505 * We map LINKTYPE_PKTAP to the platform's DLT_PKTAP for
1506 * the benefit of software that's expecting DLT_PKTAP
1507 * (even if that's DLT_USER2) for an Apple PKTAP capture.
1509 * (Yes, this is an annoyance if you want to read a
1510 * LINKTYPE_USER2 packet as something other than DLT_PKTAP
1511 * on a Darwin-based OS, as, on that OS, DLT_PKTAP and DLT_USER2
1512 * are the same. Feel free to complain to Apple about this.)
1514 #if LINKTYPE_PKTAP != DLT_PKTAP
1515 if (linktype
== LINKTYPE_PKTAP
)
1520 * These DLT_* codes have different values on different
1521 * platforms, so we assigned them LINKTYPE_* codes just
1522 * below the lower bound of the high matching range;
1523 * those values should never be equal to any DLT_*
1524 * code, so that should avoid collisions.
1526 * That way, for example, "raw IP" packets will have
1527 * LINKTYPE_RAW as the code in all savefiles for
1528 * which the code that writes them maps to that
1529 * value, regardless of the platform on which they
1530 * were written, so they should be readable on all
1531 * platforms without having to determine on which
1532 * platform they were written.
1534 * We map the LINKTYPE_* codes to the corresponding
1535 * DLT_* code on this platform.
1537 if (linktype
== LINKTYPE_ATM_RFC1483
)
1538 return (DLT_ATM_RFC1483
);
1539 if (linktype
== LINKTYPE_RAW
)
1541 if (linktype
== LINKTYPE_SLIP_BSDOS
)
1542 return (DLT_SLIP_BSDOS
);
1543 if (linktype
== LINKTYPE_PPP_BSDOS
)
1544 return (DLT_PPP_BSDOS
);
1547 * These DLT_* codes were originally defined on some platform,
1548 * and weren't defined on other platforms.
1550 * At least some of them have values, on at least one platform,
1551 * that collide with other DLT_* codes on other platforms, e.g.
1552 * DLT_LOOP, so we don't just define them, on all platforms,
1553 * as having the same value as on the original platform.
1555 * Therefore, we assigned new LINKTYPE_* codes to them, and,
1556 * on the platforms where they weren't originally defined,
1557 * define the DLT_* codes to have the same value as the
1558 * corresponding LINKTYPE_* codes.
1560 * This means that, for capture files with the original
1561 * platform's DLT_* code rather than the LINKTYPE_* code
1562 * as a link-layer type, we will recognize those types
1563 * on that platform, but not on other platforms.
1565 * We map the LINKTYPE_* codes to the corresponding
1566 * DLT_* code on platforms where the two codes differ..
1569 /* BSD/OS Frame Relay */
1570 if (linktype
== LINKTYPE_FRELAY
)
1573 #if LINKTYPE_NETBSD_HDLC != DLT_HDLC
1575 if (linktype
== LINKTYPE_NETBSD_HDLC
)
1578 #if LINKTYPE_C_HDLC != DLT_C_HDLC
1579 /* BSD/OS Cisco HDLC */
1580 if (linktype
== LINKTYPE_C_HDLC
)
1581 return (DLT_C_HDLC
);
1583 #if LINKTYPE_LOOP != DLT_LOOP
1584 /* OpenBSD DLT_LOOP */
1585 if (linktype
== LINKTYPE_LOOP
)
1588 #if LINKTYPE_ENC != DLT_ENC
1589 /* OpenBSD DLT_ENC */
1590 if (linktype
== LINKTYPE_ENC
)
1595 * These DLT_* codes are not on all platforms, but, so far,
1596 * there don't appear to be any platforms that define
1597 * other codes with those values; we map them to
1598 * different LINKTYPE_* values anyway, just in case.
1600 * LINKTYPE_ATM_CLIP is a special case. DLT_ATM_CLIP is
1601 * not on all platforms, but, so far, there don't appear
1602 * to be any platforms that define it as anything other
1603 * than 19; we define LINKTYPE_ATM_CLIP as something
1604 * other than 19, just in case. That value is in the
1605 * high matching range, so we have to check for it.
1607 /* Linux ATM Classical IP */
1608 if (linktype
== LINKTYPE_ATM_CLIP
)
1609 return (DLT_ATM_CLIP
);
1612 * For all other values, return the linktype code as the
1615 * If the code is in the high matching range, the
1616 * DLT_* code is the same as the LINKTYPE_* code.
1618 * If the code is greater than the maximum value in
1619 * the high matching range, it may be a value from
1620 * a newer version of libpcap; we provide it in case
1621 * the program' capable of handling it.
1623 * If the code is less than the minimum value in the
1624 * high matching range, it might be from a capture
1625 * written by code that doesn't map non-matching range
1626 * DLT_* codes to the appropriate LINKTYPE_* code, so
1627 * we'll just pass it through, so that *if it was written
1628 * on this platform* it will be interpreted correctly.
1629 * (We don't know whether it was written on this platform,
1630 * but at least this way there's *some* chance that it
1637 * Return the maximum snapshot length for a given DLT_ value.
1639 * For most link-layer types, we use MAXIMUM_SNAPLEN.
1641 * For DLT_DBUS, the maximum is 128MiB, as per
1643 * https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages
1645 * For DLT_EBHSCR, the maximum is 8MiB, as per
1647 * https://www.elektrobit.com/ebhscr
1649 * For DLT_USBPCAP, the maximum is 1MiB, as per
1651 * https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=15985
1654 max_snaplen_for_dlt(int dlt
)
1659 return 128*1024*1024;
1668 return MAXIMUM_SNAPLEN
;