On Mon, 24 Nov 2014 12:11:32 +0530 Rizwan wrote:
RA> Under IPv6 environment, sent snmptrap after setting clientaddr in
RA> snmp.conf, It is sent from another interface.
RA> [...]
RA> I looked into IPv4 code and feel like same code is missing under IPv6
RA> section.

Yes, I'd noticed that myself recently..

RA> Sending missing code section from IPv6 in
RA> *snmplib/transports/snmpUDPIPv6Domain.c*
RA> 
RA> diff --git a/snmplib/transports/snmpUDPIPv6Domain.c
RA> b/snmplib/transports/snmpUDPIPv6Domain.c
RA> index b3eaae4..85a2f7a 100644
RA> --- a/snmplib/transports/snmpUDPIPv6Domain.c
RA> +++ b/snmplib/transports/snmpUDPIPv6Domain.c
RA> @@ -190,6 +190,7 @@ netsnmp_udp6_transport(struct sockaddr_in6 *addr, int
RA> local)
RA>  {
RA>      netsnmp_transport *t = NULL;
RA>      int             rc = 0;
RA> +    char           *client_socket = NULL;
RA> 
RA>  #ifdef NETSNMP_NO_LISTEN_SUPPORT
RA>      if (local)
RA> @@ -267,10 +268,29 @@ netsnmp_udp6_transport(struct sockaddr_in6 *addr, int
RA> local)
RA>  #endif /* NETSNMP_NO_LISTEN_SUPPORT */
RA>      } else {
RA>          /*
RA> +         * This is a client session.  If we've been given a
RA> +         * client address to send from, then bind to that.
RA> +         * Otherwise the send will use "something sensible".
RA> +         */
RA> +        client_socket = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
RA> +                                              NETSNMP_DS_LIB_CLIENT_ADDR);
RA> +        if (client_socket) {
RA> +            struct sockaddr_in6 client_addr;
RA> +            netsnmp_sockaddr_in6_2(&client_addr, client_socket, NULL);
RA> +            rc = bind(t->sock, (struct sockaddr *)&client_addr,
RA> +                  sizeof(struct sockaddr_in6));
RA> +            if ( rc != 0 ) {
RA> +                DEBUGMSGTL(("netsnmp_udp6", "failed to bind for
RA> clientaddr: %d %s\n",
RA> +                            errno, strerror(errno)));
RA> +                netsnmp_socketbase_close(t);
RA> +                netsnmp_transport_free(t);
RA> +            }
RA> +        }
RA> +        /*
RA>           * This is a client session.  Save the address in the
RA>           * transport-specific data pointer for later use by
RA> netsnmp_udp6_send.
RA>           */
RA> -
RA>          t->data = malloc(sizeof(netsnmp_indexed_addr_pair));
RA>          if (t->data == NULL) {
RA>              netsnmp_socketbase_close(t);
RA> 
RA> 
RA> 
RA> I need to confirm the changes, This is required to send snmptrap after
RA> setting clientaddr in snmp.conf.
RA> 
RA> Please provide your  feedback regarding this change.

Please open a bug report for this, and either attach your patch or submit the
patch separately in the patches section and reference it in the bug report.
Also, please confirm if you've tested it, where it was tested, and if it
worked.

Thanks!

Robert

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to