aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-pcap_pktdata.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-01-17 20:08:17 -0800
committerGuy Harris <guy@alum.mit.edu>2016-01-18 04:15:16 +0000
commit8ec153f93816a302a325e40924f4e13383ad8eaf (patch)
tree630efb01c710f8fd81c69f4c54dfd09873ec26fe /epan/dissectors/packet-pcap_pktdata.c
parent5fe11fb75964d8e0d87fb73d99aa5f69066b9e8f (diff)
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 <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-pcap_pktdata.c')
-rw-r--r--epan/dissectors/packet-pcap_pktdata.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/epan/dissectors/packet-pcap_pktdata.c b/epan/dissectors/packet-pcap_pktdata.c
index b15ae7d6f1..2e55eb3f54 100644
--- a/epan/dissectors/packet-pcap_pktdata.c
+++ b/epan/dissectors/packet-pcap_pktdata.c
@@ -257,6 +257,8 @@ dissect_pcap_pktdata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
proto_item *pseudoheader_item;
proto_tree *pseudoheader_tree = NULL;
proto_item *packet_item;
+ struct eth_phdr eth;
+ void *phdr;
DISSECTOR_ASSERT(data);
@@ -313,6 +315,7 @@ dissect_pcap_pktdata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
else
pinfo->p2p_dir = P2P_DIR_UNKNOWN;
offset += 4;
+ phdr = NULL;
break;
case WTAP_ENCAP_ATM_PDUS:
@@ -347,11 +350,27 @@ dissect_pcap_pktdata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
next_tvb = tvb_new_subset_remaining(tvb, offset);
return tvb_captured_length(tvb);
}
+ } else {
+ /*
+ * These also require a pseudo-header, but it's not constructed
+ * from packet data.
+ */
+ switch (pinfo->phdr->pkt_encap) {
+
+ case WTAP_ENCAP_ETHERNET:
+ eth.fcs_len = -1; /* Unknown whether we have an FCS */
+ phdr = &eth;
+ break;
+
+ default:
+ phdr = NULL;
+ break;
+ }
}
next_tvb = tvb_new_subset_remaining(tvb, offset);
- offset = dissector_try_uint_new(wtap_encap_table, pinfo->phdr->pkt_encap, next_tvb, pinfo, tree, TRUE, NULL);
+ offset = dissector_try_uint_new(wtap_encap_table, pinfo->phdr->pkt_encap, next_tvb, pinfo, tree, TRUE, phdr);
return offset;
}