[libvirt] [RFC] net-dhcp-leases: virNetworkDHCPLeases struct design

Nehal J Wani nehaljw.kkd1 at gmail.com
Tue Oct 8 12:39:22 UTC 2013


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) */
    char *hostname;             /* Hostname (can be null) */
    char *clientid;             /* Client ID(ipv4) or DUID(ipv6) (can
be null, in case of ipv4) */
};
-- 
Nehal J Wani




More information about the libvir-list mailing list