Hi Aluisio Leonelo Victal,
> I belive that you want de source address of ip packets, but i need more
>information about the "struct pdu" and any another information about how
>you catch the packets.
I used net-snmp-5.3.0.1, I also used
snmptrapd_add_session(netsnmp_transport *transport) to get the packet, and
in the function callback function --- snmp_input is used to process an
incoming trap through calling a new
function------trap_message_handler(netsnmp_pdu *, netsnmp_trapsport *,
netsnmp_trapd_handler *) which I add. The pdu is a struct netsnmp_pdu, and
unsigned char agent_addr[4] is the a item of the struct, I get the ip
through agent_addr as follow:
char *strIpAddress;
struct in_addr sInAddr = *(struct in_addr *)pdu->agent_addr;
strIpAddress = inet_ntoa(sInAddr);
printf("Agent address : %s\n", strIpAddress);
and the result is 0.0.0.0 as said in the previous letter.
I think the address I got is the agent address, why the result is 0.0.0.0,
Is it needed to set, how to set it?
The second question is that how can I get the address of ip packets?
Thank you !
yao yu
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders