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



-------------------------------------------------------
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/listinfo/net-snmp-coders

Reply via email to