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

sslh-fork stops servicing requests when connection is closed before accept() #486

Open
xieliwei opened this issue Jan 16, 2025 · 0 comments

Comments

@xieliwei
Copy link

I've recently updated sslh and it does not survive for more than a few hours before requiring a restart. Digging into what's happening, it seems that sslh-fork is too strict in handling error-ed accepts():

sslh/sslh-fork.c

Lines 186 to 187 in 710807f

in_socket = accept(endpoint[active_endpoint].socketfd, 0, 0);
CHECK_RES_RETURN(in_socket, "accept", /*void*/ );

This led me to a closed pull request #421 and a commit (3117c15) mentioned in its code review.

The commit is odd though, as it is doing exactly the wrong thing the code review mentioned. The committed code can never be reached because CHECK_RES_RETURN(in_socket, "accept", /*void*/ ); would return when in_socket == -1:

sslh/sslh-fork.c

Lines 186 to 189 in 710807f

in_socket = accept(endpoint[active_endpoint].socketfd, 0, 0);
CHECK_RES_RETURN(in_socket, "accept", /*void*/ );
if (in_socket == -1) {
print_message(msg_system_error, "%s:%d:%s:%d:%s\n",

Could it be that the commit intended to remove the CHECK_RES_RETURN() as well?

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

No branches or pull requests

1 participant