I tried adding this line to target.c:get_target_sessoin():
netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENT_ADDR,
"localhost:6666");
So the new code looks like this:
Line
------
155 netsnmp_transport *t = NULL;
156
157 netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_CLIENT_ADDR, "localhost:6666");
158
159 t = netsnmp_tdomain_transport_oid(targaddrs->
.....
(I also disabled engineID probe, and set the remote engineID manually.
as you can see the USM processing is successful)
I get an error, you can see in the debug logs:
----------------------------------------------------
netsnmp_sockaddr_in: addr 0xbfe7c040, peername "localhost:6666"
netsnmp_sockaddr_in: port number suffix :6666
netsnmp_sockaddr_in: hostname (resolved okay)
netsnmp_sockaddr_in: return { AF_INET, 127.0.0.1:6666 }
target_sessions: to: UDP: [135.64.102.136]:162
target_sessions: timeout: 1500 -> 1500000
target_sessions: setting SNMP_FLAG_DONT_PROB for snmp_add, and EIDusm:
match on user usr1
target_sessions: looking for: trap
target_sessions: for: 0=trap
target_sessions: looking for: inform
target_sessions: for: 0=inform
target_sessions: found one: inform
netsnmp_udp: open remote UDP: [135.64.102.136]:162:41472
netsnmp_sockaddr_in: addr 0xbfe7c040, peername "localhost:6666"
netsnmp_sockaddr_in: port number suffix :6666
netsnmp_sockaddr_in: hostname (resolved okay)
netsnmp_sockaddr_in: return { AF_INET, 127.0.0.1:6666 }
target_sessions: to: UDP: [135.64.102.136]:162
target_sessions: timeout: 1500 -> 1500000
target_sessions: setting SNMP_FLAG_DONT_PROB for snmp_add, and EIDusm:
match on user usr1
trap: sending trap type=166, version=3
usm: USM processing has begun (offset 97)
usm: getting user usr1
usm: match on user usr1
usm: USM processing completed.
netsnmp_udp: send 165 bytes from 0x8f52d83 to UDP: [135.64.102.136]:162
on fd 7
netsnmp_udp: sendto error, rc -1 (errno 22)
snmpd: send_trap: Failure in sendto (Invalid argument)
target_sessions: looking for: trap
target_sessions: for: 0=trap
Erez Makavy
Software Engineer
AVAYA Communication, ITC
Mail : <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
Tel:+972-3-6457562
_____
From: Makavy, Erez (Erez)
Sent: Tuesday, May 08, 2007 3:45 PM
To: net-snmp-coders@lists.sourceforge.net
Subject: Sending Informs with fixed source ports
Hi,
The initial Problem:
-----------------------------
Inform ACKs are block by my Firewall.
Net-SNMP sends out an Infrom : [port X] --> [port 162]
Std. Infrom receiver replies: [port Y] --> [port X]
* X,Y are random ports.
Solution concept:
--------------------------
AMke net-snmp send the Informs from fixed source-ports.
So that we can allow the predefined UDP ports in the Firewall
Implementation outline:
------------------------------------
1) I'm using the snmpNotifyMIB and snmpTargetMIB for sending traps.
2) Becasue net-snmp maintains an open session for each Infrom receiver,
and each such session binds to a certain port to be re-used for
sending out Informs,
it seems that I need a different port for each Inform receiver.
(In my case I limit the receivers' number to 3, so I'll predefine 3
ports.)
3) I thought that in get_target_sessions() (target.c),
I can set the [localname , local_port] in the netsnmp_session
structure of each receiver,
when the session is created.
It doesn't seem to be working very neatly. I'm working on it.
Quesitons:
----------------
1) Does this make sence?
2) Can all Infrom-receivers be using the same session? (So I can use
only 1 port)
P.S:
I also would like to disable the engineID Probe which is not really
needed since we can take the engineID from the USM table of the
appropriate user.
Any ideas about that? (I thought I can access the USM table also in the
get_target_sessions() and set the appropriate securityEndingID.
Thanks,
Erez.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders