diff options
author | Sage Weil <sage@newdream.net> | 2010-07-01 18:18:31 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-07-09 18:00:20 -0400 |
commit | f91d3471ccf1ca9a795f46c94b1ded8dd219940c (patch) | |
tree | 7a8d496d69ad9dd7a206183d11f5719b7161e6a7 | |
parent | 39139f64e14684cf2370770deb79d929d27cfd9b (diff) |
ceph: fix creation of ipv6 sockets
Use the address family from the peer address instead of assuming IPv4.
Signed-off-by: Sage Weil <sage@newdream.net>
-rw-r--r-- | fs/ceph/messenger.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/ceph/messenger.c b/fs/ceph/messenger.c index 3ddef1556457..15167b2daa55 100644 --- a/fs/ceph/messenger.c +++ b/fs/ceph/messenger.c | |||
@@ -203,12 +203,13 @@ static void set_sock_callbacks(struct socket *sock, | |||
203 | */ | 203 | */ |
204 | static struct socket *ceph_tcp_connect(struct ceph_connection *con) | 204 | static struct socket *ceph_tcp_connect(struct ceph_connection *con) |
205 | { | 205 | { |
206 | struct sockaddr *paddr = (struct sockaddr *)&con->peer_addr.in_addr; | 206 | struct sockaddr_storage *paddr = &con->peer_addr.in_addr; |
207 | struct socket *sock; | 207 | struct socket *sock; |
208 | int ret; | 208 | int ret; |
209 | 209 | ||
210 | BUG_ON(con->sock); | 210 | BUG_ON(con->sock); |
211 | ret = sock_create_kern(AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock); | 211 | ret = sock_create_kern(con->peer_addr.in_addr.ss_family, SOCK_STREAM, |
212 | IPPROTO_TCP, &sock); | ||
212 | if (ret) | 213 | if (ret) |
213 | return ERR_PTR(ret); | 214 | return ERR_PTR(ret); |
214 | con->sock = sock; | 215 | con->sock = sock; |
@@ -222,7 +223,8 @@ static struct socket *ceph_tcp_connect(struct ceph_connection *con) | |||
222 | 223 | ||
223 | dout("connect %s\n", pr_addr(&con->peer_addr.in_addr)); | 224 | dout("connect %s\n", pr_addr(&con->peer_addr.in_addr)); |
224 | 225 | ||
225 | ret = sock->ops->connect(sock, paddr, sizeof(*paddr), O_NONBLOCK); | 226 | ret = sock->ops->connect(sock, (struct sockaddr *)paddr, sizeof(*paddr), |
227 | O_NONBLOCK); | ||
226 | if (ret == -EINPROGRESS) { | 228 | if (ret == -EINPROGRESS) { |
227 | dout("connect %s EINPROGRESS sk_state = %u\n", | 229 | dout("connect %s EINPROGRESS sk_state = %u\n", |
228 | pr_addr(&con->peer_addr.in_addr), | 230 | pr_addr(&con->peer_addr.in_addr), |