DEC LANBridge Spanning Tree Protocol support, from Paul Ionescu.

Put "packet-lapbether.c" into "Makefile.nmake".

svn path=/trunk/; revision=2828
This commit is contained in:
Guy Harris 2001-01-05 19:00:37 +00:00
parent 9e392235ca
commit 499a830af6
4 changed files with 172 additions and 2 deletions

View File

@ -333,6 +333,7 @@ Paul Ionescu <paul@acorp.ro> {
EIGRP support
Cisco IGRP support
X.25 over TCP support
DEC LANBridge Spanning Tree Protocol support
}
Mark Burton <markb@ordern.com> {

View File

@ -1,7 +1,7 @@
# Makefile.am
# Automake file for Ethereal
#
# $Id: Makefile.am,v 1.266 2001/01/03 10:34:41 guy Exp $
# $Id: Makefile.am,v 1.267 2001/01/05 19:00:37 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@zing.org>
@ -53,6 +53,7 @@ DISSECTOR_SOURCES = \
packet-cops.c \
packet-data.c \
packet-ddtp.c \
packet-dec-bpdu.c \
packet-diameter.c \
packet-dns.c \
packet-eigrp.c \

View File

@ -1,7 +1,7 @@
## Makefile for building ethereal.exe with Microsoft C and nmake
## Use: nmake -f makefile.nmake
#
# $Id: Makefile.nmake,v 1.69 2000/12/23 08:06:14 guy Exp $
# $Id: Makefile.nmake,v 1.70 2001/01/05 19:00:37 guy Exp $
include config.nmake
@ -40,6 +40,7 @@ DISSECTOR_SOURCES = \
packet-cops.c \
packet-data.c \
packet-ddtp.c \
packet-dec-bpdu.c \
packet-diameter.c \
packet-dns.c \
packet-eigrp.c \
@ -78,6 +79,7 @@ DISSECTOR_SOURCES = \
packet-kerberos.c \
packet-l2tp.c \
packet-lapb.c \
packet-lapbether.c \
packet-lapd.c \
packet-ldap.c \
packet-ldp.c \

166
packet-dec-bpdu.c Normal file
View File

@ -0,0 +1,166 @@
/* packet-dec-bpdu.c
* Routines for DEC BPDU (DEC Spanning Tree Protocol) disassembly
*
* $Id: packet-dec-bpdu.c,v 1.1 2001/01/05 19:00:37 guy Exp $
*
* Copyright 2001 Paul Ionescu <paul@acorp.ro>
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
* Copyright 1998 Gerald Combs
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#include <stdio.h>
#include <string.h>
#include <glib.h>
#include "packet.h"
#include "resolv.h"
#include "etypes.h"
/* Offsets of fields within a BPDU */
#define BPDU_DEC_CODE 0
#define BPDU_TYPE 1
#define BPDU_VERSION 2
#define BPDU_FLAGS 3
#define BPDU_ROOT_PRI 4
#define BPDU_ROOT_MAC 6
#define BPDU_ROOT_PATH_COST 12
#define BPDU_BRIDGE_PRI 14
#define BPDU_BRIDGE_MAC 16
#define BPDU_PORT_IDENTIFIER 22
#define BPDU_MESSAGE_AGE 23
#define BPDU_HELLO_TIME 24
#define BPDU_MAX_AGE 25
#define BPDU_FORWARD_DELAY 26
static int proto_dec_bpdu = -1;
static gint ett_dec_bpdu = -1;
static void
dissect_dec_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
guint8 protocol_identifier;
guint8 protocol_version;
guint8 bpdu_type;
guint8 flags;
proto_tree *bpdu_tree;
proto_item *ti;
CHECK_DISPLAY_AS_DATA(proto_dec_bpdu, tvb, pinfo, tree);
pinfo->current_proto = "DEC_STP";
if (check_col(pinfo->fd, COL_PROTOCOL)) {
col_set_str(pinfo->fd, COL_PROTOCOL, "DEC_STP");
}
bpdu_type = tvb_get_guint8(tvb, BPDU_TYPE);
flags=tvb_get_guint8(tvb,BPDU_FLAGS);
if (check_col(pinfo->fd, COL_INFO)) {
if (bpdu_type == 25)
col_add_fstr(pinfo->fd, COL_INFO, "Hello Packet");
else if (bpdu_type == 0x02)
col_add_fstr(pinfo->fd, COL_INFO, "Topology Change Notification");
}
if (tree) {
protocol_identifier = tvb_get_guint8(tvb, BPDU_DEC_CODE);
protocol_version = tvb_get_guint8(tvb, BPDU_VERSION);
ti = proto_tree_add_protocol_format(tree, proto_dec_bpdu, tvb, 0, 27,
"DEC Spanning Tree Protocol");
bpdu_tree = proto_item_add_subtree(ti, ett_dec_bpdu);
proto_tree_add_text(bpdu_tree, tvb, BPDU_DEC_CODE, 1, "Protocol ID: %d (%s)",
protocol_identifier,
protocol_identifier==0xe1?"DEC Spanning Tree Protocol":
"Unknown protocol, the dissection may be wrong");
proto_tree_add_text(bpdu_tree, tvb, BPDU_TYPE,1, "BPDU Type: %d (%s)", bpdu_type,
(bpdu_type==25?"Hello Packet":(bpdu_type==2?"Topology change notice":"Unknown")));
proto_tree_add_text(bpdu_tree, tvb, BPDU_VERSION,1, "BPDU Version: %d (%s)",
protocol_version,protocol_version==1?"DEC STP Version 1":"Unknown Version");
proto_tree_add_text(bpdu_tree, tvb, BPDU_FLAGS,1, "Flags: %d",flags);
if (flags & 0x80)
proto_tree_add_text(bpdu_tree, tvb, BPDU_FLAGS, 1, " 1... .... Use short timers");
if (flags & 0x02)
proto_tree_add_text(bpdu_tree, tvb, BPDU_FLAGS, 1, " .... ..1. Topology Change Acknowledgment");
if (flags & 0x01)
proto_tree_add_text(bpdu_tree, tvb, BPDU_FLAGS, 1, " .... ...1 Topology Change");
proto_tree_add_text(bpdu_tree, tvb, BPDU_ROOT_PRI,2, "Root priority: %d",
tvb_get_ntohs(tvb,BPDU_ROOT_PRI));
proto_tree_add_text(bpdu_tree, tvb, BPDU_ROOT_MAC,6, "Root MAC: %s",
ether_to_str(tvb_get_ptr(tvb,BPDU_ROOT_MAC,6)));
proto_tree_add_text(bpdu_tree, tvb, BPDU_ROOT_PATH_COST,2, "Root path cost: %d",
tvb_get_ntohs(tvb,BPDU_ROOT_PATH_COST));
proto_tree_add_text(bpdu_tree, tvb, BPDU_BRIDGE_PRI,2, "Root priority: %d",
tvb_get_ntohs(tvb,BPDU_BRIDGE_PRI));
proto_tree_add_text(bpdu_tree, tvb, BPDU_BRIDGE_MAC,6, "Root MAC: %s",
ether_to_str(tvb_get_ptr(tvb,BPDU_BRIDGE_MAC,6)));
proto_tree_add_text(bpdu_tree, tvb, BPDU_PORT_IDENTIFIER,1, "Port identifier: %d",
tvb_get_guint8(tvb,BPDU_PORT_IDENTIFIER));
proto_tree_add_text(bpdu_tree, tvb, BPDU_MESSAGE_AGE,1, "Age: %d",
tvb_get_guint8(tvb,BPDU_MESSAGE_AGE));
proto_tree_add_text(bpdu_tree, tvb, BPDU_HELLO_TIME,1, "Hello time: %d",
tvb_get_guint8(tvb,BPDU_HELLO_TIME));
proto_tree_add_text(bpdu_tree, tvb, BPDU_MAX_AGE,1, "Max Age: %d",
tvb_get_guint8(tvb,BPDU_MAX_AGE));
proto_tree_add_text(bpdu_tree, tvb, BPDU_FORWARD_DELAY,1, "Forward Delay: %d",
tvb_get_guint8(tvb,BPDU_FORWARD_DELAY));
}
}
void
proto_register_dec_bpdu(void)
{
static gint *ett[] = {
&ett_dec_bpdu,
};
proto_dec_bpdu = proto_register_protocol("DEC Spanning Tree Protocol", "DEC_STP", "dec_stp");
proto_register_subtree_array(ett, array_length(ett));
register_dissector("dec_bpdu", dissect_dec_bpdu);
}
void
proto_reg_handoff_dec_bpdu(void)
{
dissector_add("ethertype", ETHERTYPE_DEC_LB, dissect_dec_bpdu);
}