Commit f91d3471 authored by Sage Weil's avatar Sage Weil

ceph: fix creation of ipv6 sockets

Use the address family from the peer address instead of assuming IPv4.
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent 39139f64
...@@ -203,12 +203,13 @@ static void set_sock_callbacks(struct socket *sock, ...@@ -203,12 +203,13 @@ static void set_sock_callbacks(struct socket *sock,
*/ */
static struct socket *ceph_tcp_connect(struct ceph_connection *con) static struct socket *ceph_tcp_connect(struct ceph_connection *con)
{ {
struct sockaddr *paddr = (struct sockaddr *)&con->peer_addr.in_addr; struct sockaddr_storage *paddr = &con->peer_addr.in_addr;
struct socket *sock; struct socket *sock;
int ret; int ret;
BUG_ON(con->sock); BUG_ON(con->sock);
ret = sock_create_kern(AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock); ret = sock_create_kern(con->peer_addr.in_addr.ss_family, SOCK_STREAM,
IPPROTO_TCP, &sock);
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
con->sock = sock; con->sock = sock;
...@@ -222,7 +223,8 @@ static struct socket *ceph_tcp_connect(struct ceph_connection *con) ...@@ -222,7 +223,8 @@ static struct socket *ceph_tcp_connect(struct ceph_connection *con)
dout("connect %s\n", pr_addr(&con->peer_addr.in_addr)); dout("connect %s\n", pr_addr(&con->peer_addr.in_addr));
ret = sock->ops->connect(sock, paddr, sizeof(*paddr), O_NONBLOCK); ret = sock->ops->connect(sock, (struct sockaddr *)paddr, sizeof(*paddr),
O_NONBLOCK);
if (ret == -EINPROGRESS) { if (ret == -EINPROGRESS) {
dout("connect %s EINPROGRESS sk_state = %u\n", dout("connect %s EINPROGRESS sk_state = %u\n",
pr_addr(&con->peer_addr.in_addr), pr_addr(&con->peer_addr.in_addr),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment