Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
83
Issues
83
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
e6582246
Commit
e6582246
authored
Oct 08, 2020
by
Michal Wasiak
Committed by
Adam Wujek
Oct 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
snmp/bridge_mib: update dot1dBase
Signed-off-by:
Michal Wasiak
<
michal.wasiak@gmail.com
>
parent
8a46e224
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
11 deletions
+31
-11
Makefile
userspace/snmpd/bridge_mib/Makefile
+1
-0
dot1dBase.c
userspace/snmpd/bridge_mib/dot1dBase.c
+26
-11
dot1dBase.h
userspace/snmpd/bridge_mib/dot1dBase.h
+2
-0
init_bridge_mib.c
userspace/snmpd/bridge_mib/init_bridge_mib.c
+2
-0
No files found.
userspace/snmpd/bridge_mib/Makefile
View file @
e6582246
...
...
@@ -13,6 +13,7 @@ include $(BRIDGE_INCLUDE_DIRS)
CFLAGS
+=
-I
$(BRIDGE_MIB_DIR)
BRIDGE_MIB_SRCS
+=
\
dot1dBase.c
\
init_bridge_mib.c
BRIDGE_MIB_SRCS
:=
$
(
addprefix
$(BRIDGE_MIB_DIR)
/,
$(BRIDGE_MIB_SRCS)
)
userspace/snmpd/bridge_mib/dot1dBase.c
View file @
e6582246
...
...
@@ -8,6 +8,8 @@
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "dot1dBase.h"
#include "wrsSnmp.h"
#include "snmp_shmem.h"
/** Initializes the dot1dBase module */
void
...
...
@@ -47,15 +49,25 @@ handle_dot1dBaseBridgeAddress(netsnmp_mib_handler *handler,
/* a instance handler also only hands us one request at a time, so
we don't need to loop over a list of requests; we'll only get one. */
int
i
;
switch
(
reqinfo
->
mode
)
{
case
MODE_GET
:
snmp_set_var_typed_value
(
requests
->
requestvb
,
ASN_OCTET_STR
,
/* XXX: a pointer to the scalar's data */
,
/* XXX: the length of the data in bytes */
);
break
;
/* look for a first port */
for
(
i
=
0
;
i
<
hal_nports_local
;
i
++
)
{
if
(
!
strcmp
(
hal_ports
[
i
].
name
,
FIRST_PORT_NAME
))
{
/* First port found */
snmp_set_var_typed_value
(
requests
->
requestvb
,
ASN_OCTET_STR
,
hal_ports
[
i
].
hw_addr
,
ETH_ALEN
);
/* no need for more checks */
return
SNMP_ERR_NOERROR
;
}
}
snmp_log
(
LOG_ERR
,
"Port name (%s) not found for handle_dot1dBaseBridgeAddress!
\n
"
,
FIRST_PORT_NAME
);
return
SNMP_ERR_GENERR
;
default:
/* we should never get here, so this is a really bad error */
...
...
@@ -76,13 +88,15 @@ handle_dot1dBaseNumPorts(netsnmp_mib_handler *handler,
/* a instance handler also only hands us one request at a time, so
we don't need to loop over a list of requests; we'll only get one. */
/* Get the port number from HAL */
int
port_num
=
hal_nports_local
;
switch
(
reqinfo
->
mode
)
{
case
MODE_GET
:
snmp_set_var_typed_value
(
requests
->
requestvb
,
ASN_INTEGER
,
/* XXX: a pointer to the scalar's data */
,
/* XXX: the length of the data in bytes */
);
&
port_num
,
sizeof
(
port_num
)
);
break
;
...
...
@@ -106,12 +120,13 @@ handle_dot1dBaseType(netsnmp_mib_handler *handler,
/* a instance handler also only hands us one request at a time, so
we don't need to loop over a list of requests; we'll only get one. */
int
baseType
=
BASETYPE_TRANSPARENT_ONLY
;
switch
(
reqinfo
->
mode
)
{
case
MODE_GET
:
snmp_set_var_typed_value
(
requests
->
requestvb
,
ASN_INTEGER
,
/* XXX: a pointer to the scalar's data */
,
/* XXX: the length of the data in bytes */
);
&
baseType
,
sizeof
(
baseType
)
);
break
;
...
...
userspace/snmpd/bridge_mib/dot1dBase.h
View file @
e6582246
...
...
@@ -11,6 +11,8 @@
#define BASETYPE_SOURCEROUTE_ONLY 3
#define BASETYPE_SRT 4
#define FIRST_PORT_NAME "wri1"
/* function declarations */
void
init_dot1dBase
(
void
);
Netsnmp_Node_Handler
handle_dot1dBaseBridgeAddress
;
...
...
userspace/snmpd/bridge_mib/init_bridge_mib.c
View file @
e6582246
...
...
@@ -8,11 +8,13 @@
/* The sub-init functions */
#include "wrsSnmp.h"
#include "snmp_shmem.h"
#include "dot1dBase.h"
#include "dot1dTpFdbTable/dot1dTpFdbTable.h"
#include "dot1qFdbTable/dot1qFdbTable.h"
void
init_bridge_mib
(
void
)
{
init_dot1dBase
();
init_dot1dTpFdbTable
();
init_dot1qFdbTable
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment