aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2007-08-30 19:50:56 +0000
committerUlf Lamping <ulf.lamping@web.de>2007-08-30 19:50:56 +0000
commitb57c83f6eb197167b5dd486100af660c22bab58d (patch)
tree5352b03b0e6ec90aef1a0a19ebe1c8a1f977a23a /plugins
parent51460c5a5f3d215a14b6b59835d8513dea10364f (diff)
fix length calculation for 802.11 packets - the 802.11 dissector will strip off the 4 byte FCS at the end of a packet (while the Ethernet dissector does not).
svn path=/trunk/; revision=22759
Diffstat (limited to 'plugins')
-rw-r--r--plugins/profinet/packet-pn-rt.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/plugins/profinet/packet-pn-rt.c b/plugins/profinet/packet-pn-rt.c
index d35edf015a..4ee1237fa8 100644
--- a/plugins/profinet/packet-pn-rt.c
+++ b/plugins/profinet/packet-pn-rt.c
@@ -114,11 +114,26 @@ dissect_pn_rt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
gboolean bCyclic;
- /* Initialize variables */
- tvb_len = tvb_length(tvb) -
- /* subtract (optional) Ethernet FCS or trailer len */
+ /* The PN-RT protocol uses status values at the end of the Ethernet frame.
+ * Unfortunately it doesn't contain a length field in the PN-RT protocol itself,
+ * so we must depend on the tvb length. This is sometimes is a bit confusing
+ * wether the length of the tvb contains the optional FCS at the end or not
+ * therefore the following heuristic ... */
+
+ if(pinfo->fd->lnk_t == WTAP_ENCAP_IEEE_802_11_WITH_RADIO) {
+ /* 802.11: at least when using AiroPeek to capture,
+ * the 802.11 dissector already has stripped the FCS from the tvb.
+ * XXX - we might need to add other 802.11 encaps here as well */
+ tvb_len = tvb_length(tvb);
+ } else {
+ /* Ethernet: subtract (optional) FCS or trailer len
+ * (fcs_len -1 means we don't know if FCS is appended, we assume it's not) */
+ tvb_len = tvb_length(tvb) -
((pinfo->pseudo_header->eth.fcs_len != -1) ? pinfo->pseudo_header->eth.fcs_len : 0);
+ }
tvb_set_reported_length(tvb, tvb_len);
+
+ /* Initialize variables */
pn_rt_tree = NULL;
ds_tree = NULL;
ti = NULL;