policy: retry hostname resolution when it fails
Summary
(Describe what the merge request does)
Currently if the system hostname can't be determined, NetworkManager only retries when something changes: a new address is added, the DHCP lease changes, etc.
However, it might happen that the current failure in looking up the hostname is caused by an external factor, like a temporary outage of the DNS server.
Add a mechanism to retry the resolution with an increasing timeout.
Checklist
Please read https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/main/CONTRIBUTING.md before opening the merge request. In particular, check that:
-
the subject for all commits is concise and explicative -
the message for all commits explains the reason for the change -
the source is properly formatted -
any relevant documentation is up to date -
you have added unit tests if applicable -
the NEWS file is updated when the change deserves to be mentioned, for example for new features, behavior changes, API deprecations, etc.