Keep the snmp_bridge(3) module up to date with if_bridge(4) and add an
object to control the value of the new 'PRIVATE' bridge members' flag. While here, remove stale '__unused' compiler directives. Reviewed by: bz Approved by: re (bmah), bz (mentor)
This commit is contained in:
parent
bcc9fe49c4
commit
fea5330c6b
@ -41,7 +41,7 @@ IMPORTS
|
||||
FROM BEGEMOT-MIB;
|
||||
|
||||
begemotBridge MODULE-IDENTITY
|
||||
LAST-UPDATED "200611210000Z"
|
||||
LAST-UPDATED "200708060000Z"
|
||||
ORGANIZATION "Sofia University St. Kliment Ohridski"
|
||||
CONTACT-INFO
|
||||
" Shteryana Shopova
|
||||
@ -56,6 +56,10 @@ begemotBridge MODULE-IDENTITY
|
||||
E-Mail: syrinx@FreeBSD.org"
|
||||
DESCRIPTION
|
||||
"The Begemot MIB for managing bridge interfaces."
|
||||
REVISION "200708060000Z"
|
||||
DESCRIPTION
|
||||
"Third revision adds begemotBridgeBasePortPrivate
|
||||
object."
|
||||
REVISION "200611210000Z"
|
||||
DESCRIPTION
|
||||
"Second revision adds support for monitoring RSTP
|
||||
@ -211,7 +215,8 @@ BegemotBridgeBasePortEntry ::= SEQUENCE {
|
||||
begemotBridgeBaseSpanEnabled INTEGER,
|
||||
begemotBridgeBasePortDelayExceededDiscards Counter32,
|
||||
begemotBridgeBasePortMtuExceededDiscards Counter32,
|
||||
begemotBridgeBasePortStatus RowStatus
|
||||
begemotBridgeBasePortStatus RowStatus,
|
||||
begemotBridgeBasePortPrivate TruthValue
|
||||
}
|
||||
|
||||
begemotBridgeBasePort OBJECT-TYPE
|
||||
@ -272,6 +277,17 @@ begemotBridgeBasePortStatus OBJECT-TYPE
|
||||
removal of member ports from a specified bridge."
|
||||
::= { begemotBridgeBasePortEntry 6 }
|
||||
|
||||
begemotBridgeBasePortPrivate OBJECT-TYPE
|
||||
SYNTAX TruthValue
|
||||
MAX-ACCESS read-write
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The value of this objects reflects whether the port
|
||||
has a PRIVATE flag set. A port with this flags set
|
||||
can only communicate with ports not having the
|
||||
PRIVATE flag set."
|
||||
::= { begemotBridgeBasePortEntry 7 }
|
||||
|
||||
-- ---------------------------------------------------------- --
|
||||
-- the Bridge interface STP table
|
||||
-- ---------------------------------------------------------- --
|
||||
|
@ -1074,6 +1074,7 @@ op_begemot_base_port(struct snmp_context *ctx, struct snmp_value *val,
|
||||
uint sub, uint iidx __unused, enum snmp_op op)
|
||||
{
|
||||
int8_t status, which;
|
||||
const char *bname;
|
||||
struct bridge_port *bp;
|
||||
|
||||
if (time(NULL) - ports_list_age > bridge_get_data_maxage())
|
||||
@ -1110,6 +1111,16 @@ op_begemot_base_port(struct snmp_context *ctx, struct snmp_value *val,
|
||||
case LEAF_begemotBridgeBasePortStatus:
|
||||
return (bridge_port_set_status(ctx, val, sub));
|
||||
|
||||
case LEAF_begemotBridgeBasePortPrivate:
|
||||
if ((bp = bridge_port_index_get(&val->var, sub,
|
||||
status)) == NULL)
|
||||
return (SNMP_ERR_NOSUCHNAME);
|
||||
if ((bname = bridge_if_find_name(bp->sysindex)) == NULL)
|
||||
return (SNMP_ERR_GENERR);
|
||||
ctx->scratch->int1 = bp->priv_set;
|
||||
return (bridge_port_set_private(bname, bp,
|
||||
val->v.integer));
|
||||
|
||||
case LEAF_begemotBridgeBasePort:
|
||||
case LEAF_begemotBridgeBasePortIfIndex:
|
||||
case LEAF_begemotBridgeBasePortDelayExceededDiscards:
|
||||
@ -1124,6 +1135,14 @@ op_begemot_base_port(struct snmp_context *ctx, struct snmp_value *val,
|
||||
/* FALLTHROUGH */
|
||||
case LEAF_begemotBridgeBasePortStatus:
|
||||
return (bridge_port_rollback_status(ctx, val, sub));
|
||||
case LEAF_begemotBridgeBasePortPrivate:
|
||||
if ((bp = bridge_port_index_get(&val->var, sub,
|
||||
status)) == NULL)
|
||||
return (SNMP_ERR_GENERR);
|
||||
if ((bname = bridge_if_find_name(bp->sysindex)) == NULL)
|
||||
return (SNMP_ERR_GENERR);
|
||||
return (bridge_port_set_private(bname, bp,
|
||||
ctx->scratch->int1));
|
||||
}
|
||||
return (SNMP_ERR_NOERROR);
|
||||
|
||||
@ -1160,6 +1179,10 @@ op_begemot_base_port(struct snmp_context *ctx, struct snmp_value *val,
|
||||
case LEAF_begemotBridgeBasePortStatus:
|
||||
val->v.integer = bp->status;
|
||||
return (SNMP_ERR_NOERROR);
|
||||
|
||||
case LEAF_begemotBridgeBasePortPrivate:
|
||||
val->v.integer = bp->priv_set;
|
||||
return (SNMP_ERR_NOERROR);
|
||||
}
|
||||
|
||||
abort();
|
||||
|
@ -106,6 +106,7 @@ struct bridge_port {
|
||||
uint32_t dly_ex_drops; /* Drops on output. */
|
||||
uint32_t dly_mtu_drops; /* MTU exceeded drops. */
|
||||
int32_t status; /* The entry status. */
|
||||
enum TruthValue priv_set; /* The private flag. */
|
||||
|
||||
/* dot1dStp subtree objects. */
|
||||
int32_t path_cost;
|
||||
@ -337,6 +338,10 @@ int bridge_port_set_admin_ptp(const char *bif_name, struct bridge_port *bp,
|
||||
int bridge_port_set_admin_edge(const char *bif_name, struct bridge_port *bp,
|
||||
uint32_t enable);
|
||||
|
||||
/* Set 'private' flag. */
|
||||
int bridge_port_set_private(const char *bif_name, struct bridge_port *bp,
|
||||
uint32_t priv_set);
|
||||
|
||||
/* Add a bridge member port. */
|
||||
int bridge_port_addm(struct bridge_port *bp, const char *b_name);
|
||||
|
||||
|
@ -429,8 +429,7 @@ bridge_set_max_cache(struct bridge_if *bif, int32_t max_cache)
|
||||
}
|
||||
|
||||
int
|
||||
bridge_set_tx_hold_count(struct bridge_if *bif __unused,
|
||||
int32_t tx_hc __unused)
|
||||
bridge_set_tx_hold_count(struct bridge_if *bif, int32_t tx_hc)
|
||||
{
|
||||
struct ifdrv ifd;
|
||||
struct ifbrparam b_param;
|
||||
@ -455,8 +454,7 @@ bridge_set_tx_hold_count(struct bridge_if *bif __unused,
|
||||
}
|
||||
|
||||
int
|
||||
bridge_set_stp_version(struct bridge_if *bif __unused,
|
||||
int32_t stp_proto __unused)
|
||||
bridge_set_stp_version(struct bridge_if *bif, int32_t stp_proto)
|
||||
{
|
||||
struct ifdrv ifd;
|
||||
struct ifbrparam b_param;
|
||||
@ -675,6 +673,11 @@ bridge_port_getinfo_conf(struct ifbreq *k_info, struct bridge_port *bp)
|
||||
else
|
||||
bp->span_enable = begemotBridgeBaseSpanEnabled_disabled;
|
||||
|
||||
if (k_info->ifbr_ifsflags & IFBIF_PRIVATE)
|
||||
bp->priv_set = TruthValue_true;
|
||||
else
|
||||
bp->priv_set = TruthValue_false;
|
||||
|
||||
if (k_info->ifbr_ifsflags & IFBIF_BSTP_ADMEDGE)
|
||||
bp->admin_edge = TruthValue_true;
|
||||
else
|
||||
@ -840,8 +843,8 @@ bridge_port_set_path_cost(const char *bif_name, struct bridge_port *bp,
|
||||
* Set the PonitToPoint status of the link administratively.
|
||||
*/
|
||||
int
|
||||
bridge_port_set_admin_ptp(const char *bif_name __unused,
|
||||
struct bridge_port *bp __unused, uint32_t admin_ptp __unused)
|
||||
bridge_port_set_admin_ptp(const char *bif_name, struct bridge_port *bp,
|
||||
uint32_t admin_ptp)
|
||||
{
|
||||
struct ifdrv ifd;
|
||||
struct ifbreq b_req;
|
||||
@ -891,8 +894,8 @@ bridge_port_set_admin_ptp(const char *bif_name __unused,
|
||||
* Set admin edge.
|
||||
*/
|
||||
int
|
||||
bridge_port_set_admin_edge(const char *bif_name __unused,
|
||||
struct bridge_port *bp __unused, uint32_t enable __unused)
|
||||
bridge_port_set_admin_edge(const char *bif_name, struct bridge_port *bp,
|
||||
uint32_t enable)
|
||||
{
|
||||
struct ifdrv ifd;
|
||||
struct ifbreq b_req;
|
||||
@ -931,6 +934,52 @@ bridge_port_set_admin_edge(const char *bif_name __unused,
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set 'private' flag.
|
||||
*/
|
||||
int
|
||||
bridge_port_set_private(const char *bif_name, struct bridge_port *bp,
|
||||
uint32_t priv_set)
|
||||
{
|
||||
struct ifdrv ifd;
|
||||
struct ifbreq b_req;
|
||||
|
||||
if (bp->priv_set == priv_set)
|
||||
return (0);
|
||||
|
||||
bzero(&b_req, sizeof(b_req));
|
||||
strlcpy(ifd.ifd_name, bif_name, sizeof(ifd.ifd_name));
|
||||
ifd.ifd_len = sizeof(b_req);
|
||||
ifd.ifd_data = &b_req;
|
||||
strlcpy(b_req.ifbr_ifsname, bp->p_name, sizeof(b_req.ifbr_ifsname));
|
||||
ifd.ifd_cmd = BRDGGIFFLGS;
|
||||
|
||||
if (ioctl(sock, SIOCGDRVSPEC, &ifd) < 0) {
|
||||
syslog(LOG_ERR, "get member %s param: ioctl(BRDGGIFFLGS) "
|
||||
"failed: %s", bp->p_name, strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (priv_set == TruthValue_true)
|
||||
b_req.ifbr_ifsflags |= IFBIF_PRIVATE;
|
||||
else if (priv_set == TruthValue_false)
|
||||
b_req.ifbr_ifsflags &= ~IFBIF_PRIVATE;
|
||||
else
|
||||
return (SNMP_ERR_WRONG_VALUE);
|
||||
|
||||
ifd.ifd_cmd = BRDGSIFFLGS;
|
||||
if (ioctl(sock, SIOCSDRVSPEC, &ifd) < 0) {
|
||||
syslog(LOG_ERR, "set member %s param: ioctl(BRDGSIFFLGS) "
|
||||
"failed: %s", bp->p_name, strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
bp->priv_set = priv_set;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Add a bridge member port.
|
||||
*/
|
||||
|
@ -200,6 +200,7 @@ typedef TpFdbStatus ENUM (
|
||||
(4 begemotBridgeBasePortDelayExceededDiscards COUNTER GET)
|
||||
(5 begemotBridgeBasePortMtuExceededDiscards COUNTER GET)
|
||||
(6 begemotBridgeBasePortStatus RowStatus GET SET)
|
||||
(7 begemotBridgeBasePortPrivate TruthValue GET SET)
|
||||
))
|
||||
)
|
||||
(2 begemotBridgeStp
|
||||
|
@ -25,7 +25,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd December 8, 2006
|
||||
.Dd August 6, 2007
|
||||
.Dt snmp_bridge 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -83,6 +83,9 @@ has been SET already.
|
||||
.It Va destroy
|
||||
will attempt to remove the interface from the system bridge interface.
|
||||
.El
|
||||
.It Va begemotBridgeBasePortPrivate
|
||||
This object controls a bridge interface flag called PRIVATE where any private
|
||||
port can not communicate with another private port.
|
||||
.El
|
||||
.Sh RESTRICTIONS
|
||||
Not all information in the MIBs is currently available in FreeBSD.
|
||||
|
Loading…
Reference in New Issue
Block a user