I'm using some mib2c.iterate.conf generated code to implement some tables that are accessing external data. The get_first_data_point function allocates storage for the loop context (generally an integer or two) and calls get_next_data_point to finish setting it up (kinda like the netSnmpHostsTable_access.c example) - building the index, incrementing counters, etc. The get_next_data_point also, with each call, allocates a data context that is intended to be shared by all of the varbinds (requests) in the PDU. I use the free_loop_context_at_end and free_data_context handlers to free up this information.
Everything was fine doing gets and single-variable get-next walks, until I tried looking at the table with a table viewer that sends a single request containing all the columns to get a row at a time.
It turns out that net-snmp caches the data_context pointer with each request. After it's done processing the message it iterates through the requests, extracts the data_context pointer, and calls the free_data_context handler on each of them. It doesn't care that all of the requests are using the same data context. Unfortunately, at the moment, this means that a message that gets N columns in the same row means my data_context pointer gets freed N times.
[Insert explosion sound effect here]
I was under the impression that the data context was supposed to be per-row, not per variable. Is this not how it's intended to be used?
I tried moving the data context creation into a make_data_context handler. Unfortunately, that resulted in creating N data contexts for N variables, which at least matches the number freed, but blows my method current method of avoiding rollbacks or causing things to happen that can't be undone all to hell.
Is this a bug or my misunderstanding about how the data context is supposed to work?
-- Michael Kirkham www.muonics.com
------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ Net-snmp-coders mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
