Merge branch 'V5-6-patches' into V5-7-patches

* V5-6-patches:
  Fix bug 2546: netsnmp_tdomain_transport_full uses wrong port for snmptrap + udp6
diff --git a/snmplib/transports/snmpIPv6BaseDomain.c b/snmplib/transports/snmpIPv6BaseDomain.c
index 9afa8fa..1ad6888 100644
--- a/snmplib/transports/snmpIPv6BaseDomain.c
+++ b/snmplib/transports/snmpIPv6BaseDomain.c
@@ -170,8 +170,10 @@
             return 0;
         }
 
-        for (cp = peername; *cp && isdigit((unsigned char) *cp); cp++);
-        portno = atoi(peername);
+        cp = peername;
+        if (*cp == ':') cp++;
+        portno = atoi(cp);
+        while (*cp && isdigit((unsigned char) *cp)) cp++;
         if (!*cp &&  portno != 0) {
             /*
              * Okay, it looks like JUST a port number.  
@@ -230,8 +232,10 @@
                          (void *) &(addr->sin6_addr))) {
                         DEBUGMSGTL(("netsnmp_sockaddr_in6_2",
                                     "IPv6 address with square brackets\n"));
-                        portno = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
-				                    NETSNMP_DS_LIB_DEFAULT_PORT);
+                        portno = ntohs(addr->sin6_port);
+                        if (portno == 0)
+                            portno = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+                                                    NETSNMP_DS_LIB_DEFAULT_PORT);
                         if (portno <= 0)
                             portno = SNMP_PORT;
                         addr->sin6_port = htons((u_short)portno);