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

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) ===
Avoids detecting the incorrect fan underlay address when /32 VIPs from the underlay subnet are added to a different interface than the underlay subnet is being used on.

Fixes https://discuss.linuxcontainers.org/t/delete-a-stopped-container-bring-down-the-fan-interface/8803

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From 602ecadd3c7a1286bf2d1245394f06824c712394 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@canonical.com>
Date: Wed, 2 Sep 2020 11:04:54 +0100
Subject: [PATCH] lxd/network/driver/bridge: Exclude /32 underlay addresses
 from overlay address generation

Avoids detecting the incorrect fan underlay address when /32 VIPs from the 
underlay subnet are added to a different interface than the underlay subnet is 
being used on.

Fixes 
https://discuss.linuxcontainers.org/t/delete-a-stopped-container-bring-down-the-fan-interface/8803

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
---
 lxd/network/driver_bridge.go | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lxd/network/driver_bridge.go b/lxd/network/driver_bridge.go
index 8ef1e612e4..9d04ba123b 100644
--- a/lxd/network/driver_bridge.go
+++ b/lxd/network/driver_bridge.go
@@ -1819,11 +1819,18 @@ func (n *bridge) addressForSubnet(subnet *net.IPNet) 
(net.IP, string, error) {
                }
 
                for _, addr := range addrs {
-                       ip, _, err := net.ParseCIDR(addr.String())
+                       ip, network, err := net.ParseCIDR(addr.String())
                        if err != nil {
                                continue
                        }
 
+                       // Skip /32 addresses on interfaces in case VIPs are 
being used on a different interface
+                       // than the intended underlay subnet interface.
+                       maskOnes, maskSize := network.Mask.Size()
+                       if maskOnes == 32 && maskSize == 32 {
+                               continue
+                       }
+
                        if subnet.Contains(ip) {
                                return ip, iface.Name, nil
                        }
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to