[lxc-devel] [lxd/master] Network: Don't generate volatile.bridge.hwaddr in fan mode or allow static hwaddr to be set
tomponline on Github
lxc-bot at linuxcontainers.org
Fri Aug 7 11:55:54 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 390 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200807/8e78322d/attachment.bin>
-------------- next part --------------
From a059598f46665a38e89369052c74a9c128a61ee4 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Fri, 7 Aug 2020 12:31:29 +0100
Subject: [PATCH 1/2] lxd/network/driver/bridge: Don't allow stable volatile
MAC with fan network
Breaks host<->fan traffic.
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/network/driver_bridge.go | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lxd/network/driver_bridge.go b/lxd/network/driver_bridge.go
index 5518259f0a..997a805184 100644
--- a/lxd/network/driver_bridge.go
+++ b/lxd/network/driver_bridge.go
@@ -48,6 +48,13 @@ type bridge struct {
// fillHwaddr populates the volatile.bridge.hwaddr in config if it, nor bridge.hwaddr, are already set.
func (n *bridge) fillHwaddr(config map[string]string) error {
+ // Fan bridge doesn't support having the same MAC on all nodes (it breaks host<->fan traffic).
+ // Presumably because the host's MAC address is used for routing across the fan network.
+ if config["bridge.mode"] == "fan" {
+ return nil
+ }
+
+ // Don't generate a volatile stable MAC if network already has stable MAC.
if config["bridge.hwaddr"] != "" || config["volatile.bridge.hwaddr"] != "" {
return nil
}
From 0a111a8ae198e5d74b0551eeb54c028a7be51bca Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Fri, 7 Aug 2020 12:53:13 +0100
Subject: [PATCH 2/2] lxd/network/driver/bridge: Don't allow hwaddr to be set
in fan mode
Fan mode doesn't support static MAC address across all nodes.
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/network/driver_bridge.go | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lxd/network/driver_bridge.go b/lxd/network/driver_bridge.go
index 997a805184..cb098e4b88 100644
--- a/lxd/network/driver_bridge.go
+++ b/lxd/network/driver_bridge.go
@@ -162,6 +162,10 @@ func (n *bridge) Validate(config map[string]string) error {
return nil
}
+ if n.config["bridge.mode"] == "fan" {
+ return fmt.Errorf("Cannot specify static MAC address when using fan mode")
+ }
+
return validate.IsNetworkMAC(value)
},
"volatile.bridge.hwaddr": func(value string) error {
More information about the lxc-devel
mailing list