Skip to content
Snippets Groups Projects
Commit f333b913 authored by Adam Wujek's avatar Adam Wujek
Browse files

snmp: make sure that rtud's shmem is oppened before accessing it


Signed-off-by: default avatarAdam Wujek <dev_public@wujek.eu>
parent 8f2d1ed6
Branches
Tags
No related merge requests found
#include "wrsSnmp.h"
#include "snmp_shmem.h"
/* HAL */
struct wrs_shm_head *hal_head;
struct hal_shmem_header *hal_shmem;
......@@ -19,9 +20,10 @@ int *ppsi_ppi_nlinks=NULL;
/* RTUd */
struct wrs_shm_head *rtud_head;
int shmem_open_hald;
int shmem_open_ppsi;
int shmem_open_rtud;
int shmem_open_hald = 0;
int shmem_open_ppsi = 0;
int shmem_open_rtud = 0;
static int init_shm_hald(void)
{
......@@ -263,6 +265,9 @@ int shmem_rtu_read_vlans(struct rtu_vlan_table_entry *vlan_tab_local)
struct rtu_vlan_table_entry *vlan_tab_shm;
struct rtu_shmem_header *rtu_hdr;
if (!shmem_ready_rtud())
return -2;
rtu_hdr = (void *)rtud_head + rtud_head->data_off;
vlan_tab_shm = wrs_shm_follow(rtud_head, rtu_hdr->vlans);
if (!vlan_tab_shm)
......@@ -292,6 +297,9 @@ int shmem_rtu_read_htab(struct rtu_filtering_entry *rtu_htab_local, int *read_en
struct rtu_shmem_header *rtu_hdr;
struct rtu_filtering_entry *empty;
if (!shmem_ready_rtud())
return -2;
rtu_hdr = (void *)rtud_head + rtud_head->data_off;
htab_shm = wrs_shm_follow(rtud_head, rtu_hdr->filters);
if (!htab_shm)
......@@ -332,6 +340,9 @@ int shmem_rtu_read_ports(struct rtu_port_entry *ports_tab_local, int *nports)
struct rtu_port_entry *rtu_ports_shm;
struct rtu_shmem_header *rtu_hdr;
if (!shmem_ready_rtud())
return -2;
rtu_hdr = (void *)rtud_head + rtud_head->data_off;
rtu_ports_shm = wrs_shm_follow(rtud_head, rtu_hdr->rtu_ports);
if (!rtu_ports_shm)
......@@ -356,6 +367,7 @@ int shmem_rtu_read_ports(struct rtu_port_entry *ports_tab_local, int *nports)
return 0;
}
/* Compare entries by by MAC */
int cmp_rtu_entries_mac(const void *p1, const void *p2)
{
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment