1. 04 12月, 2014 1 次提交
    • P
      leaseshelper: Skip entries missing expiry time on INIT action · 3be8c1f0
      Peter Krempa 提交于
      Coverity pointed out that in other places we always check the return
      value from virJSONValueObjectGetNumberLong() but not in the new addition
      in leaseshelper. To solve the issue and also be more robust in case
      somebody would corrupt the file, skip outputting of the lease entry in
      case the expiry time is missing.
      3be8c1f0
  2. 03 12月, 2014 2 次提交
    • P
      leaseshelper: Refactor control flow · ca6dbdd0
      Peter Krempa 提交于
      Untangle a few conditions into a case statement and improve reporting of
      invaid commands.
      ca6dbdd0
    • N
      leaseshelper: improvements to support all events · 0f87054b
      Nehal J Wani 提交于
      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 obsoletes
      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 passing a custom env var to leaseshelper,
      which helps us map events related to leases with their corresponding
      network bridges, no matter what the event be.
      
      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.
      
      The drawback of this change is that upgrade to this new approach does
      not transfer the existing leases for the network if the leaseshelper
      wasn't already used.
      0f87054b
  3. 11 9月, 2014 1 次提交
    • J
      network: Resolve Coverity FORWARD_NULL · d3f0708e
      John Ferlan 提交于
      If the VIR_STRDUP(exptime,...) fails, then we will jump to cleanup,
      no need to check if exptime is set which causes Coverity to issue
      a complaint in the virStrToLong_ll call because there wasn't a check
      for a NULL value while there was one for the reference right after
      the VIR_STRDUP().
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      d3f0708e
  4. 24 7月, 2014 1 次提交
  5. 17 6月, 2014 3 次提交
  6. 16 6月, 2014 1 次提交
    • P
      leaseshelper: fix another crash · 647bdf02
      Pavel Hrdina 提交于
      We create a 'lease_new' when we are adding new lease entry, then later
      in the code we add the 'lease_new' into a 'leases_array_new' which
      leads into the crash because we double free the 'lease_new'.
      
      To prevent the double free we set the 'lease_new' to NULL after
      successful append into the 'leases_array_new'.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      647bdf02
  7. 11 6月, 2014 1 次提交
    • P
      leaseshelper: fix crash · a93504cc
      Pavel Hrdina 提交于
      Commit baafe668 introduced new leaseshelper with a crash of freeing
      env string. Calling 'getenv()' inside 'virGetEnvAllowSUID()' may
      return a static string and we definitely should not free it.
      
      The author probably want to free the copy of that string.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      a93504cc
  8. 02 6月, 2014 2 次提交
    • P
      Fix build on freebsd · f8a0c9ed
      Pavel Hrdina 提交于
      On freebsd there isn't known "setlocale" so we have to include locale.h
      f8a0c9ed
    • N
      Add helper program to create custom leases · baafe668
      Nehal J Wani 提交于
      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/network/leaseshelper.c
         * Helper program to create the custom lease file
      baafe668