On 12/13/24 12:55, Stefano Garzarella wrote:
On Thu, Dec 12, 2024 at 11:12:19PM +0100, Michal Luczaj wrote:
quoted
On 12/10/24 17:18, Stefano Garzarella wrote:
quoted
[...]
What about using `vsock_stream_connect` so you can remove a lot of
code from this function (e.g. sockaddr_vm, socket(), etc.)
We only need to add `control_expectln("LISTENING")` in the server which
should also fix my previous comment.
Sure, I followed your suggestion with
tout = current_nsec() + ACCEPTQ_LEAK_RACE_TIMEOUT * NSEC_PER_SEC;
do {
control_writeulong(RACE_CONTINUE);
fd = vsock_stream_connect(opts->peer_cid, opts->peer_port);
if (fd >= 0)
close(fd);
I'd do
if (fd < 0) {
perror("connect");
exit(EXIT_FAILURE);
}
close(fd);
I think that won't fly. We're racing here with close(listener), so a
failing connect() is expected.
Michal