I tried to debug my MSTP implementation by Ethereal and
saw, that my MST BPDUs are considered as *malformed
packets*.
I investigated a problem, exploring the code
(fortunately I know it a little - I was a person, who wrote RSTP
support, as Alex Ruzin <alexr[AT]nbase.co.il>, Revision 1.32,
Wed Feb 27 10:03:08 2002 UTC).
It seems, that a current version has a bug in packet-bpdu.c
I fixed it as far as I can; attached is a patch for ethereal-0.10.0
Please check it and let me know, if I am right or wrong.
Thanks in advance,
Respectfully yours, Alex
--- packet-bpdu.orig.c Sun Jan 4 19:00:45 2004
+++ packet-bpdu.c Mon Jan 5 09:05:52 2004
@@ -71,7 +71,7 @@
#define CONF_BPDU_SIZE 35
#define TC_BPDU_SIZE 4
#define RST_BPDU_SIZE 36
-#define VERSION_3_STATIC_LENGTH 64
+#define VERSION_3_STATIC_LENGTH 66
#define MSTI_MESSAGE_SIZE 16
/* Flag bits */
@@ -207,6 +207,7 @@
gchar *msti_regional_root_mac_str;
guint8 msti_bridge_identifier_priority, msti_port_identifier_priority;
int length, offset, msti;
+ guint bpdu_length;
proto_tree *bpdu_tree;
proto_tree *mstp_tree, *msti_tree;
@@ -326,6 +327,7 @@
}
}
+ bpdu_length = tvb_length(tvb);
switch (bpdu_type) {
case BPDU_TYPE_CONF:
@@ -339,7 +341,9 @@
case BPDU_TYPE_RST:
if (protocol_version_identifier == 3) {
version_3_length = tvb_get_ntohs(tvb, BPDU_VERSION_3_LENGTH);
- set_actual_length(tvb, RST_BPDU_SIZE + 2 + version_3_length);
+ set_actual_length(tvb, RST_BPDU_SIZE +
+ VERSION_3_STATIC_LENGTH +
+ version_3_length * MSTI_MESSAGE_SIZE);
} else
set_actual_length(tvb, RST_BPDU_SIZE);
break;
@@ -513,7 +517,7 @@
BPDU_CIST_REMAINING_HOPS, 1, cist_remaining_hops);
/* MSTI messages */
- length = version_3_length - VERSION_3_STATIC_LENGTH;
+ length = bpdu_length - BPDU_MSTI;
offset = BPDU_MSTI;
msti = 1;
while (length >= MSTI_MESSAGE_SIZE) {