- 20 1月, 2016 2 次提交
-
-
由 Ján Tomko 提交于
We either use the value from the environment variable, or learn it from the existing lease file. In the second case, the pointer would be pointing into the JSON object of the first lease with a DUID, owned by leases_array, then leases_array_new. Always allocate the string instead, making obvious who should free the string.
-
由 Ján Tomko 提交于
If dnsmasq specified DNSMASQ_IAID (so we're dealing with an IPv6 lease) but no DNSMASQ_MAC, we skip creation of the new lease object. Also skip adding it to the leases array. https://bugzilla.redhat.com/show_bug.cgi?id=1202350
-
- 04 12月, 2014 2 次提交
-
-
由 Peter Krempa 提交于
Introduced in ca6dbdd0
-
由 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.
-
- 03 12月, 2014 2 次提交
-
-
由 Peter Krempa 提交于
Untangle a few conditions into a case statement and improve reporting of invaid commands.
-
由 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.
-
- 11 9月, 2014 1 次提交
-
-
由 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>
-
- 24 7月, 2014 1 次提交
-
-
由 Nehal J Wani 提交于
Contents of existing lease file were being stored in a variable which was never freed.
-
- 17 6月, 2014 3 次提交
-
-
由 Peter Krempa 提交于
When copying entries from the old lease file into the new array the old code would copy the pointer of the json object into the second array without removing it from the first. Afterwards when both arrays were freed this might lead to a crash due to access of already freed memory. Refactor the code to use the new array item stealing helper added to the json code so that the entry resides just in one array.
-
由 Peter Krempa 提交于
Instead of reporting an error and terminating, rewrite the file with the newly learned info.
-
由 Peter Krempa 提交于
The value is provided via environment and causes a crash if not defined.
-
- 16 6月, 2014 1 次提交
-
-
由 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>
-
- 11 6月, 2014 1 次提交
-
-
由 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>
-
- 02 6月, 2014 2 次提交
-
-
由 Pavel Hrdina 提交于
On freebsd there isn't known "setlocale" so we have to include locale.h
-
由 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
-