From: Jens Osterkamp
Subject: Added Perl implementation of BRIDGE-MIB
References: bnc#694026, FATE#311640
Patch-upstream: r18414, r19251, r19252, r19937, r19938, r19939

Signed-off-by: Leonardo Chiquitto <lchiquitto@suse.de>

---
 local/Makefile.in     |   11 
 local/snmp-bridge-mib | 1172 +++++++++++++++++++++++++++++++++++++++
 mibs/BRIDGE-MIB.txt   | 1472 ++++++++++++++++++++++++++++++++++++++++++++++++++
 mibs/Makefile.in      |    2 
 mibs/Makefile.mib     |    5 
 man/snmp-bridge-mib.1 |  208 +++++++
 man/Makefile.in       |    2 
 7 files changed, 2867 insertions(+), 5 deletions(-)

Index: local/Makefile.in
===================================================================
--- local/Makefile.in.orig
+++ local/Makefile.in
@@ -16,10 +16,10 @@ OTHERUNINSTALL=localuninstall
 #
 SNMPCONFPATH=@SNMPCONFPATH@
 PERSISTENT_DIRECTORY=@PERSISTENT_DIRECTORY@
-PERLSCRIPTS=snmpcheck tkmib mib2c fixproc ipf-mod.pl snmpconf traptoemail
+PERLSCRIPTS=snmpcheck tkmib mib2c fixproc ipf-mod.pl snmpconf traptoemail snmp-bridge-mib
 SHELLSCRIPTS=mib2c-update
 SCRIPTSMADEFORPERL=snmpcheck.made tkmib.made mib2c.made fixproc.made \
-	ipf-mod.pl.made snmpconf.made traptoemail.made
+	ipf-mod.pl.made snmpconf.made traptoemail.made snmp-bridge-mib.made
 DATASRCS=mib2c.conf mib2c.iterate.conf mib2c.iterate_access.conf \
 	mib2c.create-dataset.conf mib2c.mfd.conf \
 	mib2c.array-user.conf mib2c.column_enums.conf \
@@ -134,6 +134,13 @@ traptoemail.made: $(srcdir)/traptoemail
 	  touch traptoemail.made; \
         fi
 
+snmp-bridge-mib.made: $(srcdir)/snmp-bridge-mib
+	if test "x$(PERL)" != "x" ; then \
+	  $(PERL) -p -e 's%^#!.*/perl.*%#!$(PERL)%' ${srcdir}/snmp-bridge-mib > snmp-bridge-mib.made; \
+	else \
+	  touch snmp-bridge-mib.made; \
+	fi
+
 localinstall: $(SCRIPTSMADEFORPERL)
 	@if test "x$(PERL)" != "x" ; then \
 	  for i in $(PERLSCRIPTS) ; do $(INSTALL) $$i.made $(INSTALL_PREFIX)$(bindir)/$$i ; echo "install:  installed $$i in $(INSTALL_PREFIX)$(bindir)" ; done ; \
