diff options
author | Thomas Haller <thaller@redhat.com> | 2021-01-14 14:15:27 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-01-19 16:41:50 +0100 |
commit | a824f56441b75a94697bd59eba40ab54c8128310 (patch) | |
tree | 7d17c761b66d24d18b7dcf14c0aee7b28833c909 /src/devices/nm-device.c | |
parent | 7c05ff16322c5b5d5c8e382f94aefb09657aebdb (diff) |
device: if a device is not IFF_UP assume that is has carrier
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
Diffstat (limited to 'src/devices/nm-device.c')
-rw-r--r-- | src/devices/nm-device.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 59812ef0f3..c6ec4e3bcb 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"); |