libvirt/tests/nssdata/virbr0.status
Michal Privoznik a7cbfabc2f libvirt_nss: Report newer addresses first
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>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-07-15 13:48:19 +02:00

26 lines
619 B
Plaintext

[
{
"ip-address": "192.168.122.197",
"mac-address": "52:54:00:a4:6f:91",
"hostname": "fedora",
"expiry-time": 1900000002
},
{
"ip-address": "192.168.122.198",
"mac-address": "52:54:00:a4:6f:92",
"hostname": "fedora",
"expiry-time": 1900000001
},
{
"ip-address": "192.168.122.254",
"mac-address": "52:54:00:3a:b5:0c",
"hostname": "gentoo",
"expiry-time": 2000000000
},
{
"ip-address": "192.168.122.2",
"mac-address": "52:54:00:11:22:33",
"expiry-time": 2000000000
}
]