Blame SOURCES/net-snmp-5.7.2-client-udp6.patch

e0c9be
diff -urpN old/snmplib/snmp_api.c new/snmplib/snmp_api.c
e0c9be
--- old/snmplib/snmp_api.c	2017-04-03 09:07:41.795091238 +0200
e0c9be
+++ new/snmplib/snmp_api.c	2017-04-03 10:54:47.809422106 +0200
e0c9be
@@ -1553,12 +1553,12 @@ _sess_open(netsnmp_session * in_session)
e0c9be
         if (in_session->flags & SNMP_FLAGS_STREAM_SOCKET) {
e0c9be
             transport =
e0c9be
                 netsnmp_tdomain_transport_full("snmp", in_session->peername,
e0c9be
-                                               in_session->local_port, "tcp",
e0c9be
+                                               in_session->local_port, "tcp,tcp6",
e0c9be
                                                NULL);
e0c9be
         } else {
e0c9be
             transport =
e0c9be
                 netsnmp_tdomain_transport_full("snmp", in_session->peername,
e0c9be
-                                               in_session->local_port, "udp",
e0c9be
+                                               in_session->local_port, "udp,udp6",
e0c9be
                                                NULL);
e0c9be
         }
e0c9be
 
e0c9be
diff -urpN old/snmplib/snmp_transport.c new/snmplib/snmp_transport.c
e0c9be
--- old/snmplib/snmp_transport.c	2012-10-10 00:28:58.000000000 +0200
e0c9be
+++ new/snmplib/snmp_transport.c	2017-04-03 11:50:49.158878706 +0200
e0c9be
@@ -498,6 +498,9 @@ netsnmp_tdomain_transport_full(const cha
e0c9be
     const char * const *spec = NULL;
e0c9be
     int                 any_found = 0;
e0c9be
     char buf[SNMP_MAXPATH];
e0c9be
+    char **lspec = 0;
e0c9be
+    char *tokenized_domain = 0;
e0c9be
+
e0c9be
 
e0c9be
     DEBUGMSGTL(("tdomain",
e0c9be
                 "tdomain_transport_full(\"%s\", \"%s\", %d, \"%s\", \"%s\")\n",
e0c9be
@@ -587,7 +590,23 @@ netsnmp_tdomain_transport_full(const cha
e0c9be
             DEBUGMSGTL(("tdomain",
e0c9be
                         "Use user specified default domain \"%s\"\n",
e0c9be
                         default_domain));
e0c9be
-            match = find_tdomain(default_domain);
e0c9be
+            if (!strchr(default_domain, ','))
e0c9be
+                match = find_tdomain(default_domain);
e0c9be
+            else {
e0c9be
+                int commas = 0;
e0c9be
+                const char *cp = default_domain;
e0c9be
+                char *ptr = NULL;
e0c9be
+                tokenized_domain = strdup(default_domain);
e0c9be
+
e0c9be
+                while (*++cp) if (*cp == ',') commas++;
e0c9be
+                lspec = calloc(commas+2, sizeof(char *));
e0c9be
+                commas = 1;
e0c9be
+                lspec[0] = strtok_r(tokenized_domain, ",", &ptr);
e0c9be
+                while ((lspec[commas++] = strtok_r(NULL, ",", &ptr)))
e0c9be
+                    ;
e0c9be
+                spec = (const char * const *)lspec;
e0c9be
+            }
e0c9be
+
e0c9be
         } else {
e0c9be
             spec = netsnmp_lookup_default_domains(application);
e0c9be
             if (spec == NULL) {
e0c9be
@@ -636,6 +655,10 @@ netsnmp_tdomain_transport_full(const cha
e0c9be
             else
e0c9be
                 t = match->f_create_from_tstring_new(addr, local, addr2);
e0c9be
             if (t) {
e0c9be
+                if (lspec) {
e0c9be
+                    free(tokenized_domain);
e0c9be
+                    free(lspec);
e0c9be
+                }
e0c9be
                 return t;
e0c9be
             }
e0c9be
         }
e0c9be
@@ -647,6 +670,10 @@ netsnmp_tdomain_transport_full(const cha
e0c9be
     }
e0c9be
     if (!any_found)
e0c9be
         snmp_log(LOG_ERR, "No support for any checked transport domain\n");
e0c9be
+    if (lspec) {
e0c9be
+        free(tokenized_domain);
e0c9be
+        free(lspec);
e0c9be
+    }
e0c9be
     return NULL;
e0c9be
 }
e0c9be
 
e0c9be
diff -urpN old/snmplib/system.c new/snmplib/system.c
e0c9be
--- old/snmplib/system.c	2012-10-10 00:28:58.000000000 +0200
e0c9be
+++ new/snmplib/system.c	2017-04-03 12:02:35.693153449 +0200
e0c9be
@@ -750,13 +750,6 @@ netsnmp_gethostbyname_v4(const char* nam
e0c9be
 
e0c9be
     err = netsnmp_getaddrinfo(name, NULL, &hint, &addrs);
e0c9be
     if (err != 0) {
e0c9be
-#if HAVE_GAI_STRERROR
e0c9be
-        snmp_log(LOG_ERR, "getaddrinfo: %s %s\n", name,
e0c9be
-                 gai_strerror(err));
e0c9be
-#else
e0c9be
-        snmp_log(LOG_ERR, "getaddrinfo: %s (error %d)\n", name,
e0c9be
-                 err);
e0c9be
-#endif
e0c9be
         return -1;
e0c9be
     }
e0c9be
 
e0c9be
diff -urpN old/snmplib/transports/snmpIPv6BaseDomain.c new/snmplib/transports/snmpIPv6BaseDomain.c
e0c9be
--- old/snmplib/transports/snmpIPv6BaseDomain.c	2012-10-10 00:28:58.000000000 +0200
e0c9be
+++ new/snmplib/transports/snmpIPv6BaseDomain.c	2017-04-03 12:00:38.669641503 +0200
e0c9be
@@ -342,13 +342,6 @@ netsnmp_sockaddr_in6_2(struct sockaddr_i
e0c9be
             err = netsnmp_getaddrinfo(peername, NULL, &hint, &addrs);
e0c9be
         }
e0c9be
         if (err != 0) {
e0c9be
-#if HAVE_GAI_STRERROR
e0c9be
-            snmp_log(LOG_ERR, "getaddrinfo(\"%s\", NULL, ...): %s\n", peername,
e0c9be
-                     gai_strerror(err));
e0c9be
-#else
e0c9be
-            snmp_log(LOG_ERR, "getaddrinfo(\"%s\", NULL, ...): (error %d)\n",
e0c9be
-                     peername, err);
e0c9be
-#endif
e0c9be
             free(peername);
e0c9be
             return 0;
e0c9be
         }