6

I'm currently developing a monitoring application for some in-house hardware using net-snmp. I have code that somewhat works, when calling snmp_pdu_free() my code segfaults. I am creating the pdu struct with snmp_create_pdu(). I would like an API reference to see if I am in fact writing my code correctly, but I haven't been able to find one. The best thing I've found is the tutorials on the net-snmp website, but they aren't much help for determining if my code is correct while I'm debugging.

Edward
  • 1,786
  • 1
  • 15
  • 33

3 Answers3

5

The Net-SNMP documentation is not very helpful, unfortunately. Overall, the API is a bugger to work with, but it does work.

Aside from net-snmp.org and the mailing list, this is the only other useful Net-SNMP related reference I've found useful:

http://www.cuddletech.com/articles/snmp/index.html

Also, sign up for the 'net-snmp-coders' mailing list. It is very active and you can get feedback directly from the authors of Net-SNMP.

http://www.net-snmp.org/support/mailinglists.html

Good luck.

sth
  • 222,467
  • 53
  • 283
  • 367
initzero
  • 852
  • 11
  • 13
2

There are MAN pages for net-snmp, try man snmp-free-pdu. If that doesn't help, the source code for 5.3.3 is available to download here:

http://sourceforge.net/projects/net-snmp/files/net-snmp/5.3.3%20source%20code/net-snmp-5.3.3.zip/download

Corehpf
  • 560
  • 1
  • 6
  • 14
  • The man pages don't mention snmp_create_pdu, though the tutorial does mention it and the sources reference it. – Edward Jul 29 '09 at 20:34
1

In the tutorial, they don't call snmp_free_pdu() to delete the PDU created with snmp_create_pdu(). Instead, they call it to delete the one returned by snmp_synch_response().

Indeed, it's stated in the comments:

The pdu is freed by snmp_send() unless a failure occured.

I personally think that it's an awkward design decision, but it's too late now.

Benoit Blanchon
  • 13,364
  • 4
  • 73
  • 81