Fedora Account System
Red Hat Associate
Red Hat Customer
The problem code is static bool server_available(std::string_view host, std::string_view service) { // Resolve host name/service to IP address/port struct addrinfo * server_info; if (getaddrinfo(host.data(), service.data(), nullptr, &server_info) != 0) { return false; } // Create a socket int sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd < 0) { freeaddrinfo(server_info); return false; } // Attempt to connect to the server bool retval = true; struct timeval timeout; timeout.tv_sec = 1; timeout.tv_usec = 0; setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)); if (connect(sockfd, server_info->ai_addr, server_info->ai_addrlen) < 0) { retval = false; } close(sockfd); freeaddrinfo(server_info); return retval; } The problem is that when you test an IPv6 address you also need to create an IPv6 socket. On systems where IPv6 is preferred, you almost always get an IPv6 address to test. The AutomaticCommand::wait_for_network() seems pointless as you wouldn't get any addresses to test with if the network is down. At least not when you get the addresses from DNS over the network. Reproducible: Always
See also: https://discussion.fedoraproject.org/t/dnf5-automatic-no-network-connection-detected/205823
I should add that I'm not sure the bug I reported in my forum post is the same as being reported here. I get a dnf5 automatic timeout even when the network is functioning correctly so I believe it always uses cached package lists as a result. I'll open a new bug if required.
@lzqhwo the discussion very likely represents the same root cause, thanks!
I created https://github.com/rpm-software-management/dnf5/pull/3006 PR with a fix for IPv6 environments.