[pve-devel] [PATCH pve-cluster] pve-cluster.service : remove 127.0.1.1 from /etc/hosts

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Jun 28 10:13:27 CEST 2023


Am 28/06/2023 um 09:47 schrieb DERUMIER, Alexandre:
>> Let's rather improve pmxcfs logic for getting the non-local IP
>> configured on
>> a node via getaddrinfo with the ALL flag and filtering out local
>> IPs..
> oh, I didn't known than getaddrinfo could return multiple ips.

yes, check the "getaddrinfo_all" method in PVE::Tools and how it's used
in the "get_local_ip" method in PVE::Network.

> (I thinked it was doing a simple dns resolution)
> I'll look at that, thanks !
> 

if you don't get to it I would take a look tomorrow – as yes, this is indeed
annoying and it seems that quite some users are affected, at least relatively
speaking.


im pmxcfs.c one would need to adapt lookup_node_ip, mostly set the flags for
the ahints struct directly, the memset to zero should not be required then
any more, i.e.:

struct addrinfo ahints = { 
    .ai_flags = AI_V4MAPPED | AI_ALL
};

and then wrap the existing code into a loop, returning once the first non-local
IP was found, something like:

for (struct addrinfo addr = ainfo; addr != NULL; addr = addr->ai_next) {
    // ...
}

so it shouldn't be _that_ hard.





More information about the pve-devel mailing list