diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-05-17 00:15:58 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-05-17 00:15:58 +0000 |
commit | 7532c175b66509e952e80370d48b8f14e160a4b2 (patch) | |
tree | ea470abee489ae703c0036597d7df998ff9e944e /wiretap/dbs-etherwatch.c | |
parent | a6d35a28ddac2cd420a87b6ef39c5c8ef7bcab71 (diff) | |
download | wireshark-7532c175b66509e952e80370d48b8f14e160a4b2.tar.gz |
Set *data_offset early in the read process, to emphasize that it's the
offset of the entire packet, not the offset of the data.
Pull the setting of the FCS length into a common routine.
svn path=/trunk/; revision=49359
Diffstat (limited to 'wiretap/dbs-etherwatch.c')
-rw-r--r-- | wiretap/dbs-etherwatch.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/wiretap/dbs-etherwatch.c b/wiretap/dbs-etherwatch.c index 4e82a05431..66a46d46b1 100644 --- a/wiretap/dbs-etherwatch.c +++ b/wiretap/dbs-etherwatch.c @@ -210,6 +210,7 @@ static gboolean dbs_etherwatch_read(wtap *wth, int *err, gchar **err_info, offset = dbs_etherwatch_seek_next_packet(wth, err, err_info); if (offset < 1) return FALSE; + *data_offset = offset; /* Make sure we have enough room for the packet */ buffer_assure_space(wth->frame_buffer, DBS_ETHERWATCH_MAX_PACKET_LEN); @@ -221,12 +222,6 @@ static gboolean dbs_etherwatch_read(wtap *wth, int *err, gchar **err_info, if (pkt_len == -1) return FALSE; - /* - * We don't have an FCS in this frame. - */ - wth->phdr.pseudo_header.eth.fcs_len = 0; - - *data_offset = offset; return TRUE; } @@ -236,7 +231,6 @@ dbs_etherwatch_seek_read (wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info) { - union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; int pkt_len; if (file_seek(wth->random_fh, seek_off - 1, SEEK_SET, err) == -1) @@ -254,11 +248,6 @@ dbs_etherwatch_seek_read (wtap *wth, gint64 seek_off, return FALSE; } - /* - * We don't have an FCS in this frame. - */ - pseudo_header->eth.fcs_len = 0; - return TRUE; } @@ -477,6 +466,11 @@ parse_dbs_etherwatch_packet(struct wtap_pkthdr *phdr, FILE_T fh, guint8* buf, phdr->caplen = eth_hdr_len + pkt_len; phdr->len = eth_hdr_len + pkt_len; + /* + * We don't have an FCS in this frame. + */ + phdr->pseudo_header.eth.fcs_len = 0; + /* Parse the hex dump */ count = 0; while (count < pkt_len) { |