Index: local/snmp-bridge-mib
===================================================================
--- /dev/null
+++ local/snmp-bridge-mib
@@ -0,0 +1,1172 @@
+#!/usr/bin/perl
+#
+# Copyright (c) IBM Corp. 2009, 2010, All Rights Reserved
+#
+# Author(s):	Vasileios Pappas <vpappas@us.ibm.com>
+#		Jens Osterkamp <jens@linux.vnet.ibm.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use NetSNMP::OID (':all');
+use NetSNMP::ASN (':all');
+use NetSNMP::agent (':all');
+
+sub STP_PROP_VALUE() { 0x01}
+sub STP_PROP_FILE() { 0x02}
+sub STP_PROP_DEC() { 0x04}
+sub STP_PROP_HEX() { 0x08}
+
+sub FDB_STATUS_OTHER { 1 }
+sub FDB_STATUS_INVALID { 2 }
+sub FDB_STATUS_LEARNED { 3 }
+sub FDB_STATUS_SELF { 4 }
+sub FDB_STATUS_MGMT { 5 }
+
+my %oid_value;
+my %oid_type;
+my %oid_next;
+my (%indexes, %interfaces, %macs, %ages, %locals, %vlans, %tagged);
+my $oid;
+
+$subagent=0;
+my $netdir="/sys/class/net/";
+my $targetbridge;
+
+$cache_timout=60;
+$last_populated=0;
+
+my $regoid = ".1.3.6.1.2.1.17";
+# are we running embedded ? If not, register as subagent
+if (!$agent) {
+    $agent = new NetSNMP::agent('Name' => 'dot1qbridge',
+				'AgentX' => 1);
+    $subagent = 1;
+    if ( $#ARGV != 0) {
+	usage($0);
+	exit();
+    }
+    $targetbridge = $ARGV[0];
+} else {
+    if (!defined($bridge)) {
+	usage($0);
+	exit();
+    }
+    $targetbridge = $bridge;
+}
+
+$agent->register("dot1qbridge", ".1.3.6.1.2.1.17", \&request_handler) or die "registration of handler failed !\n";
+
+if ($subagent) {
+	# register handler for graceful shutdown
+	$SIG{'INT'} = \&shutdown;
+	$SIG{'QUIT'} = \&shutdown;
+	$running = 1;
+
+	while($running) {
+		$agent->agent_check_and_process(1);
+	}
+
+	$agent->shutdown();
+}
+
+sub usage {
+	my $name = shift;
+	if ($subagent) {
+		print $name."\n\n";
+		print "usage: \t$name <bridge>	start snmp bridge module".
+			" for bridge <bridge>\n\n";
+		print "arguments:	bridge		name of the Linux bridge".
+			" which you want to provide info via snmp for.\n\n";
+	} else {
+		print 'usage in snmpd.conf: perl $bridge="br0"; perl do <path to $name>\n';
+	}
+	print "number of arguments given $#ARGV\n\n";
+}
+
+sub request_handler {
+	my ($handler, $registration_info, $request_info, $requests)=@_;
+	my $request;
+
+	populate_mib($targetbridge);
+
+	for($request = $requests; $request; $request = $request->next()) {
+		if($request_info->getMode() == MODE_GET) {
+			mode_get($request);
+		} elsif($request_info->getMode() == MODE_GETNEXT) {
+			mode_get_next($request);
+		} else {
+			print STDERR "mode not implemented.\n";
+		}
+	}
+}
+
+sub mode_get{
+	my ($request)=@_;
+	my $oid=$request->getOID();
+
+	$SNMP::use_numeric = 1;
+	my $noid=SNMP::translateObj($oid);
+
+	reply($request, $noid) if (exists $oid_value{$noid});
+}
+
+sub find_next{
+	my ($noid) = @_;
+	my $nextoid = $oid_next{$noid};
+	if(!defined($nextoid) || !defined($oid_value{$nextoid})) {
+		# find the lowest OID whis is higher than $noid
+		$prev = ".1.3.6.1.2.1.18";
+		$prev_oid = new NetSNMP::OID($prev);
+		$noid_oid = new NetSNMP::OID($noid);
+		#print "looking for next of $noid\n";
+		for my $candidate (keys %oid_value) {
+			#print "evaluating $candidate\n";
+			$candidate_oid = new NetSNMP::OID($candidate);
+			if ($noid_oid < $candidate_oid && $prev_oid > $candidate_oid) {
+				#print "found candidate $candidate\n";
+				$prev = $candidate;
+				$prev_oid = $candidate_oid;
+			}
+		}
+		if ($prev eq ".1.3.6.1.2.1.18") {
+			return; # no OID higher than $noid found
+		}
+		$nextoid = $prev;
+	}
+	return $nextoid;
+}
+
+sub mode_get_next{
+	my ($request)=@_;
+	my $oid=$request->getOID();
+	$SNMP::use_numeric = 1;
+	my $noid=SNMP::translateObj($oid);
+	my $nextoid = find_next($noid);
+	#print "found $nextoid\n";
+	if(defined($nextoid)) {
+		my $type = $oid_type{$nextoid};
+		my $value = $oid_value{$nextoid};
+		if (defined($type) and defined($value)) {
+			reply($request,	$nextoid);
+		}
+	}
+}
+
+sub reply{
+	my ($request, $oid)=@_;
+
+	my $type=$oid_type{$oid};
+	my $value=$oid_value{$oid};
+
+	$request->setOID(new NetSNMP::OID($oid));
+	$request->setValue($type, $value);
+}
+
+# Populated MIB OID
+#
+## dot1dBasePort:	1.3.6.1.2.1.17.1.4.1.1.<dot1dBasePort>
+#			INTEGER32
+#
+# dot1dBasePortIfIndex:	1.3.6.1.2.1.17.1.4.1.2.<dot1dBasePort>
+#			INTEGER32
+#
+# dot1dStp*:		1.3.6.1.2.1.17.2.<1-14>
+#			INTEGER, OCTET STRING
+#
+# dot1dTpFdbAddress:	1.3.6.1.2.1.17.4.3.1.1.<dot1dTpFdbAddress>
+#			OCTET STRING (SIZE (6))
+#
+# dot1dTpFdbPort:	1.3.6.1.2.1.17.4.3.1.2.<dot1dTpFdbAddress>
+#			INTEGER32
+#
+# dot1dTpFdbStatus:	1.3.6.1.2.1.17.4.3.1.3.<dot1dTpFdbAddress>
+#			INTEGER
+#			1 : other
+#			2 : invalid
+#			3 : learned
+#			4 : self
+#			5 : mgmt
+#
+
+sub populate_mib {
+	my $now;
+	my $bridge = shift;
+	my $seconds_passed;
+	$ports=0;
+	$oid="";
+
+        $now=time();
+	$seconds_passed=$now-$last_populated;
+        return if($seconds_passed <= $cache_timout);
+        $last_populated=$now;
+
+	%oid_value=();
+	%oid_type=();
+	%oid_next=();
+	%indexes=();
+	%interfaces=();
+	%macs=();
+	%ages=();
+	%locals=();
+	%vlans=();
+	%tagged=();
+
+	# first populated oid
+	$oid_next{".1.3.6.1.2.1.17"}=".1.3.6.1.2.1.17.1.1";
+
+	createbaseinfo($bridge);
+
+	readindexes($bridge);
+	readforwards($bridge);
+	readvlans($bridge);
+
+	createports($bridge);
+
+	stpproperties($bridge);
+
+	stpportproperties($bridge);
+
+	dot1dTpproperties();
+
+	my $prevoid = $oid;
+	my $curroid = createmacs($bridge);
+	$oid_next{$prevoid} = $curroid;
+
+	portproperties($bridge);
+
+
+	dot1qbase($bridge);
+
+	dot1qfdb($bridge);
+
+	dot1qcurrentvlans($bridge);
+
+	return 0;
+}
+
+sub findbridges()
+{
+	my @bridges;
+
+	opendir(DIR, $netdir) or die "unable to open $netdir !\n";
+
+	while(my $br=readdir(DIR)){
+		next if $br eq ".";
+		next if $br eq "..";
+		next unless -d $netdir.$br."/bridge";
+		push @bridges, $br;
+	}
+
+	close(DIR);
+
+	return @bridges;
+}
+
+sub createbaseinfo()
+{
+	my $bridge = shift;
+
+	$oid=".1.3.6.1.2.1.17.1.1";
+	$oid_value{$oid}=mac2hex(readfile($netdir.$bridge."/address", 0));
+	$oid_type{$oid}=ASN_OCTET_STR;
+	$oid_next{$oid}=".1.3.6.1.2.1.17.1.2";
+
+	opendir(DIR, $netdir.$bridge."/brif/") or die "Could not open ".$netdir.$bridge."brif !\n";
+
+	foreach $entry (readdir(DIR)) {
+		next if $entry eq ".";
+		next if $entry eq "..";
+		# only count non-vlan interfaces
+		next if $entry =~ /\.[0-9]*/;
+		$ports++;
+	}
+
+	closedir(DIR);
+
+	$oid=".1.3.6.1.2.1.17.1.2";
+	$oid_value{$oid}=$ports;
+	$oid_type{$oid}=ASN_INTEGER;
+	$oid_next{$oid}=".1.3.6.1.2.1.17.1.3";
+
+	$oid=".1.3.6.1.2.1.17.1.3";
+	$oid_value{$oid}="2";	# transparent only
+	$oid_type{$oid}=ASN_INTEGER;
+	$oid_next{$oid}=".1.3.6.1.2.1.17.1.4.1.1.1";
+
+}
+
+sub createmacs()
+{
+	my $bridge = shift;
+        my $start_oid = $oid = ".1.3.6.1.2.1.17.4.3.1";
+
+	foreach my $mac (sort {$a cmp $b} keys %macs) {
+		my $mac_oid=mac2oid($mac);
+		unless(defined($first_mac_oid)){
+			$first_mac_oid=$mac_oid;
+			$oid_next{$oid.".1"}=$oid.".1".$mac_oid;
+			$oid_next{$oid.".2"}=$oid.".2".$mac_oid;
+			$oid_next{$oid.".3"}=$oid.".3".$mac_oid;
+		}
+		my $port=$macs{$mac}{$bridge};
+		my $baseport=$baseports{$bridge}{$port};
+		my $status=$locals{$mac}{$bridge};
+		my $age=$ages{$mac}{$bridge};
+
+		$oid_value{$oid.".1".$mac_oid}=mac2hex($mac);
+		$oid_type{$oid.".1".$mac_oid}=ASN_OCTET_STR;
+		if(defined($prv_mac_oid)){
+			$oid_next{$oid.".1".$prv_mac_oid}=
+				$oid.".1".$mac_oid;
+		}
+
+		$oid_value{$oid.".2".$mac_oid}=$baseport;
+		$oid_type{$oid.".2".$mac_oid}=ASN_INTEGER;
+		if(defined($prv_mac_oid)){
+			$oid_next{$oid.".2".$prv_mac_oid}=
+				$oid.".2".$mac_oid;
+		}
+
+		$oid_value{$oid.".3".$mac_oid}=$status;
+		$oid_type{$oid.".3".$mac_oid}=ASN_INTEGER;
+		if(defined($prv_mac_oid)){
+			$oid_next{$oid.".3".$prv_mac_oid}=
+				$oid.".3".$mac_oid;
+		}
+
+		$prv_mac_oid=$mac_oid;
+	}
+
+	if ($prv_mac_oid and $first_mac_oid) {
+		$oid_next{$oid.".1".$prv_mac_oid}=$oid.".2".$first_mac_oid;
+		$oid_next{$oid.".2".$prv_mac_oid}=$oid.".3".$first_mac_oid;
+		$oid_next{$oid.".3".$prv_mac_oid}=".1.3.6.1.2.1.17.4.4.1.1.1";
+	}
+
+	undef $prv_mac_oid;
+	undef $first_mac_oid;
+
+	return $start_oid.".1".$first_mac_oid;
+}
+
+# TODO: is this sequence complete ?
+sub createports()
+{
+	my $bridge = shift;
+	my ($baseport, $prev_baseport, $first_baseport);
+	$baseport=1;
+	my $oid= '.1.3.6.1.2.1.17.1.4.1';
+
+	foreach my $port (keys %{$indexes{$bridge}}) {
+		unless(defined($first_baseport)){
+			$first_baseport=$baseport;
+			$oid_next{$oid.".1"}=$oid.".1.".$baseport;
+			$oid_next{$oid.".2"}=$oid.".2.".$baseport;
+		}
+		my $index=$indexes{$bridge}{$port};
+		$baseports{$bridge}{$port}=$baseport;
+
+		$oid_value{$oid.".1.".$baseport}=$baseport;
+		$oid_type{$oid.".1.".$baseport}=ASN_INTEGER;
+		if(defined($prv_baseport)){
+			$oid_next{$oid.".1.".$prv_baseport}=
+				$oid.".1.".$baseport;
+		}
+
+		$oid_value{$oid.".2.".$baseport}=$index;
+		$oid_type{$oid.".2.".$baseport}=ASN_INTEGER;
+		if(defined($prv_baseport)){
+			$oid_next{$oid.".2.".$prv_baseport}=
+				$oid.".2.".$baseport;
+		}
+
+		$prv_baseport=$baseport;
+		$baseport++;
+	}
+
+	if ( $prv_baseport and $first_baseport ) {
+		$oid_next{$oid.".1.".$prv_baseport}=$oid.".2.".$first_baseport;
+		$oid_next{$oid.".2.".$prv_baseport}=".1.3.6.1.2.1.17.2.1";
+	}
+
+	undef $prv_baseport;
+	undef $first_baseport;
+
+}
+
+sub stpproperties()
+{
+	my $bridge = shift;
+	my $dir = $netdir.$bridge."/bridge/";
+
+	@stpprops = ( { oid => ".1.3.6.1.2.1.17.2.1",
+			flags => STP_PROP_VALUE,
+			value => "3",
+			type => ASN_INTEGER,
+			nextoid => ".1.3.6.1.2.1.17.2.2" },
+			{ oid => ".1.3.6.1.2.1.17.2.2",
+			flags => STP_PROP_FILE | STP_PROP_DEC,
+			value => $dir."priority",
+			type => ASN_INTEGER,
+			nextoid => ".1.3.6.1.2.1.17.2.3" },
+			{ oid => ".1.3.6.1.2.1.17.2.3",
+			flags => STP_PROP_FILE | STP_PROP_DEC,
+			value => $dir."topology_change_timer",
+			type => ASN_TIMETICKS,
+			nextoid => ".1.3.6.1.2.1.17.2.4" },
+			{ oid => ".1.3.6.1.2.1.17.2.4",
+			flags => STP_PROP_FILE | STP_PROP_DEC,
+			value => $dir."topology_change",
+			type => ASN_COUNTER,
+			nextoid => ".1.3.6.1.2.1.17.2.5" },
+			{ oid => ".1.3.6.1.2.1.17.2.5",
+			flags => STP_PROP_FILE | STP_PROP_DEC,
+			value => $dir."root_id",
+			type => ASN_OCTET_STR,
+			nextoid => ".1.3.6.1.2.1.17.2.6" },
+			{ oid => ".1.3.6.1.2.1.17.2.6",
+			flags => STP_PROP_FILE | STP_PROP_DEC,
+			value => $dir."root_path_cost",
+			type => ASN_INTEGER,
+			nextoid => ".1.3.6.1.2.1.17.2.7" },
+			{ oid => ".1.3.6.1.2.1.17.2.7",
+			flags => STP_PROP_FILE | STP_PROP_DEC,
+			value => $dir."root_port",
+			type => ASN_INTEGER,
+			nextoid => ".1.3.6.1.2.1.17.2.8" },
+			{ oid => ".1.3.6.1.2.1.17.2.8",
+			flags => STP_PROP_FILE | STP_PROP_DEC,
+			value => $dir."max_age",
+			type => ASN_INTEGER,
+			nextoid => ".1.3.6.1.2.1.17.2.9" },
+			{ oid => ".1.3.6.1.2.1.17.2.9",
+			flags => STP_PROP_FILE | STP_PROP_DEC,
+			value => $dir."hello_time",
+			type => ASN_INTEGER,
+			nextoid => ".1.3.6.1.2.1.17.2.11" },
+			# TODO ...17.2.10
+			{ oid => ".1.3.6.1.2.1.17.2.11",
+			flags => STP_PROP_FILE | STP_PROP_DEC,
+			value => $dir."forward_delay",
+			type => ASN_INTEGER,
+			nextoid => ".1.3.6.1.2.1.17.2.12" },
+			{ oid => ".1.3.6.1.2.1.17.2.12",
+			flags => STP_PROP_FILE | STP_PROP_DEC,
+			value => $dir."max_age",
+			type => ASN_INTEGER,
+			nextoid => ".1.3.6.1.2.1.17.2.13" },
+			{ oid => ".1.3.6.1.2.1.17.2.13",
+			flags => STP_PROP_FILE | STP_PROP_DEC,
+			value => $dir."hello_time",
+			type => ASN_INTEGER,
+			nextoid => ".1.3.6.1.2.1.17.2.14" },
+			{ oid => ".1.3.6.1.2.1.17.2.14",
+			flags => STP_PROP_FILE | STP_PROP_DEC,
+			value => $dir."forward_delay",
+			type => ASN_INTEGER,
+			nextoid => ".1.3.6.1.2.1.17.2.15.1.1.1" },
+			);
+
+	for ($i=0; $i <= $#stpprops; $i++) {
+		my %props = %{$stpprops[$i]};
+		$oid = $props{'oid'};
+		if ( $props{'flags'} & STP_PROP_VALUE,) {
+			$oid_value{$oid} = $props{'value'};
+		}
+		if ( $props{'flags'} & STP_PROP_FILE,) {
+			$oid_value{$oid} =
+			readfile($props{'value'},
+			$props{'flags'});
+		}
+		$oid_type{$oid} = $props{'type'};
+		$oid_next{$oid} = $props{'nextoid'};
+	}
+}
+
+sub stpportproperties
+{
+	my $bridge = shift;
+	my $brifdir = $netdir.$bridge."/brif/";
+	my ($baseport, $first_baseport, $prev_baseport);
+
+	$oid='.1.3.6.1.2.1.17.2.15.1';
+
+	foreach my $port (keys %{$interfaces{$bridge}}) {
+		$baseport = $baseports{$bridge}{$port};
+
+		unless(defined($first_baseport)){
+			$first_baseport=$baseport;
+			$oid_next{$oid.".1"}=$oid.".1.".$baseport;
+			$oid_next{$oid.".2"}=$oid.".2.".$baseport;
+		}
+
+		my $interface = $interfaces{$bridge}{$port};
+		my $ifdir = $brifdir.$interface;
+
+		# dot1dStpPort
+		$oid_value{$oid.".1.".$baseport}=$baseport;
+		$oid_type{$oid.".1.".$baseport}=ASN_INTEGER;
+		if(defined($prev_baseport)){
+			$oid_next{$oid.".1.".$prev_baseport}=
+				$oid.".1.".$baseport;
+		}
+
+		# dot1dStpPortPriority
+		$oid_value{$oid.".2.".$baseport}=readfile($ifdir."/priority", 0);
+		$oid_type{$oid.".2.".$baseport}=ASN_INTEGER;
+		if(defined($prev_baseport)){
+			$oid_next{$oid.".2.".$prev_baseport}=
+				$oid.".2.".$baseport;
+		}
+
+		# dot1dStpPortState
+		my @translation = (1, 3, 4, 5, 2);
+		my $state = readfile($ifdir."/state", 0);
+		$oid_value{$oid.".3.".$baseport}=$translation[$state];
+		$oid_type{$oid.".3.".$baseport}=ASN_INTEGER;
+		if(defined($prev_baseport)){
+			$oid_next{$oid.".3.".$prev_baseport}=
+				$oid.".3.".$baseport;
+		}
+
+		# dot1dStpPortEnable
+		@translation = (2, 1, 1, 1, 1);
+		$oid_value{$oid.".4.".$baseport}=$translation[$state];
+		$oid_type{$oid.".4.".$baseport}=ASN_INTEGER;
+		if(defined($prev_baseport)){
+			$oid_next{$oid.".4.".$prev_baseport}=
+				$oid.".4.".$baseport;
+		}
+
+		# dot1dStpPortPathCost
+		$oid_value{$oid.".5.".$baseport}=readfile($ifdir."/path_cost", 0);
+		$oid_type{$oid.".5.".$baseport}=ASN_INTEGER;
+		if(defined($prev_baseport)){
+			$oid_next{$oid.".5.".$prev_baseport}=
+				$oid.".5.".$baseport;
+		}
+
+		# dot1dStpPortDesignatedRoot
+		$oid_value{$oid.".6.".$baseport}=readfile($ifdir."/designated_root", 0);
+		$oid_type{$oid.".6.".$baseport}=ASN_OCTET_STR;
+		if(defined($prev_baseport)){
+			$oid_next{$oid.".6.".$prev_baseport}=
+				$oid.".6.".$baseport;
+		}
+
+		# dot1dStpPortDesignatedCost
+		$oid_value{$oid.".7.".$baseport}=readfile($ifdir."/designated_cost", 0);
+		$oid_type{$oid.".7.".$baseport}=ASN_INTEGER;
+		if(defined($prev_baseport)){
+			$oid_next{$oid.".7.".$prev_baseport}=
+				$oid.".7.".$baseport;
+		}
+
+		# dot1dStpPortDesignatedBridge
+		$oid_value{$oid.".8.".$baseport}=readfile($ifdir."/designated_bridge", 0);
+		$oid_type{$oid.".8.".$baseport}=ASN_OCTET_STR;
+		if(defined($prev_baseport)){
+			$oid_next{$oid.".8.".$prev_baseport}=
+				$oid.".8.".$baseport;
+		}
+
+		# dot1dStpPortDesignatedPort
+		$oid_value{$oid.".9.".$baseport}=readfile($ifdir."/designated_port", 0);
+		$oid_type{$oid.".9.".$baseport}=ASN_OCTET_STR;
+		if(defined($prev_baseport)){
+			$oid_next{$oid.".9.".$prev_baseport}=
+				$oid.".9.".$baseport;
+		}
+
+		# dot1dStpPortForwardTransitions (no value in bridge module)
+
+		# dot1dStpPortPathCost32
+		$oid_value{$oid.".11.".$baseport}=readfile($ifdir."/path_cost", 0);
+		$oid_type{$oid.".11.".$baseport}=ASN_INTEGER;
+		if(defined($prev_baseport)){
+			$oid_next{$oid.".11.".$prev_baseport}=
+				$oid.".11.".$baseport;
+		}
+
+
+		$prev_baseport=$baseport;
+	}
+
+	if ( $prev_baseport and $first_baseport ) {
+		$oid_next{$oid.".1.".$prev_baseport}=$oid.".2.".$first_baseport;
+		$oid_next{$oid.".2.".$prev_baseport}=$oid.".3.".$first_baseport;
+		$oid_next{$oid.".3.".$prev_baseport}=$oid.".4.".$first_baseport;
+		$oid_next{$oid.".4.".$prev_baseport}=$oid.".5.".$first_baseport;
+		$oid_next{$oid.".5.".$prev_baseport}=$oid.".6.".$first_baseport;
+		$oid_next{$oid.".6.".$prev_baseport}=$oid.".7.".$first_baseport;
+		$oid_next{$oid.".7.".$prev_baseport}=$oid.".8.".$first_baseport;
+		$oid_next{$oid.".8.".$prev_baseport}=$oid.".9.".$first_baseport;
+		$oid_next{$oid.".9.".$prev_baseport}=$oid.".11.".$first_baseport;
+		$oid_next{$oid.".11.".$prev_baseport}=".1.3.6.1.2.1.17.4.1";
+	}
+
+	$oid = $oid.".11.".$prev_baseport;
+
+	undef $prev_baseport;
+	undef $first_baseport;
+
+}
+
+sub dot1dTpproperties()
+{
+	@stpprops = ( { oid => ".1.3.6.1.2.1.17.4.1",
+			flags => STP_PROP_VALUE,
+			value => "0",
+			type => ASN_COUNTER,
+			nextoid => ".1.3.6.1.2.1.17.4.2" },
+			{ oid => ".1.3.6.1.2.1.17.4.2",
+			flags => STP_PROP_VALUE,
+			value => "300",
+			type => ASN_INTEGER,
+			nextoid => ".1.3.6.1.2.1.17.4.3" },
+			);
+
+	for ($i=0; $i <= $#stpprops; $i++) {
+		my %props = %{$stpprops[$i]};
+		$oid = $props{'oid'};
+		if ( $props{'flags'} & STP_PROP_VALUE,) {
+			$oid_value{$oid} = $props{'value'};
+		}
+		if ( $props{'flags'} & STP_PROP_FILE,) {
+			$oid_value{$oid} =
+			readfile($props{'value'},
+			$props{'flags'});
+		}
+		$oid_type{$oid} = $props{'type'};
+		$oid_next{$oid} = $props{'nextoid'};
+	}
+}
+
+sub portproperties
+{
+	my $bridge = shift;
+	my ($baseport, $first_baseport, $prev_baseport);
+
+	$oid='.1.3.6.1.2.1.17.4.4.1';
+
+	foreach my $port (keys %{$interfaces{$bridge}}) {
+		$baseport = $baseports{$bridge}{$port};
+
+		unless(defined($first_baseport)){
+			$first_baseport=$baseport;
+			$oid_next{$oid.".1"}=$oid.".1.".$baseport;
+			$oid_next{$oid.".2"}=$oid.".2.".$baseport;
+		}
+
+		my $interface = $interfaces{$bridge}{$port};
+		my $ifdir = $netdir.$interface;
+
+		# dot1dTpPort
+		$oid_value{$oid.".1.".$baseport}=$baseport;
+		$oid_type{$oid.".1.".$baseport}=ASN_INTEGER;
+		if(defined($prev_baseport)){
+			$oid_next{$oid.".1.".$prev_baseport}=
+				$oid.".1.".$baseport;
+		}
+
+		# dot1dTpPortMaxInfo
+		$oid_value{$oid.".2.".$baseport}=readfile($ifdir."/mtu", 0);
+		$oid_type{$oid.".2.".$baseport}=ASN_INTEGER;
+		if(defined($prev_baseport)){
+			$oid_next{$oid.".2.".$prev_baseport}=
+				$oid.".2.".$baseport;
+		}
+
+		# dot1dTpPortInFrames
+		$oid_value{$oid.".3.".$baseport}=readfile($ifdir."/statistics/rx_packets", 0);
+		$oid_type{$oid.".3.".$baseport}=ASN_COUNTER;
+		if(defined($prev_baseport)){
+			$oid_next{$oid.".3.".$prev_baseport}=
+				$oid.".3.".$baseport;
+		}
+
+		# dot1dTpPortOutFrames
+		$oid_value{$oid.".4.".$baseport}=readfile($ifdir."/statistics/tx_packets", 0);
+		$oid_type{$oid.".4.".$baseport}=ASN_COUNTER;
+		if(defined($prev_baseport)){
+			$oid_next{$oid.".4.".$prev_baseport}=
+				$oid.".4.".$baseport;
+		}
+
+		# dot1dTpPortInDiscards
+		$oid_value{$oid.".5.".$baseport}=readfile($ifdir."/statistics/rx_dropped", 0);
+		$oid_type{$oid.".5.".$baseport}=ASN_COUNTER;
+		if(defined($prev_baseport)){
+			$oid_next{$oid.".5.".$prev_baseport}=
+				$oid.".5.".$baseport;
+		}
+
+		$prev_baseport=$baseport;
+	}
+
+	if ( $prev_baseport and $first_baseport ) {
+		$oid_next{$oid.".1.".$prev_baseport}=$oid.".2.".$first_baseport;
+		$oid_next{$oid.".2.".$prev_baseport}=$oid.".3.".$first_baseport;
+		$oid_next{$oid.".3.".$prev_baseport}=$oid.".4.".$first_baseport;
+		$oid_next{$oid.".4.".$prev_baseport}=$oid.".5.".$first_baseport;
+		$oid_next{$oid.".5.".$prev_baseport}=".1.3.6.1.2.1.17.5.1";
+	}
+
+	$oid = $oid.".5.".$prev_baseport;
+
+	undef $prev_baseport;
+	undef $first_baseport;
+}
+
+sub dot1qbase()
+{
+	my $bridge = shift;
+
+	my $oid=".1.3.6.1.2.1.17.7.1.1";
+	$oid_next{".1.3.6.1.2.1.17.7"}=$oid.".1";
+	$oid_next{".1.3.6.1.2.1.17.7.1"}=$oid.".1";
+
+	$oid_value{$oid.".1"}=1;
+	$oid_type{$oid.".1"}=ASN_INTEGER;
+	$oid_next{$oid.".1"}=$oid.".2";
+
+	$oid_value{$oid.".2"}=4094;
+	$oid_type{$oid.".2"}=ASN_UNSIGNED;
+	$oid_next{$oid.".2"}=$oid.".3";
+
+	$oid_value{$oid.".3"}=4094;
+	$oid_type{$oid.".3"}=ASN_UNSIGNED;
+	$oid_next{$oid.".3"}=$oid.".4";
+
+	$oid_value{$oid.".4"}=0; # filled in by currentvlans
+	$oid_type{$oid.".4"}=ASN_UNSIGNED;
+	$oid_next{$oid.".4"}=$oid.".5";
+
+	$oid_value{$oid.".5"}=2;
+	$oid_type{$oid.".5"}=ASN_INTEGER;
+	$oid_next{$oid.".5"}=0;  # filled in by dot1qfdb
+
+}
+
+sub dot1qfdb()
+{
+	my $bridge = shift;
+
+	my $oid=".1.3.6.1.2.1.17.7.1.2";
+	foreach my $vlan (sort {$a<=>$b} keys %vlans){
+		unless(defined($first_vlan)){
+			$first_vlan=$vlan;
+			$oid_next{".1.3.6.1.2.1.17.7.1.1.5"}=$oid.".1.1.".$vlan;
+			$oid_next{$oid}=$oid.".1.1.".$vlan;
+			$oid_next{$oid.".1"}=$oid.".1.1.".$vlan;
+			$oid_next{$oid.".1.1"}=$oid.".1.1.".$vlan;
+			$oid_next{$oid.".1.2"}=$oid.".1.2.".$vlan;
+		}
+
+		$oid_value{$oid.".1.1.".$vlan}=$vlan;
+		$oid_type{$oid.".1.1.".$vlan}=ASN_UNSIGNED;
+		if(defined($prv_vlan)){
+			$oid_next{$oid.".1.1.".$prv_vlan}=$oid.".1.1.".$vlan;
+		}
+
+		$oid_value{$oid.".1.2.".$vlan}=0; # to be filled later
+		$oid_type{$oid.".1.2.".$vlan}=ASN_COUNTER;
+		if(defined($prv_vlan)){
+			$oid_next{$oid.".1.2.".$prv_vlan}=$oid.".1.2.".$vlan;
+		}
+
+		$prv_vlan=$vlan;
+	}
+	if($prv_vlan and $first_vlan){
+		$oid_next{$oid.".1.1.".$prv_vlan}=$oid.".1.2.".$first_vlan;
+		$oid_next{$oid.".1.2.".$prv_vlan}=0; # to be filled later
+	}
+
+	my %macvlan=();
+	my %vlanmac=();
+
+	foreach my $vlan (sort {$a<=>$b} keys %vlans){
+		my $count=0;
+		foreach my $mac (sort {$a cmp $b} keys %macs) {
+			my $vbridge=$bridge."_vlan".$vlan;
+			next unless(defined($macs{$mac}{$vbridge}));
+			$count++;
+			my $mac_oid=mac2oid($mac);
+			$macvlan{$vlan.$mac_oid}=$mac;
+			$vlanmac{$vlan.$mac_oid}=$vlan;
+		}
+		$oid_value{$oid.".1.2.".$vlan}=$count;
+	}
+
+	foreach my $vmac_oid (sort {$a cmp $b} keys %vlanmac){
+		my $mac=$macvlan{$vmac_oid};
+		my $vlan=$vlanmac{$vmac_oid};
+
+		#print "VMAC: $vmac_oid ($vlan:$mac)\n";
+		unless(defined($first_vmac_oid)){
+			$first_vmac_oid=$vmac_oid;
+			$oid_next{$oid.".1.2.".$prv_vlan}=$oid.".2.1.".$vmac_oid;
+			$oid_next{$oid.".2"}=$oid.".2.1.".$vmac_oid;
+			$oid_next{$oid.".2.1"}=$oid.".2.1.".$vmac_oid;
+			$oid_next{$oid.".2.2"}=$oid.".2.2.".$vmac_oid;
+			$oid_next{$oid.".2.3"}=$oid.".2.3.".$vmac_oid;
+		}
+
+		my $port=$macs{$mac}{$bridge};
+		my $baseport=$baseports{$bridge}{$port};
+		my $status=$locals{$mac}{$bridge};
+		my $age=$ages{$mac}{$bridge};
+
+		print "VLAN $vlan: $mac -> $port:$baseport ($status, $age)\n";
+
+		$oid_value{$oid.".2.1.".$vmac_oid}=mac2hex($mac);
+		$oid_type{$oid.".2.1.".$vmac_oid}=ASN_OCTET_STR;
+		if(defined($prv_vmac_oid)){
+			$oid_next{$oid.".2.1.".$prv_vmac_oid}=$oid.".2.1.".$vmac_oid;
+		}
+
+		$oid_value{$oid.".2.2.".$vmac_oid}=$baseport;
+		$oid_type{$oid.".2.2.".$vmac_oid}=ASN_INTEGER;
+		if(defined($prv_vmac_oid)){
+			$oid_next{$oid.".2.2.".$prv_vmac_oid}=$oid.".2.2.".$vmac_oid;
+		}
+
+		$oid_value{$oid.".2.3.".$vmac_oid}=$status;
+		$oid_type{$oid.".2.3.".$vmac_oid}=ASN_INTEGER;
+		if(defined($prv_vmac_oid)){
+			$oid_next{$oid.".2.3.".$prv_vmac_oid}=$oid.".2.3.".$vmac_oid;
+		}
+		$prv_vmac_oid=$vmac_oid;
+	}
+
+	if ($prv_vmac_oid and $first_vmac_oid) {
+		$oid_next{$oid.".2.1.".$prv_vmac_oid}=$oid.".2.2.".$first_vmac_oid;
+		$oid_next{$oid.".2.2.".$prv_vmac_oid}=$oid.".2.3.".$first_vmac_oid;
+		$oid_next{$oid.".2.3.".$prv_vmac_oid}=".1.3.6.1.2.1.17.7.1.4.1";
+	}
+
+	undef $first_vmac_oid;
+	undef $prv_vmac_oid;
+
+	undef $first_vlan;
+	undef $prv_vlan;
+}
+
+sub dot1qcurrentvlans()
+{
+	my $bridge = shift;
+
+
+	my $oid=".1.3.6.1.2.1.17.7.1.4.1";
+	$oid_next{".1.3.6.1.2.1.17.7.1.4"}=$oid;
+
+	$oid_value{$oid}=0;	# can't keep track of this info
+	$oid_type{$oid}=ASN_COUNTER;
+
+	my $count=0;
+	$oid=".1.3.6.1.2.1.17.7.1.4.2";
+	foreach my $vlan (sort {$a<=>$b} keys %vlans){
+		$count++;
+		my @allports=();
+		my @untaggedports=();
+		foreach my $port (keys %{$vlans{$vlan}}){
+			$baseport=$baseports{$bridge}{$port};
+			push @allports, $baseport;
+			push @untaggedports, $baseport
+				unless($tagged{$vlan}{$port});
+		}
+		#print "ADDING: vlan $vlan (@allports, @untaggedports)\n";
+		unless(defined($first_vlan)){
+			$first_vlan=$vlan;
+			$oid_next{".1.3.6.1.2.1.17.7.1.4.1"}=$oid.".1.0.".$vlan;
+			$oid_next{$oid}=$oid.".1.0.".$vlan;
+			$oid_next{$oid.".1"}=$oid.".1.0.".$vlan;
+			$oid_next{$oid.".2"}=$oid.".2.0.".$vlan;
+			$oid_next{$oid.".3"}=$oid.".3.0.".$vlan;
+			$oid_next{$oid.".4"}=$oid.".4.0.".$vlan;
+			$oid_next{$oid.".5"}=$oid.".5.0.".$vlan;
+			$oid_next{$oid.".6"}=$oid.".6.0.".$vlan;
+			$oid_next{$oid.".7"}=$oid.".7.0.".$vlan;
+		}
+
+		$oid_value{$oid.".1.0.".$vlan}=0; # can't keep track of this
+		$oid_type{$oid.".1.0.".$vlan}=ASN_TIMETICKS;
+		if(defined($prv_vlan)){
+			$oid_next{$oid.".1.0.".$prv_vlan}=$oid.".1.0.".$vlan;
+		}
+
+		$oid_value{$oid.".2.0.".$vlan}=$vlan;
+		$oid_type{$oid.".2.0.".$vlan}=ASN_UNSIGNED;
+		if(defined($prv_vlan)){
+			$oid_next{$oid.".2.0.".$prv_vlan}=$oid.".2.0.".$vlan;
+		}
+
+		$oid_value{$oid.".3.0.".$vlan}=$vlan;
+		$oid_type{$oid.".3.0.".$vlan}=ASN_UNSIGNED;
+		if(defined($prv_vlan)){
+			$oid_next{$oid.".3.0.".$prv_vlan}=$oid.".3.0.".$vlan;
+		}
+
+		$oid_value{$oid.".4.0.".$vlan}=getportlist(@allports);
+		$oid_type{$oid.".4.0.".$vlan}=ASN_OCTET_STR;
+		if(defined($prv_vlan)){
+			$oid_next{$oid.".4.0.".$prv_vlan}=$oid.".4.0.".$vlan;
+		}
+
+		$oid_value{$oid.".5.0.".$vlan}=getportlist(@untaggedports);
+		$oid_type{$oid.".5.0.".$vlan}=ASN_OCTET_STR;
+		if(defined($prv_vlan)){
+			$oid_next{$oid.".5.0.".$prv_vlan}=$oid.".5.0.".$vlan;
+		}
+
+		$oid_value{$oid.".6.0.".$vlan}=1;
+		$oid_type{$oid.".6.0.".$vlan}=ASN_INTEGER;
+		if(defined($prv_vlan)){
+			$oid_next{$oid.".6.0.".$prv_vlan}=$oid.".6.0.".$vlan;
+		}
+
+		$oid_value{$oid.".7.0.".$vlan}=0;
+		$oid_type{$oid.".7.0.".$vlan}=ASN_TIMETICKS;
+		if(defined($prv_vlan)){
+			$oid_next{$oid.".7.0.".$prv_vlan}=$oid.".7.0.".$vlan;
+		}
+		$prv_vlan=$vlan;
+	}
+
+	$oid_value{".1.3.6.1.2.1.17.7.1.1.4"}=$count;
+	if($prv_vlan and $first_vlan){
+		$oid_next{$oid.".1.0.".$prv_vlan}=$oid.".2.0.".$first_vlan;
+		$oid_next{$oid.".2.0.".$prv_vlan}=$oid.".3.0.".$first_vlan;
+		$oid_next{$oid.".3.0.".$prv_vlan}=$oid.".4.0.".$first_vlan;
+		$oid_next{$oid.".4.0.".$prv_vlan}=$oid.".5.0.".$first_vlan;
+		$oid_next{$oid.".5.0.".$prv_vlan}=$oid.".6.0.".$first_vlan;
+		$oid_next{$oid.".6.0.".$prv_vlan}=$oid.".7.0.".$first_vlan;
+		$oid_next{$oid.".7.0.".$prv_vlan}=".1.3.6.1.2.1.17.7.1.4.3";
+	}
+
+	undef $prv_vlan;
+	undef $first_vlan;
+
+}
+
+sub readforwards()
+{
+	my $bridge = shift;
+	my $fdb=$netdir.$bridge."/brforward";
+
+	open(FWD, $fdb) or return -1;
+	while(sysread(FWD, $data, 20)){
+		my $mac;
+		my ($b1,$b2,$b3,$b4,$b5,$b6,$port,$local,$age,$hi)=
+		unpack("C6 C C L C x3", $data);
+		$mac=sprintf("%.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
+					$b1,$b2,$b3,$b4,$b5,$b6);
+		$age=$age/100;
+		$macs{$mac}{$bridge}=$port;
+		$ages{$mac}{$bridge}=$age;
+		$locals{$mac}{$bridge}=FDB_STATUS_LEARNED;
+		next if ($local);
+		$macs{$mac}{$bridge}=$bridge;
+		$locals{$mac}{$bridge}=FDB_STATUS_SELF;
+	}
+	close(FWD);
+}
+
+sub readindexes()
+{
+	my $bridge = shift;
+
+	my $brifdir=$netdir.$bridge."/brif/";
+
+	opendir(DIR, $brifdir) or return -1;
+	my @interfaces = readdir(DIR);
+	next if ($#interfaces lt 2);
+	foreach my $if (@interfaces) {
+		next if $if eq ".";
+		next if  $if eq "..";
+
+		my $port=hex(readfile($brifdir.$if."/port_no", 0));
+		my $index=readfile($netdir.$if."/ifindex", STP_PROP_HEX);
+
+		$indexes{$bridge}{$port}=$index;
+		$interfaces{$bridge}{$port}=$if;
+	}
+
+	$indexes{$bridge}{$bridge}=readfile($netdir.$bridge."/ifindex", 0);
+
+	close(DIR);
+}
+
+sub readvlans()
+{
+	my $bridge = shift;
+	my $brifdir = $netdir.$bridge."/brif/";
+	my %ifs;
+
+	opendir(DIR, $brifdir) or return -1;
+	my @interfaces = readdir(DIR);
+	return if ($#interfaces < 2);
+	foreach my $if (@interfaces) {
+		next if $if eq ".";
+		next if  $if eq "..";
+		$ifs{$if}=1;
+	}
+	close(DIR);
+
+	opendir(DIR, $netdir) or return -1;
+	@interfaces = readdir(DIR);
+	return 0 if ($#interfaces < 2);
+	foreach my $if (@interfaces) {
+		next if $if eq ".";
+		next if  $if eq "..";
+		next unless($if=~/^(.*)\.(\d+)$/);
+		my $pif=$1;
+		my $vlan=$2;
+		next unless(defined($ifs{$pif}));
+		tracevlan($vlan, $if, $bridge);
+	}
+	close(DIR);
+}
+
+sub tracevlan{
+	my ($vlan, $interface, $bridge)=@_;
+
+	my $brifdir=$netdir.$interface."/brport/bridge/brif/";
+
+	opendir(DIR, $brifdir) or return -1;
+	my @interfaces = readdir(DIR);
+	return if ($#interfaces < 2);
+	foreach my $if (@interfaces) {
+		next if $if eq ".";
+		next if  $if eq "..";
+		my $port;
+		my $index;
+		if($if=~/^(.*)\.(\d+)$/){
+			my $pif=$1;
+			$brifdir=$netdir.$pif."/brport/bridge/brif/";
+			$port=hex(readfile($brifdir.$pif."/port_no", 0));
+			$index=readfile($netdir.$pif."/ifindex", STP_PROP_HEX);
+			#$indexes{$bridge}{$port}=$index;
+			#$interfaces{$bridge}{$port}=$if;
+			$tagged{$vlan}{$port}=1;
+		}else{
+			my $brid=readfile($netdir.$if."/brport/bridge/ifindex",
+						STP_PROP_HEX);
+			$brifdir=$netdir.$if."/brport/bridge/brif/";
+			$port=hex(readfile($brifdir.$if."/port_no", 0));
+			$port=$brid*1000+$port; #create a unique port number
+			$index=readfile($netdir.$if."/ifindex", STP_PROP_HEX);
+			$indexes{$bridge}{$port}=$index;
+			$interfaces{$bridge}{$port}=$if;
+			$tagged{$vlan}{$port}=0;
+		}
+		$vlans{$vlan}{$port}=1;
+		#print "VLAN: $vlan -> $if ($port <-> $index)\n";
+	}
+	close(DIR);
+
+	my $brid=readfile($netdir.$interface."/brport/bridge/ifindex",
+					 STP_PROP_HEX);
+	my $fdb=$netdir.$interface."/brport/bridge/brforward";
+
+	my $vbridge=$bridge."_vlan".$vlan;
+	open(FWD, $fdb) or return -1;
+	while(sysread(FWD, $data, 20)){
+		my $mac;
+		my ($b1,$b2,$b3,$b4,$b5,$b6,$port,$local,$age,$hi)=
+		unpack("C6 C C L C x3", $data);
+		 $mac=sprintf("%.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
+					$b1,$b2,$b3,$b4,$b5,$b6);
+		 $port=$brid*1000+$port unless(defined($indexes{$bridge}{$port}));  #create a unique port number
+		 $age=$age/100;
+		 #$macs{$mac}{$bridge}=$port;
+		 $macs{$mac}{$vbridge}=$port;
+		 #$ages{$mac}{$bridge}=$age;
+		 $ages{$mac}{$vbridge}=$age;
+		 #$locals{$mac}{$bridge}=FDB_STATUS_LEARNED;
+		 $locals{$mac}{$vbridge}=FDB_STATUS_LEARNED;
+		 next if ($local);
+		 #$macs{$mac}{$bridge}=$bridge;
+		 $macs{$mac}{$vbridge}=$bridge;
+		 #$locals{$mac}{$bridge}=FDB_STATUS_SELF;
+		 $locals{$mac}{$vbridge}=FDB_STATUS_SELF;
+	}
+	close(FWD);
+}
+
+sub readfile()
+{
+	my $file = shift;
+	my $flags = shift;
+
+	open(FILE, $file) or print "Could not open file $file !\n";
+	my $value=<FILE>;
+	chomp $value;
+	close(FILE);
+
+	if ($flags & STP_PROP_HEX) {
+		return hex($value);
+	}
+
+	return $value;
+}
+
+sub getportlist{
+	my @ports=@_;
+	my $portlist="";
+
+	@ports=sort {$a <=> $b} @ports;
+	my $last=1;
+	foreach my $port (@ports){
+		for(my $i=$last; $i<$port; $i++){
+			$portlist=$portlist."0";
+		}
+		$portlist=$portlist."1";
+		$last=$port+1;
+	}
+	return pack('B*',$portlist);
+}
+
+sub mac2oid{
+	my ($mac)=@_;
+	my @octets=split(/:/,$mac);
+
+	$mac="";
+	foreach my $octet (@octets){
+		$mac=$mac.".".hex($octet);
+	}
+	return $mac;
+}
+
+sub mac2hex{
+        my ($mac)=@_;
+	my @decimals;
+	my @octets=split(/:/,$mac);
+
+	foreach my $octet (@octets){
+		push @decimals, hex($octet);
+	}
+	return pack("CCCCCC", @decimals);
+}
+
+sub shutdown {
+	$running = 0;
+}
Index: mibs/BRIDGE-MIB.txt
===================================================================
--- /dev/null
+++ mibs/BRIDGE-MIB.txt
@@ -0,0 +1,1472 @@
+BRIDGE-MIB DEFINITIONS ::= BEGIN
+
+-- ---------------------------------------------------------- --
+-- MIB for IEEE 802.1D devices
+-- ---------------------------------------------------------- --
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE,
+    Counter32, Integer32, TimeTicks, mib-2
+        FROM SNMPv2-SMI
+    TEXTUAL-CONVENTION, MacAddress
+        FROM SNMPv2-TC
+    MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP
+        FROM SNMPv2-CONF
+    InterfaceIndex FROM IF-MIB
+    ;
+
+dot1dBridge MODULE-IDENTITY
+    LAST-UPDATED "200509190000Z"
+    ORGANIZATION "IETF Bridge MIB Working Group"
+    CONTACT-INFO
+        "Email: bridge-mib@ietf.org
+
+                 K.C. Norseth (Editor)
+                 L-3 Communications
+            Tel: +1 801-594-2809
+          Email: kenyon.c.norseth@L-3com.com
+         Postal: 640 N. 2200 West.
+                 Salt Lake City, Utah 84116-0850
+
+                 Les Bell (Editor)
+                 3Com Europe Limited
+          Phone: +44 1442 438025
+          Email: elbell@ntlworld.com
+         Postal: 3Com Centre, Boundary Way
+                 Hemel Hempstead
+                 Herts.  HP2 7YU
+                 UK
+
+         Send comments to <bridge-mib@ietf.org>"
+    DESCRIPTION
+        "The Bridge MIB module for managing devices that support
+        IEEE 802.1D.
+
+        Copyright (C) The Internet Society (2005).  This version of
+        this MIB module is part of RFC 4188; see the RFC itself for
+        full legal notices."
+    REVISION     "200509190000Z"
+    DESCRIPTION
+         "Third revision, published as part of RFC 4188.
+
+         The MIB module has been converted to SMIv2 format.
+         Conformance statements have been added and some
+         description and reference clauses have been updated.
+
+         The object dot1dStpPortPathCost32 was added to
+         support IEEE 802.1t and the permissible values of
+         dot1dStpPriority and dot1dStpPortPriority have been
+         clarified for bridges supporting IEEE 802.1t or
+         IEEE 802.1w.
+
+         The interpretation of dot1dStpTimeSinceTopologyChange
+         has been clarified for bridges supporting the Rapid
+         Spanning Tree Protocol (RSTP)."
+    REVISION     "199307310000Z"
+    DESCRIPTION
+         "Second revision, published as part of RFC 1493."
+    REVISION     "199112310000Z"
+    DESCRIPTION
+         "Initial revision, published as part of RFC 1286."
+    ::= { mib-2 17 }
+
+-- ---------------------------------------------------------- --
+-- Textual Conventions
+-- ---------------------------------------------------------- --
+
+BridgeId ::= TEXTUAL-CONVENTION
+    STATUS      current
+    DESCRIPTION
+        "The Bridge-Identifier, as used in the Spanning Tree
+        Protocol, to uniquely identify a bridge.  Its first two
+        octets (in network byte order) contain a priority value,
+        and its last 6 octets contain the MAC address used to
+        refer to a bridge in a unique fashion (typically, the
+        numerically smallest MAC address of all ports on the
+        bridge)."
+    SYNTAX      OCTET STRING (SIZE (8))
+
+Timeout ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "d"
+    STATUS      current
+    DESCRIPTION
+        "A Spanning Tree Protocol (STP) timer in units of 1/100
+        seconds.  Several objects in this MIB module represent
+        values of timers used by the Spanning Tree Protocol.
+        In this MIB, these timers have values in units of
+        hundredths of a second (i.e., 1/100 secs).
+
+        These timers, when stored in a Spanning Tree Protocol's
+        BPDU, are in units of 1/256 seconds.  Note, however, that
+        802.1D-1998 specifies a settable granularity of no more
+        than one second for these timers.  To avoid ambiguity,
+        a conversion algorithm is defined below for converting
+        between the different units, which ensures a timer's
+        value is not distorted by multiple conversions.
+
+        To convert a Timeout value into a value in units of
+        1/256 seconds, the following algorithm should be used:
+
+            b = floor( (n * 256) / 100)
+
+        where:
+            floor   =  quotient [ignore remainder]
+            n is the value in 1/100 second units
+            b is the value in 1/256 second units
+
+        To convert the value from 1/256 second units back to
+        1/100 seconds, the following algorithm should be used:
+
+            n = ceiling( (b * 100) / 256)
+
+        where:
+            ceiling = quotient [if remainder is 0], or
+                      quotient + 1 [if remainder is nonzero]
+            n is the value in 1/100 second units
+
+            b is the value in 1/256 second units
+
+        Note: it is important that the arithmetic operations are
+        done in the order specified (i.e., multiply first,
+        divide second)."
+    SYNTAX      Integer32
+
+-- ---------------------------------------------------------- --
+-- subtrees in the Bridge MIB
+-- ---------------------------------------------------------- --
+
+dot1dNotifications  OBJECT IDENTIFIER ::= { dot1dBridge 0 }
+
+dot1dBase           OBJECT IDENTIFIER ::= { dot1dBridge 1 }
+dot1dStp            OBJECT IDENTIFIER ::= { dot1dBridge 2 }
+
+dot1dSr             OBJECT IDENTIFIER ::= { dot1dBridge 3 }
+-- documented in RFC 1525
+
+dot1dTp             OBJECT IDENTIFIER ::= { dot1dBridge 4 }
+dot1dStatic         OBJECT IDENTIFIER ::= { dot1dBridge 5 }
+
+-- Subtrees used by Bridge MIB Extensions:
+--      pBridgeMIB  MODULE-IDENTITY   ::= { dot1dBridge 6 }
+--      qBridgeMIB  MODULE-IDENTITY   ::= { dot1dBridge 7 }
+-- Note that the practice of registering related MIB modules
+-- below dot1dBridge has been discouraged since there is no
+-- robust mechanism to track such registrations.
+
+dot1dConformance    OBJECT IDENTIFIER ::= { dot1dBridge 8 }
+
+-- ---------------------------------------------------------- --
+-- the dot1dBase subtree
+-- ---------------------------------------------------------- --
+-- Implementation of the dot1dBase subtree is mandatory for all
+-- bridges.
+-- ---------------------------------------------------------- --
+
+dot1dBaseBridgeAddress OBJECT-TYPE
+    SYNTAX      MacAddress
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The MAC address used by this bridge when it must be
+        referred to in a unique fashion.  It is recommended
+        that this be the numerically smallest MAC address of
+        all ports that belong to this bridge.  However, it is only
+
+        required to be unique.  When concatenated with
+        dot1dStpPriority, a unique BridgeIdentifier is formed,
+        which is used in the Spanning Tree Protocol."
+    REFERENCE
+        "IEEE 802.1D-1998: clauses 14.4.1.1.3 and 7.12.5"
+    ::= { dot1dBase 1 }
+
+dot1dBaseNumPorts OBJECT-TYPE
+    SYNTAX      Integer32
+    UNITS       "ports"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The number of ports controlled by this bridging
+        entity."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 14.4.1.1.3"
+    ::= { dot1dBase 2 }
+
+dot1dBaseType OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    unknown(1),
+                    transparent-only(2),
+                    sourceroute-only(3),
+                    srt(4)
+                }
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "Indicates what type of bridging this bridge can
+        perform.  If a bridge is actually performing a
+        certain type of bridging, this will be indicated by
+        entries in the port table for the given type."
+    ::= { dot1dBase 3 }
+
+-- ---------------------------------------------------------- --
+-- The Generic Bridge Port Table
+-- ---------------------------------------------------------- --
+dot1dBasePortTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF Dot1dBasePortEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A table that contains generic information about every
+        port that is associated with this bridge.  Transparent,
+        source-route, and srt ports are included."
+    ::= { dot1dBase 4 }
+
+dot1dBasePortEntry OBJECT-TYPE
+    SYNTAX      Dot1dBasePortEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A list of information for each port of the bridge."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 14.4.2, 14.6.1"
+    INDEX  { dot1dBasePort }
+    ::= { dot1dBasePortTable 1 }
+
+Dot1dBasePortEntry ::=
+    SEQUENCE {
+        dot1dBasePort
+            Integer32,
+        dot1dBasePortIfIndex
+            InterfaceIndex,
+        dot1dBasePortCircuit
+            OBJECT IDENTIFIER,
+        dot1dBasePortDelayExceededDiscards
+            Counter32,
+        dot1dBasePortMtuExceededDiscards
+            Counter32
+    }
+
+dot1dBasePort OBJECT-TYPE
+    SYNTAX      Integer32 (1..65535)
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The port number of the port for which this entry
+        contains bridge management information."
+    ::= { dot1dBasePortEntry 1 }
+
+dot1dBasePortIfIndex OBJECT-TYPE
+    SYNTAX      InterfaceIndex
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The value of the instance of the ifIndex object,
+        defined in IF-MIB, for the interface corresponding
+        to this port."
+    ::= { dot1dBasePortEntry 2 }
+
+dot1dBasePortCircuit OBJECT-TYPE
+    SYNTAX      OBJECT IDENTIFIER
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "For a port that (potentially) has the same value of
+        dot1dBasePortIfIndex as another port on the same bridge.
+        This object contains the name of an object instance
+        unique to this port.  For example, in the case where
+        multiple ports correspond one-to-one with multiple X.25
+        virtual circuits, this value might identify an (e.g.,
+        the first) object instance associated with the X.25
+        virtual circuit corresponding to this port.
+
+        For a port which has a unique value of
+        dot1dBasePortIfIndex, this object can have the value
+        { 0 0 }."
+    ::= { dot1dBasePortEntry 3 }
+
+dot1dBasePortDelayExceededDiscards OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The number of frames discarded by this port due
+        to excessive transit delay through the bridge.  It
+        is incremented by both transparent and source
+        route bridges."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 14.6.1.1.3"
+    ::= { dot1dBasePortEntry 4 }
+
+dot1dBasePortMtuExceededDiscards OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The number of frames discarded by this port due
+        to an excessive size.  It is incremented by both
+        transparent and source route bridges."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 14.6.1.1.3"
+    ::= { dot1dBasePortEntry 5 }
+
+-- ---------------------------------------------------------- --
+-- the dot1dStp subtree
+-- ---------------------------------------------------------- --
+-- Implementation of the dot1dStp subtree is optional.  It is
+-- implemented by those bridges that support the Spanning Tree
+-- Protocol.
+-- ---------------------------------------------------------- --
+
+dot1dStpProtocolSpecification OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    unknown(1),
+                    decLb100(2),
+                    ieee8021d(3)
+                }
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "An indication of what version of the Spanning Tree
+        Protocol is being run.  The value 'decLb100(2)'
+        indicates the DEC LANbridge 100 Spanning Tree protocol.
+        IEEE 802.1D implementations will return 'ieee8021d(3)'.
+        If future versions of the IEEE Spanning Tree Protocol
+        that are incompatible with the current version
+        are released a new value will be defined."
+    ::= { dot1dStp 1 }
+
+dot1dStpPriority OBJECT-TYPE
+    SYNTAX      Integer32 (0..65535)
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The value of the write-able portion of the Bridge ID
+        (i.e., the first two octets of the (8 octet long) Bridge
+        ID).  The other (last) 6 octets of the Bridge ID are
+        given by the value of dot1dBaseBridgeAddress.
+        On bridges supporting IEEE 802.1t or IEEE 802.1w,
+        permissible values are 0-61440, in steps of 4096."
+    REFERENCE
+        "IEEE 802.1D-1998 clause 8.10.2, Table 8-4,
+        IEEE 802.1t clause 8.10.2, Table 8-4, clause 14.3."
+    ::= { dot1dStp 2 }
+
+dot1dStpTimeSinceTopologyChange OBJECT-TYPE
+    SYNTAX      TimeTicks
+    UNITS       "centi-seconds"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The time (in hundredths of a second) since the
+        last time a topology change was detected by the
+        bridge entity.
+        For RSTP, this reports the time since the tcWhile
+        timer for any port on this Bridge was nonzero."
+    REFERENCE
+        "IEEE 802.1D-1998 clause 14.8.1.1.,
+        IEEE 802.1w clause 14.8.1.1."
+    ::= { dot1dStp 3 }
+
+dot1dStpTopChanges OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The total number of topology changes detected by
+        this bridge since the management entity was last
+        reset or initialized."
+    REFERENCE
+        "IEEE 802.1D-1998 clause 14.8.1.1."
+    ::= { dot1dStp 4 }
+
+dot1dStpDesignatedRoot OBJECT-TYPE
+    SYNTAX      BridgeId
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The bridge identifier of the root of the spanning
+        tree, as determined by the Spanning Tree Protocol,
+        as executed by this node.  This value is used as
+        the Root Identifier parameter in all Configuration
+        Bridge PDUs originated by this node."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 8.5.3.1"
+    ::= { dot1dStp 5 }
+
+dot1dStpRootCost OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The cost of the path to the root as seen from
+        this bridge."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 8.5.3.2"
+    ::= { dot1dStp 6 }
+
+dot1dStpRootPort OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The port number of the port that offers the lowest
+        cost path from this bridge to the root bridge."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 8.5.3.3"
+    ::= { dot1dStp 7 }
+
+dot1dStpMaxAge OBJECT-TYPE
+    SYNTAX      Timeout
+    UNITS       "centi-seconds"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The maximum age of Spanning Tree Protocol information
+        learned from the network on any port before it is
+        discarded, in units of hundredths of a second.  This is
+        the actual value that this bridge is currently using."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 8.5.3.4"
+    ::= { dot1dStp 8 }
+
+dot1dStpHelloTime OBJECT-TYPE
+    SYNTAX      Timeout
+    UNITS       "centi-seconds"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The amount of time between the transmission of
+        Configuration bridge PDUs by this node on any port when
+        it is the root of the spanning tree, or trying to become
+        so, in units of hundredths of a second.  This is the
+        actual value that this bridge is currently using."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 8.5.3.5"
+    ::= { dot1dStp 9 }
+
+dot1dStpHoldTime OBJECT-TYPE
+    SYNTAX      Integer32
+    UNITS       "centi-seconds"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "This time value determines the interval length
+        during which no more than two Configuration bridge
+        PDUs shall be transmitted by this node, in units
+        of hundredths of a second."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 8.5.3.14"
+    ::= { dot1dStp 10 }
+
+dot1dStpForwardDelay OBJECT-TYPE
+    SYNTAX      Timeout
+    UNITS       "centi-seconds"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "This time value, measured in units of hundredths of a
+        second, controls how fast a port changes its spanning
+        state when moving towards the Forwarding state.  The
+        value determines how long the port stays in each of the
+        Listening and Learning states, which precede the
+        Forwarding state.  This value is also used when a
+        topology change has been detected and is underway, to
+        age all dynamic entries in the Forwarding Database.
+        [Note that this value is the one that this bridge is
+        currently using, in contrast to
+        dot1dStpBridgeForwardDelay, which is the value that this
+        bridge and all others would start using if/when this
+        bridge were to become the root.]"
+    REFERENCE
+        "IEEE 802.1D-1998: clause 8.5.3.6"
+    ::= { dot1dStp 11 }
+
+dot1dStpBridgeMaxAge OBJECT-TYPE
+    SYNTAX      Timeout (600..4000)
+    UNITS       "centi-seconds"
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The value that all bridges use for MaxAge when this
+        bridge is acting as the root.  Note that 802.1D-1998
+        specifies that the range for this parameter is related
+        to the value of dot1dStpBridgeHelloTime.  The
+        granularity of this timer is specified by 802.1D-1998 to
+        be 1 second.  An agent may return a badValue error if a
+        set is attempted to a value that is not a whole number
+        of seconds."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 8.5.3.8"
+    ::= { dot1dStp 12 }
+
+dot1dStpBridgeHelloTime OBJECT-TYPE
+    SYNTAX      Timeout (100..1000)
+    UNITS       "centi-seconds"
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The value that all bridges use for HelloTime when this
+        bridge is acting as the root.  The granularity of this
+        timer is specified by 802.1D-1998 to be 1 second.  An
+        agent may return a badValue error if a set is attempted
+
+        to a value that is not a whole number of seconds."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 8.5.3.9"
+    ::= { dot1dStp 13 }
+
+dot1dStpBridgeForwardDelay OBJECT-TYPE
+    SYNTAX      Timeout (400..3000)
+    UNITS       "centi-seconds"
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The value that all bridges use for ForwardDelay when
+        this bridge is acting as the root.  Note that
+        802.1D-1998 specifies that the range for this parameter
+        is related to the value of dot1dStpBridgeMaxAge.  The
+        granularity of this timer is specified by 802.1D-1998 to
+        be 1 second.  An agent may return a badValue error if a
+        set is attempted to a value that is not a whole number
+        of seconds."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 8.5.3.10"
+    ::= { dot1dStp 14 }
+
+-- ---------------------------------------------------------- --
+-- The Spanning Tree Port Table
+-- ---------------------------------------------------------- --
+
+dot1dStpPortTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF Dot1dStpPortEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A table that contains port-specific information
+        for the Spanning Tree Protocol."
+    ::= { dot1dStp 15 }
+
+dot1dStpPortEntry OBJECT-TYPE
+    SYNTAX      Dot1dStpPortEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A list of information maintained by every port about
+        the Spanning Tree Protocol state for that port."
+    INDEX   { dot1dStpPort }
+    ::= { dot1dStpPortTable 1 }
+
+Dot1dStpPortEntry ::=
+    SEQUENCE {
+
+        dot1dStpPort
+            Integer32,
+        dot1dStpPortPriority
+            Integer32,
+        dot1dStpPortState
+            INTEGER,
+        dot1dStpPortEnable
+            INTEGER,
+        dot1dStpPortPathCost
+            Integer32,
+        dot1dStpPortDesignatedRoot
+            BridgeId,
+        dot1dStpPortDesignatedCost
+            Integer32,
+        dot1dStpPortDesignatedBridge
+            BridgeId,
+        dot1dStpPortDesignatedPort
+            OCTET STRING,
+        dot1dStpPortForwardTransitions
+            Counter32,
+        dot1dStpPortPathCost32
+            Integer32
+    }
+
+dot1dStpPort OBJECT-TYPE
+    SYNTAX      Integer32 (1..65535)
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The port number of the port for which this entry
+        contains Spanning Tree Protocol management information."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 14.8.2.1.2"
+    ::= { dot1dStpPortEntry 1 }
+
+dot1dStpPortPriority OBJECT-TYPE
+    SYNTAX      Integer32 (0..255)
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The value of the priority field that is contained in
+        the first (in network byte order) octet of the (2 octet
+        long) Port ID.  The other octet of the Port ID is given
+        by the value of dot1dStpPort.
+        On bridges supporting IEEE 802.1t or IEEE 802.1w,
+        permissible values are 0-240, in steps of 16."
+    REFERENCE
+        "IEEE 802.1D-1998 clause 8.10.2, Table 8-4,
+        IEEE 802.1t clause 8.10.2, Table 8-4, clause 14.3."
+    ::= { dot1dStpPortEntry 2 }
+
+dot1dStpPortState OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    disabled(1),
+                    blocking(2),
+                    listening(3),
+                    learning(4),
+                    forwarding(5),
+                    broken(6)
+                }
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The port's current state, as defined by application of
+        the Spanning Tree Protocol.  This state controls what
+        action a port takes on reception of a frame.  If the
+        bridge has detected a port that is malfunctioning, it
+        will place that port into the broken(6) state.  For
+        ports that are disabled (see dot1dStpPortEnable), this
+        object will have a value of disabled(1)."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 8.5.5.2"
+    ::= { dot1dStpPortEntry 3 }
+
+dot1dStpPortEnable OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    enabled(1),
+                    disabled(2)
+                }
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The enabled/disabled status of the port."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 8.5.5.2"
+    ::= { dot1dStpPortEntry 4 }
+
+dot1dStpPortPathCost OBJECT-TYPE
+    SYNTAX      Integer32 (1..65535)
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The contribution of this port to the path cost of
+        paths towards the spanning tree root which include
+        this port.  802.1D-1998 recommends that the default
+        value of this parameter be in inverse proportion to
+
+        the speed of the attached LAN.
+
+        New implementations should support dot1dStpPortPathCost32.
+        If the port path costs exceeds the maximum value of this
+        object then this object should report the maximum value,
+        namely 65535.  Applications should try to read the
+        dot1dStpPortPathCost32 object if this object reports
+        the maximum value."
+    REFERENCE "IEEE 802.1D-1998: clause 8.5.5.3"
+        ::= { dot1dStpPortEntry 5 }
+
+dot1dStpPortDesignatedRoot OBJECT-TYPE
+    SYNTAX      BridgeId
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The unique Bridge Identifier of the Bridge
+        recorded as the Root in the Configuration BPDUs
+        transmitted by the Designated Bridge for the
+        segment to which the port is attached."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 8.5.5.4"
+    ::= { dot1dStpPortEntry 6 }
+
+dot1dStpPortDesignatedCost OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The path cost of the Designated Port of the segment
+        connected to this port.  This value is compared to the
+        Root Path Cost field in received bridge PDUs."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 8.5.5.5"
+    ::= { dot1dStpPortEntry 7 }
+
+dot1dStpPortDesignatedBridge OBJECT-TYPE
+    SYNTAX      BridgeId
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The Bridge Identifier of the bridge that this
+        port considers to be the Designated Bridge for
+        this port's segment."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 8.5.5.6"
+    ::= { dot1dStpPortEntry 8 }
+
+dot1dStpPortDesignatedPort OBJECT-TYPE
+    SYNTAX      OCTET STRING (SIZE (2))
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The Port Identifier of the port on the Designated
+        Bridge for this port's segment."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 8.5.5.7"
+    ::= { dot1dStpPortEntry 9 }
+
+dot1dStpPortForwardTransitions OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The number of times this port has transitioned
+        from the Learning state to the Forwarding state."
+    ::= { dot1dStpPortEntry 10 }
+
+dot1dStpPortPathCost32 OBJECT-TYPE
+    SYNTAX      Integer32 (1..200000000)
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The contribution of this port to the path cost of
+        paths towards the spanning tree root which include
+        this port.  802.1D-1998 recommends that the default
+        value of this parameter be in inverse proportion to
+        the speed of the attached LAN.
+
+        This object replaces dot1dStpPortPathCost to support
+        IEEE 802.1t."
+    REFERENCE
+        "IEEE 802.1t clause 8.10.2, Table 8-5."
+    ::= { dot1dStpPortEntry 11 }
+
+-- ---------------------------------------------------------- --
+-- the dot1dTp subtree
+-- ---------------------------------------------------------- --
+-- Implementation of the dot1dTp subtree is optional.  It is
+-- implemented by those bridges that support the transparent
+-- bridging mode.  A transparent or SRT bridge will implement
+-- this subtree.
+-- ---------------------------------------------------------- --
+
+dot1dTpLearnedEntryDiscards OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The total number of Forwarding Database entries that
+        have been or would have been learned, but have been
+        discarded due to a lack of storage space in the
+        Forwarding Database.  If this counter is increasing, it
+        indicates that the Forwarding Database is regularly
+        becoming full (a condition that has unpleasant
+        performance effects on the subnetwork).  If this counter
+        has a significant value but is not presently increasing,
+        it indicates that the problem has been occurring but is
+        not persistent."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 14.7.1.1.3"
+    ::= { dot1dTp 1 }
+
+dot1dTpAgingTime OBJECT-TYPE
+    SYNTAX      Integer32 (10..1000000)
+    UNITS       "seconds"
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The timeout period in seconds for aging out
+        dynamically-learned forwarding information.
+        802.1D-1998 recommends a default of 300 seconds."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 14.7.1.1.3"
+    ::= { dot1dTp 2 }
+
+-- ---------------------------------------------------------- --
+--  The Forwarding Database for Transparent Bridges
+-- ---------------------------------------------------------- --
+
+dot1dTpFdbTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF Dot1dTpFdbEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A table that contains information about unicast
+        entries for which the bridge has forwarding and/or
+        filtering information.  This information is used
+        by the transparent bridging function in
+        determining how to propagate a received frame."
+    ::= { dot1dTp 3 }
+
+dot1dTpFdbEntry OBJECT-TYPE
+    SYNTAX      Dot1dTpFdbEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Information about a specific unicast MAC address
+        for which the bridge has some forwarding and/or
+        filtering information."
+    INDEX   { dot1dTpFdbAddress }
+    ::= { dot1dTpFdbTable 1 }
+
+Dot1dTpFdbEntry ::=
+    SEQUENCE {
+        dot1dTpFdbAddress
+            MacAddress,
+        dot1dTpFdbPort
+            Integer32,
+        dot1dTpFdbStatus
+            INTEGER
+    }
+
+dot1dTpFdbAddress OBJECT-TYPE
+    SYNTAX      MacAddress
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "A unicast MAC address for which the bridge has
+        forwarding and/or filtering information."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 7.9.1, 7.9.2"
+    ::= { dot1dTpFdbEntry 1 }
+
+dot1dTpFdbPort OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "Either the value '0', or the port number of the port on
+        which a frame having a source address equal to the value
+        of the corresponding instance of dot1dTpFdbAddress has
+        been seen.  A value of '0' indicates that the port
+        number has not been learned, but that the bridge does
+        have some forwarding/filtering information about this
+        address (e.g., in the dot1dStaticTable).  Implementors
+        are encouraged to assign the port value to this object
+        whenever it is learned, even for addresses for which the
+        corresponding value of dot1dTpFdbStatus is not
+        learned(3)."
+    ::= { dot1dTpFdbEntry 2 }
+
+dot1dTpFdbStatus OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    other(1),
+                    invalid(2),
+                    learned(3),
+                    self(4),
+                    mgmt(5)
+                }
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The status of this entry.  The meanings of the
+        values are:
+            other(1) - none of the following.  This would
+                include the case where some other MIB object
+                (not the corresponding instance of
+                dot1dTpFdbPort, nor an entry in the
+                dot1dStaticTable) is being used to determine if
+                and how frames addressed to the value of the
+                corresponding instance of dot1dTpFdbAddress are
+                being forwarded.
+            invalid(2) - this entry is no longer valid (e.g.,
+                it was learned but has since aged out), but has
+                not yet been flushed from the table.
+            learned(3) - the value of the corresponding instance
+                of dot1dTpFdbPort was learned, and is being
+                used.
+            self(4) - the value of the corresponding instance of
+                dot1dTpFdbAddress represents one of the bridge's
+                addresses.  The corresponding instance of
+                dot1dTpFdbPort indicates which of the bridge's
+                ports has this address.
+            mgmt(5) - the value of the corresponding instance of
+                dot1dTpFdbAddress is also the value of an
+                existing instance of dot1dStaticAddress."
+    ::= { dot1dTpFdbEntry 3 }
+
+-- ---------------------------------------------------------- --
+--  Port Table for Transparent Bridges
+-- ---------------------------------------------------------- --
+
+dot1dTpPortTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF Dot1dTpPortEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A table that contains information about every port that
+        is associated with this transparent bridge."
+    ::= { dot1dTp 4 }
+
+dot1dTpPortEntry OBJECT-TYPE
+    SYNTAX      Dot1dTpPortEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A list of information for each port of a transparent
+        bridge."
+    INDEX   { dot1dTpPort }
+    ::= { dot1dTpPortTable 1 }
+
+Dot1dTpPortEntry ::=
+    SEQUENCE {
+        dot1dTpPort
+            Integer32,
+        dot1dTpPortMaxInfo
+            Integer32,
+        dot1dTpPortInFrames
+            Counter32,
+        dot1dTpPortOutFrames
+            Counter32,
+        dot1dTpPortInDiscards
+            Counter32
+    }
+
+dot1dTpPort OBJECT-TYPE
+    SYNTAX      Integer32 (1..65535)
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The port number of the port for which this entry
+        contains Transparent bridging management information."
+    ::= { dot1dTpPortEntry 1 }
+
+-- It would be nice if we could use ifMtu as the size of the
+-- largest INFO field, but we can't because ifMtu is defined
+-- to be the size that the (inter-)network layer can use, which
+-- can differ from the MAC layer (especially if several layers
+-- of encapsulation are used).
+
+dot1dTpPortMaxInfo OBJECT-TYPE
+    SYNTAX      Integer32
+    UNITS       "bytes"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The maximum size of the INFO (non-MAC) field that
+
+        this port will receive or transmit."
+    ::= { dot1dTpPortEntry 2 }
+
+dot1dTpPortInFrames OBJECT-TYPE
+    SYNTAX      Counter32
+    UNITS       "frames"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The number of frames that have been received by this
+        port from its segment.  Note that a frame received on the
+        interface corresponding to this port is only counted by
+        this object if and only if it is for a protocol being
+        processed by the local bridging function, including
+        bridge management frames."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 14.6.1.1.3"
+    ::= { dot1dTpPortEntry 3 }
+
+dot1dTpPortOutFrames OBJECT-TYPE
+    SYNTAX      Counter32
+    UNITS       "frames"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The number of frames that have been transmitted by this
+        port to its segment.  Note that a frame transmitted on
+        the interface corresponding to this port is only counted
+        by this object if and only if it is for a protocol being
+        processed by the local bridging function, including
+        bridge management frames."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 14.6.1.1.3"
+    ::= { dot1dTpPortEntry 4 }
+
+dot1dTpPortInDiscards OBJECT-TYPE
+    SYNTAX      Counter32
+    UNITS       "frames"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "Count of received valid frames that were discarded
+        (i.e., filtered) by the Forwarding Process."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 14.6.1.1.3"
+    ::= { dot1dTpPortEntry 5 }
+
+-- ---------------------------------------------------------- --
+
+-- The Static (Destination-Address Filtering) Database
+-- ---------------------------------------------------------- --
+-- Implementation of this subtree is optional.
+-- ---------------------------------------------------------- --
+
+dot1dStaticTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF Dot1dStaticEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A table containing filtering information configured
+        into the bridge by (local or network) management
+        specifying the set of ports to which frames received
+        from specific ports and containing specific destination
+        addresses are allowed to be forwarded.  The value of
+        zero in this table, as the port number from which frames
+        with a specific destination address are received, is
+        used to specify all ports for which there is no specific
+        entry in this table for that particular destination
+        address.  Entries are valid for unicast and for
+        group/broadcast addresses."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 14.7.2"
+    ::= { dot1dStatic 1 }
+
+dot1dStaticEntry OBJECT-TYPE
+    SYNTAX      Dot1dStaticEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Filtering information configured into the bridge by
+        (local or network) management specifying the set of
+        ports to which frames received from a specific port and
+        containing a specific destination address are allowed to
+        be forwarded."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 14.7.2"
+    INDEX   { dot1dStaticAddress, dot1dStaticReceivePort }
+    ::= { dot1dStaticTable 1 }
+
+Dot1dStaticEntry ::=
+    SEQUENCE {
+        dot1dStaticAddress       MacAddress,
+        dot1dStaticReceivePort   Integer32,
+        dot1dStaticAllowedToGoTo OCTET STRING,
+        dot1dStaticStatus        INTEGER
+    }
+
+dot1dStaticAddress OBJECT-TYPE
+    SYNTAX      MacAddress
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The destination MAC address in a frame to which this
+        entry's filtering information applies.  This object can
+        take the value of a unicast address, a group address, or
+        the broadcast address."
+    REFERENCE
+        "IEEE 802.1D-1998: clause 7.9.1, 7.9.2"
+    ::= { dot1dStaticEntry 1 }
+
+dot1dStaticReceivePort OBJECT-TYPE
+    SYNTAX      Integer32 (0..65535)
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "Either the value '0', or the port number of the port
+        from which a frame must be received in order for this
+        entry's filtering information to apply.  A value of zero
+        indicates that this entry applies on all ports of the
+        bridge for which there is no other applicable entry."
+    ::= { dot1dStaticEntry 2 }
+
+dot1dStaticAllowedToGoTo OBJECT-TYPE
+    SYNTAX      OCTET STRING (SIZE (0..512))
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The set of ports to which frames received from a
+        specific port and destined for a specific MAC address,
+        are allowed to be forwarded.  Each octet within the
+        value of this object specifies a set of eight ports,
+        with the first octet specifying ports 1 through 8, the
+        second octet specifying ports 9 through 16, etc.  Within
+        each octet, the most significant bit represents the
+        lowest numbered port, and the least significant bit
+        represents the highest numbered port.  Thus, each port
+        of the bridge is represented by a single bit within the
+        value of this object.  If that bit has a value of '1',
+        then that port is included in the set of ports; the port
+        is not included if its bit has a value of '0'.  (Note
+        that the setting of the bit corresponding to the port
+        from which a frame is received is irrelevant.)  The
+        default value of this object is a string of ones of
+        appropriate length.
+
+        The value of this object may exceed the required minimum
+        maximum message size of some SNMP transport (484 bytes,
+        in the case of SNMP over UDP, see RFC 3417, section 3.2).
+        SNMP engines on bridges supporting a large number of
+        ports must support appropriate maximum message sizes."
+    ::= { dot1dStaticEntry 3 }
+
+dot1dStaticStatus OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    other(1),
+                    invalid(2),
+                    permanent(3),
+                    deleteOnReset(4),
+                    deleteOnTimeout(5)
+                }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object indicates the status of this entry.
+        The default value is permanent(3).
+            other(1) - this entry is currently in use but the
+                conditions under which it will remain so are
+                different from each of the following values.
+            invalid(2) - writing this value to the object
+                removes the corresponding entry.
+            permanent(3) - this entry is currently in use and
+                will remain so after the next reset of the
+                bridge.
+            deleteOnReset(4) - this entry is currently in use
+                and will remain so until the next reset of the
+                bridge.
+            deleteOnTimeout(5) - this entry is currently in use
+                and will remain so until it is aged out."
+    ::= { dot1dStaticEntry 4 }
+
+-- ---------------------------------------------------------- --
+-- Notifications for use by Bridges
+-- ---------------------------------------------------------- --
+-- Notifications for the Spanning Tree Protocol
+-- ---------------------------------------------------------- --
+
+newRoot NOTIFICATION-TYPE
+    -- OBJECTS     { }
+    STATUS      current
+    DESCRIPTION
+        "The newRoot trap indicates that the sending agent has
+        become the new root of the Spanning Tree; the trap is
+        sent by a bridge soon after its election as the new
+
+        root, e.g., upon expiration of the Topology Change Timer,
+        immediately subsequent to its election.  Implementation
+        of this trap is optional."
+    ::= { dot1dNotifications 1 }
+
+topologyChange NOTIFICATION-TYPE
+    -- OBJECTS     { }
+    STATUS      current
+    DESCRIPTION
+        "A topologyChange trap is sent by a bridge when any of
+        its configured ports transitions from the Learning state
+        to the Forwarding state, or from the Forwarding state to
+        the Blocking state.  The trap is not sent if a newRoot
+        trap is sent for the same transition.  Implementation of
+        this trap is optional."
+    ::= { dot1dNotifications 2 }
+
+-- ---------------------------------------------------------- --
+-- IEEE 802.1D MIB - Conformance Information
+-- ---------------------------------------------------------- --
+
+dot1dGroups         OBJECT IDENTIFIER ::= { dot1dConformance 1 }
+dot1dCompliances    OBJECT IDENTIFIER ::= { dot1dConformance 2 }
+
+-- ---------------------------------------------------------- --
+-- units of conformance
+-- ---------------------------------------------------------- --
+
+-- ---------------------------------------------------------- --
+-- the dot1dBase group
+-- ---------------------------------------------------------- --
+
+dot1dBaseBridgeGroup OBJECT-GROUP
+    OBJECTS {
+        dot1dBaseBridgeAddress,
+        dot1dBaseNumPorts,
+        dot1dBaseType
+    }
+    STATUS      current
+    DESCRIPTION
+        "Bridge level information for this device."
+    ::= { dot1dGroups 1 }
+
+dot1dBasePortGroup OBJECT-GROUP
+    OBJECTS {
+        dot1dBasePort,
+        dot1dBasePortIfIndex,
+        dot1dBasePortCircuit,
+        dot1dBasePortDelayExceededDiscards,
+        dot1dBasePortMtuExceededDiscards
+    }
+    STATUS      current
+    DESCRIPTION
+        "Information for each port on this device."
+    ::= { dot1dGroups 2 }
+
+-- ---------------------------------------------------------- --
+-- the dot1dStp group
+-- ---------------------------------------------------------- --
+
+dot1dStpBridgeGroup OBJECT-GROUP
+    OBJECTS {
+        dot1dStpProtocolSpecification,
+        dot1dStpPriority,
+        dot1dStpTimeSinceTopologyChange,
+        dot1dStpTopChanges,
+        dot1dStpDesignatedRoot,
+        dot1dStpRootCost,
+        dot1dStpRootPort,
+        dot1dStpMaxAge,
+        dot1dStpHelloTime,
+        dot1dStpHoldTime,
+        dot1dStpForwardDelay,
+        dot1dStpBridgeMaxAge,
+        dot1dStpBridgeHelloTime,
+        dot1dStpBridgeForwardDelay
+    }
+    STATUS      current
+    DESCRIPTION
+        "Bridge level Spanning Tree data for this device."
+    ::= { dot1dGroups 3 }
+
+dot1dStpPortGroup OBJECT-GROUP
+    OBJECTS {
+        dot1dStpPort,
+        dot1dStpPortPriority,
+        dot1dStpPortState,
+        dot1dStpPortEnable,
+        dot1dStpPortPathCost,
+        dot1dStpPortDesignatedRoot,
+        dot1dStpPortDesignatedCost,
+        dot1dStpPortDesignatedBridge,
+        dot1dStpPortDesignatedPort,
+        dot1dStpPortForwardTransitions
+    }
+    STATUS      current
+    DESCRIPTION
+        "Spanning Tree data for each port on this device."
+    ::= { dot1dGroups 4 }
+
+dot1dStpPortGroup2 OBJECT-GROUP
+    OBJECTS {
+        dot1dStpPort,
+        dot1dStpPortPriority,
+        dot1dStpPortState,
+        dot1dStpPortEnable,
+        dot1dStpPortDesignatedRoot,
+        dot1dStpPortDesignatedCost,
+        dot1dStpPortDesignatedBridge,
+        dot1dStpPortDesignatedPort,
+        dot1dStpPortForwardTransitions,
+        dot1dStpPortPathCost32
+    }
+    STATUS      current
+    DESCRIPTION
+        "Spanning Tree data for each port on this device."
+    ::= { dot1dGroups 5 }
+
+dot1dStpPortGroup3 OBJECT-GROUP
+    OBJECTS {
+        dot1dStpPortPathCost32
+    }
+    STATUS      current
+    DESCRIPTION
+        "Spanning Tree data for devices supporting 32-bit
+         path costs."
+    ::= { dot1dGroups 6 }
+
+-- ---------------------------------------------------------- --
+-- the dot1dTp group
+-- ---------------------------------------------------------- --
+
+dot1dTpBridgeGroup OBJECT-GROUP
+    OBJECTS {
+        dot1dTpLearnedEntryDiscards,
+        dot1dTpAgingTime
+    }
+    STATUS      current
+    DESCRIPTION
+        "Bridge level Transparent Bridging data."
+    ::= { dot1dGroups 7 }
+
+dot1dTpFdbGroup OBJECT-GROUP
+    OBJECTS {
+
+        dot1dTpFdbAddress,
+        dot1dTpFdbPort,
+        dot1dTpFdbStatus
+    }
+    STATUS      current
+    DESCRIPTION
+        "Filtering Database information for the Bridge."
+    ::= { dot1dGroups 8 }
+
+dot1dTpGroup OBJECT-GROUP
+    OBJECTS {
+        dot1dTpPort,
+        dot1dTpPortMaxInfo,
+        dot1dTpPortInFrames,
+        dot1dTpPortOutFrames,
+        dot1dTpPortInDiscards
+    }
+    STATUS      current
+    DESCRIPTION
+        "Dynamic Filtering Database information for each port of
+        the Bridge."
+    ::= { dot1dGroups 9 }
+
+-- ---------------------------------------------------------- --
+-- The Static (Destination-Address Filtering) Database
+-- ---------------------------------------------------------- --
+
+dot1dStaticGroup OBJECT-GROUP
+    OBJECTS {
+        dot1dStaticAddress,
+        dot1dStaticReceivePort,
+        dot1dStaticAllowedToGoTo,
+        dot1dStaticStatus
+    }
+    STATUS      current
+    DESCRIPTION
+        "Static Filtering Database information for each port of
+        the Bridge."
+    ::= { dot1dGroups 10 }
+
+-- ---------------------------------------------------------- --
+-- The Trap Notification Group
+-- ---------------------------------------------------------- --
+
+dot1dNotificationGroup NOTIFICATION-GROUP
+    NOTIFICATIONS {
+        newRoot,
+        topologyChange
+    }
+    STATUS      current
+    DESCRIPTION
+        "Group of objects describing notifications (traps)."
+    ::= { dot1dGroups 11 }
+
+-- ---------------------------------------------------------- --
+-- compliance statements
+-- ---------------------------------------------------------- --
+
+bridgeCompliance1493 MODULE-COMPLIANCE
+    STATUS      current
+    DESCRIPTION
+        "The compliance statement for device support of bridging
+        services, as per RFC1493."
+
+    MODULE
+        MANDATORY-GROUPS {
+            dot1dBaseBridgeGroup,
+            dot1dBasePortGroup
+        }
+
+    GROUP   dot1dStpBridgeGroup
+    DESCRIPTION
+        "Implementation of this group is mandatory for bridges
+        that support the Spanning Tree Protocol."
+
+    GROUP   dot1dStpPortGroup
+    DESCRIPTION
+        "Implementation of this group is mandatory for bridges
+        that support the Spanning Tree Protocol."
+
+    GROUP   dot1dTpBridgeGroup
+    DESCRIPTION
+        "Implementation of this group is mandatory for bridges
+        that support the transparent bridging mode.  A
+        transparent or SRT bridge will implement this group."
+
+    GROUP   dot1dTpFdbGroup
+    DESCRIPTION
+        "Implementation of this group is mandatory for bridges
+        that support the transparent bridging mode.  A
+        transparent or SRT bridge will implement this group."
+
+    GROUP   dot1dTpGroup
+    DESCRIPTION
+        "Implementation of this group is mandatory for bridges
+
+        that support the transparent bridging mode.  A
+        transparent or SRT bridge will implement this group."
+
+    GROUP   dot1dStaticGroup
+    DESCRIPTION
+        "Implementation of this group is optional."
+
+    GROUP dot1dNotificationGroup
+    DESCRIPTION
+        "Implementation of this group is optional."
+    ::= { dot1dCompliances 1 }
+
+bridgeCompliance4188 MODULE-COMPLIANCE
+    STATUS      current
+    DESCRIPTION
+        "The compliance statement for device support of bridging
+        services.  This supports 32-bit Path Cost values and the
+        more restricted bridge and port priorities, as per IEEE
+        802.1t.
+
+        Full support for the 802.1D management objects requires that
+        the SNMPv2-MIB [RFC3418] objects sysDescr, and sysUpTime, as
+        well as the IF-MIB [RFC2863] objects ifIndex, ifType,
+        ifDescr, ifPhysAddress, and ifLastChange are implemented."
+
+    MODULE
+        MANDATORY-GROUPS {
+            dot1dBaseBridgeGroup,
+            dot1dBasePortGroup
+        }
+
+    GROUP   dot1dStpBridgeGroup
+    DESCRIPTION
+        "Implementation of this group is mandatory for
+        bridges that support the Spanning Tree Protocol."
+
+    OBJECT dot1dStpPriority
+    SYNTAX Integer32 (0|4096|8192|12288|16384|20480|24576
+                     |28672|32768|36864|40960|45056|49152
+                     |53248|57344|61440)
+    DESCRIPTION
+        "The possible values defined by IEEE 802.1t."
+
+    GROUP   dot1dStpPortGroup2
+    DESCRIPTION
+        "Implementation of this group is mandatory for
+        bridges that support the Spanning Tree Protocol."
+
+    GROUP   dot1dStpPortGroup3
+    DESCRIPTION
+        "Implementation of this group is mandatory for bridges
+         that support the Spanning Tree Protocol and 32-bit path
+         costs.  In particular, this includes devices supporting
+         IEEE 802.1t and IEEE 802.1w."
+
+    OBJECT dot1dStpPortPriority
+    SYNTAX Integer32 (0|16|32|48|64|80|96|112|128
+                     |144|160|176|192|208|224|240)
+    DESCRIPTION
+        "The possible values defined by IEEE 802.1t."
+
+    GROUP   dot1dTpBridgeGroup
+    DESCRIPTION
+        "Implementation of this group is mandatory for
+        bridges that support the transparent bridging
+        mode.  A transparent or SRT bridge will implement
+        this group."
+
+    GROUP   dot1dTpFdbGroup
+    DESCRIPTION
+        "Implementation of this group is mandatory for
+        bridges that support the transparent bridging
+        mode.  A transparent or SRT bridge will implement
+        this group."
+
+    GROUP   dot1dTpGroup
+    DESCRIPTION
+        "Implementation of this group is mandatory for
+        bridges that support the transparent bridging
+        mode.  A transparent or SRT bridge will implement
+        this group."
+
+    GROUP   dot1dStaticGroup
+    DESCRIPTION
+        "Implementation of this group is optional."
+
+    GROUP dot1dNotificationGroup
+    DESCRIPTION
+        "Implementation of this group is optional."
+    ::= { dot1dCompliances 2 }
+
+END
Index: mibs/Makefile.in
===================================================================
--- mibs/Makefile.in.orig
+++ mibs/Makefile.in
@@ -40,7 +40,7 @@ RFCMIBS	= IF-MIB.txt IF-INVERTED-STACK-M
 	DISMAN-EVENT-MIB.txt DISMAN-SCRIPT-MIB.txt DISMAN-SCHEDULE-MIB.txt \
 	NOTIFICATION-LOG-MIB.txt SNMP-USM-AES-MIB.txt \
 	SNMP-USM-DH-OBJECTS-MIB.txt \
