Re: [PATCHv4 1/4] net-dhcp-leases: Implement the public APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 2, 2013 at 1:43 PM, Daniel P. Berrange <berrange@xxxxxxxxxx> wrote:
> On Tue, Oct 01, 2013 at 05:39:02PM -0600, Eric Blake wrote:
>> On 09/26/2013 02:08 AM, Nehal J Wani wrote:
>> > Introduce 3 new APIs, virNetworkGetDHCPLeases, virNetworkGetDHCPLeasesForMAC
>> > and virNetworkDHCPLeaseFree.
>> >
>> > * virNetworkGetDHCPLeases: returns the dhcp leases information for a given
>> >      virtual network.
>> >
>> >      For DHCPv4, the information includes:
>> >      - Expirytime
>> >      - MAC Address
>> >      - IPv4 address (with type and prefix)
>> >      - Hostname (can be NULL)
>> >      - Client ID (can be NULL)
>> >
>> >      For DHCPv6, the information includes
>> >      - Expirytime
>> >      - IAID
>> >      - IPv6 address (with type and prefix)
>> >      - Hostname (can be NULL)
>> >      - Client DUID
>> >
>> > * virNetworkGetDHCPLeasesForMAC: returns the dhcp leases information for a
>> >      given virtual network and specified MAC Address.
>> >
>> > * virNetworkDHCPLeaseFree: allows the upper layer application to free the
>> >      network interface object conveniently.
>> >
>> > There is no support for flags, so user is expected to pass 0 for
>> > both the APIs.
>>
>>
>> > +typedef struct _virNetworkDHCPLeases virNetworkDHCPLeases;
>> > +typedef virNetworkDHCPLeases *virNetworkDHCPLeasesPtr;
>> > +struct _virNetworkDHCPLeases {
>> > +    long long expirytime;       /* Seconds since epoch */
>> > +    union {
>> > +        char *mac;              /* MAC address */
>> > +        unsigned long iaid;     /* Identity association identifier (IAID) */
>> > +    } id;
>>
>> I'm not sure I like iaid - the whole point of this interface was to
>> return IP addresses associated with a MAC.  Either the iaid is important
>> and deserves a separate field, or all we care about is the MAC address.
>>  Not to mention that you didn't document which leg of the id union is
>> valid based on the type discriminator.
>
> Agreed, we want the MAC address to be unconditionally available
> here. IMHO the IAID is not something we care about exposing. That
> is a impl detail of the DHCP comms protocol that is not useful
> to people outside.
>

So in case DHCPv6 is used by the client, should we report the rest of
the lease fields and report MAC as NULL?


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



-- 
Nehal J Wani
UG3, BTech CS+MS(CL)
IIIT-Hyderabad
http://commandlinewani.blogspot.com

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]