aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/netmon.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-10-01 07:11:49 +0000
committerGuy Harris <guy@alum.mit.edu>2003-10-01 07:11:49 +0000
commitbe2736adcf8ac583c2d56e37db9ef01f391913f9 (patch)
treedefd8c4db6a77dd4d288de2b0b10f39d6c701b73 /wiretap/netmon.c
parent44bb98184df93ebb56b5dce5dbd1deb6f37d716a (diff)
Have a pseudo-header for Ethernet packets, giving the size of the FCS -
0 means "there is no FCS in the packet data", 4 means "there is an FCS in the packet data", -1 means "I don't know whether there's an FCS in the packet data, guess based on the packet size". Assume that Ethernet encapsulated inside other protocols has no FCS, by having the "eth" dissector assume that (and not check for an Ethernet pseudo-header). Have "ethertype()" take an argument giving the FCS size; pass 0 when appropriate. Fix up Wiretap routines to set the pseudo-header. This means we no longer use the "generic" seek-and-read routine, so get rid of it. svn path=/trunk/; revision=8574
Diffstat (limited to 'wiretap/netmon.c')
-rw-r--r--wiretap/netmon.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/wiretap/netmon.c b/wiretap/netmon.c
index d760f59054..c5a2e96504 100644
--- a/wiretap/netmon.c
+++ b/wiretap/netmon.c
@@ -1,6 +1,6 @@
/* netmon.c
*
- * $Id: netmon.c,v 1.64 2003/01/10 04:04:41 guy Exp $
+ * $Id: netmon.c,v 1.65 2003/10/01 07:11:48 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -392,7 +392,9 @@ static gboolean netmon_read(wtap *wth, int *err, long *data_offset)
* and the VPI and VCI; read them and generate the pseudo-header
* from them.
*/
- if (wth->file_encap == WTAP_ENCAP_ATM_PDUS) {
+ switch (wth->file_encap) {
+
+ case WTAP_ENCAP_ATM_PDUS:
if (packet_size < sizeof (struct netmon_atm_hdr)) {
/*
* Uh-oh, the packet isn't big enough to even
@@ -413,6 +415,14 @@ static gboolean netmon_read(wtap *wth, int *err, long *data_offset)
orig_size -= sizeof (struct netmon_atm_hdr);
packet_size -= sizeof (struct netmon_atm_hdr);
wth->data_offset += sizeof (struct netmon_atm_hdr);
+ break;
+
+ case WTAP_ENCAP_ETHERNET:
+ /*
+ * We assume there's no FCS in this frame.
+ */
+ wth->pseudo_header.eth.fcs_len = 0;
+ break;
}
buffer_assure_space(wth->frame_buffer, packet_size);
@@ -460,12 +470,22 @@ netmon_seek_read(wtap *wth, long seek_off,
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- if (wth->file_encap == WTAP_ENCAP_ATM_PDUS) {
+ switch (wth->file_encap) {
+
+ case WTAP_ENCAP_ATM_PDUS:
if (!netmon_read_atm_pseudoheader(wth->random_fh, pseudo_header,
err)) {
/* Read error */
return FALSE;
}
+ break;
+
+ case WTAP_ENCAP_ETHERNET:
+ /*
+ * We assume there's no FCS in this frame.
+ */
+ pseudo_header->eth.fcs_len = 0;
+ break;
}
/*