Bring in a SNMP module to support monitoring if_bridge(4) interfaces
via bsnmpd(1). The module implements IETF BRIDGE-MIB as defined in RFC4188 and a private BEGEMOT-BRIDGE-MIB. Sponsored by: Google Summer of Code 2006 Reviewed by: bz Approved by: bz (mentor)
This commit is contained in:
parent
a6852e6ab6
commit
2b14cadbaf
965
usr.sbin/bsnmpd/modules/snmp_bridge/BEGEMOT-BRIDGE-MIB.txt
Normal file
965
usr.sbin/bsnmpd/modules/snmp_bridge/BEGEMOT-BRIDGE-MIB.txt
Normal file
@ -0,0 +1,965 @@
|
||||
--
|
||||
-- Copyright (C) 2006 Shteryana Shopova <syrinx@FreeBSD.org>
|
||||
-- All rights reserved.
|
||||
--
|
||||
-- Redistribution and use in source and binary forms, with or without
|
||||
-- modification, are permitted provided that the following conditions
|
||||
-- are met:
|
||||
-- 1. Redistributions of source code must retain the above copyright
|
||||
-- notice, this list of conditions and the following disclaimer.
|
||||
-- 2. Redistributions in binary form must reproduce the above copyright
|
||||
-- notice, this list of conditions and the following disclaimer in the
|
||||
-- documentation and/or other materials provided with the distribution.
|
||||
--
|
||||
-- THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
-- ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
-- SUCH DAMAGE.
|
||||
--
|
||||
-- $FreeBSD$
|
||||
--
|
||||
|
||||
BEGEMOT-BRIDGE-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE,
|
||||
Counter32, Integer32, TimeTicks, mib-2
|
||||
FROM SNMPv2-SMI
|
||||
TEXTUAL-CONVENTION, MacAddress, TruthValue, RowStatus
|
||||
FROM SNMPv2-TC
|
||||
BridgeId, Timeout
|
||||
FROM BRIDGE-MIB
|
||||
InterfaceIndex FROM IF-MIB
|
||||
begemot
|
||||
FROM BEGEMOT-MIB;
|
||||
|
||||
begemotBridge MODULE-IDENTITY
|
||||
LAST-UPDATED "200608100000Z"
|
||||
ORGANIZATION "Sofia University St. Kliment Ohridski"
|
||||
CONTACT-INFO
|
||||
" Shteryana Shopova
|
||||
|
||||
Postal: Faculty of Mathematics and Informatics
|
||||
5 James Bourchier Blvd.
|
||||
1164 Sofia
|
||||
Bulgaria
|
||||
|
||||
Fax: +359 2 687 180
|
||||
|
||||
E-Mail: syrinx@FreeBSD.org"
|
||||
DESCRIPTION
|
||||
"The Begemot MIB for managing bridge interfaces."
|
||||
|
||||
::= { begemot 205 }
|
||||
|
||||
-- ---------------------------------------------------------- --
|
||||
BridgeIfName ::= TEXTUAL-CONVENTION
|
||||
DISPLAY-HINT "16a"
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Name of a bridge interface."
|
||||
SYNTAX OCTET STRING (SIZE(1..16))
|
||||
|
||||
BridgeIfNameOrEmpty ::= TEXTUAL-CONVENTION
|
||||
DISPLAY-HINT "16a"
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Name of a bridge interface."
|
||||
SYNTAX OCTET STRING (SIZE(0..16))
|
||||
|
||||
BridgePortId ::= TEXTUAL-CONVENTION
|
||||
DISPLAY-HINT "1x.1x"
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A port identifier that contains a bridge port's STP priority
|
||||
in the first octet and the port number in the second octet."
|
||||
SYNTAX OCTET STRING (SIZE(2))
|
||||
|
||||
-- ---------------------------------------------------------- --
|
||||
-- subtrees in the Begemot Bridge MIB
|
||||
-- ---------------------------------------------------------- --
|
||||
begemotBridgeNotifications OBJECT IDENTIFIER ::= { begemotBridge 0 }
|
||||
|
||||
begemotBridgeBase OBJECT IDENTIFIER ::= { begemotBridge 1 }
|
||||
|
||||
begemotBridgeStp OBJECT IDENTIFIER ::= { begemotBridge 2 }
|
||||
|
||||
begemotBridgeTp OBJECT IDENTIFIER ::= { begemotBridge 3 }
|
||||
|
||||
begemotBridgePf OBJECT IDENTIFIER ::= { begemotBridge 4 }
|
||||
|
||||
begemotBridgeConfigObjects OBJECT IDENTIFIER ::= { begemotBridge 5 }
|
||||
|
||||
-- ---------------------------------------------------------- --
|
||||
-- the base Bridge interface table
|
||||
-- ---------------------------------------------------------- --
|
||||
|
||||
begemotBridgeBaseTable OBJECT-TYPE
|
||||
SYNTAX SEQUENCE OF BegemotBridgeBaseEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A table that contains generic information for each
|
||||
bridge interface on the managed device."
|
||||
::= { begemotBridgeBase 1 }
|
||||
|
||||
begemotBridgeBaseEntry OBJECT-TYPE
|
||||
SYNTAX BegemotBridgeBaseEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A list of information for the bridge interfaces on
|
||||
the managed device."
|
||||
INDEX { begemotBridgeBaseName }
|
||||
::= { begemotBridgeBaseTable 1 }
|
||||
|
||||
BegemotBridgeBaseEntry ::= SEQUENCE {
|
||||
begemotBridgeBaseName BridgeIfName,
|
||||
begemotBridgeBaseAddress MacAddress,
|
||||
begemotBridgeBaseNumPorts Integer32,
|
||||
begemotBridgeBaseType INTEGER,
|
||||
begemotBridgeBaseStatus RowStatus
|
||||
}
|
||||
|
||||
begemotBridgeBaseName OBJECT-TYPE
|
||||
SYNTAX BridgeIfName
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The name of the bridge interface for which this
|
||||
entry contains management information."
|
||||
::= { begemotBridgeBaseEntry 1 }
|
||||
|
||||
begemotBridgeBaseAddress OBJECT-TYPE
|
||||
SYNTAX MacAddress
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The MAC address of the bridge interface."
|
||||
::= { begemotBridgeBaseEntry 2 }
|
||||
|
||||
begemotBridgeBaseNumPorts OBJECT-TYPE
|
||||
SYNTAX Integer32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The number of ports, members of this bridge."
|
||||
::= { begemotBridgeBaseEntry 3 }
|
||||
|
||||
begemotBridgeBaseType 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."
|
||||
::= { begemotBridgeBaseEntry 4 }
|
||||
|
||||
begemotBridgeBaseStatus OBJECT-TYPE
|
||||
SYNTAX RowStatus
|
||||
MAX-ACCESS read-create
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Used to create/destroy bridge interfaces on the
|
||||
managed device."
|
||||
::= { begemotBridgeBaseEntry 5 }
|
||||
|
||||
-- ---------------------------------------------------------- --
|
||||
-- the base Bridge ports table
|
||||
-- ---------------------------------------------------------- --
|
||||
|
||||
begemotBridgeBasePortTable OBJECT-TYPE
|
||||
SYNTAX SEQUENCE OF BegemotBridgeBasePortEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A table containing generic information about ports,
|
||||
members of each bridge interface."
|
||||
::= { begemotBridgeBase 2 }
|
||||
|
||||
begemotBridgeBasePortEntry OBJECT-TYPE
|
||||
SYNTAX BegemotBridgeBasePortEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A list of information about a specific port, member of
|
||||
a bridge interface."
|
||||
INDEX { begemotBridgeBaseName, begemotBridgeBasePortIfIndex }
|
||||
::= { begemotBridgeBasePortTable 1 }
|
||||
|
||||
BegemotBridgeBasePortEntry ::= SEQUENCE {
|
||||
begemotBridgeBasePort Integer32,
|
||||
begemotBridgeBasePortIfIndex InterfaceIndex,
|
||||
begemotBridgeBaseSpanEnabled INTEGER,
|
||||
begemotBridgeBasePortDelayExceededDiscards Counter32,
|
||||
begemotBridgeBasePortMtuExceededDiscards Counter32,
|
||||
begemotBridgeBasePortStatus RowStatus
|
||||
}
|
||||
|
||||
begemotBridgeBasePort OBJECT-TYPE
|
||||
SYNTAX Integer32 (1..65535)
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The system interface index of the interface corresponding
|
||||
to this port."
|
||||
::= { begemotBridgeBasePortEntry 1 }
|
||||
|
||||
begemotBridgeBasePortIfIndex 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."
|
||||
::= { begemotBridgeBasePortEntry 2 }
|
||||
|
||||
begemotBridgeBaseSpanEnabled OBJECT-TYPE
|
||||
SYNTAX INTEGER {
|
||||
enabled(1),
|
||||
disabled(2)
|
||||
}
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The value of this objects reflects whether the port
|
||||
is a span port on the specified bridge interface."
|
||||
::= { begemotBridgeBasePortEntry 3 }
|
||||
|
||||
begemotBridgeBasePortDelayExceededDiscards 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."
|
||||
::= { begemotBridgeBasePortEntry 4 }
|
||||
|
||||
begemotBridgeBasePortMtuExceededDiscards OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The number of frames discarded by this port due
|
||||
to an excessive size."
|
||||
::= { begemotBridgeBasePortEntry 5 }
|
||||
|
||||
begemotBridgeBasePortStatus OBJECT-TYPE
|
||||
SYNTAX RowStatus
|
||||
MAX-ACCESS read-create
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Used to control addition of member ports to or
|
||||
removal of member ports from a specified bridge."
|
||||
::= { begemotBridgeBasePortEntry 6 }
|
||||
|
||||
-- ---------------------------------------------------------- --
|
||||
-- the Bridge interface STP table
|
||||
-- ---------------------------------------------------------- --
|
||||
|
||||
begemotBridgeStpTable OBJECT-TYPE
|
||||
SYNTAX SEQUENCE OF BegemotBridgeStpEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A table that contains Spanning Tree Protocol information
|
||||
for each bridge interface on the managed device."
|
||||
::= { begemotBridgeStp 1 }
|
||||
|
||||
begemotBridgeStpEntry OBJECT-TYPE
|
||||
SYNTAX BegemotBridgeStpEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A list of information about the Spanning Tree Protocol
|
||||
operation on a bridge interface."
|
||||
AUGMENTS { begemotBridgeBaseEntry }
|
||||
::= { begemotBridgeStpTable 1 }
|
||||
|
||||
BegemotBridgeStpEntry ::= SEQUENCE {
|
||||
begemotBridgeStpProtocolSpecification INTEGER,
|
||||
begemotBridgeStpPriority Integer32,
|
||||
begemotBridgeStpTimeSinceTopologyChange TimeTicks,
|
||||
begemotBridgeStpTopChanges Counter32,
|
||||
begemotBridgeStpDesignatedRoot BridgeId,
|
||||
begemotBridgeStpRootCost Integer32,
|
||||
begemotBridgeStpRootPort Integer32,
|
||||
begemotBridgeStpMaxAge Timeout,
|
||||
begemotBridgeStpHelloTime Timeout,
|
||||
begemotBridgeStpHoldTime Integer32,
|
||||
begemotBridgeStpForwardDelay Timeout,
|
||||
begemotBridgeStpBridgeMaxAge Timeout,
|
||||
begemotBridgeStpBridgeHelloTime Timeout,
|
||||
begemotBridgeStpBridgeForwardDelay Timeout
|
||||
}
|
||||
|
||||
begemotBridgeStpProtocolSpecification OBJECT-TYPE
|
||||
SYNTAX INTEGER {
|
||||
unknown(1),
|
||||
decLb100(2),
|
||||
ieee8021d(3)
|
||||
}
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The Spanning Tree Protocol version being run on the
|
||||
bridge interface. The value 'decLb100(2)' indicates the
|
||||
DEC LANbridge 100 Spanning Tree protocol, 'ieee8021d(3)'
|
||||
indicates the bridge is running IEEE 802.1D STP
|
||||
implementation."
|
||||
::= { begemotBridgeStpEntry 1 }
|
||||
|
||||
begemotBridgeStpPriority OBJECT-TYPE
|
||||
SYNTAX Integer32 (0..65535)
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The priority value of the bridge interface forming the
|
||||
first two octets of the bridge identifier. Acceptable
|
||||
values are 0-61440, in steps of 4096."
|
||||
::= { begemotBridgeStpEntry 2 }
|
||||
|
||||
begemotBridgeStpTimeSinceTopologyChange OBJECT-TYPE
|
||||
SYNTAX TimeTicks
|
||||
UNITS "centi-seconds"
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The time (in hundreds of a second) since a topology change
|
||||
was last detected by this bridge."
|
||||
::= { begemotBridgeStpEntry 3 }
|
||||
|
||||
begemotBridgeStpTopChanges OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The number of times a topology change was detected by the
|
||||
bridge interface since the management entity was initialized
|
||||
or reset."
|
||||
::= { begemotBridgeStpEntry 4 }
|
||||
|
||||
begemotBridgeStpDesignatedRoot OBJECT-TYPE
|
||||
SYNTAX BridgeId
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The bridge identifier of the root of the spanning tree as
|
||||
calculated by the Spanning Tree Protocol."
|
||||
::= { begemotBridgeStpEntry 5 }
|
||||
|
||||
begemotBridgeStpRootCost OBJECT-TYPE
|
||||
SYNTAX Integer32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The cost of the path from this bridge to the root bridge."
|
||||
::= { begemotBridgeStpEntry 6 }
|
||||
|
||||
begemotBridgeStpRootPort 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 of
|
||||
the spanning tree. If this bridge is the root bridge,
|
||||
this object shall have a value of zero."
|
||||
::= { begemotBridgeStpEntry 7 }
|
||||
|
||||
begemotBridgeStpMaxAge OBJECT-TYPE
|
||||
SYNTAX Timeout
|
||||
UNITS "centi-seconds"
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The maximum age of Spanning Tree Protocol information
|
||||
received from the network on any port, before that
|
||||
information is discarded. This is the actual value that
|
||||
the bridge is currently using."
|
||||
::= { begemotBridgeStpEntry 8 }
|
||||
|
||||
begemotBridgeStpHelloTime OBJECT-TYPE
|
||||
SYNTAX Timeout
|
||||
UNITS "centi-seconds"
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The amount of time between transmission of
|
||||
Configuration BPDUs by this bridge on any port,
|
||||
when it is the root of the spanning tree or is
|
||||
trying to become so. This is the actual value that
|
||||
this bridge is currently using."
|
||||
::= { begemotBridgeStpEntry 9 }
|
||||
|
||||
begemotBridgeStpHoldTime 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 BPDUs
|
||||
shall be transmitted by this node, in units of
|
||||
hundredths of a second."
|
||||
::= { begemotBridgeStpEntry 10 }
|
||||
|
||||
begemotBridgeStpForwardDelay OBJECT-TYPE
|
||||
SYNTAX Timeout
|
||||
UNITS "centi-seconds"
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"This value, measured in units of hundredths of a second
|
||||
determines how long a port will stay consecutively in the
|
||||
Listening and Learning states before transitioning to
|
||||
Forwarding state.
|
||||
This is the actual value currently used by the bridge
|
||||
as opposed to begemotBridgeStpBridgeForwardDelay, which
|
||||
is the value this and all bridges participating in the
|
||||
spanning tree were to use, if this was the root bridge."
|
||||
::= { begemotBridgeStpEntry 11 }
|
||||
|
||||
begemotBridgeStpBridgeMaxAge OBJECT-TYPE
|
||||
SYNTAX Timeout (600..4000)
|
||||
UNITS "centi-seconds"
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The value that all bridges participating in the
|
||||
spanning tree would use for MaxAge if this bridge
|
||||
was the root of the spanning tree."
|
||||
::= { begemotBridgeStpEntry 12 }
|
||||
|
||||
begemotBridgeStpBridgeHelloTime OBJECT-TYPE
|
||||
SYNTAX Timeout (100..1000)
|
||||
UNITS "centi-seconds"
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The value that all bridges participating in the
|
||||
spanning tree would use for HelloTime if this
|
||||
bridge was the root of the spanning tree."
|
||||
::= { begemotBridgeStpEntry 13 }
|
||||
|
||||
begemotBridgeStpBridgeForwardDelay OBJECT-TYPE
|
||||
SYNTAX Timeout (400..3000)
|
||||
UNITS "centi-seconds"
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The value that all bridges participating in the
|
||||
spanning tree would use for ForwardDelay if this
|
||||
bridge was the root of the spanning tree."
|
||||
::= { begemotBridgeStpEntry 14 }
|
||||
|
||||
-- ---------------------------------------------------------- --
|
||||
-- the Bridge STP ports table
|
||||
-- ---------------------------------------------------------- --
|
||||
|
||||
begemotBridgeStpPortTable OBJECT-TYPE
|
||||
SYNTAX SEQUENCE OF BegemotBridgeStpPortEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A table containing Spanning Tree Protocol information
|
||||
about the members of each bridge interface."
|
||||
::= { begemotBridgeStp 2 }
|
||||
|
||||
begemotBridgeStpPortEntry OBJECT-TYPE
|
||||
SYNTAX BegemotBridgeStpPortEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A list of Spanning Tree Protocol information about
|
||||
a specific member of a bridge interface."
|
||||
INDEX { begemotBridgeBaseName, begemotBridgeBasePortIfIndex }
|
||||
::= { begemotBridgeStpPortTable 1 }
|
||||
|
||||
BegemotBridgeStpPortEntry ::= SEQUENCE {
|
||||
begemotBridgeStpPort Integer32,
|
||||
begemotBridgeStpPortPriority Integer32,
|
||||
begemotBridgeStpPortState INTEGER,
|
||||
begemotBridgeStpPortEnable INTEGER,
|
||||
begemotBridgeStpPortPathCost Integer32,
|
||||
begemotBridgeStpPortDesignatedRoot BridgeId,
|
||||
begemotBridgeStpPortDesignatedCost Integer32,
|
||||
begemotBridgeStpPortDesignatedBridge BridgeId,
|
||||
begemotBridgeStpPortDesignatedPort BridgePortId,
|
||||
begemotBridgeStpPortForwardTransitions Counter32
|
||||
}
|
||||
|
||||
begemotBridgeStpPort OBJECT-TYPE
|
||||
SYNTAX Integer32 (1..65535)
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The system interface index of the interface corresponding
|
||||
to this port, for which the management entity has Spanning
|
||||
Tree Protocol information."
|
||||
::= { begemotBridgeStpPortEntry 1 }
|
||||
|
||||
begemotBridgeStpPortPriority OBJECT-TYPE
|
||||
SYNTAX Integer32 (0..255)
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The STP priority of this port that is contained in the first
|
||||
octet of its Port Identifier. The second octet contains the
|
||||
value of begemotBridgeStpPort."
|
||||
::= { begemotBridgeStpPortEntry 2 }
|
||||
|
||||
begemotBridgeStpPortState OBJECT-TYPE
|
||||
SYNTAX INTEGER {
|
||||
disabled(1),
|
||||
blocking(2),
|
||||
listening(3),
|
||||
learning(4),
|
||||
forwarding(5),
|
||||
broken(6)
|
||||
}
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The current state of the port as defined by the operation
|
||||
of the Spanning Tree Protocol. If the Spanning Tree Protocol
|
||||
is administratively disabled on the port, this object shall
|
||||
have value disabled(1). A value of broken(6) does not correspond
|
||||
to any legal state of a port, and if present should indicate
|
||||
error in the operation of either the Spanning Tree Protocol
|
||||
implementation running on the device or the management entity."
|
||||
::= { begemotBridgeStpPortEntry 3 }
|
||||
|
||||
begemotBridgeStpPortEnable OBJECT-TYPE
|
||||
SYNTAX INTEGER {
|
||||
enabled(1),
|
||||
disabled(2)
|
||||
}
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The administrative Spanning Tree Protocol state of the
|
||||
port - value of enabled(1) indicates that the port is
|
||||
participating in the Spanning Tree Protocol operation."
|
||||
::= { begemotBridgeStpPortEntry 4 }
|
||||
|
||||
begemotBridgeStpPortPathCost OBJECT-TYPE
|
||||
SYNTAX Integer32 (1..65535)
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The contribution of the path through this port, when the port
|
||||
is the Root Port, to the total cost of the path to the root
|
||||
bridge for this bridge."
|
||||
::= { begemotBridgeStpPortEntry 5 }
|
||||
|
||||
begemotBridgeStpPortDesignatedRoot OBJECT-TYPE
|
||||
SYNTAX BridgeId
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The unique Bridge Identifier of the bridge recorded as the
|
||||
root in the Root Identifier parameter of Configuration BPDUs
|
||||
transmitted by the Designated Bridge for the LAN to which
|
||||
the port is attached."
|
||||
::= { begemotBridgeStpPortEntry 6 }
|
||||
|
||||
begemotBridgeStpPortDesignatedCost OBJECT-TYPE
|
||||
SYNTAX Integer32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"For a Designated port, the path cost (equal to the Root
|
||||
Path Cost of the bridge) offered to the LAN to which the
|
||||
port is attached otherwise the cost of the path to the Root
|
||||
offered by the Designated Port on the LAN to which this
|
||||
Port is attached."
|
||||
::= { begemotBridgeStpPortEntry 7 }
|
||||
|
||||
begemotBridgeStpPortDesignatedBridge OBJECT-TYPE
|
||||
SYNTAX BridgeId
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The unique Bridge Identifier of the bridge to which the
|
||||
port belongs, in the case when the port is a designated
|
||||
port, otherwise the bridge believed to be the Designated
|
||||
Bridge for the LAN to which this port is attached."
|
||||
::= { begemotBridgeStpPortEntry 8 }
|
||||
|
||||
begemotBridgeStpPortDesignatedPort OBJECT-TYPE
|
||||
SYNTAX BridgePortId
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The Port Identifier of the Bridge port, on the Designated
|
||||
Bridge, through which the Designated Bridge transmits the
|
||||
Configuration Message information stored by this port."
|
||||
::= { begemotBridgeStpPortEntry 9 }
|
||||
|
||||
begemotBridgeStpPortForwardTransitions 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."
|
||||
::= { begemotBridgeStpPortEntry 10 }
|
||||
|
||||
-- ---------------------------------------------------------- --
|
||||
-- the Bridge interface Transparent bridging table
|
||||
-- ---------------------------------------------------------- --
|
||||
|
||||
begemotBridgeTpTable OBJECT-TYPE
|
||||
SYNTAX SEQUENCE OF BegemotBridgeTpEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A table that contains information regarding transparent
|
||||
bridging for each bridge interface on the managed device."
|
||||
::= { begemotBridgeTp 1 }
|
||||
|
||||
begemotBridgeTpEntry OBJECT-TYPE
|
||||
SYNTAX BegemotBridgeTpEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A list of information regarding transparent bridging
|
||||
on a bridge interface."
|
||||
AUGMENTS { begemotBridgeBaseEntry }
|
||||
::= { begemotBridgeTpTable 1 }
|
||||
|
||||
BegemotBridgeTpEntry ::= SEQUENCE {
|
||||
begemotBridgeTpLearnedEntryDiscards Counter32,
|
||||
begemotBridgeTpAgingTime Integer32,
|
||||
begemotBridgeTpMaxAddresses Integer32
|
||||
}
|
||||
|
||||
begemotBridgeTpLearnedEntryDiscards OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The total number of Forwarding Database entries that would
|
||||
have been learnt, but have been discarded due to Forwarding
|
||||
Address Table having reached it's maximum entries limit."
|
||||
::= { begemotBridgeTpEntry 1 }
|
||||
|
||||
begemotBridgeTpAgingTime OBJECT-TYPE
|
||||
SYNTAX Integer32 (10..1000000)
|
||||
UNITS "seconds"
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The timeout period in seconds before aging out
|
||||
dynamically learnt forwarding entries."
|
||||
::= { begemotBridgeTpEntry 2 }
|
||||
|
||||
begemotBridgeTpMaxAddresses OBJECT-TYPE
|
||||
SYNTAX Integer32 (1..10000)
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The maximum number of entires that this bridge can
|
||||
learn in it's Forwarding Address Table and use for
|
||||
making forwarding decisions."
|
||||
::= { begemotBridgeTpEntry 3 }
|
||||
|
||||
-- ---------------------------------------------------------- --
|
||||
-- The Forwarding Database for Transparent Bridging interfaces
|
||||
-- ---------------------------------------------------------- --
|
||||
|
||||
begemotBridgeTpFdbTable OBJECT-TYPE
|
||||
SYNTAX SEQUENCE OF BegemotBridgeTpFdbEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A table that contains information about unicast entries
|
||||
for which the bridge interfaces have forwarding and/or
|
||||
filtering information. This information is used by the
|
||||
bridge interfaces to make forwarding decisions."
|
||||
::= { begemotBridgeTp 2 }
|
||||
|
||||
begemotBridgeTpFdbEntry OBJECT-TYPE
|
||||
SYNTAX BegemotBridgeTpFdbEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Information about a specific unicast MAC address
|
||||
for which the bridge interface has some forwarding
|
||||
and/or filtering information."
|
||||
INDEX { begemotBridgeBaseName, begemotBridgeTpFdbAddress }
|
||||
::= { begemotBridgeTpFdbTable 1 }
|
||||
|
||||
BegemotBridgeTpFdbEntry ::= SEQUENCE {
|
||||
begemotBridgeTpFdbAddress MacAddress,
|
||||
begemotBridgeTpFdbPort Integer32,
|
||||
begemotBridgeTpFdbStatus INTEGER
|
||||
}
|
||||
|
||||
begemotBridgeTpFdbAddress OBJECT-TYPE
|
||||
SYNTAX MacAddress
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A unicast MAC address for which the bridge has which the
|
||||
bridge interface has some forwarding and/or filtering
|
||||
information."
|
||||
::= { begemotBridgeTpFdbEntry 1 }
|
||||
|
||||
begemotBridgeTpFdbPort OBJECT-TYPE
|
||||
SYNTAX Integer32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The port number of the bridge port on which a frame having
|
||||
a source address equal to the value of the corresponding
|
||||
instance of begemotBridgeTpFdbAddress has been seen."
|
||||
::= { begemotBridgeTpFdbEntry 2 }
|
||||
|
||||
begemotBridgeTpFdbStatus 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.
|
||||
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 begemotBridgeTpFdbPort was learned, and is being
|
||||
used.
|
||||
self(4) - the value of the corresponding instance of
|
||||
begemotBridgeTpFdbAddress represents one of the
|
||||
bridge's addresses. The corresponding instance of
|
||||
begemotBridgeTpFdbPort indicates which of the bridge's
|
||||
ports has this address.
|
||||
mgmt(5) - the value of the corresponding instance of
|
||||
begemotBridgeTpFdbAddress has been added to the
|
||||
bridge's Forwarding Database by some management
|
||||
means."
|
||||
::= { begemotBridgeTpFdbEntry 3 }
|
||||
|
||||
-- ---------------------------------------------------------- --
|
||||
-- Ports table for Transparent Bridging interfaces
|
||||
-- ---------------------------------------------------------- --
|
||||
|
||||
begemotBridgeTpPortTable OBJECT-TYPE
|
||||
SYNTAX SEQUENCE OF BegemotBridgeTpPortEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A table that contains information about every bridge port,
|
||||
member of a bridge interface, associated with the transparent
|
||||
bridging function of the bridge."
|
||||
::= { begemotBridgeTp 3 }
|
||||
|
||||
begemotBridgeTpPortEntry OBJECT-TYPE
|
||||
SYNTAX BegemotBridgeTpPortEntry
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A list of information about every bridge port, member of a
|
||||
bridge interface, associated with the bridge's transparent
|
||||
bridging function."
|
||||
INDEX { begemotBridgeBaseName, begemotBridgeBasePortIfIndex }
|
||||
::= { begemotBridgeTpPortTable 1 }
|
||||
|
||||
BegemotBridgeTpPortEntry ::= SEQUENCE {
|
||||
begemotBridgeTpPort Integer32,
|
||||
begemotBridgeTpPortMaxInfo Integer32,
|
||||
begemotBridgeTpPortInFrames Counter32,
|
||||
begemotBridgeTpPortOutFrames Counter32,
|
||||
begemotBridgeTpPortInDiscards Counter32
|
||||
}
|
||||
|
||||
begemotBridgeTpPort OBJECT-TYPE
|
||||
SYNTAX Integer32 (1..65535)
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The system interface index of the port for which this entry
|
||||
contains Transparent bridging management information."
|
||||
::= { begemotBridgeTpPortEntry 1 }
|
||||
|
||||
begemotBridgeTpPortMaxInfo 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."
|
||||
::= { begemotBridgeTpPortEntry 2 }
|
||||
|
||||
begemotBridgeTpPortInFrames 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."
|
||||
::= { begemotBridgeTpPortEntry 3 }
|
||||
|
||||
begemotBridgeTpPortOutFrames 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."
|
||||
::= { begemotBridgeTpPortEntry 4 }
|
||||
|
||||
begemotBridgeTpPortInDiscards 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."
|
||||
::= { begemotBridgeTpPortEntry 5 }
|
||||
|
||||
-- ---------------------------------------------------------- --
|
||||
-- the begemotBridgePf objects
|
||||
-- ---------------------------------------------------------- --
|
||||
|
||||
begemotBridgePfilStatus OBJECT-TYPE
|
||||
SYNTAX TruthValue
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Indicates whether packet filtering by some firewall
|
||||
package is enabled on the bridge interface."
|
||||
::= { begemotBridgePf 1 }
|
||||
|
||||
begemotBridgePfilMembers OBJECT-TYPE
|
||||
SYNTAX TruthValue
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A value of true(1) indicates that packet filtering is
|
||||
enabled on both incoming and outgoing bridge member
|
||||
interfaces."
|
||||
::= { begemotBridgePf 2 }
|
||||
|
||||
begemotBridgePfilIpOnly OBJECT-TYPE
|
||||
SYNTAX TruthValue
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"This value controls the handling of non-IP packets which
|
||||
are not passed on for further processing to a firewall
|
||||
package. A value of false(0) indicates that all non-IP
|
||||
Ethernet frames are passed unconditionally."
|
||||
::= { begemotBridgePf 3 }
|
||||
|
||||
begemotBridgeLayer2PfStatus OBJECT-TYPE
|
||||
SYNTAX INTEGER {
|
||||
enabled(1),
|
||||
disabled(2)
|
||||
}
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"This value indicates whether layer2 filtering by a
|
||||
firewall package is enabled for bridge interfaces."
|
||||
::= { begemotBridgePf 4 }
|
||||
|
||||
-- ---------------------------------------------------------- --
|
||||
-- the begemotBridgeConfigObjects objects
|
||||
-- ---------------------------------------------------------- --
|
||||
|
||||
begemotBridgeDefaultBridgeIf OBJECT-TYPE
|
||||
|
||||
SYNTAX BridgeIfNameOrEmpty
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The name of the bridge interface that will be managed
|
||||
via objects in IETF BRIDGE-MIB (RFC4188). If the
|
||||
object's value is set to an empty string, bridge interfaces
|
||||
will only be managed via objects in this MIB module."
|
||||
DEFVAL { "bridge0" }
|
||||
::= { begemotBridgeConfigObjects 1 }
|
||||
|
||||
begemotBridgeDataUpdate OBJECT-TYPE
|
||||
|
||||
SYNTAX Timeout (1..300)
|
||||
UNITS "seconds"
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The maximum age in seconds of the cached data."
|
||||
DEFVAL { 10 }
|
||||
::= { begemotBridgeConfigObjects 2 }
|
||||
|
||||
begemotBridgeDataPoll OBJECT-TYPE
|
||||
|
||||
SYNTAX Timeout (1..3600)
|
||||
UNITS "seconds"
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The polling rate of data when the module is idle."
|
||||
DEFVAL { 300 }
|
||||
::= { begemotBridgeConfigObjects 3 }
|
||||
|
||||
-- ---------------------------------------------------------- --
|
||||
-- Notifications for the Spanning Tree Protocol
|
||||
-- ---------------------------------------------------------- --
|
||||
|
||||
begemotBridgeNewRoot NOTIFICATION-TYPE
|
||||
OBJECTS { begemotBridgeBaseName }
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The begemotBridgeNewRoot trap indicates that one of the
|
||||
bridge interfaces on the sending agent's device has
|
||||
become the new root of the spanning tree topology it is
|
||||
participating in."
|
||||
::= { begemotBridgeNotifications 1 }
|
||||
|
||||
begemotBridgeTopologyChange NOTIFICATION-TYPE
|
||||
OBJECTS { begemotBridgeBaseName }
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"A begemotBridgeTopologyChange trap is send when a member
|
||||
port on one of the bridge interfaces, monitored by the agent,
|
||||
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 begemotBridgeNewRoot trap is sent for the
|
||||
same transition."
|
||||
::= { begemotBridgeNotifications 2 }
|
||||
|
||||
END
|
1483
usr.sbin/bsnmpd/modules/snmp_bridge/BRIDGE-MIB.txt
Normal file
1483
usr.sbin/bsnmpd/modules/snmp_bridge/BRIDGE-MIB.txt
Normal file
File diff suppressed because it is too large
Load Diff
19
usr.sbin/bsnmpd/modules/snmp_bridge/Makefile
Normal file
19
usr.sbin/bsnmpd/modules/snmp_bridge/Makefile
Normal file
@ -0,0 +1,19 @@
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
MOD= bridge
|
||||
SRCS= bridge_snmp.c bridge_if.c bridge_port.c bridge_addrs.c \
|
||||
bridge_pf.c bridge_sys.c
|
||||
CFLAGS+= -DSNMPTREE_TYPES
|
||||
|
||||
XSYM= dot1dBridge newRoot topologyChange begemotBridgeNewRoot \
|
||||
begemotBridgeTopologyChange begemotBridgeBaseName
|
||||
|
||||
MAN= snmp_bridge.3
|
||||
|
||||
BMIBS= BRIDGE-MIB.txt BEGEMOT-BRIDGE-MIB.txt
|
||||
DEFS= ${MOD}_tree.def
|
||||
INCS= ${MOD}_snmp.h
|
||||
|
||||
.include <bsd.snmpmod.mk>
|
592
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_addrs.c
Normal file
592
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_addrs.c
Normal file
@ -0,0 +1,592 @@
|
||||
/*-
|
||||
* Copyright (c) 2006 Shteryana Shopova <syrinx@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* Bridge MIB implementation for SNMPd.
|
||||
* Bridge addresses.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/queue.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_mib.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <bsnmp/snmpmod.h>
|
||||
#include <bsnmp/snmp_mibII.h>
|
||||
|
||||
#include "bridge_tree.h"
|
||||
#include "bridge_snmp.h"
|
||||
|
||||
TAILQ_HEAD(tp_entries, tp_entry);
|
||||
|
||||
/*
|
||||
* Free the bridge address list.
|
||||
*/
|
||||
static void
|
||||
bridge_tpe_free(struct tp_entries *headp)
|
||||
{
|
||||
struct tp_entry *t;
|
||||
|
||||
while ((t = TAILQ_FIRST(headp)) != NULL) {
|
||||
TAILQ_REMOVE(headp, t, tp_e);
|
||||
free(t);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the bridge address entries from the address list,
|
||||
* for the specified bridge interface only.
|
||||
*/
|
||||
static void
|
||||
bridge_tpe_bif_free(struct tp_entries *headp,
|
||||
struct bridge_if *bif)
|
||||
{
|
||||
struct tp_entry *tp;
|
||||
|
||||
while (bif->f_tpa != NULL && bif->sysindex == bif->f_tpa->sysindex) {
|
||||
tp = TAILQ_NEXT(bif->f_tpa, tp_e);
|
||||
TAILQ_REMOVE(headp, bif->f_tpa, tp_e);
|
||||
free(bif->f_tpa);
|
||||
bif->f_tpa = tp;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare two mac addresses.
|
||||
* m1 < m2 : -1
|
||||
* m1 > m2 : +1
|
||||
* m1 = m2 : 0
|
||||
*/
|
||||
static int
|
||||
bridge_compare_macs(const uint8_t *m1, const uint8_t *m2)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ETHER_ADDR_LEN; i++) {
|
||||
if (m1[i] < m2[i])
|
||||
return (-1);
|
||||
if (m1[i] > m2[i])
|
||||
return (1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert an address entry in the bridge address TAILQ starting to search
|
||||
* for its place from the position of the first bridge address for the bridge
|
||||
* interface. Update the first bridge address if neccessary.
|
||||
*/
|
||||
static void
|
||||
bridge_addrs_insert_at(struct tp_entries *headp,
|
||||
struct tp_entry *ta, struct tp_entry **f_tpa)
|
||||
{
|
||||
struct tp_entry *t1;
|
||||
|
||||
assert(f_tpa != NULL);
|
||||
|
||||
for (t1 = *f_tpa;
|
||||
t1 != NULL && ta->sysindex == t1->sysindex;
|
||||
t1 = TAILQ_NEXT(t1, tp_e)) {
|
||||
if (bridge_compare_macs(ta->tp_addr, t1->tp_addr) < 0) {
|
||||
TAILQ_INSERT_BEFORE(t1, ta, tp_e);
|
||||
if (*f_tpa == t1)
|
||||
(*f_tpa) = ta;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (t1 == NULL)
|
||||
TAILQ_INSERT_TAIL(headp, ta, tp_e);
|
||||
else
|
||||
TAILQ_INSERT_BEFORE(t1, ta, tp_e);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find an address entry's possition in the address list
|
||||
* according to bridge interface name.
|
||||
*/
|
||||
static struct tp_entry *
|
||||
bridge_addrs_find_pos(struct tp_entries *headp, uint32_t b_idx)
|
||||
{
|
||||
uint32_t t_idx;
|
||||
struct tp_entry *t1;
|
||||
|
||||
if ((t1 = TAILQ_FIRST(headp)) == NULL ||
|
||||
bridge_compare_sysidx(b_idx, t1->sysindex) < 0)
|
||||
return (NULL);
|
||||
|
||||
t_idx = t1->sysindex;
|
||||
|
||||
for (t1 = TAILQ_NEXT(t1, tp_e); t1 != NULL; t1 = TAILQ_NEXT(t1, tp_e)) {
|
||||
|
||||
if (t1->sysindex != t_idx) {
|
||||
if (bridge_compare_sysidx(b_idx, t1->sysindex) < 0)
|
||||
return (TAILQ_PREV(t1, tp_entries, tp_e));
|
||||
else
|
||||
t_idx = t1->sysindex;
|
||||
}
|
||||
}
|
||||
|
||||
if (t1 == NULL)
|
||||
t1 = TAILQ_LAST(headp, tp_entries);
|
||||
|
||||
return (t1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert a bridge address in the bridge addresses list.
|
||||
*/
|
||||
static void
|
||||
bridge_addrs_bif_insert(struct tp_entries *headp, struct tp_entry *te,
|
||||
struct tp_entry **f_tpa)
|
||||
{
|
||||
struct tp_entry *temp;
|
||||
|
||||
if (*f_tpa != NULL)
|
||||
bridge_addrs_insert_at(headp, te, f_tpa);
|
||||
else {
|
||||
temp = bridge_addrs_find_pos(headp, te->sysindex);
|
||||
|
||||
if (temp == NULL)
|
||||
TAILQ_INSERT_HEAD(headp, te, tp_e);
|
||||
else
|
||||
TAILQ_INSERT_AFTER(headp, temp, te, tp_e);
|
||||
*f_tpa = te;
|
||||
}
|
||||
}
|
||||
|
||||
static struct tp_entries tp_entries = TAILQ_HEAD_INITIALIZER(tp_entries);
|
||||
static time_t address_list_age;
|
||||
|
||||
void
|
||||
bridge_addrs_update_listage(void)
|
||||
{
|
||||
address_list_age = time(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
bridge_addrs_fini(void)
|
||||
{
|
||||
bridge_tpe_free(&tp_entries);
|
||||
}
|
||||
|
||||
void
|
||||
bridge_addrs_free(struct bridge_if *bif)
|
||||
{
|
||||
bridge_tpe_bif_free(&tp_entries, bif);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the first address in the list.
|
||||
*/
|
||||
static struct tp_entry *
|
||||
bridge_addrs_first(void)
|
||||
{
|
||||
return (TAILQ_FIRST(&tp_entries));
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the next address in the list.
|
||||
*/
|
||||
static struct tp_entry *
|
||||
bridge_addrs_next(struct tp_entry *te)
|
||||
{
|
||||
return (TAILQ_NEXT(te, tp_e));
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the first address, learnt by the specified bridge interface.
|
||||
*/
|
||||
struct tp_entry *
|
||||
bridge_addrs_bif_first(struct bridge_if *bif)
|
||||
{
|
||||
return (bif->f_tpa);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the next address, learnt by the specified bridge interface.
|
||||
*/
|
||||
struct tp_entry *
|
||||
bridge_addrs_bif_next(struct tp_entry *te)
|
||||
{
|
||||
struct tp_entry *te_next;
|
||||
|
||||
if ((te_next = TAILQ_NEXT(te, tp_e)) == NULL ||
|
||||
te_next->sysindex != te->sysindex)
|
||||
return (NULL);
|
||||
|
||||
return (te_next);
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove a bridge address from the list.
|
||||
*/
|
||||
void
|
||||
bridge_addrs_remove(struct tp_entry *te, struct bridge_if *bif)
|
||||
{
|
||||
if (bif->f_tpa == te)
|
||||
bif->f_tpa = bridge_addrs_bif_next(te);
|
||||
|
||||
TAILQ_REMOVE(&tp_entries, te, tp_e);
|
||||
free(te);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate memory for a new bridge address and insert it in the list.
|
||||
*/
|
||||
struct tp_entry *
|
||||
bridge_new_addrs(uint8_t *mac, struct bridge_if *bif)
|
||||
{
|
||||
struct tp_entry *te;
|
||||
|
||||
if ((te = (struct tp_entry *) malloc(sizeof(*te))) == NULL) {
|
||||
syslog(LOG_ERR, "bridge new address: failed: %s",
|
||||
strerror(errno));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
bzero(te, sizeof(*te));
|
||||
|
||||
te->sysindex = bif->sysindex;
|
||||
bcopy(mac, te->tp_addr, ETHER_ADDR_LEN);
|
||||
bridge_addrs_bif_insert(&tp_entries, te, &(bif->f_tpa));
|
||||
|
||||
return (te);
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a mac address, learnt on a bridge,
|
||||
* find the corrsponding TP entry for it.
|
||||
*/
|
||||
struct tp_entry *
|
||||
bridge_addrs_find(uint8_t *mac, struct bridge_if *bif)
|
||||
{
|
||||
struct tp_entry *te;
|
||||
|
||||
for (te = bif->f_tpa; te != NULL; te = TAILQ_NEXT(te, tp_e)) {
|
||||
if (te->sysindex != bif->sysindex) {
|
||||
te = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (bridge_compare_macs(te->tp_addr, mac) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return (te);
|
||||
}
|
||||
|
||||
void
|
||||
bridge_addrs_dump(struct bridge_if *bif)
|
||||
{
|
||||
struct tp_entry *te;
|
||||
|
||||
syslog(LOG_ERR, "Addresses count - %d", bif->num_addrs);
|
||||
for (te = bridge_addrs_bif_first(bif); te != NULL;
|
||||
te = bridge_addrs_bif_next(te)) {
|
||||
syslog(LOG_ERR, "address %x:%x:%x:%x:%x:%x on port %d.%d",
|
||||
te->tp_addr[0], te->tp_addr[1], te->tp_addr[2],
|
||||
te->tp_addr[3], te->tp_addr[4], te->tp_addr[5],
|
||||
te->sysindex, te->port_no);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* RFC4188 specifics.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Construct the SNMP index from the address DST Mac.
|
||||
*/
|
||||
static void
|
||||
bridge_addrs_index_append(struct asn_oid *oid, uint sub,
|
||||
const struct tp_entry *te)
|
||||
{
|
||||
int i;
|
||||
|
||||
oid->len = sub + ETHER_ADDR_LEN + 1;
|
||||
oid->subs[sub] = ETHER_ADDR_LEN;
|
||||
|
||||
for (i = 1; i <= ETHER_ADDR_LEN; i++)
|
||||
oid->subs[sub + i] = te->tp_addr[i - 1];
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the address entry for the SNMP index from the default bridge only.
|
||||
*/
|
||||
static struct tp_entry *
|
||||
bridge_addrs_get(const struct asn_oid *oid, uint sub,
|
||||
struct bridge_if *bif)
|
||||
{
|
||||
int i;
|
||||
uint8_t tp_addr[ETHER_ADDR_LEN];
|
||||
|
||||
if (oid->len - sub != ETHER_ADDR_LEN + 1 ||
|
||||
oid->subs[sub] != ETHER_ADDR_LEN)
|
||||
return (NULL);
|
||||
|
||||
for (i = 0; i < ETHER_ADDR_LEN; i++)
|
||||
tp_addr[i] = oid->subs[sub + i + 1];
|
||||
|
||||
return (bridge_addrs_find(tp_addr, bif));
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the next address entry for the SNMP index
|
||||
* from the default bridge only.
|
||||
*/
|
||||
static struct tp_entry *
|
||||
bridge_addrs_getnext(const struct asn_oid *oid, uint sub,
|
||||
struct bridge_if *bif)
|
||||
{
|
||||
int i;
|
||||
uint8_t tp_addr[ETHER_ADDR_LEN];
|
||||
static struct tp_entry *te;
|
||||
|
||||
if (oid->len - sub == 0)
|
||||
return (bridge_addrs_bif_first(bif));
|
||||
|
||||
if (oid->len - sub != ETHER_ADDR_LEN + 1 ||
|
||||
oid->subs[sub] != ETHER_ADDR_LEN)
|
||||
return (NULL);
|
||||
|
||||
for (i = 0; i < ETHER_ADDR_LEN; i++)
|
||||
tp_addr[i] = oid->subs[sub + i + 1];
|
||||
|
||||
if ((te = bridge_addrs_find(tp_addr, bif)) == NULL)
|
||||
return (NULL);
|
||||
|
||||
return (bridge_addrs_bif_next(te));
|
||||
}
|
||||
|
||||
int
|
||||
op_dot1d_tp_fdb(struct snmp_context *c __unused, struct snmp_value *val,
|
||||
uint sub, uint iidx __unused, enum snmp_op op)
|
||||
{
|
||||
int ret;
|
||||
struct bridge_if *bif;
|
||||
struct tp_entry *te;
|
||||
|
||||
if ((bif = bridge_get_default()) == NULL)
|
||||
return (SNMP_ERR_NOSUCHNAME);
|
||||
|
||||
if (time(NULL) - bif->addrs_age > bridge_get_data_maxage() &&
|
||||
bridge_update_addrs(bif) <= 0)
|
||||
return (SNMP_ERR_NOSUCHNAME);
|
||||
|
||||
te = NULL; /* Make the compiler happy. */
|
||||
switch (op) {
|
||||
case SNMP_OP_GET:
|
||||
if ((te = bridge_addrs_get(&val->var, sub, bif)) == NULL)
|
||||
return (SNMP_ERR_NOSUCHNAME);
|
||||
break;
|
||||
|
||||
case SNMP_OP_GETNEXT:
|
||||
if ((te = bridge_addrs_getnext(&val->var, sub, bif)) == NULL)
|
||||
return (SNMP_ERR_NOSUCHNAME);
|
||||
bridge_addrs_index_append(&val->var, sub, te);
|
||||
break;
|
||||
|
||||
case SNMP_OP_SET:
|
||||
return (SNMP_ERR_NOT_WRITEABLE);
|
||||
|
||||
case SNMP_OP_ROLLBACK:
|
||||
case SNMP_OP_COMMIT:
|
||||
abort();
|
||||
}
|
||||
|
||||
ret = SNMP_ERR_NOERROR;
|
||||
switch (val->var.subs[sub - 1]) {
|
||||
case LEAF_dot1dTpFdbAddress:
|
||||
ret = string_get(val, te->tp_addr, ETHER_ADDR_LEN);
|
||||
break;
|
||||
case LEAF_dot1dTpFdbPort :
|
||||
val->v.integer = te->port_no;
|
||||
break;
|
||||
case LEAF_dot1dTpFdbStatus:
|
||||
val->v.integer = te->status;
|
||||
break;
|
||||
}
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* Private BEGEMOT-BRIDGE-MIB specifics.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Construct the SNMP index from the bridge interface name
|
||||
* and the address DST Mac.
|
||||
*/
|
||||
static int
|
||||
bridge_addrs_begemot_index_append(struct asn_oid *oid, uint sub,
|
||||
const struct tp_entry *te)
|
||||
{
|
||||
uint i, n_len;
|
||||
const char *b_name;
|
||||
|
||||
if ((b_name = bridge_if_find_name(te->sysindex)) == NULL)
|
||||
return (-1);
|
||||
|
||||
n_len = strlen(b_name);
|
||||
oid->len = sub++;
|
||||
oid->subs[oid->len++] = n_len;
|
||||
|
||||
for (i = 1; i <= n_len; i++)
|
||||
oid->subs[oid->len++] = b_name[i - 1];
|
||||
|
||||
oid->subs[oid->len++] = ETHER_ADDR_LEN;
|
||||
for (i = 1 ; i <= ETHER_ADDR_LEN; i++)
|
||||
oid->subs[oid->len++] = te->tp_addr[i - 1];
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find a bridge address entry by the bridge interface name
|
||||
* and the address DST Mac.
|
||||
*/
|
||||
static struct tp_entry *
|
||||
bridge_addrs_begemot_get(const struct asn_oid *oid, uint sub)
|
||||
{
|
||||
uint i, n_len;
|
||||
uint8_t tp_addr[ETHER_ADDR_LEN];
|
||||
char bif_name[IFNAMSIZ];
|
||||
struct bridge_if *bif;
|
||||
|
||||
n_len = oid->subs[sub];
|
||||
if (oid->len - sub != n_len + ETHER_ADDR_LEN + 3 ||
|
||||
n_len >= IFNAMSIZ || oid->subs[sub + n_len + 1] != ETHER_ADDR_LEN)
|
||||
return (NULL);
|
||||
|
||||
for (i = 0; i < n_len; i++)
|
||||
bif_name[i] = oid->subs[n_len + i + 1];
|
||||
bif_name[i] = '\0';
|
||||
|
||||
for (i = 1; i <= ETHER_ADDR_LEN; i++)
|
||||
tp_addr[i - 1] = oid->subs[n_len + i + 1];
|
||||
|
||||
if ((bif = bridge_if_find_ifname(bif_name)) == NULL)
|
||||
return (NULL);
|
||||
|
||||
return (bridge_addrs_find(tp_addr, bif));
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the next bridge address entry by the bridge interface name
|
||||
* and the address DST Mac.
|
||||
*/
|
||||
static struct tp_entry *
|
||||
bridge_addrs_begemot_getnext(const struct asn_oid *oid, uint sub)
|
||||
{
|
||||
uint i, n_len;
|
||||
uint8_t tp_addr[ETHER_ADDR_LEN];
|
||||
char bif_name[IFNAMSIZ];
|
||||
struct bridge_if *bif;
|
||||
struct tp_entry *tp;
|
||||
|
||||
if (oid->len - sub == 0)
|
||||
return (bridge_addrs_first());
|
||||
|
||||
n_len = oid->subs[sub];
|
||||
if (oid->len - sub != n_len + ETHER_ADDR_LEN + 2 ||
|
||||
n_len >= IFNAMSIZ || oid->subs[sub + n_len + 1] != ETHER_ADDR_LEN)
|
||||
return (NULL);
|
||||
|
||||
for (i = 1; i <= n_len; i++)
|
||||
bif_name[i - 1] = oid->subs[sub + i];
|
||||
|
||||
bif_name[i - 1] = '\0';
|
||||
|
||||
for (i = 1; i <= ETHER_ADDR_LEN; i++)
|
||||
tp_addr[i - 1] = oid->subs[sub + n_len + i + 1];
|
||||
|
||||
if ((bif = bridge_if_find_ifname(bif_name)) == NULL ||
|
||||
(tp = bridge_addrs_find(tp_addr, bif)) == NULL)
|
||||
return (NULL);
|
||||
|
||||
return (bridge_addrs_next(tp));
|
||||
}
|
||||
|
||||
int
|
||||
op_begemot_tp_fdb(struct snmp_context *c __unused, struct snmp_value *val,
|
||||
uint sub, uint iidx __unused, enum snmp_op op)
|
||||
{
|
||||
int ret;
|
||||
struct tp_entry *te = NULL;
|
||||
|
||||
if (time(NULL) - address_list_age > bridge_get_data_maxage())
|
||||
bridge_update_all_addrs();
|
||||
|
||||
switch (op) {
|
||||
case SNMP_OP_GET:
|
||||
if ((te = bridge_addrs_begemot_get(&val->var, sub)) == NULL)
|
||||
return (SNMP_ERR_NOSUCHNAME);
|
||||
break;
|
||||
|
||||
case SNMP_OP_GETNEXT:
|
||||
if ((te = bridge_addrs_begemot_getnext(&val->var,
|
||||
sub)) == NULL ||
|
||||
bridge_addrs_begemot_index_append(&val->var,
|
||||
sub, te) < 0)
|
||||
return (SNMP_ERR_NOSUCHNAME);
|
||||
break;
|
||||
|
||||
case SNMP_OP_SET:
|
||||
return (SNMP_ERR_NOT_WRITEABLE);
|
||||
|
||||
case SNMP_OP_ROLLBACK:
|
||||
case SNMP_OP_COMMIT:
|
||||
return (SNMP_ERR_NOERROR);
|
||||
}
|
||||
|
||||
ret = SNMP_ERR_NOERROR;
|
||||
switch (val->var.subs[sub - 1]) {
|
||||
case LEAF_begemotBridgeTpFdbAddress:
|
||||
ret = string_get(val, te->tp_addr, ETHER_ADDR_LEN);
|
||||
break;
|
||||
case LEAF_begemotBridgeTpFdbPort:
|
||||
val->v.integer = te->port_no;
|
||||
break;
|
||||
case LEAF_begemotBridgeTpFdbStatus:
|
||||
val->v.integer = te->status;
|
||||
break;
|
||||
}
|
||||
|
||||
return (ret);
|
||||
}
|
1369
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c
Normal file
1369
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c
Normal file
File diff suppressed because it is too large
Load Diff
117
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_pf.c
Normal file
117
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_pf.c
Normal file
@ -0,0 +1,117 @@
|
||||
/*-
|
||||
* Copyright (c) 2006 Shteryana Shopova <syrinx@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* Bridge MIB implementation for SNMPd.
|
||||
* Bridge pfil controls.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_mib.h>
|
||||
#include <net/if_types.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <bsnmp/snmpmod.h>
|
||||
#include <bsnmp/snmp_mibII.h>
|
||||
|
||||
#include "bridge_tree.h"
|
||||
#include "bridge_snmp.h"
|
||||
|
||||
static int
|
||||
val2snmp_truth(uint8_t val)
|
||||
{
|
||||
if (val == 0)
|
||||
return (2);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static int
|
||||
snmp_truth2val(int32_t truth)
|
||||
{
|
||||
if (truth == 2)
|
||||
return (0);
|
||||
else if (truth == 1)
|
||||
return (1);
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
int
|
||||
op_begemot_bridge_pf(struct snmp_context *ctx, struct snmp_value *val,
|
||||
uint sub, uint iidx __unused, enum snmp_op op)
|
||||
{
|
||||
int k_val;
|
||||
|
||||
if (val->var.subs[sub - 1] > LEAF_begemotBridgeLayer2PfStatus)
|
||||
return (SNMP_ERR_NOSUCHNAME);
|
||||
|
||||
switch (op) {
|
||||
case SNMP_OP_GETNEXT:
|
||||
abort();
|
||||
case SNMP_OP_ROLLBACK:
|
||||
bridge_do_pfctl(val->var.subs[sub - 1] - 1,
|
||||
op, &(ctx->scratch->int1));
|
||||
return (SNMP_ERR_NOERROR);
|
||||
|
||||
case SNMP_OP_COMMIT:
|
||||
return (SNMP_ERR_NOERROR);
|
||||
|
||||
case SNMP_OP_SET:
|
||||
ctx->scratch->int1 =
|
||||
bridge_get_pfval(val->var.subs[sub - 1]);
|
||||
|
||||
if ((k_val = snmp_truth2val(val->v.integer)) < 0)
|
||||
return (SNMP_ERR_BADVALUE);
|
||||
|
||||
case SNMP_OP_GET:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (val->var.subs[sub - 1]) {
|
||||
case LEAF_begemotBridgePfilStatus:
|
||||
case LEAF_begemotBridgePfilMembers:
|
||||
case LEAF_begemotBridgePfilIpOnly:
|
||||
case LEAF_begemotBridgeLayer2PfStatus:
|
||||
if (bridge_do_pfctl(val->var.subs[sub - 1] - 1,
|
||||
op, &k_val) < 0)
|
||||
return (SNMP_ERR_GENERR);
|
||||
val->v.integer = val2snmp_truth(k_val);
|
||||
break;
|
||||
abort();
|
||||
}
|
||||
|
||||
return (SNMP_ERR_NOERROR);
|
||||
}
|
1152
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c
Normal file
1152
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c
Normal file
File diff suppressed because it is too large
Load Diff
327
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_snmp.c
Normal file
327
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_snmp.c
Normal file
@ -0,0 +1,327 @@
|
||||
/*-
|
||||
* Copyright (c) 2006 Shteryana Shopova <syrinx@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* Bridge MIB implementation for SNMPd.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_mib.h>
|
||||
#include <net/if_types.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <bsnmp/snmpmod.h>
|
||||
#include <bsnmp/snmp_mibII.h>
|
||||
|
||||
#include "bridge_tree.h"
|
||||
#include "bridge_snmp.h"
|
||||
#include "bridge_oid.h"
|
||||
|
||||
static struct lmodule *bridge_module;
|
||||
|
||||
/* For the registration. */
|
||||
static const struct asn_oid oid_dot1Bridge = OIDX_dot1dBridge;
|
||||
/* The registration. */
|
||||
static uint reg_bridge;
|
||||
|
||||
/* Periodic timer for polling all bridges' data. */
|
||||
static void *bridge_data_timer;
|
||||
static void *bridge_tc_timer;
|
||||
|
||||
static int bridge_data_maxage = SNMP_BRIDGE_DATA_MAXAGE;
|
||||
static int bridge_poll_ticks = SNMP_BRIDGE_POLL_INTERVAL * 100;
|
||||
static int bridge_tc_poll_ticks = SNMP_BRIDGE_TC_POLL_INTERVAL * 100;
|
||||
|
||||
/*
|
||||
* Our default bridge, whose info will be visible under
|
||||
* the dot1dBridge subtree and functions to set/fetch it.
|
||||
*/
|
||||
static char bif_default_name[IFNAMSIZ] = "bridge0";
|
||||
static struct bridge_if *bif_default;
|
||||
|
||||
struct bridge_if *
|
||||
bridge_get_default(void)
|
||||
{
|
||||
struct mibif *ifp;
|
||||
|
||||
if (bif_default != NULL) {
|
||||
|
||||
/* Walk through the mibII interface list. */
|
||||
for (ifp = mib_first_if(); ifp != NULL; ifp = mib_next_if(ifp))
|
||||
if (strcmp(ifp->name, bif_default->bif_name) == 0)
|
||||
break;
|
||||
|
||||
if (ifp == NULL)
|
||||
bif_default = NULL;
|
||||
}
|
||||
|
||||
return (bif_default);
|
||||
}
|
||||
|
||||
void
|
||||
bridge_set_default(struct bridge_if *bif)
|
||||
{
|
||||
bif_default = bif;
|
||||
|
||||
syslog(LOG_ERR, "Set default bridge interface to: %s",
|
||||
bif == NULL ? "(none)" : bif->bif_name);
|
||||
}
|
||||
|
||||
const char *
|
||||
bridge_get_default_name(void)
|
||||
{
|
||||
return (bif_default_name);
|
||||
}
|
||||
|
||||
static int
|
||||
bridge_set_default_name(const char *bif_name, uint len)
|
||||
{
|
||||
struct bridge_if *bif;
|
||||
|
||||
if (len >= IFNAMSIZ)
|
||||
return (-1);
|
||||
|
||||
bcopy(bif_name, bif_default_name, len);
|
||||
bif_default_name[len] = '\0';
|
||||
|
||||
if ((bif = bridge_if_find_ifname(bif_default_name)) == NULL)
|
||||
return (0);
|
||||
|
||||
bif_default = bif;
|
||||
return (1);
|
||||
}
|
||||
|
||||
int
|
||||
bridge_get_data_maxage(void)
|
||||
{
|
||||
return (bridge_data_maxage);
|
||||
}
|
||||
|
||||
static void
|
||||
bridge_set_poll_ticks(int poll_ticks)
|
||||
{
|
||||
if (bridge_data_timer != NULL)
|
||||
timer_stop(bridge_data_timer);
|
||||
|
||||
bridge_poll_ticks = poll_ticks;
|
||||
bridge_data_timer = timer_start_repeat(bridge_poll_ticks,
|
||||
bridge_poll_ticks, bridge_update_all, NULL, bridge_module);
|
||||
}
|
||||
/*
|
||||
* The bridge module configuration via SNMP.
|
||||
*/
|
||||
static int
|
||||
bridge_default_name_save(struct snmp_context *ctx, const char *bridge_default)
|
||||
{
|
||||
if ((ctx->scratch->int1 = strlen(bridge_default)) >= IFNAMSIZ)
|
||||
return (-1);
|
||||
|
||||
if ((ctx->scratch->ptr1 = malloc(IFNAMSIZ)) == NULL)
|
||||
return (-1);
|
||||
|
||||
strncpy(ctx->scratch->ptr1, bridge_default, ctx->scratch->int1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
op_begemot_bridge_config(struct snmp_context *ctx, struct snmp_value *val,
|
||||
uint sub, uint iidx __unused, enum snmp_op op)
|
||||
{
|
||||
switch (op) {
|
||||
case SNMP_OP_GET:
|
||||
switch (val->var.subs[sub - 1]) {
|
||||
case LEAF_begemotBridgeDefaultBridgeIf:
|
||||
string_get(val, bridge_get_default_name(), -1);
|
||||
break;
|
||||
case LEAF_begemotBridgeDataUpdate:
|
||||
val->v.integer = bridge_data_maxage;
|
||||
break;
|
||||
case LEAF_begemotBridgeDataPoll:
|
||||
val->v.integer = bridge_poll_ticks / 100;
|
||||
break;
|
||||
}
|
||||
return (SNMP_ERR_NOERROR);
|
||||
|
||||
case SNMP_OP_GETNEXT:
|
||||
abort();
|
||||
|
||||
case SNMP_OP_SET:
|
||||
switch (val->var.subs[sub - 1]) {
|
||||
case LEAF_begemotBridgeDefaultBridgeIf:
|
||||
/*
|
||||
* Cannot use string_save() here - requires either
|
||||
* a fixed-sized or var-length string - not less
|
||||
* than or equal.
|
||||
*/
|
||||
if (bridge_default_name_save(ctx,
|
||||
bridge_get_default_name()) < 0)
|
||||
return (SNMP_ERR_RES_UNAVAIL);
|
||||
|
||||
if (bridge_set_default_name(val->v.octetstring.octets,
|
||||
val->v.octetstring.len) < 0)
|
||||
return (SNMP_ERR_BADVALUE);
|
||||
break;
|
||||
case LEAF_begemotBridgeDataUpdate:
|
||||
ctx->scratch->int1 = bridge_data_maxage;
|
||||
bridge_data_maxage = val->v.integer;
|
||||
break;
|
||||
case LEAF_begemotBridgeDataPoll:
|
||||
ctx->scratch->int1 = val->v.integer;
|
||||
break;
|
||||
}
|
||||
return (SNMP_ERR_NOERROR);
|
||||
|
||||
case SNMP_OP_ROLLBACK:
|
||||
switch (val->var.subs[sub - 1]) {
|
||||
case LEAF_begemotBridgeDefaultBridgeIf:
|
||||
bridge_set_default_name(ctx->scratch->ptr1,
|
||||
ctx->scratch->int1);
|
||||
free(ctx->scratch->ptr1);
|
||||
break;
|
||||
case LEAF_begemotBridgeDataUpdate:
|
||||
bridge_data_maxage = ctx->scratch->int1;
|
||||
break;
|
||||
}
|
||||
return (SNMP_ERR_NOERROR);
|
||||
|
||||
case SNMP_OP_COMMIT:
|
||||
switch (val->var.subs[sub - 1]) {
|
||||
case LEAF_begemotBridgeDefaultBridgeIf:
|
||||
free(ctx->scratch->ptr1);
|
||||
break;
|
||||
case LEAF_begemotBridgeDataPoll:
|
||||
bridge_set_poll_ticks(ctx->scratch->int1 * 100);
|
||||
break;
|
||||
}
|
||||
return (SNMP_ERR_NOERROR);
|
||||
}
|
||||
|
||||
return (SNMP_ERR_NOERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Bridge mib module initialization hook.
|
||||
* Returns 0 on success, < 0 on error.
|
||||
*/
|
||||
static int
|
||||
bridge_init(struct lmodule * mod, int argc __unused, char *argv[] __unused)
|
||||
{
|
||||
bridge_module = mod;
|
||||
|
||||
if (bridge_kmod_load() < 0)
|
||||
return (-1);
|
||||
|
||||
if (bridge_ioctl_init() < 0)
|
||||
return (-1);
|
||||
|
||||
/* Register to get creation messages for bridge interfaces. */
|
||||
if (mib_register_newif(bridge_attach_newif, bridge_module)) {
|
||||
syslog(LOG_ERR, "Cannot register newif function: %s",
|
||||
strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Bridge mib module finalization hook.
|
||||
*/
|
||||
static int
|
||||
bridge_fini(void)
|
||||
{
|
||||
mib_unregister_newif(bridge_module);
|
||||
or_unregister(reg_bridge);
|
||||
|
||||
if (bridge_data_timer != NULL) {
|
||||
timer_stop(bridge_data_timer);
|
||||
bridge_data_timer = NULL;
|
||||
}
|
||||
|
||||
if (bridge_tc_timer != NULL) {
|
||||
timer_stop(bridge_tc_timer);
|
||||
bridge_tc_timer = NULL;
|
||||
}
|
||||
|
||||
bridge_ifs_fini();
|
||||
bridge_ports_fini();
|
||||
bridge_addrs_fini();
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Bridge mib module start operation.
|
||||
*/
|
||||
static void
|
||||
bridge_start(void)
|
||||
{
|
||||
reg_bridge = or_register(&oid_dot1Bridge,
|
||||
"The IETF MIB for Bridges (RFC 4188).", bridge_module);
|
||||
|
||||
bridge_data_timer = timer_start_repeat(bridge_poll_ticks,
|
||||
bridge_poll_ticks, bridge_update_all, NULL, bridge_module);
|
||||
|
||||
bridge_tc_timer = timer_start_repeat(bridge_tc_poll_ticks,
|
||||
bridge_tc_poll_ticks, bridge_update_tc_time, NULL, bridge_module);
|
||||
}
|
||||
|
||||
static void
|
||||
bridge_dump(void)
|
||||
{
|
||||
struct bridge_if *bif;
|
||||
|
||||
if ((bif = bridge_get_default()) == NULL)
|
||||
syslog(LOG_ERR, "Dump: no default bridge interface");
|
||||
else
|
||||
syslog(LOG_ERR, "Dump: default bridge interface %s",
|
||||
bif->bif_name);
|
||||
|
||||
bridge_ifs_dump();
|
||||
bridge_pf_dump();
|
||||
}
|
||||
|
||||
const struct snmp_module config = {
|
||||
.comment = "This module implements the bridge mib (RFC 4188).",
|
||||
.init = bridge_init,
|
||||
.fini = bridge_fini,
|
||||
.start = bridge_start,
|
||||
.tree = bridge_ctree,
|
||||
.dump = bridge_dump,
|
||||
.tree_size = bridge_CTREE_SIZE,
|
||||
};
|
307
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_snmp.h
Normal file
307
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_snmp.h
Normal file
@ -0,0 +1,307 @@
|
||||
/*-
|
||||
* Copyright (c) 2006 Shteryana Shopova <syrinx@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* Bridge MIB implementation for SNMPd.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef SNMP_BRIDGE_H
|
||||
#define SNMP_BRIDGE_H
|
||||
|
||||
#define SNMP_BRIDGE_ID_LEN 8
|
||||
|
||||
typedef uint8_t port_id[2];
|
||||
typedef u_char bridge_id[SNMP_BRIDGE_ID_LEN];
|
||||
|
||||
#define SNMP_BRIDGE_MAX_PRIORITY 65535
|
||||
|
||||
#define SNMP_BRIDGE_MIN_AGE_TIME 10
|
||||
#define SNMP_BRIDGE_MAX_AGE_TIME 1000000
|
||||
|
||||
#define SNMP_PORT_PATHCOST_OBSOLETE 65535
|
||||
|
||||
#define SNMP_BRIDGE_DATA_MAXAGE 10
|
||||
/* By default poll kernel data every 5 minutes. */
|
||||
#define SNMP_BRIDGE_POLL_INTERVAL (5 * 60)
|
||||
/* Poll for a topology change once every 30 seconds. */
|
||||
#define SNMP_BRIDGE_TC_POLL_INTERVAL 30
|
||||
|
||||
struct bridge_if *bridge_get_default(void);
|
||||
|
||||
void bridge_set_default(struct bridge_if *bif);
|
||||
|
||||
const char *bridge_get_default_name(void);
|
||||
|
||||
int bridge_get_data_maxage(void);
|
||||
|
||||
/*
|
||||
* Bridge Addresses Table.
|
||||
*/
|
||||
struct tp_entry {
|
||||
uint32_t sysindex; /* The bridge if sysindex. */
|
||||
int32_t port_no;
|
||||
enum TpFdbStatus status;
|
||||
uint8_t tp_addr[ETHER_ADDR_LEN];
|
||||
uint8_t flags;
|
||||
TAILQ_ENTRY(tp_entry) tp_e;
|
||||
};
|
||||
|
||||
/*
|
||||
* Bridge ports.
|
||||
* The bridge port system interface index is used for a
|
||||
* port number. Transparent bridging statistics and STP
|
||||
* information for a port are also contained here.
|
||||
*/
|
||||
struct bridge_port {
|
||||
/* dot1dBase subtree objects. */
|
||||
uint32_t sysindex; /* The bridge interface sysindex. */
|
||||
int32_t port_no; /* The bridge member system index. */
|
||||
int32_t if_idx; /* SNMP ifIndex from mibII. */
|
||||
int8_t span_enable; /* Span flag set - private MIB. */
|
||||
struct asn_oid circuit; /* Unused. */
|
||||
uint32_t dly_ex_drops; /* Drops on output. */
|
||||
uint32_t dly_mtu_drops; /* MTU exceeded drops. */
|
||||
int32_t status; /* The entry status. */
|
||||
|
||||
/* dot1dStp subtree objects. */
|
||||
int32_t path_cost;
|
||||
int32_t priority;
|
||||
int32_t design_cost;
|
||||
uint32_t fwd_trans;
|
||||
char p_name[IFNAMSIZ]; /* Not in BRIDGE-MIB. */
|
||||
enum StpPortState state;
|
||||
enum dot1dStpPortEnable enable;
|
||||
port_id design_port;
|
||||
bridge_id design_root;
|
||||
bridge_id design_bridge;
|
||||
|
||||
/* dot1dTp subtree objects. */
|
||||
int32_t max_info;
|
||||
int32_t in_frames;
|
||||
int32_t out_frames;
|
||||
int32_t in_drops;
|
||||
|
||||
uint8_t flags;
|
||||
TAILQ_ENTRY(bridge_port) b_p;
|
||||
};
|
||||
|
||||
/*
|
||||
* A bridge interface.
|
||||
* The system interface index of the bridge is not required neither by the
|
||||
* standard BRIDGE-MIB nor by the private BEGEMOT-BRIDGE-MIB, but is used
|
||||
* as key for looking up the other info for this bridge.
|
||||
*/
|
||||
struct bridge_if {
|
||||
/* dot1dBase subtree objects. */
|
||||
uint32_t sysindex; /* The system interface index. */
|
||||
int32_t num_ports; /* Number of ports. */
|
||||
enum BaseType br_type; /* Bridge type. */
|
||||
enum RowStatus if_status; /* Bridge status. */
|
||||
char bif_name[IFNAMSIZ]; /* Bridge interface name. */
|
||||
struct ether_addr br_addr; /* Bridge address. */
|
||||
struct bridge_port *f_bp; /* This bridge's first entry
|
||||
* in the base ports TAILQ. */
|
||||
/* dot1dStp subtree objects. */
|
||||
int32_t priority;
|
||||
int32_t root_cost;
|
||||
int32_t root_port;
|
||||
int32_t max_age; /* Current max age. */
|
||||
int32_t hello_time; /* Current hello time. */
|
||||
int32_t fwd_delay; /* Current forward delay. */
|
||||
int32_t hold_time;
|
||||
int32_t bridge_max_age; /* Configured max age. */
|
||||
int32_t bridge_hello_time; /* Configured hello time. */
|
||||
int32_t bridge_fwd_delay; /* Configured forward delay. */
|
||||
uint32_t top_changes;
|
||||
enum dot1dStpProtocolSpecification prot_spec;
|
||||
struct timeval last_tc_time;
|
||||
bridge_id design_root;
|
||||
|
||||
/* dot1dTp subtree objects. */
|
||||
int32_t lrnt_drops; /* Dropped addresses. */
|
||||
int32_t age_time; /* Address entry timeout. */
|
||||
int32_t num_addrs; /* Current # of addresses in cache. */
|
||||
int32_t max_addrs; /* Max # of addresses in cache. */
|
||||
struct tp_entry *f_tpa; /* This bridge's first entry in
|
||||
* the tp addresses TAILQ. */
|
||||
|
||||
time_t entry_age;
|
||||
time_t ports_age;
|
||||
time_t addrs_age;
|
||||
TAILQ_ENTRY(bridge_if) b_if;
|
||||
};
|
||||
|
||||
void bridge_ifs_fini(void);
|
||||
|
||||
struct bridge_if *bridge_if_find_ifs(uint32_t sysindex);
|
||||
|
||||
struct bridge_if *bridge_if_find_ifname(const char *b_name);
|
||||
|
||||
const char *bridge_if_find_name(uint32_t sysindex);
|
||||
|
||||
int bridge_compare_sysidx(uint32_t i1, uint32_t i2);
|
||||
|
||||
int bridge_attach_newif(struct mibif *ifp);
|
||||
|
||||
struct bridge_if *bridge_first_bif(void);
|
||||
|
||||
struct bridge_if *bridge_next_bif(struct bridge_if *b_pr);
|
||||
|
||||
void bridge_remove_bif(struct bridge_if *bif);
|
||||
|
||||
void bridge_update_all_ports(void);
|
||||
|
||||
void bridge_update_all_addrs(void);
|
||||
|
||||
void bridge_update_all_ifs(void);
|
||||
|
||||
void bridge_update_all(void *arg);
|
||||
|
||||
void bridge_update_tc_time(void *arg);
|
||||
|
||||
void bridge_ifs_dump(void);
|
||||
|
||||
/* Bridge ports. */
|
||||
void bridge_ports_update_listage(void);
|
||||
|
||||
void bridge_ports_fini(void);
|
||||
|
||||
void bridge_members_free(struct bridge_if *bif);
|
||||
|
||||
struct bridge_port *bridge_new_port(struct mibif *mif, struct bridge_if *bif);
|
||||
|
||||
void bridge_port_remove(struct bridge_port *bp, struct bridge_if *bif);
|
||||
|
||||
struct bridge_port *bridge_port_bif_first(struct bridge_if *bif);
|
||||
|
||||
struct bridge_port *bridge_port_bif_next(struct bridge_port *bp);
|
||||
|
||||
struct bridge_port *bridge_port_find(int32_t if_idx, struct bridge_if *bif);
|
||||
|
||||
void bridge_port_getinfo_mibif(struct mibif *m_if, struct bridge_port *bp);
|
||||
|
||||
int bridge_getinfo_bif_ports(struct bridge_if *bif);
|
||||
|
||||
int bridge_update_memif(struct bridge_if *bif);
|
||||
|
||||
void bridge_ports_dump(struct bridge_if *bif);
|
||||
|
||||
/* Bridge addresses. */
|
||||
void bridge_addrs_update_listage(void);
|
||||
|
||||
void bridge_addrs_fini(void);
|
||||
|
||||
void bridge_addrs_free(struct bridge_if *bif);
|
||||
|
||||
struct tp_entry *bridge_new_addrs(uint8_t *mac, struct bridge_if *bif);
|
||||
|
||||
void bridge_addrs_remove(struct tp_entry *te, struct bridge_if *bif);
|
||||
|
||||
struct tp_entry *bridge_addrs_find(uint8_t *mac, struct bridge_if *bif);
|
||||
|
||||
struct tp_entry *bridge_addrs_bif_first(struct bridge_if *bif);
|
||||
|
||||
struct tp_entry *bridge_addrs_bif_next(struct tp_entry *te);
|
||||
|
||||
int bridge_getinfo_bif_addrs(struct bridge_if *bif);
|
||||
|
||||
int bridge_update_addrs(struct bridge_if *bif);
|
||||
|
||||
void bridge_addrs_dump(struct bridge_if *bif);
|
||||
|
||||
/* Bridge PF. */
|
||||
|
||||
void bridge_pf_dump(void);
|
||||
|
||||
/* System specific. */
|
||||
|
||||
/* Open the socket for the ioctls. */
|
||||
int bridge_ioctl_init(void);
|
||||
|
||||
/* Load bridge kernel module. */
|
||||
int bridge_kmod_load(void);
|
||||
|
||||
/* Get the bridge interface information. */
|
||||
int bridge_getinfo_bif(struct bridge_if *bif);
|
||||
|
||||
/* Get the bridge interface STP parameters. */
|
||||
int bridge_get_op_param(struct bridge_if *bif);
|
||||
|
||||
/* Set the bridge priority. */
|
||||
int bridge_set_priority(struct bridge_if *bif, int32_t priority);
|
||||
|
||||
/* Set the bridge max age. */
|
||||
int bridge_set_maxage(struct bridge_if *bif, int32_t max_age);
|
||||
|
||||
/* Set the bridge hello time.*/
|
||||
int bridge_set_hello_time(struct bridge_if *bif, int32_t hello_time);
|
||||
|
||||
/* Set the bridge forward delay.*/
|
||||
int bridge_set_forward_delay(struct bridge_if *bif, int32_t fwd_delay);
|
||||
|
||||
/* Set the bridge address cache max age. */
|
||||
int bridge_set_aging_time(struct bridge_if *bif, int32_t age_time);
|
||||
|
||||
/* Set the max number of entries in the bridge address cache. */
|
||||
int bridge_set_max_cache(struct bridge_if *bif, int32_t max_cache);
|
||||
|
||||
/* Set the bridge interface status to up/down. */
|
||||
int bridge_set_if_up(const char* b_name, int8_t up);
|
||||
|
||||
/* Create a bridge interface. */
|
||||
int bridge_create(const char *b_name);
|
||||
|
||||
/* Destroy a bridge interface. */
|
||||
int bridge_destroy(const char *b_name);
|
||||
|
||||
/* Fetch the bridge mac address. */
|
||||
u_char *bridge_get_basemac(const char *bif_name, u_char *mac);
|
||||
|
||||
/* Set a bridge member priority. */
|
||||
int bridge_port_set_priority(const char *bif_name, struct bridge_port *bp,
|
||||
int32_t priority);
|
||||
|
||||
/* Set a bridge member STP-enabled flag. */
|
||||
int bridge_port_set_stp_enable(const char *bif_name, struct bridge_port *bp,
|
||||
uint32_t enable);
|
||||
|
||||
/* Set a bridge member STP path cost. */
|
||||
int bridge_port_set_path_cost(const char *bif_name, struct bridge_port *bp,
|
||||
int32_t path_cost);
|
||||
|
||||
/* Add a bridge member port. */
|
||||
int bridge_port_addm(struct bridge_port *bp, const char *b_name);
|
||||
|
||||
/* Delete a bridge member port. */
|
||||
int bridge_port_delm(struct bridge_port *bp, const char *b_name);
|
||||
|
||||
/* Get the current value from the module for bridge PF control. */
|
||||
int32_t bridge_get_pfval(uint8_t which);
|
||||
|
||||
/* Get/Set a bridge PF control. */
|
||||
int32_t bridge_do_pfctl(int32_t bridge_ctl, enum snmp_op op, int32_t *val);
|
||||
|
||||
#endif /* SNMP_BRIDGE_H */
|
1293
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c
Normal file
1293
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c
Normal file
File diff suppressed because it is too large
Load Diff
242
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_tree.def
Normal file
242
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_tree.def
Normal file
@ -0,0 +1,242 @@
|
||||
#-
|
||||
# Copyright (c) 2006 Shteryana Shopova <syrinx@FreeBSD.org>
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
#include "tc.def"
|
||||
|
||||
typedef TruthValue ENUM (
|
||||
1 true
|
||||
2 false
|
||||
)
|
||||
|
||||
typedef RowStatus ENUM (
|
||||
1 active
|
||||
2 notInService
|
||||
3 notReady
|
||||
4 createAndGo
|
||||
5 createAndWait
|
||||
6 destroy
|
||||
)
|
||||
|
||||
typedef StpPortState ENUM (
|
||||
1 disabled
|
||||
2 blocking
|
||||
3 listening
|
||||
4 learning
|
||||
5 forwarding
|
||||
6 broken
|
||||
)
|
||||
|
||||
typedef BaseType ENUM (
|
||||
1 unknown
|
||||
2 transparent-only
|
||||
3 sourceroute-only
|
||||
4 srt
|
||||
)
|
||||
|
||||
typedef TpFdbStatus ENUM (
|
||||
1 other
|
||||
2 invalid
|
||||
3 learned
|
||||
4 self
|
||||
5 mgmt
|
||||
)
|
||||
|
||||
(1 internet
|
||||
(2 mgmt
|
||||
(1 mib_2
|
||||
(17 dot1dBridge
|
||||
(0 dot1dNotifications
|
||||
(1 newRoot OID op_snmp_trap)
|
||||
(2 topologyChange OID op_snmp_trap)
|
||||
)
|
||||
(1 dot1dBase
|
||||
(1 dot1dBaseBridgeAddress OCTETSTRING | MacAddress op_dot1d_base GET)
|
||||
(2 dot1dBaseNumPorts INTEGER32 op_dot1d_base GET)
|
||||
(3 dot1dBaseType BaseType op_dot1d_base GET)
|
||||
(4 dot1dBasePortTable
|
||||
(1 dot1dBasePortEntry : INTEGER op_dot1d_base_port
|
||||
(1 dot1dBasePort INTEGER GET)
|
||||
(2 dot1dBasePortIfIndex INTEGER GET)
|
||||
(3 dot1dBasePortCircuit OID GET)
|
||||
(4 dot1dBasePortDelayExceededDiscards COUNTER GET)
|
||||
(5 dot1dBasePortMtuExceededDiscards COUNTER GET)
|
||||
))
|
||||
)
|
||||
(2 dot1dStp
|
||||
(1 dot1dStpProtocolSpecification ENUM ( 1 unknown 2 decLb100 3 ieee8021d ) op_dot1d_stp GET)
|
||||
(2 dot1dStpPriority INTEGER op_dot1d_stp GET SET)
|
||||
(3 dot1dStpTimeSinceTopologyChange TIMETICKS op_dot1d_stp GET)
|
||||
(4 dot1dStpTopChanges COUNTER op_dot1d_stp GET)
|
||||
(5 dot1dStpDesignatedRoot OCTETSTRING | BridgeId op_dot1d_stp GET)
|
||||
(6 dot1dStpRootCost INTEGER32 op_dot1d_stp GET)
|
||||
(7 dot1dStpRootPort INTEGER32 op_dot1d_stp GET)
|
||||
(8 dot1dStpMaxAge INTEGER op_dot1d_stp GET)
|
||||
(9 dot1dStpHelloTime INTEGER op_dot1d_stp GET)
|
||||
(10 dot1dStpHoldTime INTEGER32 op_dot1d_stp GET)
|
||||
(11 dot1dStpForwardDelay INTEGER op_dot1d_stp GET)
|
||||
(12 dot1dStpBridgeMaxAge INTEGER op_dot1d_stp GET SET)
|
||||
(13 dot1dStpBridgeHelloTime INTEGER op_dot1d_stp GET SET)
|
||||
(14 dot1dStpBridgeForwardDelay INTEGER op_dot1d_stp GET SET)
|
||||
(15 dot1dStpPortTable
|
||||
(1 dot1dStpPortEntry : INTEGER op_dot1d_stp_port
|
||||
(1 dot1dStpPort INTEGER GET)
|
||||
(2 dot1dStpPortPriority INTEGER GET SET)
|
||||
(3 dot1dStpPortState StpPortState GET)
|
||||
(4 dot1dStpPortEnable ENUM ( 1 enabled 2 disabled ) GET SET)
|
||||
(5 dot1dStpPortPathCost INTEGER GET SET)
|
||||
(6 dot1dStpPortDesignatedRoot OCTETSTRING | BridgeId GET)
|
||||
(7 dot1dStpPortDesignatedCost INTEGER32 GET)
|
||||
(8 dot1dStpPortDesignatedBridge OCTETSTRING | BridgeId GET)
|
||||
(9 dot1dStpPortDesignatedPort OCTETSTRING | BridgePortId GET)
|
||||
(10 dot1dStpPortForwardTransitions COUNTER GET)
|
||||
))
|
||||
)
|
||||
(3 dot1dSr
|
||||
)
|
||||
(4 dot1dTp
|
||||
(1 dot1dTpLearnedEntryDiscards COUNTER op_dot1d_tp GET)
|
||||
(2 dot1dTpAgingTime INTEGER op_dot1d_tp GET SET)
|
||||
(3 dot1dTpFdbTable
|
||||
(1 dot1dTpFdbEntry : OCTETSTRING | MacAddress op_dot1d_tp_fdb
|
||||
(1 dot1dTpFdbAddress OCTETSTRING | MacAddress GET)
|
||||
(2 dot1dTpFdbPort INTEGER32 GET)
|
||||
(3 dot1dTpFdbStatus TpFdbStatus GET)
|
||||
))
|
||||
(4 dot1dTpPortTable
|
||||
(1 dot1dTpPortEntry : INTEGER op_dot1d_tp_port
|
||||
(1 dot1dTpPort INTEGER GET)
|
||||
(2 dot1dTpPortMaxInfo INTEGER32 GET)
|
||||
(3 dot1dTpPortInFrames COUNTER GET)
|
||||
(4 dot1dTpPortOutFrames COUNTER GET)
|
||||
(5 dot1dTpPortInDiscards COUNTER GET)
|
||||
))
|
||||
)
|
||||
(5 dot1dStatic
|
||||
)
|
||||
(8 dot1dConformance
|
||||
(1 dot1dGroups
|
||||
)
|
||||
(2 dot1dCompliances
|
||||
)
|
||||
)
|
||||
)))
|
||||
(4 private
|
||||
(1 enterprises
|
||||
(12325 fokus
|
||||
(1 begemot
|
||||
(205 begemotBridge
|
||||
(0 begemotBridgeNotifications
|
||||
(1 begemotBridgeNewRoot OID op_snmp_trap)
|
||||
(2 begemotBridgeTopologyChange OID op_snmp_trap)
|
||||
)
|
||||
(1 begemotBridgeBase
|
||||
(1 begemotBridgeBaseTable
|
||||
(1 begemotBridgeBaseEntry : OCTETSTRING | BridgeIfName op_begemot_base_bridge
|
||||
(1 begemotBridgeBaseName OCTETSTRING | BridgeIfName GET)
|
||||
(2 begemotBridgeBaseAddress OCTETSTRING | MacAddress GET)
|
||||
(3 begemotBridgeBaseNumPorts INTEGER32 GET)
|
||||
(4 begemotBridgeBaseType BaseType GET)
|
||||
(5 begemotBridgeBaseStatus RowStatus GET SET)
|
||||
))
|
||||
(2 begemotBridgeBasePortTable
|
||||
(1 begemotBridgeBasePortEntry : OCTETSTRING | BridgeIfName INTEGER op_begemot_base_port
|
||||
(1 begemotBridgeBasePort INTEGER GET)
|
||||
(2 begemotBridgeBasePortIfIndex INTEGER GET)
|
||||
(3 begemotBridgeBaseSpanEnabled ENUM ( 1 enabled 2 disabled ) GET SET)
|
||||
(4 begemotBridgeBasePortDelayExceededDiscards COUNTER GET)
|
||||
(5 begemotBridgeBasePortMtuExceededDiscards COUNTER GET)
|
||||
(6 begemotBridgeBasePortStatus RowStatus GET SET)
|
||||
))
|
||||
)
|
||||
(2 begemotBridgeStp
|
||||
(1 begemotBridgeStpTable
|
||||
(1 begemotBridgeStpEntry : OCTETSTRING | BridgeIfName op_begemot_stp
|
||||
(1 begemotBridgeStpProtocolSpecification ENUM ( 1 unknown 2 decLb100 3 ieee8021d ) GET)
|
||||
(2 begemotBridgeStpPriority INTEGER GET SET)
|
||||
(3 begemotBridgeStpTimeSinceTopologyChange TIMETICKS GET)
|
||||
(4 begemotBridgeStpTopChanges COUNTER GET)
|
||||
(5 begemotBridgeStpDesignatedRoot OCTETSTRING | BridgeId GET)
|
||||
(6 begemotBridgeStpRootCost INTEGER32 GET)
|
||||
(7 begemotBridgeStpRootPort INTEGER32 GET)
|
||||
(8 begemotBridgeStpMaxAge INTEGER GET)
|
||||
(9 begemotBridgeStpHelloTime INTEGER GET)
|
||||
(10 begemotBridgeStpHoldTime INTEGER32 GET)
|
||||
(11 begemotBridgeStpForwardDelay INTEGER GET)
|
||||
(12 begemotBridgeStpBridgeMaxAge INTEGER GET SET)
|
||||
(13 begemotBridgeStpBridgeHelloTime INTEGER GET SET)
|
||||
(14 begemotBridgeStpBridgeForwardDelay INTEGER GET SET)
|
||||
))
|
||||
(2 begemotBridgeStpPortTable
|
||||
(1 begemotBridgeStpPortEntry : OCTETSTRING | BridgeIfName INTEGER op_begemot_stp_port
|
||||
(1 begemotBridgeStpPort INTEGER GET)
|
||||
(2 begemotBridgeStpPortPriority INTEGER GET SET)
|
||||
(3 begemotBridgeStpPortState StpPortState GET)
|
||||
(4 begemotBridgeStpPortEnable ENUM ( 1 enabled 2 disabled ) GET SET)
|
||||
(5 begemotBridgeStpPortPathCost INTEGER GET SET)
|
||||
(6 begemotBridgeStpPortDesignatedRoot OCTETSTRING | BridgeId GET)
|
||||
(7 begemotBridgeStpPortDesignatedCost INTEGER32 GET)
|
||||
(8 begemotBridgeStpPortDesignatedBridge OCTETSTRING | BridgeId GET)
|
||||
(9 begemotBridgeStpPortDesignatedPort OCTETSTRING | BridgePortId GET)
|
||||
(10 begemotBridgeStpPortForwardTransitions COUNTER GET)
|
||||
))
|
||||
)
|
||||
(3 begemotBridgeTp
|
||||
(1 begemotBridgeTpTable
|
||||
(1 begemotBridgeTpEntry : OCTETSTRING | BridgeIfName op_begemot_tp
|
||||
(1 begemotBridgeTpLearnedEntryDiscards COUNTER GET)
|
||||
(2 begemotBridgeTpAgingTime INTEGER GET SET)
|
||||
(3 begemotBridgeTpMaxAddresses INTEGER GET SET)
|
||||
))
|
||||
(2 begemotBridgeTpFdbTable
|
||||
(1 begemotBridgeTpFdbEntry : OCTETSTRING | BridgeIfName OCTETSTRING | MacAddress op_begemot_tp_fdb
|
||||
(1 begemotBridgeTpFdbAddress OCTETSTRING | MacAddress GET)
|
||||
(2 begemotBridgeTpFdbPort INTEGER32 GET)
|
||||
(3 begemotBridgeTpFdbStatus TpFdbStatus GET)
|
||||
))
|
||||
(3 begemotBridgeTpPortTable
|
||||
(1 begemotBridgeTpPortEntry : OCTETSTRING | BridgeIfName INTEGER op_begemot_tp_port
|
||||
(1 begemotBridgeTpPort INTEGER GET)
|
||||
(2 begemotBridgeTpPortMaxInfo INTEGER32 GET)
|
||||
(3 begemotBridgeTpPortInFrames COUNTER GET)
|
||||
(4 begemotBridgeTpPortOutFrames COUNTER GET)
|
||||
(5 begemotBridgeTpPortInDiscards COUNTER GET)
|
||||
))
|
||||
)
|
||||
(4 begemotBridgePf
|
||||
(1 begemotBridgePfilStatus TruthValue op_begemot_bridge_pf GET SET)
|
||||
(2 begemotBridgePfilMembers TruthValue op_begemot_bridge_pf GET SET)
|
||||
(3 begemotBridgePfilIpOnly TruthValue op_begemot_bridge_pf GET SET)
|
||||
(4 begemotBridgeLayer2PfStatus ENUM ( 1 enabled 2 disabled ) op_begemot_bridge_pf GET SET)
|
||||
)
|
||||
(5 begemotBridgeConfigObjects
|
||||
(1 begemotBridgeDefaultBridgeIf OCTETSTRING | BridgeIfNameOrEmpty op_begemot_bridge_config GET SET)
|
||||
(2 begemotBridgeDataUpdate INTEGER op_begemot_bridge_config GET SET)
|
||||
(3 begemotBridgeDataPoll INTEGER op_begemot_bridge_config GET SET)
|
||||
)
|
||||
)))))
|
||||
)
|
113
usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3
Normal file
113
usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3
Normal file
@ -0,0 +1,113 @@
|
||||
.\"-
|
||||
.\" Copyright (C) 2006 Shteryana Shopova <syrinx@FreeBSD.org>
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd August 18, 2006
|
||||
.Dt snmp_bridge 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm snmp_bridge
|
||||
.Nd "bridge module for snmpd.
|
||||
.Sh LIBRARY
|
||||
.Pq begemotSnmpdModulePath."bridge" = "/usr/lib/snmp_bridge.so"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm snmp_bridge
|
||||
module implements the BRIDGE-MIB as standardized in RFC 4188 and a private
|
||||
BEGEMOT-BRIDGE-MIB, which allows management of multiple bridge interfaces.
|
||||
Most of the objects defined in the private BEGEMOT-BRIDGE-MIB are duplicates
|
||||
of the original objects defined by the standard BRIDGE-MIB, but the private
|
||||
MIB also defines additional objects which make the functionality of
|
||||
.Nm
|
||||
similar to
|
||||
.Xr ifconfig 8
|
||||
for configuring bridge interfaces.
|
||||
Therefore one should consider adding write comminities or loading the
|
||||
.Nm
|
||||
module on systems where security is crucial.
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
The additional objects to configure a bridge are:
|
||||
.Bl -tag -width "XXXXXXXXX"
|
||||
.It Va begemotBridgeBaseStatus
|
||||
Bridge interfaces can be created and destroyed via this object.
|
||||
SNMP SET operations with the following values are allowed:
|
||||
.Bl -tag -width ".It Va createAndWait"
|
||||
.It Va createAndWait
|
||||
will attempt to create a bridge interface with the name given by the table
|
||||
index.
|
||||
.It Va createAndGo
|
||||
will attempt to create a bridge interface with the name given by the table
|
||||
index and set the status of the interface to "active/up".
|
||||
.It Va destroy
|
||||
will attempt to destory the bridge interface.
|
||||
.El
|
||||
.It Va begemotBridgeBaseSpanEnabled
|
||||
A SNMP SET operation on this object is only successfull if the corresponding
|
||||
port has not been added as member of the bridge interface on the system.
|
||||
.It Va begemotBridgeBasePortStatus
|
||||
SNMP SET operations with the following values are allowed:
|
||||
.Bl -tag -width ".It Va createAndWait"
|
||||
.It Va createAndWait
|
||||
will create a new row for the bridge member in the SNMP
|
||||
.Va begemotBridgeBasePortTable
|
||||
but will not try to commit the information to the system.
|
||||
.It Va active
|
||||
will attempt to commit the information to the system and will be successful
|
||||
only if a value for
|
||||
.Va begemotBridgeBaseSpanEnabled
|
||||
has been SET already.
|
||||
.It Va destroy
|
||||
will attempt to remove the interface from the system bridge interface.
|
||||
.El
|
||||
.El
|
||||
.Sh RESTRICTIONS
|
||||
Not all information in the MIBs is currently available in FreeBSD.
|
||||
The following variables carry no information:
|
||||
.Bl -tag -width "XXXXXXXXX"
|
||||
.It Va dot1dBasePortCircuit
|
||||
.It Va dot1dBasePortDelayExceededDiscards
|
||||
.It Va dot1dBasePortMtuExceededDiscards
|
||||
.It Va begemotBridgeBasePortDelayExceededDiscards
|
||||
.It Va begemotBridgeBasePortMtuExceededDiscards
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width "XXXXXXXXX"
|
||||
.It Pa /usr/share/snmp/defs/bridge_tree.def
|
||||
The description of the MIB tree implemented by
|
||||
.Nm .
|
||||
.It Pa /usr/share/snmp/mibs/BRIDGE-MIB.txt
|
||||
This is the BRIDGE-MIB that is implemented by this module.
|
||||
.It Pa /usr/share/snmp/mibs/BEGEMOT-BRIDGE-MIB.txt
|
||||
This is the private BEGEMOT-BRIDGE-MIB that is implemented by this module.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr bsnmpd 1 ,
|
||||
.Xr gensnmptree 1 ,
|
||||
.Xr if_bridge 4 ,
|
||||
.Xr ifconfig 8 ,
|
||||
.Xr snmpmod 3
|
||||
.Sh AUTHORS
|
||||
.An Shteryana Shopova Aq syrinx@FreeBSD.org
|
Loading…
Reference in New Issue
Block a user