From: Marc Alff Date: January 19 2012 4:03pm Subject: bzr push into mysql-trunk-wl5259 branch (marc.alff:3353 to 3354) List-Archive: http://lists.mysql.com/commits/142454 Message-Id: <201201191603.q0JG3VTA019553@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3354 Marc Alff 2012-01-19 Fixed windows build breaks modified: sql/hostname.cc sql/sql_connect.cc 3353 Marc Alff 2012-01-18 Fixed test cases for IPv6 added: mysql-test/include/have_ipv6.inc mysql-test/suite/sys_vars/r/host_cache_size_basic.result mysql-test/suite/sys_vars/t/host_cache_size_basic-master.opt mysql-test/suite/sys_vars/t/host_cache_size_basic.test modified: mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test sql/sys_vars.cc === modified file 'sql/hostname.cc' --- a/sql/hostname.cc 2012-01-17 13:48:50 +0000 +++ b/sql/hostname.cc 2012-01-19 16:02:32 +0000 @@ -629,12 +629,12 @@ bool ip_to_hostname(struct sockaddr_stor /* Simulating ipv4 192.0.2.126 */ debug_addr= & debug_sock_addr[0]; debug_addr->sin_family= AF_INET; - inet_pton(AF_INET, "192.0.2.126", & debug_addr->sin_addr); + debug_addr->sin_addr.s_addr= inet_addr("192.0.2.126"); /* Simulating ipv4 192.0.2.127 */ debug_addr= & debug_sock_addr[1]; debug_addr->sin_family= AF_INET; - inet_pton(AF_INET, "192.0.2.127", & debug_addr->sin_addr); + debug_addr->sin_addr.s_addr= inet_addr("192.0.2.127"); debug_addr_info[0].ai_addr= (struct sockaddr*) & debug_sock_addr[0]; debug_addr_info[0].ai_addrlen= sizeof (struct sockaddr_in); @@ -661,12 +661,12 @@ bool ip_to_hostname(struct sockaddr_stor /* Simulating ipv4 192.0.2.5 */ debug_addr= & debug_sock_addr[0]; debug_addr->sin_family= AF_INET; - inet_pton(AF_INET, "192.0.2.5", & debug_addr->sin_addr); + debug_addr->sin_addr.s_addr= inet_addr("192.0.2.5"); /* Simulating ipv4 192.0.2.4 */ debug_addr= & debug_sock_addr[1]; debug_addr->sin_family= AF_INET; - inet_pton(AF_INET, "192.0.2.4", & debug_addr->sin_addr); + debug_addr->sin_addr.s_addr= inet_addr("192.0.2.4"); debug_addr_info[0].ai_addr= (struct sockaddr*) & debug_sock_addr[0]; debug_addr_info[0].ai_addrlen= sizeof (struct sockaddr_in); @@ -689,6 +689,7 @@ bool ip_to_hostname(struct sockaddr_stor freeaddrinfo(addr_info_list); struct sockaddr_in6 *debug_addr; + struct in6_addr *ip6; /* Not thread safe, which is ok. Only one connection at a time is tested with @@ -699,12 +700,21 @@ bool ip_to_hostname(struct sockaddr_stor /* Simulating ipv6 2001:DB8::6:7E */ debug_addr= & debug_sock_addr[0]; debug_addr->sin6_family= AF_INET6; - inet_pton(AF_INET6, "2001:DB8::6:7E", & debug_addr->sin6_addr); + ip6= & debug_addr->sin6_addr; + /* inet_pton not available on Windows XP. */ + ip6->s6_addr32[0] = htonl(0x20010db8); + ip6->s6_addr32[1] = htonl(0x00000000); + ip6->s6_addr32[2] = htonl(0x00000000); + ip6->s6_addr32[3] = htonl(0x0006007e); /* Simulating ipv6 2001:DB8::6:7F */ debug_addr= & debug_sock_addr[1]; debug_addr->sin6_family= AF_INET6; - inet_pton(AF_INET6, "2001:DB8::6:7F", & debug_addr->sin6_addr); + ip6= & debug_addr->sin6_addr; + ip6->s6_addr32[0] = htonl(0x20010db8); + ip6->s6_addr32[1] = htonl(0x00000000); + ip6->s6_addr32[2] = htonl(0x00000000); + ip6->s6_addr32[3] = htonl(0x0006007f); debug_addr_info[0].ai_addr= (struct sockaddr*) & debug_sock_addr[0]; debug_addr_info[0].ai_addrlen= sizeof (struct sockaddr_in6); @@ -726,6 +736,7 @@ bool ip_to_hostname(struct sockaddr_stor freeaddrinfo(addr_info_list); struct sockaddr_in6 *debug_addr; + struct in6_addr *ip6; /* Not thread safe, which is ok. Only one connection at a time is tested with @@ -736,12 +747,20 @@ bool ip_to_hostname(struct sockaddr_stor /* Simulating ipv6 2001:DB8::6:7 */ debug_addr= & debug_sock_addr[0]; debug_addr->sin6_family= AF_INET6; - inet_pton(AF_INET6, "2001:DB8::6:7", & debug_addr->sin6_addr); + ip6= & debug_addr->sin6_addr; + ip6->s6_addr32[0] = htonl(0x20010db8); + ip6->s6_addr32[1] = htonl(0x00000000); + ip6->s6_addr32[2] = htonl(0x00000000); + ip6->s6_addr32[3] = htonl(0x00060007); /* Simulating ipv6 2001:DB8::6:6 */ debug_addr= & debug_sock_addr[1]; debug_addr->sin6_family= AF_INET6; - inet_pton(AF_INET6, "2001:DB8::6:6", & debug_addr->sin6_addr); + ip6= & debug_addr->sin6_addr; + ip6->s6_addr32[0] = htonl(0x20010db8); + ip6->s6_addr32[1] = htonl(0x00000000); + ip6->s6_addr32[2] = htonl(0x00000000); + ip6->s6_addr32[3] = htonl(0x00060006); debug_addr_info[0].ai_addr= (struct sockaddr*) & debug_sock_addr[0]; debug_addr_info[0].ai_addrlen= sizeof (struct sockaddr_in6); === modified file 'sql/sql_connect.cc' --- a/sql/sql_connect.cc 2012-01-17 08:31:24 +0000 +++ b/sql/sql_connect.cc 2012-01-19 16:02:32 +0000 @@ -482,7 +482,7 @@ static int check_connection(THD *thd) struct in_addr *ip4= &((struct sockaddr_in *) sa)->sin_addr; /* See RFC 5737, 192.0.2.0/24 is reserved. */ const char* fake= "192.0.2.4"; - inet_pton(AF_INET, fake, ip4); + ip4->s_addr= inet_addr(fake); strcpy(ip, fake); peer_rc= 0; } @@ -496,7 +496,11 @@ static int check_connection(THD *thd) struct in6_addr *ip6= & sa->sin6_addr; /* See RFC 3849, ipv6 2001:DB8::/32 is reserved. */ const char* fake= "2001:db8::6:6"; - inet_pton(AF_INET6, fake, ip6); + /* inet_pton(AF_INET6, fake, ip6); not available on Windows XP. */ + ip6->s6_addr32[0] = htonl(0x20010db8); + ip6->s6_addr32[1] = htonl(0x00000000); + ip6->s6_addr32[2] = htonl(0x00000000); + ip6->s6_addr32[3] = htonl(0x00060006); strcpy(ip, fake); peer_rc= 0; } No bundle (reason: useless for push emails).