SNMP snmp_init() fails

wiebe12
Posts: 1
Joined: Fri May 10, 2019 9:58 am

SNMP snmp_init() fails

Postby wiebe12 » Fri May 10, 2019 10:55 am

Hi,

I am new to c and I want to implement snmp in my project. I am using the esp-idf 3.2 on the ESP32-PoE.

I have used https://www.nongnu.org/lwip/2_1_x/group__snmp.html to setup snmp. But when I try to build the project the compiler can't find the snmp functions

Code: Select all

undefined reference to `snmp_mib2_set_syslocation'
undefined reference to `snmp_set_auth_traps_enabled'
undefined reference to `snmp_mib2_set_sysdescr'
undefined reference to `snmp_mib2_set_sysname'
undefined reference to `snmp_trap_dst_ip_set'
undefined reference to `snmp_trap_dst_enable'
undefined reference to `snmp_set_mibs'
undefined reference to `snmp_init'
But Visual Studio is able to find the declaration. Does somebody had the same problem?

So I copied all the snmp files from lwip in my project and included them in my CMakeLists.txt. Now I am able to build the project. However when I run the code I get the following error:

Code: Select all

C:/SysGCC/esp32/esp-idf/master/components/freertos/queue.c:1448 (xQueueGenericReceive)- assert failed!
abort() was called at PC 0x400851f5 on core 0
this happens when I run the snmp_init function;
  1. static void initialize_snmp(void)
  2. {
  3.    
  4.     snmp_mib2_set_syscontact(SNMP_SYSCONTACT, &SNMP_SYSCONTACT_LEN, snmp_buffer);
  5.     snmp_mib2_set_syslocation(SNMP_SYSLOCATION, &SNMP_SYSLOCATION_LEN, snmp_buffer);
  6.     snmp_set_auth_traps_enabled(ENABLE);
  7.     snmp_mib2_set_sysdescr(SNMP_SYSDESCR, &SNMP_SYSDESCR_LEN);
  8.     snmp_mib2_set_sysname(SNMP_SYSNAME, &SNMP_SYSNAME_LEN, snmp_buffer);
  9.    
  10.     ip_addr_t gw = {};
  11.         ipaddr_aton(SNMP_SERVER_IP,&gw);
  12.    
  13.     snmp_trap_dst_ip_set(TRAP_DESTINATION_INDEX, &gw);
  14.     snmp_trap_dst_enable(TRAP_DESTINATION_INDEX, ENABLE);
  15.     snmp_set_mibs(my_snmp_mibs, LWIP_ARRAYSIZE(my_snmp_mibs));
  16.    
  17.     snmp_init();
  18.     ESP_LOGI(TAG, "initialize_snmp() finished.");
  19.    
  20. }
Have anyone got good suggestions?

Who is online

Users browsing this forum: Baidu [Spider], Ice_hedgehog and 94 guests