aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-02-15 14:03:12 -0800
committerGuy Harris <guy@alum.mit.edu>2015-02-15 22:04:23 +0000
commit1917023fc157b896a23349c0eca8c95f22f2fb6f (patch)
treef7896f2b2d0ed0b9148327041da1a3556d6bef52 /wiretap
parentad6d259e1e709cc1654c9c134553e95075c9ac2f (diff)
Don't base interpretation of LINKTYPE_ values on DLT_ value definitions.
Instead, explicitly check for particular build platforms. This means that the interpretation of the link-layer type values with different meanings on different platforms won't be dependent on the particular version of libpcap with which Wireshark happens to be built, and also means that we don't have to fix pcap-common.c to include pcap.h or net/bpf.h. Fix some comments while we're at it. Bug: 10956 Change-Id: If331d9b92081fb0bdf416620fb2ad8dce57dea6b Reviewed-on: https://code.wireshark.org/review/7140 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/pcap-common.c43
1 files changed, 16 insertions, 27 deletions
diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c
index 263af672fe..3f4a25a599 100644
--- a/wiretap/pcap-common.c
+++ b/wiretap/pcap-common.c
@@ -463,25 +463,11 @@ static const struct {
/*
* 11 is DLT_ATM_RFC1483 on most platforms; the only libpcaps I've
* seen that define anything other than DLT_ATM_RFC1483 as 11 are
- * the BSD/OS one, which defines DLT_FR as 11, and libpcap 0.5,
- * which define it as 100, mapping the kernel's value to 100, in
- * an attempt to hide the different values used on different
+ * the BSD/OS one, which defines DLT_FR as 11. We handle it as
+ * Frame Relay on BSD/OS and LLC-encapsulated ATM on all other
* platforms.
- *
- * If this is a platform where DLT_FR is defined as 11, we
- * don't handle 11 at all; otherwise, we handle it as
- * DLT_ATM_RFC1483 (this means we'd misinterpret Frame Relay
- * captures from BSD/OS if running on platforms other than BSD/OS,
- * but
- *
- * 1) we don't yet support DLT_FR
- *
- * and
- *
- * 2) nothing short of a heuristic would let us interpret
- * them correctly).
*/
-#if defined(DLT_FR) && (DLT_FR == 11)
+#if defined(__bsdi__) /* BSD/OS */
{ 11, WTAP_ENCAP_FRELAY },
#else
{ 11, WTAP_ENCAP_ATM_RFC1483 },
@@ -499,9 +485,9 @@ static const struct {
* as WTAP_ENCAP_NULL, otherwise, unless DLT_C_HDLC is defined
* as 12, interpret it as WTAP_ENCAP_RAW_IP.
*/
-#if defined(DLT_LOOP) && (DLT_LOOP == 12)
+#if defined(__OpenBSD__)
{ 12, WTAP_ENCAP_NULL },
-#elif defined(DLT_C_HDLC) && (DLT_C_HDLC == 12)
+#elif defined(__bsdi__) /* BSD/OS */
/*
* Put entry for Cisco HDLC here.
* XXX - is this just WTAP_ENCAP_CHDLC, i.e. does the frame
@@ -532,7 +518,7 @@ static const struct {
* treate 13 as WTAP_ENCAP_ATM_RFC1483, but, on all other
* systems, we can read OpenBSD DLT_ENC captures.
*/
-#if defined(DLT_ATM_RFC1483) && (DLT_ATM_RFC1483 == 13)
+#if defined(__bsdi__) /* BSD/OS */
{ 13, WTAP_ENCAP_ATM_RFC1483 },
#else
{ 13, WTAP_ENCAP_ENC },
@@ -581,21 +567,24 @@ static const struct {
* DLT_I4L_IP with the ISDN4Linux patches for libpcap
* (and on SuSE 6.3).
*/
-#if defined(DLT_CIP) && (DLT_CIP == 16)
- { 16, WTAP_ENCAP_LINUX_ATM_CLIP },
-#endif
-#if defined(DLT_HDLC) && (DLT_HDLC == 16)
+#if defined(__NetBSD__)
{ 16, WTAP_ENCAP_CHDLC },
+#elif !defined(__bsdi__)
+ /*
+ * If you care about the two different Linux interpretations
+ * of 16, fix it yourself.
+ */
+ { 16, WTAP_ENCAP_LINUX_ATM_CLIP },
#endif
/*
* 17 is DLT_LANE8023 in SuSE 6.3 libpcap; we don't currently
* handle it.
* It is also used as the PF (Packet Filter) logging format beginning
- * with OpenBSD 3.0; we use 17 for PF logs unless DLT_LANE8023 is
- * defined with the value 17.
+ * with OpenBSD 3.0; we use 17 for PF logs on OpenBSD and don't
+ * use it otherwise.
*/
-#if !defined(DLT_LANE8023) || (DLT_LANE8023 != 17)
+#if defined(__OpenBSD__)
{ 17, WTAP_ENCAP_OLD_PFLOG },
#endif