This is a discussion on Re: Setting the sender address in outgoing SNMP trap packets within the SNMP Coders forums, part of the Networking and Network Related category; Hi, Thanks for your reply. When I try to set the agent-addr using the code below, I get the ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
Thanks for your reply. When I try to set the agent-addr using the code below, I get the following error: ERROR: Couldn't parse PDU type: Wrong type for that item. I use the following code to add the agent-addr: cp = asn_build_string(cp, out_length, (u_char) (ASN_IPADDRESS | ASN_PRIMITIVE), (u_char *) pdu->agent_addr, 4); I do not see any errors when I do teh above. Thanks. /Shobana --- Dave Shield <D.T.Shield@csc.liv.ac.uk> wrote: > On Wed, 2005-04-13 at 18:59, Shobana Sampath wrote: > > > > In the netsnmp_pdu data structure, what is the > > > > field that I can use in snmp v2c to set the > > > > sender's address in outgoing SNMP packets. > > Oops. > I've just spotted that you're talking about SNMP > *trap* packets, rather than more general requests. > > In this particular case, there _is_ a field for this > value in the PDU structure - 'agent_addr'. > > The following code from 'apps/snmptrap.c' shows how > it's set up in that tool: > > // line 259 > pdu_in_addr_t = (in_addr_t *) pdu->agent_addr; > > // lines 290-295 > agent = argv[arg]; > if (agent != NULL && strlen(agent) != 0) { > *pdu_in_addr_t = parse_address(agent); > } else { > *pdu_in_addr_t = get_myaddr(); > } > > Note that this *only* works with IPv4 requests. > If you're using anything else (IPv6, or non-IP > transports), then this field should be left empty. > > Sorry for the confusion. > > Dave > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/...et-snmp-coders |