-	SCTP-MIB.txt
+	SCTP-MIB.txt BRIDGE-MIB.txt
 
 NETSNMPMIBS = NET-SNMP-TC.txt NET-SNMP-MIB.txt NET-SNMP-AGENT-MIB.txt \
 	NET-SNMP-EXAMPLES-MIB.txt NET-SNMP-EXTEND-MIB.txt
Index: mibs/Makefile.mib
===================================================================
--- mibs/Makefile.mib.orig
+++ mibs/Makefile.mib
@@ -26,7 +26,7 @@ MIBS =	SNMPv2-TC.txt SNMPv2-TM.txt SNMPv
 	NETWORK-SERVICES-MIB.txt MTA-MIB.txt \
 	RMON-MIB.txt \
 	RFC1155-SMI.txt RFC1213-MIB.txt \
-	SCTP-MIB.txt
+	SCTP-MIB.txt BRIDGE-MIB.txt
 
 MIBDEPS = Makefile.mib mibfetch smistrip
 
@@ -161,6 +161,9 @@ RFC1213-MIB.txt:	$(MIBDEPS)
 SCTP.txt:	$(MIBDEPS)
 	./mibfetch $(RFCHOST) $(RFCDIR) 3873
 
+BRIDGE-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 4188
+
 ianamibs:	ianalist
 	[ -d $(ALLDIR) ] || mkdir $(ALLDIR)
 	cat ianalist | while read file mibs; \
