Hi, this is my first foray into OpenSource land.
 
I seem to be unable to send PDU's to a UDP port other than 161.
 
I'm debugging on Win2K, but my target system will be Linux.
 
I'm using net-snmp 5.1.2.
 
Here's some background, which may also be of interest in itself.

I have one normal snmpd agent, listening on 161.  Call it MA1.  When I get 
OID's in certain ranges, I want the agent to handle them, then forward them 
another agent on another machine.  Call that SA.  To do this, I make SA an 
AgentX subagent.  To avoid converting between SNMP and AgentX myself, I thought 
I'd have another master agent on the first machine listening on port 1161 (call 
it MA2), let the SA connect to that, and have MA1 forward to MA2 under my 
program control.  I don't think I can use SNMP proxy because I want MA1 to do 
something with the data, in addition to forwarding it.
 
First question: Is this a reasonable approach, or am I missing a better way?
 
Second, I can't seem to get the MA1 handler to send SNMP PDU's to the MA2 on 
port 1161.  I set up the session that handles this to use remote port 1161, and 
then send PDU's.  Ethereal shows that the PDU's are sent to port 161.  Sounds 
like I'm misunderstanding when the port setting takes effect.
 
Also, while I'm debugging, to avoid the issue of whether 2 MA's can exist on 
the same machine, I am running MA1 and MA2 on separate machines.  In fact, 
right now SA is out of the picture.  I'm just trying to send SNMP PDU's from 
MA1 on one machine to MA2 on another, which happens to be listening on port 
1161.  MA2 seems happy, but MA1 just sends on 161.

Here's what I do:
 
>From init_myMibObjects(), after all the initialize_table_xxx()'s are called:
 
/* open an SNMP session */
snmp_sess_init ( &myStaticSession );
myStaticSession.peername = some IP address";
myStaticSession.remote_port = 1161;
    /* set the SNMP version number */
myStaticSession.version = SNMP_VERSION_2c;
    /* set the SNMPv1 community name used for authentication */
myStaticSession.community = strdup("public");
myStaticSession.community_len = strlen(myStaticSession.community);
 
mySession = snmp_open ( &myStaticSession);
 

// ...
// In the appropriate xxxTable_handler:
 
        {    
        struct snmp_pdu *response;
 
        snmp_synch_response ( mySession, pdu, & response );     // 
mySession->remotePort is 1161, but PDU goes out 161
        if (response)
                snmp_free_pdu(response);
        }
 
I'm trying to single step into net-snmp internals, but no luck so far.
 
Thanks,
 
Phil Gillis
 



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Net-snmp-coders mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to