cancel
Showing results for 
Search instead for 
Did you mean: 

SNMP v2c and v3 Support in STM32H753ZI with LwIP

Midhul_Pk
Associate II

Hello,

I am working on an SNMP implementation using STM32H753ZI with the LwIP Ethernet stack.

Currently, SNMP v1 is working successfully, including trap generation and reception testing using Net-SNMP tools. I am able to send enterprise-specific traps from the STM32 device.

Below is the trap code currently working for SNMP v1:

void send_temp_fault_trap(void)
{
    static const u32_t enterprise_oid_arr[] = {1,3,6,1,4,1,50598};
    struct snmp_obj_id enterprise_oid;
    enterprise_oid.len = LWIP_ARRAYSIZE(enterprise_oid_arr);
    memcpy(enterprise_oid.id,enterprise_oid_arr,sizeof(enterprise_oid_arr));

    ip_addr_t dst;
    IP4_ADDR(&dst, 192,168,0,255);
    snmp_trap_dst_ip_set(0, &dst);
    snmp_trap_dst_enable(0, 1);

    static const u32_t msg_oid_arr[] =
    {
        1,3,6,1,4,1,50898,10
    };

    static struct snmp_varbind vb;
    static struct snmp_obj_id msg_oid;
    static char msg[] = "System Working";
    msg_oid.len = LWIP_ARRAYSIZE(msg_oid_arr);
    memcpy(msg_oid.id,msg_oid_arr,sizeof(msg_oid_arr));

    vb.next = NULL;
    vb.oid = msg_oid;
    vb.type = SNMP_ASN1_TYPE_OCTET_STRING;
    vb.value = (void*)msg;
    vb.value_len = strlen(msg);     snmp_send_trap(&enterprise_oid,SNMP_GENTRAP_ENTERPRISE_SPECIFIC,MYTRAP_TEMP_FAULT,&vb);
    printf("SNMP Trap Sent\r\n");
}

Now I want to implement:

  1. SNMP v2c support
  2. SNMP v3 support

I have some questions regarding LwIP SNMP support on STM32:

  • Does the current LwIP SNMP agent fully support SNMP v2c and SNMP v3?
  • Are SNMPv2 traps/informs supported?
  • Is there any example project available for STM32H7 series?
  • Does LwIP provide built-in support for:
    • authentication (MD5/SHA)
    • privacy/encryption (DES/AES)
    • user-based security model (USM)
  • Are there any limitations in the STM32CubeH7 package regarding SNMP v3?
  • Is Net-SNMP interoperability tested with LwIP SNMP v3 implementation?

I would appreciate guidance or reference examples for enabling SNMP v2c/v3 in STM32 + LwIP.

Thank you.

4 REPLIES 4
Andrew Neil
Super User

Remember that LwIP is an independent 3rd-party project - not specific to ST.

 

So don't limit your searching to just ST/STM32; eg,

https://www.nongnu.org/lwip/2_0_x/group__snmp.html

https://github.com/particle-iot/lwip-contrib/tree/master/examples/snmp/snmp_v3

https://stackoverflow.com/questions/79783999/implementing-authentication-with-snmpv3-using-lwip-on-a-stm32-mcu

 

etc - via: https://www.google.com/search?q=LwIP+SNMP

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

Additionally, I would like to understand how SNMP trap handling is implemented for SNMP v2c and SNMP v3 in LwIP.

Currently, for SNMP v1, I am using: snmp_send_trap();

Questions:

  1. Is there a separate API available for:

    • SNMP v2c Trap

    • SNMP v2c Inform

    • SNMP v3 Trap/Notification

  2. Does LwIP internally support SNMPv2-Trap-PDU and InformRequest-PDU generation?

  3. Is there any example implementation available for sending SNMP v2c or SNMP v3 notifications from an STM32 device?

  4. For SNMP v3 notifications:

    • how are authentication and privacy handled?

    • how is the SNMP engine ID configured?

    • how are users/security parameters registered?

  5. Is the existing snmp_send_trap() API intended only for SNMP v1 traps, or can it also generate v2c/v3 notifications depending on configuration?

Any guidance, documentation references, or example code would be very helpful.

 


@Midhul_Pk wrote:

I would like to understand how SNMP trap handling is implemented for SNMP v2c and SNMP v3 in LwIP.


That would certainly be just down to LwIP - not specific to ST or STM32

 


@Midhul_Pk wrote:

Any guidance, documentation references, or example code would be very helpful.


Again, look to the GNU project, and general resources for this

https://www.nongnu.org/lwip/2_1_x/index.html

https://lists.nongnu.org/mailman/listinfo/lwip-users

How to make lwip SNMP work

https://lwip.fandom.com/wiki/Further_lwIP_support

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.