From: Jens Axboe Date: Sat, 25 Jan 2014 02:56:56 +0000 (-0800) Subject: client/server: don't reset ipv6 expectations X-Git-Tag: fio-2.1.5~25 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=3aa3ceeb5c93f05e50d13a0e8f374843e6cb8ec5 client/server: don't reset ipv6 expectations fio_server_parse_host() no longer falls back to ipv4, so just pass in the actual value, not a reference. Signed-off-by: Jens Axboe --- diff --git a/client.c b/client.c index 7975ce60..467d0939 100644 --- a/client.c +++ b/client.c @@ -238,7 +238,7 @@ struct fio_client *fio_client_add_explicit(struct client_ops *ops, int ipv6; ipv6 = type == Fio_client_ipv6; - if (fio_server_parse_host(hostname, &ipv6, + if (fio_server_parse_host(hostname, ipv6, &client->addr.sin_addr, &client->addr6.sin6_addr)) goto err; diff --git a/server.c b/server.c index 9bfae795..b6961fd5 100644 --- a/server.c +++ b/server.c @@ -1392,13 +1392,13 @@ static int fio_init_server_connection(void) return sk; } -int fio_server_parse_host(const char *host, int *ipv6, struct in_addr *inp, +int fio_server_parse_host(const char *host, int ipv6, struct in_addr *inp, struct in6_addr *inp6) { int ret = 0; - if (*ipv6) + if (ipv6) ret = inet_pton(AF_INET6, host, inp6); else ret = inet_pton(AF_INET, host, inp); @@ -1407,7 +1407,7 @@ int fio_server_parse_host(const char *host, int *ipv6, struct in_addr *inp, struct addrinfo hints, *res; memset(&hints, 0, sizeof(hints)); - hints.ai_family = *ipv6 ? AF_INET6 : AF_INET; + hints.ai_family = ipv6 ? AF_INET6 : AF_INET; hints.ai_socktype = SOCK_STREAM; ret = getaddrinfo(host, NULL, &hints, &res); @@ -1417,7 +1417,7 @@ int fio_server_parse_host(const char *host, int *ipv6, struct in_addr *inp, return 1; } - if (*ipv6) + if (ipv6) memcpy(inp6, &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr, sizeof(*inp6)); else memcpy(inp, &((struct sockaddr_in *) res->ai_addr)->sin_addr, sizeof(*inp)); @@ -1508,7 +1508,7 @@ int fio_server_parse_string(const char *str, char **ptr, int *is_sock, *ptr = strdup(host); - if (fio_server_parse_host(*ptr, ipv6, inp, inp6)) { + if (fio_server_parse_host(*ptr, *ipv6, inp, inp6)) { free(*ptr); *ptr = NULL; return 1; diff --git a/server.h b/server.h index 57e15d72..adb190a9 100644 --- a/server.h +++ b/server.h @@ -156,7 +156,7 @@ extern int fio_net_send_cmd(int, uint16_t, const void *, off_t, uint64_t *, stru extern int fio_net_send_simple_cmd(int, uint16_t, uint64_t, struct flist_head *); extern void fio_server_set_arg(const char *); extern int fio_server_parse_string(const char *, char **, int *, int *, struct in_addr *, struct in6_addr *, int *); -extern int fio_server_parse_host(const char *, int *, struct in_addr *, struct in6_addr *); +extern int fio_server_parse_host(const char *, int, struct in_addr *, struct in6_addr *); extern const char *fio_server_op(unsigned int); extern void fio_server_got_signal(int);