Upping an interface without configuring it is not a “cardinal sin” but a
sensible way to achieve auto-configuration, e.g. with IPv6 SLAAC (RFC
4862). If NetworkManager has troube with interfaces having only a
link-local address, this is a bug in NetworkManager, not in libvirt; it
should listen for router advertisements to decide if some interface has
global connectivity or not.
With network interfaces up by default, stateless containers can be
easily auto-configured through the network with SLAAC, without any
specific configuration from the host system.
This reverts commit c3cf3c43a0bb2e0e4909c32821e20f607635ec85.
Signed-off-by: Benjamin Cama
---
Hi,
The patch that I propose to revert basically broke my workflow for light
stateless containers, where they could be auto-configured on IPv6-only network
through SLAAC. Of course, fully-fledged containers can bring up the interface
themselves, but this behavior had previously been the default for quite some
time, and is even indicated as default in src/conf/domain_conf.h ("Default link
state (up)").
I cannot find any real justification for the patch I am reverting, and the
bugzilla looks private so I can not comment on the NetworkManager behavior,
which looks very buggy to me.
Please tell me if you think this is wrong. Also, please Cc me, I am not
subscribed.
Regards.
.mailmap| 1 +
src/lxc/lxc_container.c | 7 +--
src/lxc/lxc_native.c| 10 ++
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/.mailmap b/.mailmap
index 2f0fc901e..9dc3bff85 100644
--- a/.mailmap
+++ b/.mailmap
@@ -36,6 +36,7 @@
+
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 96fceaf1b..e546f0aaf 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -517,12 +517,7 @@ lxcContainerRenameAndEnableInterfaces(virDomainDefPtr
vmDef,
if (virNetDevSetName(veths[i], newname) < 0)
goto cleanup;
-/* Only enable this device if there is a reason to do so (either
- * at least one IP was specified, or link state was set to up in
- * the config)
- */
-if (netDef->guestIP.nips ||
-netDef->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP) {
+if (netDef->linkstate != VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN) {
VIR_DEBUG("Enabling %s", newname);
if (virNetDevSetOnline(newname, true) < 0)
goto cleanup;
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index fdc03a57e..f77a2a910 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -349,10 +349,12 @@ lxcCreateNetDef(const char *type,
if (VIR_ALLOC(net) < 0)
goto error;
-if (STREQ_NULLABLE(flag, "up"))
-net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP;
-else
-net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN;
+if (flag) {
+if (STREQ(flag, "up"))
+net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP;
+else
+net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN;
+}
if (VIR_STRDUP(net->ifname_guest, name) < 0)
goto error;
--
2.11.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list