summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-01-14 14:15:27 +0100
committerThomas Haller <thaller@redhat.com>2021-01-19 12:09:09 +0100
commit4026fc47a65c4e91d4e614635e89dea5cdda019e (patch)
tree2c88936fb0f77f57dc2fe1f912df2c859ab47770
parent46df5ab275ddb6145153cbec6047076c23d9cdf5 (diff)
downloadNetworkManager-th/veth-fixes.tar.gz
device: if a device is not IFF_UP assume that is has carrierth/veth-fixes
A device that is not IFF_UP does not have carrier. So we don't know the real state before we bring it up. On the other hand, during `nmcli connection up` we check whether the device is available. So we are blocked. The solution is to optimistically assume that the device has carrier if it is down. We may fail later. $ nmcli connection add type veth con-name vv0 autoconnect no ifname vv0 peer vv1 ipv4.method shared ipv6.method shared $ nmcli connection up vv0 $ nmcli device connect vv1 Error: Failed to add/activate new connection: Connection 'vv1' is not available on device vv1 because device has no carrier
-rw-r--r--src/devices/nm-device.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 8316107123..c39ba9fac2 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -15372,6 +15372,15 @@ check_connection_available(NMDevice * self,
if (nm_device_is_master(self))
return TRUE;
+ if (!priv->up) {
+ /* If the device is !IFF_UP it also has no carrier. But we assume that if we
+ * would start activating the device (and thereby set the device IFF_UP),
+ * that we would get a carrier. We only know after we set the device up,
+ * and we only set it up after we start activating it. So presumably, this
+ * profile would be available (but we just don't know). */
+ return TRUE;
+ }
+
nm_utils_error_set_literal(error,
NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
"device has no carrier");