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, I implemented this code: in_addr_t *addr; > addr = (in_addr_t *)pdu->agent_addr; > *addr = parse_address( "10.86.160....


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

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

Hi,

I implemented this code:
in_addr_t *addr;
> addr = (in_addr_t *)pdu->agent_addr;
> *addr = parse_address( "10.86.160.102" );
>


I also added this code:

cp = asn_build_string(cp, pkt_len,
(u_char) (ASN_IPADDRESS |
ASN_PRIMITIVE),
(u_char *) pdu->agent_addr,
4);
if (cp == NULL)
return -1;

Now the dump of the packet shows the agent-addr but
none of the trap receiving clients are able to process
it.

Here's a dump from net-snmp snmptrapd output:
Received 100 bytes from UDP: [10.86.160.102]:4236
0000: 30 82 00 60 02 01 01 04 00 A7 82 00 51 02 02
6B 0é.`.....ºé.Q..k
0016: AD 02 01 00 02 01 00 30 82 00 43 30 82 00 0D
06 ¡......0é.C0é...
0032: 09 2B 06 01 04 01 09 09 78 02 05 00 30 82 00
19 +.... x...0é..
0048: 06 0A 2B 06 01 06 03 01 01 04 01 00 06 0B 2B
06 ..+...........+.
0064: 01 04 01 09 09 78 02 00 04 30 82 00 11 06 0C
2B ... x...0é....+
0080: 06 01 04 01 09 09 78 01 02 04 00 02 01 02 40
04 .... x.......@.
0096: 0A 56 F0 1D
.V≡.

2005-05-18 12:18:35 dhcp-10-86-160-102.cisco.com [UDP:
[10.86.160.102]:4236]:
iso.3.6.1.4.1.9.9.120.2 = NULL
iso.3.6.1.6.3.1.1.4.1.0 = OID:
iso.3.6.1.4.1.9.9.120.2.0.4
iso.3.6.1.4.1.9.9.120.
2.4.0 = INTEGER: 2

Notice the last 4 bytes 0A 56 FO 1D show the address
that I am setting in the agent-addr field.

Thanks.
/Shobana

--- Dave Shield <D.T.Shield@csc.liv.ac.uk> wrote:
> On Mon, 2005-04-25 at 16:38, Shobana Sampath wrote:
> > I tried to add a varbind to set the

> snmpTrapAddress,
> > but no luck, the resulting pdu does not have the
> > agent_address set as they say in the RFC:

>
> No - you're not mean to add a varbind to do this.
> You are meant to assign a suitable address to
> the 'agent_addr' field.
>
>
>
> > oid objid_snmpTrapAddress[] = { 1, 3, 6, 1, 6, 3,

> 18,
> > 1, 3, 0 };
> > snmp_add_var(pdu, objid_snmpTrapAddress,
> > sizeof(objid_snmpTrapAddress) /
> > sizeof(oid), 'a', "10.86.160.102");

>
> Try
>
> in_addr_t *addr;
> addr = (in_addr_t *)pdu->agent_addr;
> *addr = parse_address( "10.86.160.102" );
>
> Dave
>
>




__________________________________
Yahoo! Mail Mobile
Take Yahoo! Mail with you! Check email on your mobile phone.
http://mobile.yahoo.com/learn/mail


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&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 08:00 PM.


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