Is it safe to invoke an SNMP Get within a sub-agent?

"Makavy, Erez (Erez)" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <AAB4B3D3CF0F454F98272CBE187FDE2F0A69457D@is0004avexu1.global.avaya.com>
Hey,
 
What do I need
----------------------
I want to invoke an SNMP get ( send an SNMP request PDU to the master
agent), within a sub-agent (on the same system).
In particular within a netsnmp_mib_handler - access_method.
Meaning that when the sub-agent receive a request for some OID1, it may
query the master agent for some other OID2,
and using that information decide what to return for OID1.
[Of course I have to be carefull so that OID2 retrival is not dependent
on OID1]
 
 
My solution - is it safe?
---------------------------------
Within the access_method of my (agentx) sub-agent, within the mode
MODE_GET, I basically invoke these net-snmp API function:
[in this order]
    -    snmp_sess_init(&session);
    -    ss = snmp_open(&session);
    -    pdu = snmp_pdu_create(i_queryType);
    -    snmp_synch_response(ss, pdu, &response);
    -    snmp_free_pdu(response);
    -    snmp_close(ss);
 
It seems to work,
but I'm not sure it safe, with all the global variables net-snmp is
using to manage sessions,
parse PDUs, and much more I don't know of...
 
Is it safe?
 
Thanks,
Erez.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.