&con->actual_peer_addr);
if (ret <= 0)
goto out;
+ ret = read_partial(con, &to, sizeof(con->peer_addr_for_me),
+ &con->peer_addr_for_me);
+ if (ret <= 0)
+ goto out;
ret = read_partial(con, &to, sizeof(con->in_reply), &con->in_reply);
if (ret <= 0)
goto out;
return -1;
}
+ /*
+ * did we learn our address?
+ */
+ if (con->msgr->inst.addr.ipaddr.sin_addr.s_addr == htons(INADDR_ANY)) {
+ int port = con->msgr->inst.addr.ipaddr.sin_port;
+
+ memcpy(&con->msgr->inst.addr.ipaddr,
+ &con->peer_addr_for_me.ipaddr,
+ sizeof(con->peer_addr_for_me.ipaddr));
+ con->msgr->inst.addr.ipaddr.sin_port = port;
+ dout("process_connect learned my addr is %u.%u.%u.%u:%u\n",
+ IPQUADPORT(con->msgr->inst.addr.ipaddr));
+ }
+
switch (con->in_reply.tag) {
case CEPH_MSGR_TAG_RESETSESSION:
/*
struct ceph_entity_addr peer_addr; /* peer address */
struct ceph_entity_name peer_name; /* peer name */
+ struct ceph_entity_addr peer_addr_for_me;
u32 connect_seq; /* identify the most recent connection
attempt for this connection, client */
u32 peer_global_seq; /* peer's global seq for this connection */
s32 result;
u32 len;
s64 cnum;
- struct ceph_entity_addr addr;
int err = -EINVAL;
if (client->whoami >= 0) {
end = p + msg->front.iov_len;
ceph_decode_64_safe(&p, end, cnum, bad);
- ceph_decode_need(&p, end, sizeof(addr), bad);
- ceph_decode_copy(&p, &addr, sizeof(addr));
-
ceph_decode_32_safe(&p, end, result, bad);
ceph_decode_32_safe(&p, end, len, bad);
if (result) {
client->whoami = cnum;
client->msgr->inst.name.num = cpu_to_le32(cnum);
client->msgr->inst.name.type = CEPH_ENTITY_TYPE_CLIENT;
- memcpy(&client->msgr->inst.addr, &addr, sizeof(addr));
- pr_info("ceph client%lld %u.%u.%u.%u:%u fsid %llx.%llx\n",
- client->whoami, IPQUADPORT(addr.ipaddr),
+ pr_info("ceph client%lld fsid %llx.%llx\n",
+ client->whoami,
le64_to_cpu(__ceph_fsid_major(&client->monc.monmap->fsid)),
le64_to_cpu(__ceph_fsid_minor(&client->monc.monmap->fsid)));