Skip to content

Commit

Permalink
[LibOS] Properly return peer address for accept() and accept4()
Browse files Browse the repository at this point in the history
The address should come from the accepted socket, not the listening socket.

Signed-off-by: Lejun Zhu <lejun.zhu@gmail.com>
  • Loading branch information
lejunzhu authored and Dmitrii Kuvaiskii committed Feb 17, 2022
1 parent 0c43b42 commit 3d9154f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion LibOS/shim/src/sys/shim_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ static int __do_accept(struct shim_handle* hdl, int flags, struct sockaddr* addr
inet_rebase_port(true, cli_sock->domain, &cli_sock->addr.in.conn, false);

if (addr)
*addrlen = inet_copy_addr(sock->domain, addr, *addrlen, &sock->addr.in.conn);
*addrlen = inet_copy_addr(cli_sock->domain, addr, *addrlen, &cli_sock->addr.in.conn);
}

ret = set_new_fd_handle(cli, flags & O_CLOEXEC ? FD_CLOEXEC : 0, NULL);
Expand Down

0 comments on commit 3d9154f

Please sign in to comment.