]> git.ipfire.org Git - thirdparty/collectd.git/commit
write_prometheus: don't use AI_ADDRCONFIG for resolving bind address
authorWolf480pl <wolf480@interia.pl>
Tue, 21 Nov 2023 10:53:59 +0000 (11:53 +0100)
committerMatthias Runge <mrunge@matthias-runge.de>
Tue, 21 Nov 2023 16:01:35 +0000 (17:01 +0100)
commit951fababf57087dbf77fa241e133f98ad73a7389
tree5d954cb9db498137dbde3a4b7a03781066b3452e
parentcfdfe4aa3f6dae65d9b7c9265993c74610d85c62
write_prometheus: don't use AI_ADDRCONFIG for resolving bind address

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.
src/write_prometheus.c