diff --git a/cli/src/devices.c b/cli/src/devices.c index 1841bd8b36..40388db71a 100644 --- a/cli/src/devices.c +++ b/cli/src/devices.c @@ -293,8 +293,12 @@ device_state_to_string (NMDeviceState state) return _("connecting (need authentication)"); case NM_DEVICE_STATE_IP_CONFIG: return _("connecting (getting IP configuration)"); + case NM_DEVICE_STATE_IP_CHECK: + return _("connecting (checking IP connectivity)"); case NM_DEVICE_STATE_ACTIVATED: return _("connected"); + case NM_DEVICE_STATE_DEACTIVATING: + return _("deactivating"); case NM_DEVICE_STATE_FAILED: return _("connection failed"); default: diff --git a/include/NetworkManager.h b/include/NetworkManager.h index 4d95cd6357..2190ea1744 100644 --- a/include/NetworkManager.h +++ b/include/NetworkManager.h @@ -156,73 +156,53 @@ typedef enum { } NMBluetoothCapabilities; -/* - * Device states - */ +/** + * NMDeviceState: + * @NM_DEVICE_STATE_UNKNOWN: the device's state is unknown + * @NM_DEVICE_STATE_UNMANAGED: the device is recognized, but not managed by + * NetworkManager + * @NM_DEVICE_STATE_UNAVAILABLE: the device is managed by NetworkManager, but + * is not available for use. Reasons may include the wireless switched off, + * missing firmware, no ethernet carrier, missing supplicant or modem manager, + * etc. + * @NM_DEVICE_STATE_DISCONNECTED: the device can be activated, but is currently + * idle and not connected to a network. + * @NM_DEVICE_STATE_PREPARE: the device is preparing the connection to the + * network. This may include operations like changing the MAC address, + * setting physical link properties, and anything else required to connect + * to the requested network. + * @NM_DEVICE_STATE_CONFIG: the device is connecting to the requested network. + * This may include operations like associating with the WiFi AP, dialing + * the modem, connecting to the remote Bluetooth device, etc. + * @NM_DEVICE_STATE_NEED_AUTH: the device requires more information to continue + * connecting to the requested network. This includes secrets like WiFi + * passphrases, login passwords, PIN codes, etc. + * @NM_DEVICE_STATE_IP_CONFIG: the device is requesting IPv4 and/or IPv6 + * addresses and routing information from the network. + * @NM_DEVICE_STATE_IP_CHECK: the device is checking whether further action is + * required for the requested network connection. This may include checking + * whether only local network access is available, whether a captive portal + * is blocking access to the Internet, etc. + * @NM_DEVICE_STATE_ACTIVATED: the device has a network connection, either local + * or global. + * @NM_DEVICE_STATE_DEACTIVATING: the device's network connection is no longer + * valid and the device is tearing down resources used for the previous + * connection. + * + **/ typedef enum { - NM_DEVICE_STATE_UNKNOWN = 0, - - /* Initial state of all devices and the only state for devices not - * managed by NetworkManager. - * - * Allowed next states: - * UNAVAILABLE: the device is now managed by NetworkManager - */ - NM_DEVICE_STATE_UNMANAGED = 1, - - /* Indicates the device is not yet ready for use, but is managed by - * NetworkManager. For Ethernet devices, the device may not have an - * active carrier. For WiFi devices, the device may not have it's radio - * enabled. - * - * Allowed next states: - * UNMANAGED: the device is no longer managed by NetworkManager - * DISCONNECTED: the device is now ready for use - */ - NM_DEVICE_STATE_UNAVAILABLE = 2, - - /* Indicates the device does not have an activate connection to anything. - * - * Allowed next states: - * UNMANAGED: the device is no longer managed by NetworkManager - * UNAVAILABLE: the device is no longer ready for use (rfkill, no carrier, etc) - * PREPARE: the device has started activation - */ - NM_DEVICE_STATE_DISCONNECTED = 3, - - /* Indicate states in device activation. - * - * Allowed next states: - * UNMANAGED: the device is no longer managed by NetworkManager - * UNAVAILABLE: the device is no longer ready for use (rfkill, no carrier, etc) - * FAILED: an error ocurred during activation - * NEED_AUTH: authentication/secrets are needed - * ACTIVATED: (IP_CONFIG only) activation was successful - * DISCONNECTED: the device's connection is no longer valid, or NetworkManager went to sleep - */ - NM_DEVICE_STATE_PREPARE = 4, - NM_DEVICE_STATE_CONFIG = 5, - NM_DEVICE_STATE_NEED_AUTH = 6, - NM_DEVICE_STATE_IP_CONFIG = 7, - - /* Indicates the device is part of an active network connection. - * - * Allowed next states: - * UNMANAGED: the device is no longer managed by NetworkManager - * UNAVAILABLE: the device is no longer ready for use (rfkill, no carrier, etc) - * FAILED: a DHCP lease was not renewed, or another error - * DISCONNECTED: the device's connection is no longer valid, or NetworkManager went to sleep - */ - NM_DEVICE_STATE_ACTIVATED = 8, - - /* Indicates the device's activation failed. - * - * Allowed next states: - * UNMANAGED: the device is no longer managed by NetworkManager - * UNAVAILABLE: the device is no longer ready for use (rfkill, no carrier, etc) - * DISCONNECTED: the device's connection is ready for activation, or NetworkManager went to sleep - */ - NM_DEVICE_STATE_FAILED = 9 + NM_DEVICE_STATE_UNKNOWN = 0, + NM_DEVICE_STATE_UNMANAGED = 10, + NM_DEVICE_STATE_UNAVAILABLE = 20, + NM_DEVICE_STATE_DISCONNECTED = 30, + NM_DEVICE_STATE_PREPARE = 40, + NM_DEVICE_STATE_CONFIG = 50, + NM_DEVICE_STATE_NEED_AUTH = 60, + NM_DEVICE_STATE_IP_CONFIG = 70, + NM_DEVICE_STATE_IP_CHECK = 80, + NM_DEVICE_STATE_ACTIVATED = 90, + NM_DEVICE_STATE_DEACTIVATING = 100, + NM_DEVICE_STATE_FAILED = 110 } NMDeviceState; diff --git a/introspection/nm-device.xml b/introspection/nm-device.xml index 413798365a..f6c70e92be 100644 --- a/introspection/nm-device.xml +++ b/introspection/nm-device.xml @@ -104,47 +104,57 @@ The device is in an unknown state. - + - The device is not managed by NetworkManager. + The device is recognized but not managed by NetworkManager. - + The device cannot be used (carrier off, rfkill, etc). - + The device is not connected. - + The device is preparing to connect. - + The device is being configured. - + The device is awaiting secrets necessary to continue connection. - + The IP settings of the device are being requested and configured. - + + + The device's IP connectivity ability is being determined. + + + The device is active. - + + + The device's network connection is being torn down. + + + The device is in a failure state following an attempt to activate it. diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c index f2ab7aff45..4e824eec6c 100644 --- a/src/nm-device-wifi.c +++ b/src/nm-device-wifi.c @@ -1920,6 +1920,8 @@ scanning_allowed (NMDeviceWifi *self) case NM_DEVICE_STATE_CONFIG: case NM_DEVICE_STATE_NEED_AUTH: case NM_DEVICE_STATE_IP_CONFIG: + case NM_DEVICE_STATE_IP_CHECK: + case NM_DEVICE_STATE_DEACTIVATING: /* Don't scan when unusable or activating */ return FALSE; case NM_DEVICE_STATE_DISCONNECTED: