Re: Setting the sender address in outgoing SNMP trap packets

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 ...


Go Back   Usenet Forums > Networking and Network Related > SNMP Coders

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2005
Shobana Sampath
 
Posts: n/a
Default Re: Setting the sender address in outgoing SNMP trap packets

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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:38 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0