I tried binding to the IP address of eth0. The trap is sent but not from my specified port:
tcpdump: ------------ 14:56:52.983519 IP 135.64.102.110.32797 > 135.64.102.136.snmptrap: F=ar U=usr1 [|snmp][|snmp] 14:57:11.876272 IP 135.64.102.110.32797 > 135.64.102.136.snmptrap: F=ar U=usr1 [|snmp][|snmp] 14:57:43.656022 IP 135.64.102.110.32797 > 135.64.102.136.snmptrap: F=ar U=usr1 [|snmp][|snmp] 14:57:49.571344 IP 135.64.102.110.32803 > 135.64.102.136.snmptrap: F=ar U=usr1 [|snmp][|snmp] 14:57:49.696096 IP 135.64.102.110.32803 > 135.64.102.136.snmptrap: F=ar U=usr1 [|snmp][|snmp] 14:57:58.590007 IP 135.64.102.110.32803 > 135.64.102.136.snmptrap: F=ar U=usr1 [|snmp][|snmp] snmpd logging: --------------------- netsnmp_udp: recvfrom fd 6 got 39 bytes (from UDP: [135.64.102.136]:1657) Connection from UDP: [135.64.102.136]:1657 netsnmp_udp_getSecName: no com2sec entries send_notifications: starting: pdu=94a2170, vars=0 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 0xbfdb9db0, peername "135.64.102.110:6666" netsnmp_sockaddr_in: port number suffix :6666 netsnmp_sockaddr_in: IP address netsnmp_sockaddr_in: return { AF_INET, 135.64.102.110:6666 } netsnmp_udp: Binded to client_socket 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 EIDtarget_sessions: looking for: trap target_sessions: for: 0=trap send_notifications: sent 0 notifications send_notifications: starting: pdu=94a2208, vars=94a24f0 target_sessions: looking for: inform target_sessions: for: 0=inform target_sessions: found one: inform send_notifications: checking filters... send_notifications: no matching profile netsnmp_udp: send 168 bytes from 0x94a3870 to UDP: [135.64.102.136]:162 on fd 7 target_sessions: looking for: trap target_sessions: for: 0=trap send_notifications: sent 1 notifications netsnmp_udp: recvfrom fd 7 got 168 bytes (from UDP: [135.64.102.136]:1658) Any ideas? Thanks, Erez. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dave Shield Sent: Saturday, May 19, 2007 12:41 AM To: Makavy, Erez (Erez) Cc: net-snmp-coders@lists.sourceforge.net Subject: Re: Sending Informs with fixed source ports On 08/05/07, Makavy, Erez (Erez) <[EMAIL PROTECTED]> wrote: > 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"); > 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 } : > 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) That probably makes sense. I suspect that there may not be a route from the loopback interface to that IP address. In order to send traffic to that system, you'd have to use a source address that's on the same network as either the destination system, or else a suitable gateway. Using "localhost" as the source won't qualify. Dave ------------------------------------------------------------------------- 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