fedora-infra / mirrormanager2

Rewrite of the MirrorManager application in Flask and SQLAlchemy
https://mirrormanager.fedoraproject.org
GNU General Public License v2.0
63 stars 46 forks source link

Use socket.getaddrinfo instead of socket.gethostbyname #305

Open ott opened 2 years ago

ott commented 2 years ago

socket.gethostbyname only returns a single IPv4 address. Any additional IPv4 addresses and all IPv6 addresses are ignored. As a consequence, hosts without IPv4 addresses are ignored and any additional information from additional IPv4 addresses is ignored. If IPv4 addresses are rotated by the implementation of socket.gethostbyname, for example, common with DNS servers and resolvers, the geolocation information for the host can change without every call of socket.gethostbyname.

It seems better to consider all addresses, both all IPv4 and IPv6 addresses, and to summarize the geolocation information when only a single result is required.

ott commented 2 years ago

This pull request is a first step to proper IPv6 support and support for IPv6-only mirrors.

ott commented 2 years ago

IPv6 support is tracked in issue #306 for the moment.