Re: clientAddr ipv6

Bart Van Assche <[email protected]>
Newsgroups gmane.network.net-snmp.devel,gmane.network.net-snmp.user
Message-ID <[email protected]>
On 10/29/18 9:34 PM, Pushpa Thimmaiah wrote:
> Thank you.  I  will verify. Does the patch works for IPv6 too?

Oops, I had overlooked that your example uses an IPv6 client address.
Can you verify whether the following (untested) patch helps (checked
in yesterday on the v5.8 and master branches):

commit 9b637efe809c490fdcaf30d1af20b4cbaef76e3e
Author: Bart Van Assche <[email protected]>
Date:   Sat Oct 27 20:34:21 2018 -0700

     libsnmp/transports: Fix netsnmp_udp6_transport()

     Only create a transport object if parsing the client address succeeded
     instead of creating a transport object when parsing the client address
     failed.

     Fixes: 5d8372341594 ("shared transport + udp shared domain")

diff --git a/snmplib/transports/snmpUDPIPv6Domain.c b/snmplib/transports/snmpUDPIPv6Domain.c
index 4d9f65eb9d19..7a3b1db15c67 100644
--- a/snmplib/transports/snmpUDPIPv6Domain.c
+++ b/snmplib/transports/snmpUDPIPv6Domain.c
@@ -460,14 +460,16 @@ 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);
          if (client_socket) {
              struct sockaddr_in6 client_addr;
-            if(!netsnmp_sockaddr_in6_2(&client_addr, client_socket, NULL)) {
-                return netsnmp_udp6_transport_with_source(addr, local,
-                                                          &client_addr);
-            }
+
+            if (!netsnmp_sockaddr_in6_2(&client_addr, client_socket, NULL))
+                return NULL;
+            return netsnmp_udp6_transport_with_source(addr, local,
+                                                      &client_addr);
          }
      }
      return netsnmp_udp6_transport_with_source(addr, local, NULL);


_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.