diff --git a/src/core/snmp/mib2.c b/src/core/snmp/mib2.c index afb3c312..c7ee1116 100644 --- a/src/core/snmp/mib2.c +++ b/src/core/snmp/mib2.c @@ -731,8 +731,10 @@ const struct mib_array_node mgmt = { /* internet .1.3.6.1 */ #if SNMP_PRIVATE_MIB +/* When using a private MIB, you have to create a file 'private_mib.h' that contains + * a 'struct mib_array_node mib_private' which contains your MIB. */ s32_t internet_ids[2] = { 2, 4 }; -struct mib_node* const internet_nodes[2] = { (struct mib_node* const)&mgmt, (struct mib_node* const)&private }; +struct mib_node* const internet_nodes[2] = { (struct mib_node* const)&mgmt, (struct mib_node* const)&mib_private }; const struct mib_array_node internet = { &noleafs_get_object_def, &noleafs_get_value, diff --git a/src/core/snmp/msg_in.c b/src/core/snmp/msg_in.c index 194b67df..05d30f91 100644 --- a/src/core/snmp/msg_in.c +++ b/src/core/snmp/msg_in.c @@ -88,6 +88,15 @@ snmp_init(void) msg_ps++; } trap_msg.pcb = snmp1_pcb; + +#ifdef SNMP_PRIVATE_MIB_INIT + /* If defined, rhis must be a function-like define to initialize the + * private MIB after the stack has been initialized. + * The private MIB can also be initialized in tcpip_callback (or after + * the stack is initialized), this define is only for convenience. */ + SNMP_PRIVATE_MIB_INIT(); +#endif /* SNMP_PRIVATE_MIB_INIT */ + /* The coldstart trap will only be output if our outgoing interface is up & configured */ snmp_coldstart_trap(); diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index c23318de..3dd7fe84 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -627,6 +627,8 @@ /** * SNMP_PRIVATE_MIB: + * When using a private MIB, you have to create a file 'private_mib.h' that contains + * a 'struct mib_array_node mib_private' which contains your MIB. */ #ifndef SNMP_PRIVATE_MIB #define SNMP_PRIVATE_MIB 0 diff --git a/src/include/lwip/snmp_msg.h b/src/include/lwip/snmp_msg.h index 49b5e409..8842893a 100644 --- a/src/include/lwip/snmp_msg.h +++ b/src/include/lwip/snmp_msg.h @@ -44,6 +44,8 @@ #if LWIP_SNMP #if SNMP_PRIVATE_MIB +/* When using a private MIB, you have to create a file 'private_mib.h' that contains + * a 'struct mib_array_node mib_private' which contains your MIB. */ #include "private_mib.h" #endif diff --git a/src/include/lwip/snmp_structs.h b/src/include/lwip/snmp_structs.h index 9f3f8a94..613d6de2 100644 --- a/src/include/lwip/snmp_structs.h +++ b/src/include/lwip/snmp_structs.h @@ -44,6 +44,8 @@ #include "lwip/snmp.h" #if SNMP_PRIVATE_MIB +/* When using a private MIB, you have to create a file 'private_mib.h' that contains + * a 'struct mib_array_node mib_private' which contains your MIB. */ #include "private_mib.h" #endif