snmp Mibcontext

Thank you for providing the stack trace. With that the issue is clear:

  • You are using a self generated snmpv2_mib.cpp which does not match the sysOREntry table implementation AGENT++ expects to store the SysOREntry rows it receives from the subagent.
  • Because, that object is being looked up by context and OID, the agent fetches the “wrong” one and the casting then causes the segmentation violation.

How to fix this issue cleanly?

  1. Do not generate your own SNMPv2-MIB and add it to the master in any context. (Theoretically it would be possible though, but that would need to reimplement/overwrite a lot of code)
  2. At least do not use add any object with the sysOREntry OID to the Mib in any context to avoid this memory error by wrong casting. You can however, subclass the existing sysOREntry and then add such an instance, that would not be any problem.

Regarding SNMPv1/v2c context setup for communities, please refer to the corresponding RFC: