From: Radoslaw Zarzynski Date: Tue, 26 Oct 2021 18:03:31 +0000 (+0000) Subject: crimson/net: FixedCPUServerSocket::accept() respects the listening addr's type. X-Git-Tag: v17.1.0~597^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=ed8107e8d4f206069fe8cd7ce641ea68861b8976;p=ceph.git crimson/net: FixedCPUServerSocket::accept() respects the listening addr's type. 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 --- diff --git a/src/crimson/net/Socket.h b/src/crimson/net/Socket.h index f2b9c2713913b..4e33122a43fbf 100644 --- a/src/crimson/net/Socket.h +++ b/src/crimson/net/Socket.h @@ -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( std::move(socket), Socket::side_t::acceptor, peer_addr.get_port(), Socket::construct_tag{});