The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3369

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Georg Hopp <[email protected]>

This is an addition to the fix of #2781 which also removes IPv6 leases on container delete.
From c1a9484c01334c74277a36b21885be6f31e59b9b Mon Sep 17 00:00:00 2001
From: Georg Hopp <[email protected]>
Date: Wed, 31 May 2017 14:10:42 +0200
Subject: [PATCH] Remove IPv6 leases on container delete

Signed-off-by: Georg Hopp <[email protected]>
---
 lxd/container_lxc.go  | 2 +-
 lxd/networks_utils.go | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index 3042a1471..c3de4de65 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -2779,7 +2779,7 @@ func (c *containerLXC) Delete() error {
                        continue
                }
 
-               networkClearLease(c.daemon, m["parent"], m["hwaddr"])
+               networkClearLease(c.daemon, m["parent"], c.Name())
        }
 
        logger.Info("Deleted container", ctxMap)
diff --git a/lxd/networks_utils.go b/lxd/networks_utils.go
index 0009e9972..0f4ba66d2 100644
--- a/lxd/networks_utils.go
+++ b/lxd/networks_utils.go
@@ -850,7 +850,7 @@ func networkSysctl(path string, value string) error {
        return ioutil.WriteFile(fmt.Sprintf("/proc/sys/net/%s", path), 
[]byte(value), 0)
 }
 
-func networkClearLease(d *Daemon, network string, hwaddr string) error {
+func networkClearLease(d *Daemon, network string, name string) error {
        leaseFile := shared.VarPath("networks", network, "dnsmasq.leases")
 
        // Check that we are in fact running a dnsmasq for the network
@@ -888,7 +888,7 @@ func networkClearLease(d *Daemon, network string, hwaddr 
string) error {
                }
 
                fields := strings.Fields(lease)
-               if len(fields) > 2 && strings.ToLower(fields[1]) == 
strings.ToLower(hwaddr) {
+               if len(fields) > 2 && strings.ToLower(fields[3]) == 
strings.ToLower(name) {
                        continue
                }
 
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to