mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-11 18:13:40 +08:00
Work on task #14780: Add debug helper asserts to ensure threading/locking requirements are met
Add LWIP_ASSERT_CORE_LOCKED() to several more places
This commit is contained in:
@@ -235,6 +235,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("mibs pointer must be != NULL", (mibs != NULL));
|
||||
LWIP_ASSERT("num_mibs pointer must be != 0", (num_mibs != 0));
|
||||
snmp_mibs = mibs;
|
||||
@@ -257,6 +258,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();
|
||||
if (device_enterprise_oid == NULL) {
|
||||
snmp_device_enterprise_oid = &snmp_device_enterprise_oid_default;
|
||||
} else {
|
||||
@@ -270,6 +272,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();
|
||||
return snmp_device_enterprise_oid;
|
||||
}
|
||||
|
||||
|
||||
@@ -177,6 +177,7 @@ snmp_get_community(void)
|
||||
void
|
||||
snmp_set_community(const char *const community)
|
||||
{
|
||||
LWIP_ASSERT_CORE_LOCKED();
|
||||
LWIP_ASSERT("community string is too long!", strlen(community) <= SNMP_MAX_COMMUNITY_STR_LEN);
|
||||
snmp_community = community;
|
||||
}
|
||||
@@ -214,6 +215,7 @@ snmp_get_community_trap(void)
|
||||
void
|
||||
snmp_set_community_write(const char *const community)
|
||||
{
|
||||
LWIP_ASSERT_CORE_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;
|
||||
@@ -230,6 +232,7 @@ snmp_set_community_write(const char *const community)
|
||||
void
|
||||
snmp_set_community_trap(const char *const community)
|
||||
{
|
||||
LWIP_ASSERT_CORE_LOCKED();
|
||||
LWIP_ASSERT("community string is too long!", strlen(community) <= SNMP_MAX_COMMUNITY_STR_LEN);
|
||||
snmp_community_trap = community;
|
||||
}
|
||||
@@ -241,6 +244,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();
|
||||
snmp_write_callback = write_callback;
|
||||
snmp_write_callback_arg = callback_arg;
|
||||
}
|
||||
|
||||
@@ -116,6 +116,7 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,8 @@ snmp_init(void)
|
||||
struct udp_pcb *snmp_pcb = udp_new_ip_type(IPADDR_TYPE_ANY);
|
||||
LWIP_ERROR("snmp_raw: no PCB", (snmp_pcb != NULL), return;);
|
||||
|
||||
LWIP_ASSERT_CORE_LOCKED();
|
||||
|
||||
snmp_traps_handle = snmp_pcb;
|
||||
|
||||
udp_recv(snmp_pcb, snmp_recv, NULL);
|
||||
|
||||
@@ -111,6 +111,7 @@ static u8_t snmp_auth_traps_enabled = 0;
|
||||
void
|
||||
snmp_trap_dst_enable(u8_t dst_idx, u8_t enable)
|
||||
{
|
||||
LWIP_ASSERT_CORE_LOCKED();
|
||||
if (dst_idx < SNMP_TRAP_DESTINATIONS) {
|
||||
trap_dst[dst_idx].enable = enable;
|
||||
}
|
||||
@@ -125,6 +126,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();
|
||||
if (dst_idx < SNMP_TRAP_DESTINATIONS) {
|
||||
ip_addr_set(&trap_dst[dst_idx].dip, dst);
|
||||
}
|
||||
@@ -176,6 +178,8 @@ snmp_send_trap(const struct snmp_obj_id *eoid, s32_t generic_trap, s32_t specifi
|
||||
u16_t i, tot_len;
|
||||
err_t err = ERR_OK;
|
||||
|
||||
LWIP_ASSERT_CORE_LOCKED();
|
||||
|
||||
trap_msg.snmp_version = 0;
|
||||
|
||||
for (i = 0, td = &trap_dst[0]; i < SNMP_TRAP_DESTINATIONS; i++, td++) {
|
||||
|
||||
Reference in New Issue
Block a user