Index: man/snmp-bridge-mib.1
===================================================================
--- /dev/null
+++ man/snmp-bridge-mib.1
@@ -0,0 +1,208 @@
+'\" t
+.\"     Title: snmp-bridge-mib
+.\"    Author: Jens Osterkamp <jens@linux.vnet.ibm.com>
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 03/26/2010
+.\"    Manual: Net-SNMP
+.\"    Source: http://www.ibm.com/ v6
+.\"  Language: English
+.\"
+.TH "SNMP\-BRIDGE\-MIB" 1 "26 Mar 2010" "http://www\&.ibm\&.com/ v6" "Net\-SNMP"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+snmp-bridge-mib \- provide Linux bridge information via SNMP
+.SH "SYNOPSIS"
+.HP \w'\fBsnmp\-bridge\-mib\fR\ 'u
+\fBsnmp\-bridge\-mib\fR {bridge}
+.SH "ARGUMENTS"
+.PP
+The following arguments are required:
+.PP
+\fBbridge\fR
+.RS 4
+The name of the Linux bridge for which you want to provide information via SNMP, e\&.g\&. br0\&.
+.RE
+.SH "DESCRIPTION"
+.PP
+The snmp\-bridge\-mib is an extension to net\-snmp\&. It collects information about a bridge in a Linux system and exports them for query from other (remote) systems for management purposes\&.
+.SH "CONFIGURATION:"
+.PP
+The preferred method of snmp\-bridge\-mib to attach to net\-snmp is agentx\&. For this to work, you will have to add the following line to /etc/snmp/snmpd\&.conf,
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    master agentx
+    
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+restart snmpd and start snmp\-bridge\-mib\&. snmp\-bridge\-mib will then connect to the running snmpd daemon\&.
+.PP
+Another way of attaching snmp\-bridge\-mib to is to run it as an embedded perl module\&. You have to add
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    perl do "path to location of snmp\-bridge\-mib"
+    
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+and restart snmpd\&.
+.SH "EXAMPLE:"
+.PP
+Follow the instructions in this manpage and type
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    perl /usr/bin/snmp\-bridge\-mib br0
+    
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+You\'ll get the following output:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+     registering at \&.1\&.3\&.6\&.1\&.2\&.1\&.17
+     running as a subagent\&.
+     dot1qbridge agent started\&.
+     NET\-SNMP version 5\&.4\&.2\&.1 AgentX subagent connected
+     
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+Now it\'s time for a first test:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    $ export MIBS=+BRIDGE\-MIB
+    $ snmpwalk localhost \&.1\&.3\&.6\&.1\&.2\&.1\&.17
+    
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+The output produced should look like
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    BRIDGE\-MIB::dot1dStpBridgeHelloTime = INTEGER: 199 centi\-seconds
+    BRIDGE\-MIB::dot1dStpBridgeForwardDelay = INTEGER: 1499 centi\-seconds
+    BRIDGE\-MIB::dot1dStpPort\&.1 = INTEGER: 1
+    BRIDGE\-MIB::dot1dStpPort\&.3 = INTEGER: 3
+    BRIDGE\-MIB::dot1dStpPortPriority\&.1 = INTEGER: 32
+    BRIDGE\-MIB::dot1dStpPortPriority\&.3 = INTEGER: 32
+    BRIDGE\-MIB::dot1dStpPortState\&.1 = INTEGER: disabled(1)
+    BRIDGE\-MIB::dot1dStpPortState\&.3 = INTEGER: disabled(1)
+    BRIDGE\-MIB::dot1dStpPortEnable\&.1 = INTEGER: disabled(2)
+    BRIDGE\-MIB::dot1dStpPortEnable\&.3 = INTEGER: disabled(2)
+    BRIDGE\-MIB::dot1dStpPortPathCost\&.1 = INTEGER: 2
+    BRIDGE\-MIB::dot1dStpPortPathCost\&.3 = INTEGER: 4
+    BRIDGE\-MIB::dot1dStpPortDesignatedRoot\&.1 = STRING: "8000\&.001018382c78"
+    BRIDGE\-MIB::dot1dStpPortDesignatedRoot\&.3 = STRING: "8000\&.001018382c78"
+    BRIDGE\-MIB::dot1dStpPortDesignatedCost\&.1 = INTEGER: 0
+    BRIDGE\-MIB::dot1dStpPortDesignatedCost\&.3 = INTEGER: 0
+    BRIDGE\-MIB::dot1dStpPortDesignatedBridge\&.1 = STRING: "8000\&.001018382c78"
+    BRIDGE\-MIB::dot1dStpPortDesignatedBridge\&.3 = STRING: "8000\&.001018382c78"
+    BRIDGE\-MIB::dot1dStpPortDesignatedPort\&.1 = STRING: "32769"
+    BRIDGE\-MIB::dot1dStpPortDesignatedPort\&.3 = STRING: "32770"
+    BRIDGE\-MIB::dot1dStpPortPathCost32\&.1 = INTEGER: 2
+    BRIDGE\-MIB::dot1dStpPortPathCost32\&.3 = INTEGER: 4
+    BRIDGE\-MIB::dot1dTpLearnedEntryDiscards = Counter32: 0
+    BRIDGE\-MIB::dot1dTpAgingTime = INTEGER: 300 seconds
+    BRIDGE\-MIB::dot1dTpFdbAddress\&.\'\&.\&.\&.8,x\' = STRING: 0:10:18:38:2c:78
+    BRIDGE\-MIB::dot1dTpFdbAddress\&.\'\&.!^/B|\' = STRING: 0:21:5e:2f:42:7c
+    BRIDGE\-MIB::dot1dTpFdbPort\&.\'\&.\&.\&.8,x\' = INTEGER: 1
+    BRIDGE\-MIB::dot1dTpFdbPort\&.\'\&.!^/B|\' = INTEGER: 3
+    BRIDGE\-MIB::dot1dTpFdbStatus\&.\'\&.\&.\&.8,x\' = INTEGER: learned(3)
+    BRIDGE\-MIB::dot1dTpFdbStatus\&.\'\&.!^/B|\' = INTEGER: learned(3)
+    BRIDGE\-MIB::dot1dTpPort\&.1 = INTEGER: 1
+    BRIDGE\-MIB::dot1dTpPort\&.3 = INTEGER: 3
+    BRIDGE\-MIB::dot1dTpPortMaxInfo\&.1 = INTEGER: 1500 bytes
+    BRIDGE\-MIB::dot1dTpPortMaxInfo\&.3 = INTEGER: 1500 bytes
+    BRIDGE\-MIB::dot1dTpPortInFrames\&.1 = Counter32: 18082 frames
+    BRIDGE\-MIB::dot1dTpPortInFrames\&.3 = Counter32: 1546072 frames
+    BRIDGE\-MIB::dot1dTpPortOutFrames\&.1 = Counter32: 11601 frames
+    BRIDGE\-MIB::dot1dTpPortOutFrames\&.3 = Counter32: 10988 frames
+    BRIDGE\-MIB::dot1dTpPortInDiscards\&.1 = Counter32: 0 frames
+    BRIDGE\-MIB::dot1dTpPortInDiscards\&.3 = Counter32: 0 frames
+    
+.fi
+.if n \{\
+.RE
+.\}
+.SH "BUGS"
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 1.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP "  1." 4.2
+.\}
+snmp\-bridge\-mib currently only supports one bridge which has to be specified on the commandline\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 2.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP "  2." 4.2
+.\}
+Not all elements of RFC 4188 because they are either not available in sysfs or difficult to extract from the existing data\&.
+.RE
+.PP
+.SH "SEE ALSO"
+.PP
+\fBsnmpd.conf\fR(5),
+\fBNet::SNMP\fR(3)
+.SH "AUTHOR"
+.PP
+\fBJens Osterkamp\fR <\&jens@linux\&.vnet\&.ibm\&.com\&>
+.RS 4
+Developer
+.RE
+.SH "COPYRIGHT"
+.br
+Copyright \(co 2009, 2010 IBM Corp., All Rights Reserved
+.br
+.PP
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+.PP
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software\&.
+.PP
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\&. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE\&.
+.sp
Index: man/Makefile.in
===================================================================
--- man/Makefile.in.orig
+++ man/Makefile.in
@@ -14,7 +14,7 @@ OTHERUNINSTALL=manuninstall
 # local stuff
 #
 
-MAN1  = snmpinform.1
+MAN1  = snmpinform.1 snmp-bridge-mib.1
 MAN1G = snmpbulkget.1 snmpcmd.1 snmpget.1 snmpset.1 snmpwalk.1 \
 	snmpbulkwalk.1 snmpgetnext.1 snmptest.1 snmptranslate.1 snmptrap.1 \
 	snmpusm.1 snmpvacm.1 snmptable.1 snmpstatus.1 snmpconf.1 mib2c.1 \
