diff --git a/userspace/snmpd/Makefile b/userspace/snmpd/Makefile index 30b4a00dda9e88a5708be849e0728886c07a2b76..640dd9d58a570b4f1f2dde20c82e9d6ebac09716 100644 --- a/userspace/snmpd/Makefile +++ b/userspace/snmpd/Makefile @@ -26,6 +26,7 @@ CFLAGS += -DWRS_WITH_SNMP_HACKISH_LOG=0 SHLIB = wrsSnmp.so SOURCES = \ shmem.c \ + dot-config.c \ snmp_shmem.c \ snmp_mmap.c \ wrsScalar.c \ diff --git a/userspace/snmpd/dot-config.c b/userspace/snmpd/dot-config.c new file mode 120000 index 0000000000000000000000000000000000000000..5607b5f222bd8732aa939789fcfa07ab2258028f --- /dev/null +++ b/userspace/snmpd/dot-config.c @@ -0,0 +1 @@ +../libwr/dot-config.c \ No newline at end of file diff --git a/userspace/snmpd/init.c b/userspace/snmpd/init.c index d994d3128872cbce506e9d3ca8f45db63ddc3667..1b4f22287c237259b793fd269522c243bc764b99 100644 --- a/userspace/snmpd/init.c +++ b/userspace/snmpd/init.c @@ -8,6 +8,7 @@ /* The sub-init functions */ #include "wrsSnmp.h" #include "snmp_shmem.h" +#include "libwr/config.h" #include "wrsGeneralStatusGroup.h" #include "wrsOSStatusGroup.h" #include "wrsNetworkingStatusGroup.h" @@ -21,12 +22,19 @@ #include "wrsPtpDataTable.h" #include "wrsPortStatusTable.h" +#define DOTCONFIG_FILE "/wr/etc/dot-config" FILE *wrs_logf; /* for the local-hack messages */ void init_wrsSnmp(void) { init_shm(); + if (libwr_cfg_read_file(DOTCONFIG_FILE)) { + /* unable to read dot-config, + * don't crash SNMPd, it will be reported in SNMP objects */ + snmp_log(LOG_ERR, "SNMP: unable to read dot-config file %s\n", + DOTCONFIG_FILE); + } init_wrsScalar(); init_wrsGeneralStatusGroup(); init_wrsOSStatusGroup();