[libvirt] [PATCH 1/4] net-dhcp-leases: Implement the public APIs

Daniel P. Berrange berrange at redhat.com
Wed Sep 11 15:55:34 UTC 2013


On Wed, Sep 11, 2013 at 09:00:09PM +0530, Nehal J Wani wrote:
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index a47e33c..3885baf 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -2800,6 +2800,28 @@ int                     virConnectNumOfDefinedInterfaces (virConnectPtr conn);
>  int                     virConnectListDefinedInterfaces  (virConnectPtr conn,
>                                                            char **const names,
>                                                            int maxnames);
> +
> +typedef struct _virNetworkDHCPLeases virNetworkDHCPLeases;
> +typedef virNetworkDHCPLeases *virNetworkDHCPLeasesPtr;
> +struct _virNetworkDHCPLeases {
> +    long long expirytime;
> +    char *mac;
> +    char *ipaddr;
> +    char *hostname;
> +    char *clientid;
> +};

This is missing

    int type;                /* virIPAddrType */

since it can be IPv4 or IPv6 in general.

Also we have no 'prefix' field here. Although the 'prefix' is present in
the network XML config, I think it would be useful to include it here
too, for parity with the virDomainInterfaceIPAddress struct

> +
> +void virNetworkDHCPLeaseFree(virNetworkDHCPLeasesPtr lease);
> +
> +int virNetworkGetDHCPLeases(virNetworkPtr network,
> +                            virNetworkDHCPLeasesPtr **leases,
> +                            unsigned int flags);
> +
> +int virNetworkGetDHCPLeaseForMAC(virNetworkPtr network,
> +                                 const char *mac,
> +                                 virNetworkDHCPLeasesPtr leases,

This should be '**leases' as with the other method. While our dnsmasq
setup only supports a single lease, for IPv4, that is not suitably
generic. We may well need to support DHCP v6 in the future which would
mean we had multiple leases to return per MAC address.

> +                                 unsigned int flags);
> +
>  /*
>   * virConnectListAllInterfaces:
>   *

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 :|




More information about the libvir-list mailing list