From 678b5fd6ffcb9b6fad1cd9769e393fe580cf28fa Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 24 Aug 1999 03:19:34 +0000 Subject: Add a new Wiretap encapsulation type WTAP_ENCAP_FDDI_BITSWAPPED, meaning "FDDI with the MAC addresses bit-swapped"; whether the MAC addresses are bit-swapped is a property of the machine on which the capture was taken, not of the machine on which the capture is being read - right now, none of the capture file formats we read indicate whether FDDI MAC addresses are bit-swapped, but this does let us treat non-"libpcap" captures as being bit-swapped or not bit-swapped independent of the machine on which they're being read (and of the machine on which they were captured, but I have the impression they're bit-swapped on most platforms), and allows us to, if, as, and when we implement packet capture in Wiretap, mark packets in a capture file written in Wiretap-native format based on the machine on which they are captured (assuming the rule "Ultrix, Alpha, and BSD/OS are the only platforms that don't bit-swap", or some other compile-time rule, gets the right answer, or that some platform has drivers that can tell us whether the addresses are bit-swapped). (NOTE: if, for any of the capture file formats used only on one platform, FDDI MAC addresses aren't bit-swapped, the code to read that capture file format should be fixed to flag them as not bit-swapped.) Use the encapsulation type to decide whether to bit-swap addresses in "dissect_fddi()". svn path=/trunk/; revision=557 --- wiretap/libpcap.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'wiretap/libpcap.c') diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c index fc67af9876..50a1689c41 100644 --- a/wiretap/libpcap.c +++ b/wiretap/libpcap.c @@ -1,6 +1,6 @@ /* libpcap.c * - * $Id: libpcap.c,v 1.14 1999/08/22 19:08:40 guy Exp $ + * $Id: libpcap.c,v 1.15 1999/08/24 03:19:34 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez @@ -52,6 +52,11 @@ ((((x)&0xFF00)>>8) | \ (((x)&0x00FF)<<8)) +/* On some systems, the FDDI MAC addresses are bit-swapped. */ +#if !defined(ultrix) && !defined(__alpha) && !defined(__bsdi) +#define BIT_SWAPPED_MAC_ADDRS +#endif + /* "libpcap" file header (minus magic number). */ struct pcap_hdr { guint16 version_major; /* major version number */ @@ -108,7 +113,11 @@ static const int pcap_encap[] = { WTAP_ENCAP_ARCNET, WTAP_ENCAP_SLIP, WTAP_ENCAP_PPP, +#ifdef BIT_SWAPPED_MAC_ADDRS + WTAP_ENCAP_FDDI_BITSWAPPED, +#else WTAP_ENCAP_FDDI, +#endif WTAP_ENCAP_ATM_RFC1483, /* or, on BSD/OS, Frame Relay */ WTAP_ENCAP_RAW_IP, /* or, on OpenBSD, DLT_LOOP, and on BSD/OS, Cisco HDLC */ @@ -307,6 +316,7 @@ int libpcap_dump_open(wtap_dumper *wdh, int *err) 8, /* WTAP_ENCAP_SLIP -> DLT_SLIP */ 9, /* WTAP_ENCAP_PPP -> DLT_PPP */ 10, /* WTAP_ENCAP_FDDI -> DLT_FDDI */ + 10, /* WTAP_ENCAP_FDDI_BITSWAPPED -> DLT_FDDI */ 12, /* WTAP_ENCAP_RAW_IP -> DLT_RAW */ 7, /* WTAP_ENCAP_ARCNET -> DLT_ARCNET */ 11, /* WTAP_ENCAP_ATM_RFC1483 -> DLT_ATM_RFC1483 */ -- cgit v1.2.3