From 8ec153f93816a302a325e40924f4e13383ad8eaf Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 17 Jan 2016 20:08:17 -0800 Subject: Have the "maybe an FCS" version of the Ethernet dissector take a data argument. It's called from some places other than packet-frame.c, at least one of which currently can't call anything else (the ATM dissector, for VC-multiplexed bridged frames, where you don't know whether the frames include the FCS or not), so the frame's pseudo-data doesn't necessarily have the appropriate "FCS length" value. Have it explicitly check the data argument, and explicitly pass the appropriate value to it. Ping-Bug: 9933 Change-Id: I0c75f921d25d1e2b75e476c15ff9625205036b25 Reviewed-on: https://code.wireshark.org/review/13382 Reviewed-by: Guy Harris --- epan/dissectors/packet-eth.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'epan/dissectors/packet-eth.c') diff --git a/epan/dissectors/packet-eth.c b/epan/dissectors/packet-eth.c index 48840cf522..6904849976 100644 --- a/epan/dissectors/packet-eth.c +++ b/epan/dissectors/packet-eth.c @@ -795,8 +795,9 @@ add_ethernet_trailer(packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree, /* Called for the Ethernet Wiretap encapsulation type; pass the FCS length reported to us, or, if the "assume_fcs" preference is set, pass 4. */ static int -dissect_eth_maybefcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) +dissect_eth_maybefcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { + struct eth_phdr *eth = (struct eth_phdr *)data; proto_tree *fh_tree; /* Some devices slice the packet and add their own trailer before @@ -818,9 +819,9 @@ dissect_eth_maybefcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* /* Now handle the ethernet trailer and optional FCS */ next_tvb = tvb_new_subset_remaining(tvb, tvb_captured_length(tvb) - total_trailer_length); add_ethernet_trailer(pinfo, tree, fh_tree, hf_eth_trailer, tvb, next_tvb, - eth_assume_fcs ? 4 : pinfo->pseudo_header->eth.fcs_len); + eth_assume_fcs ? 4 : eth->fcs_len); } else { - dissect_eth_common(tvb, pinfo, tree, eth_assume_fcs ? 4 : pinfo->pseudo_header->eth.fcs_len); + dissect_eth_common(tvb, pinfo, tree, eth_assume_fcs ? 4 : eth->fcs_len); } return tvb_captured_length(tvb); } -- cgit v1.2.3