]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net: FixedCPUServerSocket::accept() respects the listening addr's type. 43674/head
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 26 Oct 2021 18:03:31 +0000 (18:03 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 26 Oct 2021 19:44:12 +0000 (19:44 +0000)
For the sake of compliance with the classical OSD where the type
of the listening address is being reflected in the address type
of an accepted connection:

```
int PosixServerSocketImpl::accept(ConnectedSocket *sock, const SocketOptions &opt, entity_addr_t *out, Worker *w) {
  // ...
  sockaddr_storage ss;
  // ...
  int sd = accept_cloexec(_fd, (sockaddr*)&ss, &slen);
  if (sd < 0) {
    return -ceph_sock_errno();
  }

  // ...

  out->set_type(addr_type);
  out->set_sockaddr((sockaddr*)&ss);
  handler.set_priority(sd, opt.priority, out->get_family());
}
```

In Rook crimson binds explicitly to v2 address:

```
INFO  2021-10-26 17:55:08,116 [shard 0] osd - picked address v2:0.0.0.0:0/0
ERROR 2021-10-26 17:55:08,116 [shard 0] none - Falling back to public interface
INFO  2021-10-26 17:55:08,116 [shard 0] osd - picked address v2:0.0.0.0:0/0
```

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/net/Socket.h

index f2b9c2713913b827649cd24a31fff7225f962d9d..4e33122a43fbf014fc719e4f297d31e8421011ae 100644 (file)
@@ -226,7 +226,7 @@ public:
             auto [socket, paddr] = std::move(accept_result);
             entity_addr_t peer_addr;
             peer_addr.set_sockaddr(&paddr.as_posix_sockaddr());
-            peer_addr.set_type(entity_addr_t::TYPE_ANY);
+            peer_addr.set_type(ss.addr.get_type());
             SocketRef _socket = std::make_unique<Socket>(
                 std::move(socket), Socket::side_t::acceptor,
                 peer_addr.get_port(), Socket::construct_tag{});