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 .... [EMAIL PROTECTED]
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 <[EMAIL PROTECTED]> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders