Hello,
I have a custom board based off the MIMXRT1050-EVKB board and use Keilv5 Pro edition for development. My project includes a bootloader and jumps to external SDRAM for my main code. I currently have SNMP, SMTP, and HTTP all working in my project. I recently added SNMP and I can successfully send my board an OID such as " 1.3.6.1.2.1.1.1" and receive the correct information back through SNMP. I used the SNMP_Agent example project as a templet which I also got fully working on the MIMXRT1050-EVKB demo board.
The issue I am having is with sending a SNMP trap in my custom project. In the SNMP_Agent example, I added an SNMP trap and it sends out correctly with no issues using the following function:
netSNMP_Trap (NULL,6,1,NULL);
I attempt the same thing in my project, and I receive a status of "netInvalidParameter". I have figured out that this error is due to the server IP address. The manual states that the first parameter of netSNMP_Trap is the structure containing IP address of the Trap server. If NULL is passed in, the Trap server IP address will be taken from system configuration.
This is my system configuration in both my example and custom project, both exactly the same:
// <h>SNMP Agent#define SNMP_AGENT_ENABLE 1
// <s.15>Community Name// <i>Defines where an SNMP message is destined for.// <i>Default: "public"#define SNMP_AGENT_COMMUNITY "public"
// <o>Port Number <1-65535>// <i>Listening port number// <i>Default: 161#define SNMP_AGENT_PORT_NUM 161
// <o>Trap Port Number <1-65535>// <i>Port number for Trap operations// <i>Default: 162#define SNMP_AGENT_TRAP_PORT 162
// <s.15>Trap Server// <i>Trap Server IPv4 Address in text representation// <i>Default: "192.168.0.100"#define SNMP_AGENT_TRAP_IP "10.0.2.123"
When I manually input the server IP address, the SNMP trap is successful. Like this:
NET_ADDR SNMP_Server_Addr = { NET_ADDR_IP4, 2000, 10, 0, 2, 123 };
netSNMP_Trap (&SNMP_Server_Addr,6,1,NULL);
Question:
Why am I getting a status error of "netInvalidParameter" from netSNMP_Trap when using NULL as my server address parameter only in my custom project when the same exact code works in the example project?
Any help is appreciated.
Hello
I have moved your question to the Keil forum, where someone may be able to help you.
Thanks
Oli from the Community team
Apart from the invalid IP address for the first parameter of netSNMP_Trap(), there are also other possible reasons to lead to netInvalidParameter returned by netSNMP_Trap(). In order to find the root cause, you may enable the network lib debug output as written here https://developer.arm.com/documentation/ka004208/latest , or use Event Recorder to get the network lib debug output
This looks like an error in the network library. Please contact ARM support.
Our development team has confirmed there is a bug in netSNMP_Trap() when NULL used as the IP address parameter up to the latest Middleware pack v7.13.0, which will be fixed in the next Middleware pack release
Hi Cheng,
Thanks for looking into my issue. I understand this bug will be fixed in the next Middlepack update. Unfortunately, I will not be able to update to the latest Middlepack because my project would fail. Will there be a write up on this bug fix so I can implement it on my own?
Hi, just want to notify you that this issue has been now fixed.
If you are interested in getting the latest nightly build of Middleware pack which contains this bug fix, please open a support case Assistance Request (keil.com)