SNMP netconn API should not check for core locked

See patch #9907
This commit is contained in:
Harrold Spier 2020-03-17 09:46:56 +01:00 committed by Simon Goldschmidt
parent ccea55370a
commit 79c8a04152
5 changed files with 18 additions and 11 deletions

View File

@ -238,7 +238,7 @@ static struct snmp_mib const *const *snmp_mibs = default_mibs;
void
snmp_set_mibs(const struct snmp_mib **mibs, u8_t num_mibs)
{
LWIP_ASSERT_CORE_LOCKED();
LWIP_ASSERT_SNMP_LOCKED();
LWIP_ASSERT("mibs pointer must be != NULL", (mibs != NULL));
LWIP_ASSERT("num_mibs pointer must be != 0", (num_mibs != 0));
snmp_mibs = mibs;
@ -261,7 +261,7 @@ snmp_set_mibs(const struct snmp_mib **mibs, u8_t num_mibs)
*/
void snmp_set_device_enterprise_oid(const struct snmp_obj_id *device_enterprise_oid)
{
LWIP_ASSERT_CORE_LOCKED();
LWIP_ASSERT_SNMP_LOCKED();
if (device_enterprise_oid == NULL) {
snmp_device_enterprise_oid = &snmp_device_enterprise_oid_default;
} else {
@ -275,7 +275,7 @@ void snmp_set_device_enterprise_oid(const struct snmp_obj_id *device_enterprise_
*/
const struct snmp_obj_id *snmp_get_device_enterprise_oid(void)
{
LWIP_ASSERT_CORE_LOCKED();
LWIP_ASSERT_SNMP_LOCKED();
return snmp_device_enterprise_oid;
}

View File

@ -44,6 +44,14 @@
extern "C" {
#endif
#if !defined LWIP_ASSERT_SNMP_LOCKED
#if SNMP_USE_RAW
#define LWIP_ASSERT_SNMP_LOCKED() LWIP_ASSERT_CORE_LOCKED()
#else
#define LWIP_ASSERT_SNMP_LOCKED()
#endif
#endif
/* (outdated) SNMPv1 error codes
* shall not be used by MIBS anymore, nevertheless required from core for properly answering a v1 request
*/

View File

@ -180,7 +180,7 @@ snmp_get_community(void)
void
snmp_set_community(const char *const community)
{
LWIP_ASSERT_CORE_LOCKED();
LWIP_ASSERT_SNMP_LOCKED();
LWIP_ASSERT("community string is too long!", strlen(community) <= SNMP_MAX_COMMUNITY_STR_LEN);
snmp_community = community;
}
@ -218,7 +218,7 @@ snmp_get_community_trap(void)
void
snmp_set_community_write(const char *const community)
{
LWIP_ASSERT_CORE_LOCKED();
LWIP_ASSERT_SNMP_LOCKED();
LWIP_ASSERT("community string must not be NULL", community != NULL);
LWIP_ASSERT("community string is too long!", strlen(community) <= SNMP_MAX_COMMUNITY_STR_LEN);
snmp_community_write = community;
@ -235,7 +235,7 @@ snmp_set_community_write(const char *const community)
void
snmp_set_community_trap(const char *const community)
{
LWIP_ASSERT_CORE_LOCKED();
LWIP_ASSERT_SNMP_LOCKED();
LWIP_ASSERT("community string is too long!", strlen(community) <= SNMP_MAX_COMMUNITY_STR_LEN);
snmp_community_trap = community;
}
@ -247,7 +247,7 @@ snmp_set_community_trap(const char *const community)
void
snmp_set_write_callback(snmp_write_callback_fct write_callback, void *callback_arg)
{
LWIP_ASSERT_CORE_LOCKED();
LWIP_ASSERT_SNMP_LOCKED();
snmp_write_callback = write_callback;
snmp_write_callback_arg = callback_arg;
}

View File

@ -116,7 +116,6 @@ snmp_get_local_ip_for_dst(void *handle, const ip_addr_t *dst, ip_addr_t *result)
void
snmp_init(void)
{
LWIP_ASSERT_CORE_LOCKED();
sys_thread_new("snmp_netconn", snmp_netconn_thread, NULL, SNMP_STACK_SIZE, SNMP_THREAD_PRIO);
}

View File

@ -142,7 +142,7 @@ static s32_t req_id = 1;
void
snmp_trap_dst_enable(u8_t dst_idx, u8_t enable)
{
LWIP_ASSERT_CORE_LOCKED();
LWIP_ASSERT_SNMP_LOCKED();
if (dst_idx < SNMP_TRAP_DESTINATIONS) {
trap_dst[dst_idx].enable = enable;
}
@ -159,7 +159,7 @@ snmp_trap_dst_enable(u8_t dst_idx, u8_t enable)
void
snmp_trap_dst_ip_set(u8_t dst_idx, const ip_addr_t *dst)
{
LWIP_ASSERT_CORE_LOCKED();
LWIP_ASSERT_SNMP_LOCKED();
if (dst_idx < SNMP_TRAP_DESTINATIONS) {
ip_addr_set(&trap_dst[dst_idx].dip, dst);
}
@ -380,7 +380,7 @@ snmp_send_trap_or_notification_or_inform_generic(struct snmp_msg_trap *trap_msg,
}
};
LWIP_ASSERT_CORE_LOCKED();
LWIP_ASSERT_SNMP_LOCKED();
snmp_v2_special_varbinds[0].next = &snmp_v2_special_varbinds[1];
snmp_v2_special_varbinds[1].prev = &snmp_v2_special_varbinds[0];