Re: [PATCH] leaseshelper: add enhancements to support all events

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

 



On Fri, Jul 11, 2014 at 5:49 AM, Nehal J Wani <nehaljw.kkd1@xxxxxxxxx> wrote:
> This patch enables the helper program to detect event(s) triggered when there
> is a change in lease length or expiry and client-id. This transfers complete
> control of leases database to libvirt and suppresses use of the lease database
> file (<network-name>.leases). That file will not be created, read, or written.
> This is achieved by adding the option --leasefile-ro to dnsmasq and applying
> the symlink technique, which helps us map events related to leases with their
> corresponding network bridges.
> Example:
> /var/lib/libvirt/dnsmasq/virbr0.helper -> /home/wani/libvirt/src/libvirt_leaseshelper
> /var/lib/libvirt/dnsmasq/virbr3.helper -> /home/wani/libvirt/src/libvirt_leaseshelper
>
> Also, this requires the addition of a new non-lease entry in our custom lease
> database: "server-duid". It is required to identify a DHCPv6 server.
>
> Now that dnsmasq doesn't maintain its own leases database, it relies on our
> helper program to tell it about previous leases and server duid. Thus, this
> patch makes our leases program honor an extra action: "init", in which it sends
> the known info in a particular format to dnsmasq by printing it to stdout.
>
> ---
>  src/network/bridge_driver.c |  43 +++++++++++-
>  src/network/leaseshelper.c  | 156 +++++++++++++++++++++++++++++++++++++-------
>  2 files changed, 175 insertions(+), 24 deletions(-)

make syntax-check reported two flaws. Following diff rectifies it:

diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c
index 3d6c773..bdc1b77 100644
--- a/src/network/leaseshelper.c
+++ b/src/network/leaseshelper.c
@@ -30,6 +30,7 @@
 #include <stdlib.h>
 #include <sys/stat.h>

+#include "dirname.h"
 #include "virutil.h"
 #include "virthread.h"
 #include "virfile.h"
@@ -54,7 +55,7 @@
  * Use this when passing possibly-NULL strings to printf-a-likes.
  * Required for unkown parameters during init call.
  */
-# define EMPTY_STR(s) ((s) ? (s) : "*")
+#define EMPTY_STR(s) ((s) ? (s) : "*")


 static const char *program_name;
@@ -181,7 +182,7 @@ main(int argc, char **argv)
      * expired leases. Our symlink hack provides us an alternative method to
      * find it */
     if (!interface) {
-        interface = basename(argv[0]);
+        interface = last_component(argv[0]);
        *(strchr(interface, '.')) = '\0';
     }





Regards,
Nehal J Wani

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