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 thesysOREntry
table implementation AGENT++ expects to store theSysOREntry
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?
- 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)
- At least do not use add any object with the
sysOREntry
OID to theMib
in any context to avoid this memory error by wrong casting. You can however, subclass the existingsysOREntry
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:
- https://www.rfc-editor.org/info/rfc3584 and the recent post
- SNMP4J Agent: Set from SNMP gets access denied provides hints too. This configs here need to be translated from SNMP4J-Agent to AGENT++, but this should be straight forward.