aboutsummaryrefslogtreecommitdiffstats
path: root/packet-bpdu.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-03-19 09:17:54 +0000
committerGuy Harris <guy@alum.mit.edu>2002-03-19 09:17:54 +0000
commitdec54cc52ad3b5813fa1e8e0cc2044fd622d0c55 (patch)
tree9f58996084318686ee1f6a5bc3dac814e3be491a /packet-bpdu.c
parent5c42850e62f6c54f0275d115d16f49ae90e32973 (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. svn path=/trunk/; revision=4978
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);