
On Tue, Oct 08, 2013 at 06:09:22PM +0530, Nehal J Wani wrote:
Continued from https://www.redhat.com/archives/libvir-list/2013-October/msg00325.html
Earlier, the virNetworkDHCPLeases struct design was:
struct _virNetworkDHCPLeases { long long expirytime; /* Seconds since epoch */ union { char *mac; /* MAC address */ unsigned long iaid; /* Identity association identifier (IAID) */ } id; char *ipaddr; /* IP address */ char *hostname; /* Hostname */ char *clientid; /* Client ID or DUID */ int type; /* virIPAddrType */ unsigned int prefix; /* IP address prefix */ };
Since no one likes the idea of having a union, but we do want to support dhcpv6, following is the new design:
struct _virNetworkDHCPLeases { char *interface; /* Network interface name (non-null) */ long long expirytime; /* Seconds since epoch (non-null) */ int type; /* virIPAddrType (non-null) */ unsigned int prefix; /* IP address prefix (non-null) */ char *mac; /* MAC address (mostly non-null, except rare cases) */ char *iaid; /* IAID (ipv6) (null, in case of ipv4) */ char *ipaddr; /* IP address (non-null) */
I'd suggest the 'prefix' should be placed here, since it is associated with the 'ipaddr' field.
char *hostname; /* Hostname (can be null) */ char *clientid; /* Client ID(ipv4) or DUID(ipv6) (can be null, in case of ipv4) */ };
ACK, not convinced we need 'clientid', but it doesn't harm us to expose it just in case. Daniel. -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|