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

write_prometheus: don't use AI_ADDRCONFIG for resolving bind address #4153

Merged

Conversation

Wolf480pl
Copy link
Contributor

@Wolf480pl Wolf480pl commented Nov 21, 2023

Fixes #4150

write_prometheus uses getaddrinfo to resolve the bind address. The AI_ADDRCONFIG flag causes getaddrinfo to refuse to resolve 0.0.0.0 when the system has no non-loopback IPv4 addresses configured and refuse to resolve :: when the system has no non-loopback IPv6 configured.

We want binding to a wildcard address (0.0.0.0 or ::) to always work, even if the network is down.

To achieve that, don't pass the AI_ADDRCONFIG flag when resolving a bind address.

Changelog: write_prometheus: fixed failing to listen on wildcard address before network is up

Fixes collectd#4150

write_prometheus uses getaddrinfo to resolve the bind address.
The AI_ADDRCONFIG flag causes getaddrinfo to refuse to resolve
0.0.0.0 when the system has no non-loopback IPv4 addresses configured
and refuse to resolve :: when the system has no non-loopback IPv6 configured.

We want binding to a wildcard address (0.0.0.0 or ::) to always work,
even if the network is down.

To achieve that, don't pass the AI_ADDRCONFIG flag
when resolving a bind address.
@Wolf480pl Wolf480pl marked this pull request as ready for review November 21, 2023 11:42
@Wolf480pl Wolf480pl requested a review from a team as a code owner November 21, 2023 11:42
Copy link
Member

@mrunge mrunge left a comment

Choose a reason for hiding this comment

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

Thank you

@mrunge mrunge merged commit 951faba into collectd:main Nov 21, 2023
10 of 26 checks passed
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.

write_prometheus fails to bind when the host has no non-loopback IP addresses
2 participants