[libvirt] RFC: Implement virDomainGetIPAddress()

Michal Novotny minovotn at redhat.com
Fri Jul 15 10:11:00 UTC 2011


[snip]
>
> ipv4s = virDomainGetIPAddress(domain, macaddr, &count, VIR_DOMAIN_ADDRESS_IPV4);
> ipv6s = virDomainGetIPAddress(domain, macaddr, &count, VIR_DOMAIN_ADDRESS_IPV6);
>
> This are the simple cases where the caller explicitly requests only
> one version and knows the version of the returned IP addresses. But
> what about this
>
> ips = virDomainGetIPAddress(domain, macaddr, &count,
> VIR_DOMAIN_ADDRESS_IPV4 | VIR_DOMAIN_ADDRESS_IPV6);
>
> Now the caller needs to detect the version from the IPs string
> representation. Maybe string representation isn't the best approach
> here.
>
> Anyway, I'm probably already overengineering this here :)

I've been talking to jdenemar about this and Jirka was a great resource.
We've discussed options to be used for getting both IPv4 and IPv6
addresses. Since it's possible that the guest is not used and therefore
the entry would be dropped from the ARP table then we have to consider
other implementations. We've been talking about nwfilters and that they
are most likely using libpcap to get the information of the guest's IP
address so we may be able to use them as well. Also, the leases file of
DHCP (if client uses DHCP) could be a good thing although the best way
to get it would be the ARP table however this should be implemented
several ways if the ARP entry lookup fails.

If we have a look to [1] we may be able to find the IP address in the
packet sniffer using the libpcap facility.

Michal

[1] http://tldp.org/HOWTO/Linux+IPv6-HOWTO/examples-tcpdump.html

-- 
Michal Novotny <minovotn at redhat.com>, RHCE, Red Hat
Virtualization | libvirt-php bindings | php-virt-control.org




More information about the libvir-list mailing list