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
86
Issues
86
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
f542031a
Commit
f542031a
authored
Jun 27, 2012
by
Juan Luis Manas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/wrsw_snmpd: fixed returned port number from ieee8021QBridgeTpFdbTable.
parent
1d2161e7
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
140 additions
and
88 deletions
+140
-88
rtu_fd.c
userspace/wrsw_rtud/rtu_fd.c
+10
-5
rtu_fd.h
userspace/wrsw_rtud/rtu_fd.h
+2
-0
rtu_fd_proxy.c
userspace/wrsw_rtud/rtu_fd_proxy.c
+62
-59
rtu_fd_proxy.h
userspace/wrsw_rtud/rtu_fd_proxy.h
+2
-0
rtu_fd_srv.c
userspace/wrsw_rtud/rtu_fd_srv.c
+2
-0
rtu_fd_structs.h
userspace/wrsw_rtud/rtu_fd_structs.h
+2
-0
ieee8021QBridgeTpFdbTable.c
...ce/wrsw_snmpd/ieee8021Qbridge/ieee8021QBridgeTpFdbTable.c
+48
-15
ieee8021QBridgeTpGroupTable.c
.../wrsw_snmpd/ieee8021Qbridge/ieee8021QBridgeTpGroupTable.c
+12
-9
No files found.
userspace/wrsw_rtud/rtu_fd.c
View file @
f542031a
...
...
@@ -607,11 +607,11 @@ static int fe_insert_static_entry(uint16_t vid,
// If an entry already exists in the fdb for the same mac and fid
// just register static entry in static_fdb list associated to it
// (if the static entry was only updated, it is already registered),
// and recalculate the forward vector combining static and dynamic info
// and recalculate the forward vector combining static and dynamic info
fe_register_static_entry
(
sfe
,
fe
);
calculate_forward_vector
(
fe
->
static_fdb
,
&
_port_map
,
&
_use_dynamic
);
ret
=
fe_update
(
fe
,
_port_map
,
ve
->
port_mask
,
_use_dynamic
,
STATIC
);
fe
->
is_bpdu
|=
sfe
->
is_bpdu
;
fe
->
is_bpdu
|=
sfe
->
is_bpdu
;
}
else
{
// Create pure static entry
calculate_forward_vector
(
sfe
,
&
_port_map
,
&
_use_dynamic
);
...
...
@@ -619,7 +619,7 @@ static int fe_insert_static_entry(uint16_t vid,
_use_dynamic
,
STATIC
);
if
(
ret
==
0
)
{
fe_register_static_entry
(
sfe
,
fe
);
fe
->
is_bpdu
|=
sfe
->
is_bpdu
;
fe
->
is_bpdu
|=
sfe
->
is_bpdu
;
}
}
return
ret
;
...
...
@@ -913,13 +913,15 @@ int rtu_fdb_create_dynamic_entry(uint8_t mac[ETH_ALEN],
int
rtu_fdb_read_entry
(
uint8_t
mac
[
ETH_ALEN
],
// in
uint8_t
fid
,
// in
uint32_t
*
port_map
,
// out
uint32_t
*
use_dynamic
,
// out
int
*
entry_type
)
// out
{
struct
filtering_entry
*
fe
;
lock
();
if
(
rtu_sw_find_entry
(
mac
,
fid
,
&
fe
))
{
*
port_map
=
fe
->
port_mask_dst
;
*
port_map
=
fe
->
port_mask_dst
;
*
use_dynamic
=
fe
->
use_dynamic
;
*
entry_type
=
fe
->
dynamic
;
return
unlock
(
0
);
}
...
...
@@ -934,6 +936,7 @@ int rtu_fdb_read_entry(uint8_t mac[ETH_ALEN], // in
int
rtu_fdb_read_next_entry
(
uint8_t
(
*
mac
)[
ETH_ALEN
],
// inout
uint8_t
*
fid
,
// inout
uint32_t
*
port_map
,
// out
uint32_t
*
use_dynamic
,
// out
int
*
entry_type
)
// out
{
struct
filtering_entry
*
fe
;
...
...
@@ -950,11 +953,13 @@ int rtu_fdb_read_next_entry(uint8_t (*mac)[ETH_ALEN], // inout
// htab/hcam should be always consistent
mac_copy
(
*
mac
,
fe
->
mac
);
*
fid
=
fe
->
fid
;
*
port_map
=
fe
->
port_mask_dst
;
*
port_map
=
fe
->
port_mask_dst
;
*
use_dynamic
=
fe
->
use_dynamic
;
*
entry_type
=
fe
->
dynamic
;
return
unlock
(
0
);
}
void
rtu_fdb_delete_dynamic_entries
(
int
port
,
uint16_t
vid
)
{
if
(
illegal
(
port
)
||
reserved
(
vid
))
...
...
userspace/wrsw_rtud/rtu_fd.h
View file @
f542031a
...
...
@@ -56,6 +56,7 @@ int rtu_fdb_read_entry(
uint8_t
mac
[
ETH_ALEN
],
uint8_t
fid
,
uint32_t
*
port_map
,
uint32_t
*
use_dynamic
,
int
*
entry_type
)
__attribute__
((
warn_unused_result
));
...
...
@@ -63,6 +64,7 @@ int rtu_fdb_read_next_entry(
uint8_t
(
*
mac
)[
ETH_ALEN
],
// inout
uint8_t
*
fid
,
// inout
uint32_t
*
port_map
,
// out
uint32_t
*
use_dynamic
,
// out
int
*
entry_type
// out
)
__attribute__
((
warn_unused_result
));
...
...
userspace/wrsw_rtud/rtu_fd_proxy.c
View file @
f542031a
...
...
@@ -52,7 +52,7 @@ static inline void check_conn(void)
{
int
err
=
errno
;
if
(
err
==
EPIPE
||
err
==
ENOTCONN
||
err
==
ECONNREFUSED
)
{
minipc_close
(
client
);
minipc_close
(
client
);
client
=
NULL
;
errno
=
err
;
}
...
...
@@ -84,7 +84,7 @@ int rtu_fdb_proxy_create_static_entry(
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_create_static_entry_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -104,7 +104,7 @@ int rtu_fdb_proxy_delete_static_entry(
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_delete_static_entry_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -112,6 +112,7 @@ int rtu_fdb_proxy_read_entry(
uint8_t
mac
[
ETH_ALEN
],
uint8_t
fid
,
uint32_t
*
port_map
,
uint32_t
*
use_dynamic
,
int
*
entry_type
)
{
struct
rtu_fdb_read_entry_argdata
in
;
...
...
@@ -126,10 +127,11 @@ int rtu_fdb_proxy_read_entry(
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_read_entry_struct
,
&
out
,
&
in
)
==
0
)
{
*
port_map
=
out
.
port_map
;
*
entry_type
=
out
.
entry_type
;
*
port_map
=
out
.
port_map
;
*
use_dynamic
=
out
.
use_dynamic
;
*
entry_type
=
out
.
entry_type
;
}
else
{
check_conn
();
check_conn
();
}
return
out
.
retval
;
}
...
...
@@ -138,6 +140,7 @@ int rtu_fdb_proxy_read_next_entry(
uint8_t
(
*
mac
)[
ETH_ALEN
],
uint8_t
*
fid
,
uint32_t
*
port_map
,
uint32_t
*
use_dynamic
,
int
*
entry_type
)
{
struct
rtu_fdb_read_next_entry_argdata
in
;
...
...
@@ -155,9 +158,10 @@ int rtu_fdb_proxy_read_next_entry(
mac_copy
(
*
mac
,
out
.
mac
);
*
fid
=
out
.
fid
;
*
port_map
=
out
.
port_map
;
*
use_dynamic
=
out
.
use_dynamic
;
*
entry_type
=
out
.
entry_type
;
}
else
{
check_conn
();
check_conn
();
}
return
out
.
retval
;
}
...
...
@@ -187,7 +191,7 @@ int rtu_fdb_proxy_read_static_entry(
*
type
=
out
.
type
;
*
active
=
out
.
active
;
}
else
{
check_conn
();
check_conn
();
}
return
out
.
retval
;
}
...
...
@@ -219,7 +223,7 @@ int rtu_fdb_proxy_read_next_static_entry(
*
active
=
out
.
active
;
mac_copy
(
*
mac
,
out
.
mac
);
}
else
{
check_conn
();
check_conn
();
}
return
out
.
retval
;
}
...
...
@@ -241,7 +245,7 @@ int rtu_fdb_proxy_set_aging_time(
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_set_aging_time_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -257,7 +261,7 @@ unsigned long rtu_fdb_proxy_get_aging_time(uint8_t fid)
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_get_aging_time_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
.
retval
;
}
...
...
@@ -275,7 +279,7 @@ uint16_t rtu_fdb_proxy_get_num_dynamic_entries(uint8_t fid)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_get_num_dynamic_entries_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
.
retval
;
}
...
...
@@ -292,7 +296,7 @@ uint32_t rtu_fdb_proxy_get_num_learned_entry_discards(uint8_t fid)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_get_num_learned_entry_discards_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
.
retval
;
}
...
...
@@ -306,7 +310,7 @@ uint16_t rtu_fdb_proxy_get_num_vlans(void)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_get_num_vlans_struct
,
&
out
)
<
0
)
check_conn
();
check_conn
();
return
out
.
retval
;
}
...
...
@@ -320,7 +324,7 @@ uint16_t rtu_fdb_proxy_get_max_supported_vlans(void)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_get_max_supported_vlans_struct
,
&
out
)
<
0
)
check_conn
();
check_conn
();
return
out
.
retval
;
}
...
...
@@ -332,9 +336,9 @@ uint16_t rtu_fdb_proxy_get_max_vid(void)
return
-
1
;
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_get_max_vid_struct
,
&
out
)
<
0
)
check_conn
();
check_conn
();
return
out
.
retval
;
}
...
...
@@ -348,7 +352,7 @@ uint64_t rtu_fdb_proxy_get_num_vlan_deletes(void)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_get_num_vlan_deletes_struct
,
&
out
)
<
0
)
check_conn
();
check_conn
();
return
out
.
retval
;
}
...
...
@@ -365,7 +369,7 @@ uint16_t rtu_fdb_proxy_get_next_fid(uint8_t fid)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_get_next_fid_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
.
retval
;
}
...
...
@@ -389,7 +393,7 @@ int rtu_fdb_proxy_create_static_vlan_entry(
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_create_static_vlan_entry_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -406,7 +410,7 @@ int rtu_fdb_proxy_delete_static_vlan_entry(uint16_t vid)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_delete_static_vlan_entry_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -431,7 +435,7 @@ int rtu_fdb_proxy_read_static_vlan_entry(
*
forbidden_ports
=
out
.
forbidden_ports
;
*
untagged_set
=
out
.
untagged_set
;
}
else
{
check_conn
();
check_conn
();
}
return
out
.
retval
;
}
...
...
@@ -458,7 +462,7 @@ int rtu_fdb_proxy_read_next_static_vlan_entry(
*
forbidden_ports
=
out
.
forbidden_ports
;
*
untagged_set
=
out
.
untagged_set
;
}
else
{
check_conn
();
check_conn
();
}
return
out
.
retval
;
}
...
...
@@ -488,7 +492,7 @@ int rtu_fdb_proxy_read_vlan_entry(
*
untagged_set
=
out
.
untagged_set
;
*
creation_t
=
out
.
creation_t
;
}
else
{
check_conn
();
check_conn
();
}
return
out
.
retval
;
}
...
...
@@ -519,7 +523,7 @@ int rtu_fdb_proxy_read_next_vlan_entry(
*
untagged_set
=
out
.
untagged_set
;
*
creation_t
=
out
.
creation_t
;
}
else
{
check_conn
();
check_conn
();
}
return
out
.
retval
;
}
...
...
@@ -538,7 +542,7 @@ int rtu_vfdb_proxy_forward_dynamic(int port, uint16_t vid)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_vfdb_forward_dynamic_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -556,7 +560,7 @@ int rtu_vfdb_proxy_filter_dynamic(int port, uint16_t vid)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_vfdb_filter_dynamic_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -570,11 +574,11 @@ void rtu_fdb_proxy_delete_dynamic_entries(int port, uint16_t vid)
in
.
vid
=
vid
;
in
.
port
=
port
;
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_delete_dynamic_entries_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
}
int
rtu_fdb_proxy_is_restricted_vlan_reg
(
int
port
)
...
...
@@ -590,7 +594,7 @@ int rtu_fdb_proxy_is_restricted_vlan_reg(int port)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_is_restricted_vlan_reg_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -607,7 +611,7 @@ int rtu_fdb_proxy_set_restricted_vlan_reg(int port)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_set_restricted_vlan_reg_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -624,7 +628,7 @@ int rtu_fdb_proxy_unset_restricted_vlan_reg(int port)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_unset_restricted_vlan_reg_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -637,7 +641,7 @@ int rtu_fdb_proxy_get_size(void)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_get_size_struct
,
&
out
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -651,7 +655,7 @@ int rtu_fdb_proxy_get_num_all_static_entries(void)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_get_num_all_static_entries_struct
,
&
out
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -665,7 +669,7 @@ int rtu_fdb_proxy_get_num_all_dynamic_entries(void)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_get_num_all_dynamic_entries_struct
,
&
out
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -679,7 +683,7 @@ int rtu_vfdb_proxy_get_num_all_static_entries(void)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_vfdb_get_num_all_static_entries_struct
,
&
out
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -693,7 +697,7 @@ int rtu_vfdb_proxy_get_num_all_dynamic_entries(void)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_vfdb_get_num_all_dynamic_entries_struct
,
&
out
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -710,9 +714,9 @@ int rtu_fdb_proxy_create_lc(int sid, uint16_t vid, int lc_type)
in
.
lc_type
=
lc_type
;
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_create_lc_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -728,9 +732,9 @@ int rtu_fdb_proxy_delete_lc(int sid, uint16_t vid)
in
.
vid
=
vid
;
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_delete_lc_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -745,11 +749,11 @@ int rtu_fdb_proxy_read_lc(uint16_t vid, int *lc_set)
in
.
vid
=
vid
;
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_read_lc_struct
,
&
out
,
&
in
)
==
0
)
{
*
lc_set
=
out
.
lc_set
;
}
else
{
check_conn
();
check_conn
();
}
return
out
.
retval
;
}
...
...
@@ -765,12 +769,12 @@ int rtu_fdb_proxy_read_next_lc(uint16_t *vid, int *lc_set)
in
.
vid
=
*
vid
;
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_read_next_lc_struct
,
&
out
,
&
in
)
==
0
)
{
*
vid
=
out
.
vid
;
*
lc_set
=
out
.
lc_set
;
}
else
{
check_conn
();
check_conn
();
}
return
out
.
retval
;
}
...
...
@@ -787,7 +791,7 @@ int rtu_fdb_proxy_read_lc_set_type(int sid, int *lc_type)
&
rtu_fdb_read_lc_set_type_struct
,
&
out
,
sid
)
==
0
)
{
*
lc_type
=
out
.
lc_type
;
}
else
{
check_conn
();
check_conn
();
}
return
out
.
retval
;
}
...
...
@@ -800,9 +804,9 @@ int rtu_fdb_proxy_set_default_lc(int sid)
return
-
1
;
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_set_default_lc_struct
,
&
out
,
sid
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -819,7 +823,7 @@ void rtu_fdb_proxy_get_default_lc(int *sid, int *lc_type)
*
sid
=
out
.
sid
;
*
lc_type
=
out
.
lc_type
;
}
else
{
check_conn
();
check_conn
();
}
}
...
...
@@ -834,12 +838,12 @@ void rtu_fdb_proxy_read_fid(uint16_t vid, uint8_t *fid, int *fid_fixed)
in
.
vid
=
vid
;
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_read_fid_struct
,
&
out
,
&
in
)
==
0
)
{
*
fid
=
out
.
fid
;
*
fid_fixed
=
out
.
fid_fixed
;
}
else
{
check_conn
();
check_conn
();
}
}
...
...
@@ -854,13 +858,13 @@ int rtu_fdb_proxy_read_next_fid(uint16_t *vid, uint8_t *fid, int *fid_fixed)
in
.
vid
=
*
vid
;
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_read_next_fid_struct
,
&
out
,
&
in
)
==
0
)
{
*
vid
=
out
.
vid
;
*
fid
=
out
.
fid
;
*
fid_fixed
=
out
.
fid_fixed
;
}
else
{
check_conn
();
check_conn
();
}
return
out
.
retval
;
}
...
...
@@ -877,9 +881,9 @@ int rtu_fdb_proxy_set_fid(uint16_t vid, uint8_t fid)
in
.
fid
=
fid
;
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_set_fid_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -894,9 +898,9 @@ int rtu_fdb_proxy_delete_fid(uint16_t vid)
in
.
vid
=
vid
;
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_delete_fid_struct
,
&
out
,
&
in
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -910,7 +914,7 @@ int rtu_fdb_proxy_set_default_lc_type(int lc_type)
errno
=
0
;
if
(
minipc_call
(
client
,
MILLISEC_TIMEOUT
,
&
rtu_fdb_set_default_lc_type_struct
,
&
out
,
lc_type
)
<
0
)
check_conn
();
check_conn
();
return
out
;
}
...
...
@@ -929,4 +933,3 @@ int rtu_fdb_proxy_connected()
rtu_fdb_proxy_get_size
();
return
(
int
)
client
;
}
userspace/wrsw_rtud/rtu_fd_proxy.h
View file @
f542031a
...
...
@@ -56,6 +56,7 @@ int rtu_fdb_proxy_read_entry(
uint8_t
mac
[
ETH_ALEN
],
uint8_t
fid
,
uint32_t
*
port_map
,
uint32_t
*
use_dynamic
,
int
*
entry_type
)
__attribute__
((
warn_unused_result
));
...
...
@@ -63,6 +64,7 @@ int rtu_fdb_proxy_read_next_entry(
uint8_t
(
*
mac
)[
ETH_ALEN
],
// inout
uint8_t
*
fid
,
// inout
uint32_t
*
port_map
,
// out
uint32_t
*
use_dynamic
,
// out
int
*
entry_type
// out
)
__attribute__
((
warn_unused_result
));
...
...
userspace/wrsw_rtud/rtu_fd_srv.c
View file @
f542031a
...
...
@@ -138,6 +138,7 @@ static int rtu_fdb_srv_read_entry(
in
->
mac
,
in
->
fid
,
&
out
->
port_map
,
&
out
->
use_dynamic
,
&
out
->
entry_type
);
...
...
@@ -157,6 +158,7 @@ static int rtu_fdb_srv_read_next_entry(
&
in
->
mac
,
&
in
->
fid
,
&
out
->
port_map
,
&
out
->
use_dynamic
,
&
out
->
entry_type
);
...
...
userspace/wrsw_rtud/rtu_fd_structs.h
View file @
f542031a
...
...
@@ -93,6 +93,7 @@ struct rtu_fdb_read_entry_argdata {
struct
rtu_fdb_read_entry_retdata
{
int
retval
;
uint32_t
port_map
;
uint32_t
use_dynamic
;
int
entry_type
;
};
...
...
@@ -107,6 +108,7 @@ struct rtu_fdb_read_next_entry_retdata {
uint8_t
mac
[
ETH_ALEN
];
uint8_t
fid
;
uint32_t
port_map
;
uint32_t
use_dynamic
;
int
entry_type
;
};
...
...
userspace/wrsw_snmpd/ieee8021Qbridge/ieee8021QBridgeTpFdbTable.c
View file @
f542031a
...
...
@@ -51,16 +51,50 @@ struct mib_fdb_table_entry {
// Columns
uint32_t
port_map
;
uint32_t
use_dynamic
;
int
type
;
};
static
int
_log2
(
uint32_t
val
)
{
int
ret
=
-
1
;
while
(
val
>>=
1
)
ret
++
;
return
ret
;
}
static
unsigned
int
port_no
(
struct
mib_fdb_table_entry
*
ent
)
{
int
ret
=
-
1
;
uint32_t
port_map_dyn
,
port_map_stc
,
port_map
;
switch
(
ent
->
type
)
{
case
STATIC
:
return
0
;
case
DYNAMIC
:
port_map
=
ent
->
port_map
;
break
;
case
STATIC_DYNAMIC
:
port_map_dyn
=
ent
->
port_map
&
ent
->
use_dynamic
;
port_map_stc
=
ent
->
port_map
&
~
ent
->
use_dynamic
;
port_map
=
port_map_dyn
?
port_map_dyn
:
port_map_stc
;
break
;
}
while
(
port_map
)
{
ret
++
;
port_map
>>=
1
;
}
// TODO fix. port number 0 is reserved but RTU hardware uses it.
return
(
ret
==
-
1
)
?
0
:
ret
;
}
static
unsigned
int
entry_type
(
struct
mib_fdb_table_entry
*
ent
)
{
switch
(
ent
->
type
)
{
case
STATIC
:
return
Mgmt
;
case
DYNAMIC
:
return
ent
->
port_map
?
Learned
:
other
;
case
STATIC_DYNAMIC
:
return
(
ent
->
port_map
&
ent
->
use_dynamic
)
?
Learned
:
Mgmt
;
}
}
/**
* Get indexes for an entry.
...
...
@@ -111,11 +145,10 @@ static int get_column(netsnmp_variable_list *vb,
{
switch
(
colnum
)
{
case
COLUMN_PORT
:
snmp_set_var_typed_integer
(
vb
,
ASN_UNSIGNED
,
_log2
(
ent
->
port_map
));
snmp_set_var_typed_integer
(
vb
,
ASN_UNSIGNED
,
port_no
(
ent
));
break
;
case
COLUMN_STATUS
:
snmp_set_var_typed_integer
(
vb
,
ASN_INTEGER
,
(
ent
->
type
==
STATIC
)
?
Mgmt
:
Learned
);
snmp_set_var_typed_integer
(
vb
,
ASN_INTEGER
,
entry_type
(
ent
));
break
;
default:
return
SNMP_NOSUCHOBJECT
;
...
...
@@ -142,13 +175,14 @@ static int get(netsnmp_request_info *req, netsnmp_handler_registration *reginfo)
return
SNMP_NOSUCHINSTANCE
;
// Read entry from FDB.
err
=
rtu_fdb_proxy_read_entry
(
ent
.
mac
,
ent
.
fid
,
&
ent
.
port_map
,
&
ent
.
type
);
err
=
rtu_fdb_proxy_read_entry
(
ent
.
mac
,
ent
.
fid
,
&
ent
.
port_map
,
&
ent
.
use_dynamic
,
&
ent
.
type
);
if
(
errno
)
goto
minipc_err
;
if
(
err
)
goto
entry_not_found
;
return
get_column
(
req
->
requestvb
,
tinfo
->
colnum
,
&
ent
);
return
get_column
(
req
->
requestvb
,
tinfo
->
colnum
,
&
ent
);
entry_not_found:
DEBUGMSGTL
((
MIBMOD
,
"entry fid=%d mac=%s not found in fdb
\n
"
,
...
...
@@ -190,9 +224,8 @@ static int get_next(netsnmp_request_info *req,
return
SNMP_ENDOFMIBVIEW
;
do
{
err
=
rtu_fdb_proxy_read_next_entry
(
&
ent
.
mac
,
&
ent
.
fid
,
&
ent
.
port_map
,
&
ent
.
type
);
err
=
rtu_fdb_proxy_read_next_entry
(
&
ent
.
mac
,
&
ent
.
fid
,
&
ent
.
port_map
,
&
ent
.
use_dynamic
,
&
ent
.
type
);
if
(
errno
)
goto
minipc_err
;
if
(
err
)
...
...
userspace/wrsw_snmpd/ieee8021Qbridge/ieee8021QBridgeTpGroupTable.c
View file @
f542031a
...
...
@@ -51,6 +51,7 @@ struct mib_group_table_entry {
// Columns
uint32_t
port_map
;
uint32_t
use_dynamic
;
};
/**
...
...
@@ -65,7 +66,7 @@ static int read_next_vid(uint16_t *vid)
uint32_t
pm
,
us
;
unsigned
long
ct
;
err
=
rtu_fdb_proxy_read_vlan_entry
(
*
vid
,
&
fid
,
&
t
,
&
pm
,
&
us
,
&
ct
);
if
(
errno
)
goto
minipc_err
;
...
...
@@ -110,7 +111,7 @@ static int read_next_entry(struct mib_group_table_entry *ent)
vid_a
=
ent
->
vid
;
mac_copy
(
mac_a
,
ent
->
mac
);
err
=
rtu_fdb_proxy_read_next_static_entry
(
&
mac_a
,
&
vid_a
,
&
ep
,
&
fp
,
&
t
,
&
s
);
if
(
errno
)
goto
minipc_err
;
...
...
@@ -131,7 +132,7 @@ static int read_next_entry(struct mib_group_table_entry *ent)
vid_b
=
WILDCARD_VID
;
mac_copy
(
mac_b
,
ent
->
mac
);
err
=
rtu_fdb_proxy_read_next_static_entry
(
&
mac_b
,
&
vid_b
,
&
ep
,
&
fp
,
&
t
,
&
s
);
if
(
errno
)
goto
minipc_err
;
...
...
@@ -274,15 +275,16 @@ static int get(netsnmp_request_info *req, netsnmp_handler_registration *reginfo)
// 802.1Q (12.7.7) When operating on a Dynamic Filtering Entry [...] the
// value used in the VID parameter can be any VID that has been allocated
// to the FID concerned)
err
=
rtu_fdb_proxy_read_vlan_entry
(
ent
.
vid
,
&
fid
,
&
t
,
&
port_mask
,
&
us
,
&
ct
);
if
(
errno
)
goto
minipc_err
;
if
(
err
)
goto
vlan_not_found
;
err
=
rtu_fdb_proxy_read_entry
(
ent
.
mac
,
fid
,
&
ent
.
port_map
,
&
t
);
err
=
rtu_fdb_proxy_read_entry
(
ent
.
mac
,
fid
,
&
ent
.
port_map
,
&
ent
.
use_dynamic
,
&
t
);
if
(
errno
)
goto
minipc_err
;
if
(
err
)
...
...
@@ -334,15 +336,16 @@ static int get_next(netsnmp_request_info *req,
if
(
err
)
return
err
;
// Obtain FID assigned to VID
err
=
rtu_fdb_proxy_read_vlan_entry
(
ent
.
vid
,
&
fid
,
&
t
,
&
port_mask
,
&
us
,
&
ct
);
if
(
errno
)
goto
minipc_err
;
if
(
err
)
goto
vlan_not_found
;
// Read entry from FDB
err
=
rtu_fdb_proxy_read_entry
(
ent
.
mac
,
fid
,
&
ent
.
port_map
,
&
t
);
err
=
rtu_fdb_proxy_read_entry
(
ent
.
mac
,
fid
,
&
ent
.
port_map
,
&
ent
.
use_dynamic
,
&
t
);
if
(
errno
)
goto
minipc_err
;
if
(
err
)
...
...
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