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