aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2016-08-24 06:52:25 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2016-08-24 06:52:25 -0700
commit041f9776f70d3f5683eb23d418cbd31358a39c00 (patch)
tree37cd3b9fbf50af316161138fd6373f47a5b994f9
parentb8b384a9f685337ed3c6e7accc974df72b1963da (diff)
Fixed wrong processing of ipv6 IPs.
-rw-r--r--src/core/ext/lb_policy/grpclb/grpclb.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/ext/lb_policy/grpclb/grpclb.c b/src/core/ext/lb_policy/grpclb/grpclb.c
index 6fecc7cd58..c3294b7988 100644
--- a/src/core/ext/lb_policy/grpclb/grpclb.c
+++ b/src/core/ext/lb_policy/grpclb/grpclb.c
@@ -304,12 +304,12 @@ static bool process_serverlist(const grpc_grpclb_server *server,
memcpy(&addr4->sin_addr, ip->bytes, ip->size);
addr4->sin_port = netorder_port;
} else if (ip->size == 6) {
- struct sockaddr_in *addr6 = (struct sockaddr_in *)sa;
- *sa_len = sizeof(struct sockaddr_in);
+ struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)sa;
+ *sa_len = sizeof(struct sockaddr_in6);
memset(addr6, 0, *sa_len);
- addr6->sin_family = AF_INET;
- memcpy(&addr6->sin_addr, ip->bytes, ip->size);
- addr6->sin_port = netorder_port;
+ addr6->sin6_family = AF_INET;
+ memcpy(&addr6->sin6_addr, ip->bytes, ip->size);
+ addr6->sin6_port = netorder_port;
} else {
gpr_log(GPR_ERROR, "Expected IP to be 4 or 16 bytes. Got %d.", ip->size);
return false;