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

Nehal J Wani nehaljw.kkd1 at gmail.com
Fri Oct 4 15:57:50 UTC 2013


The dnsmasq guys have confirmed that the code exposing the environment
variable DNSMASQ_MAC in case ipv6 will be out in the coming week as an
official release. Meanwhile, I had a chat with mrjester on #ipv6
regarding fields which are supposed to be useful to users in case
DHCPv6 is used. I've attached the chat history.

Now, coming to the API, I do think that supporting --dhcp-script will
be a good option. So that we don't land up with half-implementations.
So I am hoping that we are in a position to finalize the
virNetworkDHCPLeases struct now.

In case of DHCPv6, we should be exposing expirytime, MAC Address, IP
Address, hostname, client DUID, IAID and the interface name to which
the lease is provided (which can be obtained from the env variable
DNSMASQ_INTERFACE)

I personally think the easiest way would be to have all possible
values in the virNetworkDHCPLeases struct and let the user decide
which one he wants. The ones which are not available, will be set to
NULL.


-- 
Nehal J Wani
-------------- next part --------------
<nehaljwani> Hello! I am developing an API for libvirt which exposes leases API to the users for a particular network. Since we are also planning to include support for DHCPv6, I would like to know which fields in a dhcpv6 lease are important, from a user's point of view. Example, will exposing IAID be useful to a user or not?
<mrjester> Yes.
<mrjester> DUID
<mrjester> DHCP server
<mrjester> Lease time
<nehaljwani> mrjester, I am talking more in terms of info related to guests, not the dhcp server itself
<mrjester> That is relevant to the client.
<mrjester> The DHCP server that issues the lease.
<mrjester> Useful for troubleshooting.
<nehaljwani> and which fields are important in the leases info of the client machines?
<mrjester> Ahh. I see. 
<nehaljwani> out of expirytime, mac address, iaid, client duid, ip address
<nehaljwani> etc
<mrjester> IAID, DUID, Addres, 
<mrjester> MAC wouldn't hurt, but not really relevant to DHCPv6
<nehaljwani> Could you explain a bit more on that? I mean, why is MAC irrelevant, but IAID is more relevant?
<mrjester> MAC isn't used in the standard DHCP request.
<mrjester> DUID is derived from the MAC
<mrjester> but is used instead
<mrjester> IAID indicates the interface that the request is for.
<mrjester> There are some variants of DHCP which use the actual MAC, but that is non-standard behavior.  Not invalid, just not the default.
<nehaljwani> Well, currently libvirt uses dnsmasq
<mrjester> Probably makes sense to have the MAC as well then since dnsmasq tries to do some magic with DDNS between v4 and v6.
<mrjester> eg. Putting in DDNS entries for a SLAAC address based on the v4 address.
<mrjester> Short version, since you are using dnsmasq, yes exposing the MAC Addr makes sense.
<nehaljwani> the dnsmasq guys don't release the MAC in the lease file. We have to give the --dchp-script option to dnsmasq to extract it from environment variables. 
<mrjester> What about on the v4 side?
<nehaljwani> On the v4 side, they do.
<mrjester> or at the itnerface.
<mrjester> Good enough I would think
<mrjester> Shouldn't need to pull it twice.
<nehaljwani> mrjester, http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2013q4/007589.html
<mrjester> IMO, the ideal situation is that all details in the lease file are exportable via the API and you allow the consumers to decide what to request/display.
<nehaljwani> By all, do you mean, the server DUID as well?
<mrjester> Why not?  While you nor I may see a use for it today, someone will probably come up with a clever use.
<mrjester> Why not aside from the extra dev work of course.
<nehaljwani> And if we are talking in present day scenario, which fields will be important for a user?
<mrjester> Does the lease expose the DHCP options that were sent?
<mrjester> DNS, SNTP servers
<mrjester> Address, DUID, IAID, Expiriry, DHCP Server IP would probably be the most used today.  
<mrjester> If you have the options in the lease file, those too.
<nehaljwani> mrjester, if we are taking about only the leases, then, in case of ipv4, they are : expirytime, mac address, ip address, hostname, client id and in case of ipv6, they are: server duid, expirytime, IAID, ip address, hostname, client DUID
<mrjester> Server DUID is the only one of those that has questionable usefulness.
<mrjester> Since it is not easily associated to a server.


More information about the libvir-list mailing list