Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

net: Ensure consistent binding to IPV6 if address is absent #7683

Closed

Conversation

raymondfeng
Copy link

See #7675:

net.server.listen() behaves inconsistently depending on whether the port
number is provided.

  1. port === 0 && host == '' (i.e. false-y), node creates an AF_INET
    socket but does not call bind().
  2. port > 0 && host == '', node creates an AF_INET6 socket and calls
    bind().

The fix makes 1 consistent with 2.

@trevnorris trevnorris added the net label May 24, 2014
handle.close();
// Fallback to ipv4
return createServerHandle('0.0.0.0', port);
}
Copy link
Member

Choose a reason for hiding this comment

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

Duplicates the logic at lines 1084-1090. Can you find a way to unify both blocks?

See nodejs#7675
net.server.listen() behaves inconsistently depending on whether the port
number is provided.

1. port === 0 && host == '' (i.e. false-y), node creates an AF_INET
socket but does not call bind().

2. port > 0 && host == '', node creates an AF_INET6 socket and calls
bind().

The fix makes 1 consistent with 2.
@raymondfeng
Copy link
Author

@bnoordhuis Thank you for review. The issues you raised should have been fixed now.

@piscisaureus
Copy link

@indutny

@indutny
Copy link
Member

indutny commented May 28, 2014

LGTM, running tests

@indutny
Copy link
Member

indutny commented May 28, 2014

Thank you very much, landed in 57c5655

@indutny indutny closed this May 28, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants