[lxc-devel] [lxd/master] Remove IPv6 leases on container delete
georghopp on Github
lxc-bot at linuxcontainers.org
Wed May 31 12:13:52 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 392 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170531/a517330e/attachment.bin>
-------------- next part --------------
From eb5719a75aa514428cb7005b2564ab8275bce330 Mon Sep 17 00:00:00 2001
From: Georg Hopp <georg at steffers.org>
Date: Wed, 31 May 2017 14:10:42 +0200
Subject: [PATCH] Remove IPv6 leases on container delete
---
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
}
More information about the lxc-devel
mailing list