Hi

This query is regarding setting ipv6 source ip for traps.
*Query 1*

We are using this api
*netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID,NETSNMP_DS_LIB_CLIENT_ADDR_V6,effective_ipv6);*
 to set the source-ip.Currently we are passing the ipv6 address as 2001::1
(without enclosing in brackets). But it was *not working* so I made a fix
in this net-snmp function and *post that it works*. + indicates the line
added. Is this a correct fix? any comments would be helpful.

netsnmp_transport *
netsnmp_udp6_transport(const struct sockaddr_in6 *addr, int local)
{
    if (!local) {
        const char *client_socket;
        client_socket = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,

NETSNMP_DS_LIB_CLIENT_ADDR_V6);
        if (client_socket) {
            struct sockaddr_in6 client_addr;
            if(netsnmp_sockaddr_in6_2(&client_addr, client_socket, NULL)) {
            +   client_addr.sin6_port = 0;
                return netsnmp_udp6_transport_with_source(addr, local,
                                                          &client_addr);
            }
        }
    }
    return netsnmp_udp6_transport_with_source(addr, local, NULL);
}
*Query 2*

What should be the format to pass the ipv6 address in this api
*netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID,NETSNMP_DS_LIB_CLIENT_ADDR_V6,effective_ipv6);*.
for example, should we pass it as 2001::1, or [2001::1] or both are correct
?

-- 
Warm Regards,
Vivek Aditya
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to