Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct socket state checks and handle listen errors in netsyscall #2068

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

rinor
Copy link
Contributor

@rinor rinor commented Sep 24, 2024

resolve #2066

@rinor rinor force-pushed the netsyscall_tcp_EADDRINUSE branch 2 times, most recently from 3fad3b9 to 394ea81 Compare September 25, 2024 15:41
@rinor rinor marked this pull request as ready for review September 25, 2024 15:42
@rinor rinor force-pushed the netsyscall_tcp_EADDRINUSE branch from 394ea81 to 23bf400 Compare September 27, 2024 06:51
if (!lw) {
rv = lwip_to_errno(err);
goto unlock_out;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, if the SO_REUSEADDR socket option is enabled, the bind() system call doesn't return -EADDRINUSE if another socket is bound to the same address, so we have to check for in-use addresses in the listen() system call. This is the correct fix.

@francescolavra francescolavra merged commit 243c5a2 into nanovms:master Sep 27, 2024
5 checks passed
@rinor rinor deleted the netsyscall_tcp_EADDRINUSE branch September 27, 2024 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

issue: kernel crash on TCP bind/listen when address already in use
2 participants