diff options
author | Matt Braithwaite <mab@google.com> | 2015-09-29 05:45:54 +0300 |
---|---|---|
committer | Adam Langley <alangley@gmail.com> | 2015-10-27 00:06:01 +0300 |
commit | 29d8adbdc6dbe8663e25c3bde68e3014d443454a (patch) | |
tree | b0c7abcee19611f6dea95c5ea4aa34dd4bb72b9a /tool/transport_common.cc | |
parent | 301afaf2230b5dfa028842296ab63a66f0d1b16c (diff) |
Better handle IPv6.
∙ host:port parsing, where unavoidable, is now IPv6-friendly.
∙ |BIO_C_GET_CONNECT| is simply removed.
∙ bssl -accept now listens on both IPv6 and IPv4.
Change-Id: I1cbd8a79c0199bab3ced4c4fd79d2cc5240f250c
Reviewed-on: https://boringssl-review.googlesource.com/6214
Reviewed-by: Adam Langley <alangley@gmail.com>
Diffstat (limited to 'tool/transport_common.cc')
-rw-r--r-- | tool/transport_common.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tool/transport_common.cc b/tool/transport_common.cc index 98f0f953..cfda6c35 100644 --- a/tool/transport_common.cc +++ b/tool/transport_common.cc @@ -133,19 +133,19 @@ out: } bool Accept(int *out_sock, const std::string &port) { - struct sockaddr_in addr, cli_addr; + struct sockaddr_in6 addr, cli_addr; socklen_t cli_addr_len = sizeof(cli_addr); memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - addr.sin_addr.s_addr = INADDR_ANY; - addr.sin_port = htons(atoi(port.c_str())); + addr.sin6_family = AF_INET6; + addr.sin6_addr = in6addr_any; + addr.sin6_port = htons(atoi(port.c_str())); bool ok = false; int server_sock = -1; server_sock = - socket(addr.sin_family, SOCK_STREAM, 0); + socket(addr.sin6_family, SOCK_STREAM, 0); if (server_sock < 0) { perror("socket"); goto out; |