On Mon, Feb 24, 2014 at 5:27 PM, Nehal J Wani <nehaljw.kkd1(a)gmail.com> wrote:
Introduce helper program to catch events from dnsmasq and maintain a
custom
lease file per network. It supports dhcpv4 and dhcpv6. The file is saved as
"<interface-name>.status".
Each lease contains the following info:
<expiry-time (epoch time)> <mac> <iaid> <ip-address>
<hostname> <clientid>
Example of custom leases file content:
[
{
"iaid": "1221229",
"ip-address": "2001:db8:ca2:2:1::95",
"mac-address": "52:54:00:12:a2:6d",
"hostname": "Fedora20",
"client-id":
"00:04:1a:c1:d9:6b:5a:0a:e2:bc:f8:4b:1e:37:2e:38:22:55",
"expiry-time": 1393244216
},
{
"ip-address": "192.168.150.208",
"mac-address": "52:54:00:11:56:b3",
"hostname": "Wani-PC",
"client-id": "01:52:54:00:11:56:b3",
"expiry-time": 1393244248
}
]
src/Makefile.am:
* Add options to compile the helper program
src/network/bridge_driver.c:
* Introduce networkDnsmasqLeaseFileNameCustom()
* Invoke helper program along with dnsmasq
* Delete the .status file when corresponding n/w is destroyed.
src/util/leaseshelper.c
* Helper program to create the custom lease file
---
v3:
* Improved file handling, removed redundant copying, introduced --help and --version
v2:
* Changed format to JSON
* Refer:
https://www.redhat.com/archives/libvir-list/2014-January/msg01234.html
v1:
* Refer:
https://www.redhat.com/archives/libvir-list/2014-January/msg00626.html
src/Makefile.am | 16 +++
src/network/bridge_driver.c | 19 +++
src/util/leaseshelper.c | 303 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 338 insertions(+), 0 deletions(-)
create mode 100644 src/util/leaseshelper.c