[lxc-devel] [lxd/master] lxd/network: Fix fan subnet calculation logic
stgraber on Github
lxc-bot at linuxcontainers.org
Tue Apr 24 20:35:56 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180424/646ce02d/attachment.bin>
-------------- next part --------------
From 24f13b218e52e07c5832e4044731719544e8d2ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 24 Apr 2018 16:34:47 -0400
Subject: [PATCH] lxd/network: Fix fan subnet calculation logic
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/networks_utils.go | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lxd/networks_utils.go b/lxd/networks_utils.go
index ccef0ed59..6846ab537 100644
--- a/lxd/networks_utils.go
+++ b/lxd/networks_utils.go
@@ -633,12 +633,15 @@ func networkFanAddress(underlay *net.IPNet, overlay *net.IPNet) (string, string,
ipBytes[0] = overlay.IP[0]
if overlaySize == 16 {
ipBytes[1] = overlay.IP[1]
+ ipBytes[2] = ipBytes[3]
} else if underlaySize == 24 {
- ipBytes[1] = 0
+ ipBytes[1] = ipBytes[3]
+ ipBytes[2] = 0
} else if underlaySize == 16 {
ipBytes[1] = ipBytes[2]
+ ipBytes[2] = ipBytes[3]
}
- ipBytes[2] = ipBytes[3]
+
ipBytes[3] = 1
return fmt.Sprintf("%s/%d", ipBytes.String(), overlaySize), dev, ipStr, err
More information about the lxc-devel
mailing list