Re: Is it possible to set the L3 source interface IP address in atrap packet? - SNMP

This is a discussion on Re: Is it possible to set the L3 source interface IP address in atrap packet? - SNMP ; Zhouhuai Shen wrote: > Hi all, > > Is it possible to set the layer 3 source IP address for a trap packet to > a certain interface on the device, other than the outgoing interface? > > I have ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Re: Is it possible to set the L3 source interface IP address in atrap packet?

  1. Re: Is it possible to set the L3 source interface IP address in atrap packet?

    Zhouhuai Shen wrote:
    > Hi all,
    >
    > Is it possible to set the layer 3 source IP address for a trap packet to
    > a certain interface on the device, other than the outgoing interface?
    >
    > I have tried to set the member localname of the netsnmp_session data
    > structure to the desired interface address in the function
    > send_trap_to_sess() in agent_trap.c, but it doesn't work. The localname
    > in the function is null, I suppose the source interface for the trap
    > packet will be filled up later on.
    >
    > Can anyone please give me some help?


    You can use '[snmp] clientaddr' option to set source address of UDP
    packet with the trap and with patch [1] you can use 'v1trapaddress'
    option to set address of the agent sent inside the trap.

    [1]:
    http://sourceforge.net/tracker/index...94&atid=312694

    Jan

    -------------------------------------------------------------------------
    This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
    Build the coolest Linux based applications with Moblin SDK & win great prizes
    Grand prize is a trip for two to an Open Source event anywhere in the world
    http://moblin-contest.org/redirect.p...r_id=100&url=/
    _______________________________________________
    Net-snmp-coders mailing list
    Net-snmp-coders@lists.sourceforge.net
    https://lists.sourceforge.net/lists/...et-snmp-coders


  2. Re: Is it possible to set the L3 source interface IP address in atrap packet?

    Zhouhuai Shen wrote:
    > Hi Jan,
    >
    > Thanks a lot for your help.
    >
    > I have put the '[snmp] clientaddr' option to set source address of UDP
    > packet with the trap as in the following in my snmpd.conf file:
    >
    > [snmp]
    > clientaddr 192.168.1.1
    > [snmpd]
    > .....(The rest of commands in my snmpd.conf file)
    >
    > But when I capture the trap packet, it still shows the IP address of the
    > outgoing interface. Did i do something wrong in my config file?


    clientaddr option affects only UDP source address of the traps. It
    should be 192.168.1.1, right? The agent address inside the UDP payload
    will still be wrong. You need to apply the patch I mentioned before to
    have possibility to set also this address.

    Jan

    -------------------------------------------------------------------------
    This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
    Build the coolest Linux based applications with Moblin SDK & win great prizes
    Grand prize is a trip for two to an Open Source event anywhere in the world
    http://moblin-contest.org/redirect.p...r_id=100&url=/
    _______________________________________________
    Net-snmp-coders mailing list
    Net-snmp-coders@lists.sourceforge.net
    https://lists.sourceforge.net/lists/...et-snmp-coders


  3. Re: Is it possible to set the L3 source interface IP address in atrap packet?

    Zhouhuai Shen wrote:
    > Hi Jan,
    >
    > I checked the patch for 'v1trapaddress', it used the following to
    > register the v1trapaddress string in the snmpd.conf:
    >
    > netsnmp_ds_register_config(ASN_OCTET_STR, app, "v1trapaddress",
    > NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_TRAP_ADDR);
    >
    > Once the snmpd is re-read as it receives a SIGHUP signal, the string
    > v1trapaddress will not be refreshed. For example, if I manually
    > remove the 'v1trapaddress 10.0.0.1' from the snmpd.conf, then a
    > SIGHUP is sent, the snmp daemon still thinks that the string defined
    > for v1trapaddress is there


    v1trapaddress does react to SIGHUP, it you change it, then the agent's
    address in outgoing traps will be different. On the other side, you are
    right with the removal - the old value is still used even if it's
    removed from the config file. That's the usual behavior of snmpd, it
    does not restore default value if a config option gets deleted. I am not
    sure if it is bug or feature.

    Jan

    -------------------------------------------------------------------------
    This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
    Build the coolest Linux based applications with Moblin SDK & win great prizes
    Grand prize is a trip for two to an Open Source event anywhere in the world
    http://moblin-contest.org/redirect.p...r_id=100&url=/
    _______________________________________________
    Net-snmp-coders mailing list
    Net-snmp-coders@lists.sourceforge.net
    https://lists.sourceforge.net/lists/...et-snmp-coders


  4. Re: Is it possible to set the L3 source interface IP address in atrap packet?

    On Thu, 2008-09-18 at 14:47 +0200, Jan Safranek wrote:
    >
    > v1trapaddress does react to SIGHUP, it you change it, then the agent's
    > address in outgoing traps will be different. On the other side, you are
    > right with the removal - the old value is still used even if it's
    > removed from the config file. That's the usual behavior of snmpd, it
    > does not restore default value if a config option gets deleted. I am not
    > sure if it is bug or feature.


    I think that is a bug in the general case.

    I see a couple of different value sources that I think should have
    different semantics:

    * Command line values - should be preserved for all
    reconfigurations
    * Config file values - should be rechecked at each SIGHUP, should
    be used unless the command line overrides it
    * Default values - should be used unless any of the other ones
    override it

    If a removal from the config file followed by a recheck fails to remove
    the value from the actual config then I wonder how one is supposed to
    tell the daemon that the value should be turned off?

    /MF


    -------------------------------------------------------------------------
    This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
    Build the coolest Linux based applications with Moblin SDK & win great prizes
    Grand prize is a trip for two to an Open Source event anywhere in the world
    http://moblin-contest.org/redirect.p...r_id=100&url=/
    _______________________________________________
    Net-snmp-coders mailing list
    Net-snmp-coders@lists.sourceforge.net
    https://lists.sourceforge.net/lists/...et-snmp-coders


+ Reply to Thread