
On 7/15/19 10:16 AM, Erik Skultety wrote:
On Sat, Jul 13, 2019 at 12:58:38PM +0200, Michal Privoznik wrote:
Ideally, a software that's translating domain names would iterate over all addresses the NSS returned, but some software does not bother (e.g. ping). What happens is that for instance when installing a guest, it's assigned one IP address but once it's installed and rebooted it gets a different IP address (because client ID used for the first DHCP traffic when installing the guest was generated dynamically and never saved so after reboot the guest generated new ID which resulted in different IP address to be assigned). This results in 'ping $domain' not working properly as it still pings the old IP address. Well, it might - NSS plugin does not guarantee any order of addresses.
To resolve this problem, we can sort the array just before returning it to the caller (ping) so that the newer IP addresses come before older ones.
Reported-by: Andrea Bolognani <abologna@redhat.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- ...
{ "ip-address": "192.168.122.254", "mac-address": "52:54:00:3a:b5:0c", "hostname": "gentoo", - "expiry-time": 2000000000 + "expiry-time": 2000000001
So, why is ^this specific change needed? In the test, you're expecting 192.168.122.[197-199], 192.168.122.199 has expiry time of 1900000000, so the test would still work.
192.168.122.254 is only assumed in a gentoo test twice, but there are no other addresses to sort in those cases, so the expiry time in there should not matter right?
With the explanation of the above: Reviewed-by: Erik Skultety <eskultet@redhat.com>
Oh right, I don't understand how it got there. I'm removing it before pushing. Thanks for the review! Michal