On 07/20/2011 02:11 AM, Laine Stump wrote:
In the subject:
s/utilies/utilities/
This function uses ioctl(SIOCGIFADDR), which limits it to returning
the first IPv4 address of an interface, but that's what we want right
now (the place we're going to use the address only accepts one).
---
src/libvirt_private.syms | 1 +
src/util/interface.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++
src/util/interface.h | 3 ++
3 files changed, 64 insertions(+), 0 deletions(-)
@@ -511,6 +512,65 @@ ifaceSetMacAddress(const char *ifname ATTRIBUTE_UNUSED,
/**
+ * ifaceGetIPAddress:
+ * @ifname: name of the interface whose IP address we want
+ * @macaddr: MAC address (VIR_MAC_BUFLEN in size)
+ *
+ * This function gets the @macaddr for a given interface @ifname.
+ *
+ * Returns 0 in case of success or an errno code in case of failure.
Positive on error? Should we instead be returing -errno, so callers can
check < 0, per our typical usage?
Conditional ACK, depending on the answer to that question (the code
looks correct, and converting to negative return on failure seems
trivial enough if we decide to go that way).
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org