aboutsummaryrefslogtreecommitdiffstats
path: root/packet-bpdu.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2002-03-19 09:17:54 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2002-03-19 09:17:54 +0000
commit5e052e89a12178d4d5b8f49877681513679cbd6e (patch)
tree9f58996084318686ee1f6a5bc3dac814e3be491a /packet-bpdu.c
parent5834f4437740005a89f376e9f68ee25a20ef841c (diff)
Set the length for topology change BPDUs to 4, and leave the length of
unknown BPDU types alone. Use the tvbuff's length in as the length of the top-level protocol tree item. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4978 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-bpdu.c')
-rw-r--r--packet-bpdu.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/packet-bpdu.c b/packet-bpdu.c
index 7457d84755..f0e7a199a3 100644
--- a/packet-bpdu.c
+++ b/packet-bpdu.c
@@ -1,7 +1,7 @@
/* packet-bpdu.c
* Routines for BPDU (Spanning Tree Protocol) disassembly
*
- * $Id: packet-bpdu.c,v 1.33 2002/03/19 09:00:44 guy Exp $
+ * $Id: packet-bpdu.c,v 1.34 2002/03/19 09:17:54 guy Exp $
*
* Copyright 1999 Christophe Tronche <ch.tronche@computer.org>
*
@@ -60,7 +60,8 @@
#define BPDU_FORWARD_DELAY 33
#define BPDU_VERSION_1_LENGTH 35
-#define BPDU_SIZE 35
+#define CONF_BPDU_SIZE 35
+#define TC_BPDU_SIZE 4
#define RST_BPDU_SIZE 36
/* Flag bits */
@@ -270,12 +271,24 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
- bpdu_size = (bpdu_type == BPDU_TYPE_RST) ? RST_BPDU_SIZE : BPDU_SIZE;
- set_actual_length(tvb, bpdu_size);
+ switch (bpdu_type) {
+
+ case BPDU_TYPE_CONF:
+ set_actual_length(tvb, CONF_BPDU_SIZE);
+ break;
+
+ case BPDU_TYPE_TOPOLOGY_CHANGE:
+ set_actual_length(tvb, TC_BPDU_SIZE);
+ break;
+
+ case BPDU_TYPE_RST:
+ set_actual_length(tvb, RST_BPDU_SIZE);
+ break;
+ }
if (tree) {
bpdu_item = proto_tree_add_protocol_format(tree, proto_bpdu, tvb,
- 0, bpdu_size, "Spanning Tree Protocol");
+ 0, -1, "Spanning Tree Protocol");
bpdu_tree = proto_item_add_subtree(bpdu_item, ett_bpdu);
protocol_identifier = tvb_get_ntohs(tvb, BPDU_IDENTIFIER);