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

feat: add address handling for unspecified IPs in connect function #2070

Closed
wants to merge 1 commit into from

Conversation

rinor
Copy link
Contributor

@rinor rinor commented Sep 26, 2024

Added a utility function to set loopback addresses for unspecified IPv4 and IPv6 addresses during socket connection attempts. This ensures proper handling of "0.0.0.0" and "::" addresses.

@rinor rinor force-pushed the set_loopback_if_any branch 2 times, most recently from 5c8f56e to d07a726 Compare September 26, 2024 14:36
@rinor rinor marked this pull request as ready for review September 26, 2024 14:37
Added a utility function to set loopback addresses for unspecified IPv4 and IPv6 addresses during socket connection attempts.
This ensures proper handling of "0.0.0.0" and "::" addresses.
@francescolavra
Copy link
Member

Connecting to 0.0.0.0 or [::] is non-standard practice, and as such I'm a little reluctant to add support for it. Is there an application out in the wild that uses this and you want to run on Nanos?

@rinor
Copy link
Contributor Author

rinor commented Sep 27, 2024

Connecting to 0.0.0.0 or [::] is non-standard practice, and as such I'm a little reluctant to add support for it. Is there an application out in the wild that uses this and you want to run on Nanos?

Right, strictly speaking those are not valid as a destination address, only as a source address, but based on what i.e linux is doing (copies source address to destination address, and if the packet does not have a source address, both are set to the loopback address), it's being (ab)used.

I encountered this while trying to build some stuff with https://github.com/ergo-services/examples.

I understand the reluctance and agree, however we could put that behind a build flag leaving it disabled by default, assuming there is any interest at all, otherwise I don't mind closing this since the correct solution would be fixing the application.

@rinor rinor closed this Sep 27, 2024
@francescolavra
Copy link
Member

I would prefer not to add this functionality for the time being. If its use by existing applications turns out to be more widespread, we could revisit this.
Thanks

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.

2 participants