Hi,

While using the function libvirt_domain_interface_addresses() with qemu guest agent as the source, for interfaces with more than one IP address, the function will only return one IP.

Example code:

$netdetails = libvirt_domain_interface_addresses($vmres, 2);
foreach ($netdetails as $nic) {
        print_r($nic);
}


Example output:

Array
(
   [name] => eth0
   [hwaddr] => 52:54:00:12:b9:22
   [naddrs] => 2
   [addrs] => Array
       (
           [addr] => fe80::5054:ff:fe12:b922
           [prefix] => 64
           [type] => 1
       )

)
Array
(
   [name] => eth1
   [hwaddr] => 52:54:00:8e:b0:35
   [naddrs] => 2
   [addrs] => Array
       (
           [addr] => fe80::5054:ff:fe8e:b035
           [prefix] => 64
           [type] => 1
       )

)

As you can see for this guest the function returns two interfaces (eth0 and eth1). For both interfaces naddrs => 2 which is correct because both interfaces have an ipv4 and an ipv6 address but the addrs array only contains the ipv6 address information while the ipv4 address information is missing.

System information:

OS: Debian Bullseye
PHP version (fast cgi): 7.3.15
Libvirt PHP version: 0.5.5
Libvirt version: 6.0.0

KVM host libvirt version: 5.9.0

If you need any other information please let me know.

Thanks.

Fernando


Reply via email to