summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2018-02-10 00:00:10 +0000
committerVladislav Vaintroub <wlad@mariadb.com>2018-02-10 00:00:10 +0000
commit17c9ed672588b4b2c355efbab4329ff6b611dd78 (patch)
treed2535f538a4f3b86fe0c698818f3ee8fb05b17d5
parente3cf577948855a31949923544106787bbc253630 (diff)
downloadmariadb-git-17c9ed672588b4b2c355efbab4329ff6b611dd78.tar.gz
Fix perfschema tests in debug mode.
Correctly initialize fake IPs.
-rw-r--r--sql/hostname.cc17
-rw-r--r--sql/sql_connect.cc2
2 files changed, 13 insertions, 6 deletions
diff --git a/sql/hostname.cc b/sql/hostname.cc
index 92888b737b4..2d39a8bb03d 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -701,11 +701,13 @@ int ip_to_hostname(struct sockaddr_storage *ip_storage,
static struct addrinfo debug_addr_info[2];
/* Simulating ipv4 192.0.2.126 */
debug_addr= & debug_sock_addr[0];
- inet_pton(AF_INET,"192.0.2.126",debug_addr);
+ debug_addr->sin_family= AF_INET;
+ inet_pton(AF_INET,"192.0.2.126", &debug_addr->sin_addr);
/* Simulating ipv4 192.0.2.127 */
debug_addr= & debug_sock_addr[1];
- inet_pton(AF_INET,"192.0.2.127",debug_addr);
+ debug_addr->sin_family= AF_INET;
+ inet_pton(AF_INET,"192.0.2.127", &debug_addr->sin_addr);
debug_addr_info[0].ai_addr= (struct sockaddr*) & debug_sock_addr[0];
debug_addr_info[0].ai_addrlen= sizeof (struct sockaddr_in);
@@ -731,11 +733,13 @@ int ip_to_hostname(struct sockaddr_storage *ip_storage,
static struct addrinfo debug_addr_info[2];
/* Simulating ipv4 192.0.2.5 */
debug_addr= & debug_sock_addr[0];
- inet_pton(AF_INET,"192.0.2.5",debug_addr);
+ debug_addr->sin_family= AF_INET;
+ inet_pton(AF_INET,"192.0.2.5", &debug_addr->sin_addr);
/* Simulating ipv4 192.0.2.4 */
debug_addr= & debug_sock_addr[1];
- inet_pton(AF_INET,"192.0.2.5",debug_addr);
+ debug_addr->sin_family= AF_INET;
+ inet_pton(AF_INET,"192.0.2.4", &debug_addr->sin_addr);
debug_addr_info[0].ai_addr= (struct sockaddr*) & debug_sock_addr[0];
debug_addr_info[0].ai_addrlen= sizeof (struct sockaddr_in);
@@ -768,13 +772,16 @@ int ip_to_hostname(struct sockaddr_storage *ip_storage,
static struct addrinfo debug_addr_info[2];
/* Simulating ipv6 2001:DB8::6:7E */
debug_addr= & debug_sock_addr[0];
+ debug_addr->sin6_family= AF_INET6;
ip6= & debug_addr->sin6_addr;
inet_pton(AF_INET6,"2001:DB8::6:7E",ip6);
/* Simulating ipv6 2001:DB8::6:7F */
debug_addr= & debug_sock_addr[1];
+ debug_addr->sin6_family= AF_INET6;
ip6= & debug_addr->sin6_addr;
- inet_pton(AF_INET6,"2001:DB8::6:7E",ip6);
+ inet_pton(AF_INET6,"2001:DB8::6:7F",ip6);
+
debug_addr_info[0].ai_addr= (struct sockaddr*) & debug_sock_addr[0];
debug_addr_info[0].ai_addrlen= sizeof (struct sockaddr_in6);
debug_addr_info[0].ai_next= & debug_addr_info[1];
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 81beb5d4110..558d11eca8c 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -979,7 +979,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);
+ inet_pton(AF_INET,fake, ip4);
strcpy(ip, fake);
peer_rc= 0;
}