diff options
author | Thomas Haller <thaller@redhat.com> | 2014-12-08 12:39:45 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-02-24 11:49:03 +0100 |
commit | 5a042737152b928f5cd9d0e874df5952be219c12 (patch) | |
tree | 7e84e345b3cbc5e6143f6f5cb61c5c5416e1ecea /src/devices | |
parent | 364c4476e392cad1ef076a473e0462174cf14bd0 (diff) | |
download | NetworkManager-5a042737152b928f5cd9d0e874df5952be219c12.tar.gz |
device: merge check_connection_available_wifi_hidden() into check_connection_available()
Only refactoring, no behavioral change.
Diffstat (limited to 'src/devices')
-rw-r--r-- | src/devices/bluetooth/nm-device-bt.c | 1 | ||||
-rw-r--r-- | src/devices/nm-device-bond.c | 1 | ||||
-rw-r--r-- | src/devices/nm-device-bridge.c | 1 | ||||
-rw-r--r-- | src/devices/nm-device.c | 11 | ||||
-rw-r--r-- | src/devices/nm-device.h | 14 | ||||
-rw-r--r-- | src/devices/team/nm-device-team.c | 1 | ||||
-rw-r--r-- | src/devices/wifi/nm-device-wifi.c | 39 | ||||
-rw-r--r-- | src/devices/wimax/nm-device-wimax.c | 1 | ||||
-rw-r--r-- | src/devices/wwan/nm-device-modem.c | 1 |
9 files changed, 33 insertions, 37 deletions
diff --git a/src/devices/bluetooth/nm-device-bt.c b/src/devices/bluetooth/nm-device-bt.c index 689f37c9b4..7b1b3fde5e 100644 --- a/src/devices/bluetooth/nm-device-bt.c +++ b/src/devices/bluetooth/nm-device-bt.c @@ -187,6 +187,7 @@ check_connection_compatible (NMDevice *device, NMConnection *connection) static gboolean check_connection_available (NMDevice *device, NMConnection *connection, + gboolean for_user_activation_request, const char *specific_object) { NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device); diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c index 07f5d0bff7..8cad44f5c9 100644 --- a/src/devices/nm-device-bond.c +++ b/src/devices/nm-device-bond.c @@ -78,6 +78,7 @@ is_available (NMDevice *dev) static gboolean check_connection_available (NMDevice *device, NMConnection *connection, + gboolean for_user_activation_request, const char *specific_object) { /* Connections are always available because the carrier state is determined diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c index a70cfd9571..53d5bef33b 100644 --- a/src/devices/nm-device-bridge.c +++ b/src/devices/nm-device-bridge.c @@ -76,6 +76,7 @@ is_available (NMDevice *dev) static gboolean check_connection_available (NMDevice *device, NMConnection *connection, + gboolean for_user_activation_request, const char *specific_object) { /* Connections are always available because the carrier state is determined diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 0219a40fe6..26476dd733 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -6927,15 +6927,15 @@ nm_device_connection_is_available (NMDevice *self, } if ( is_default_unmanaged - && NM_DEVICE_GET_CLASS (self)->check_connection_available (self, connection, NULL)) { + && NM_DEVICE_GET_CLASS (self)->check_connection_available (self, connection, FALSE, NULL)) { /* default-unmanaged devices in UNMANAGED state have no available connections * so we must manually check whether the connection is available here. */ return TRUE; } if ( for_user_activation_request - && NM_DEVICE_GET_CLASS (self)->check_connection_available_wifi_hidden - && NM_DEVICE_GET_CLASS (self)->check_connection_available_wifi_hidden (self, connection)) { + && NM_DEVICE_GET_CLASS (self)->check_connection_available_has_user_override + && NM_DEVICE_GET_CLASS (self)->check_connection_available (self, connection, TRUE, NULL)) { /* Connections for an explicit user activation request might only be available after * additional checking. * @@ -6970,7 +6970,7 @@ _try_add_available_connection (NMDevice *self, NMConnection *connection) return FALSE; if (nm_device_check_connection_compatible (self, connection)) { - if (NM_DEVICE_GET_CLASS (self)->check_connection_available (self, connection, NULL)) { + if (NM_DEVICE_GET_CLASS (self)->check_connection_available (self, connection, FALSE, NULL)) { g_hash_table_add (NM_DEVICE_GET_PRIVATE (self)->available_connections, g_object_ref (connection)); return TRUE; @@ -6988,6 +6988,7 @@ _del_available_connection (NMDevice *self, NMConnection *connection) static gboolean check_connection_available (NMDevice *self, NMConnection *connection, + gboolean for_user_activation_request, const char *specific_object) { /* Connections which require a network connection are not available when @@ -7049,7 +7050,7 @@ nm_device_get_available_connections (NMDevice *self, const char *specific_object * compatible with it. */ if ( !specific_object - || NM_DEVICE_GET_CLASS (self)->check_connection_available (self, connection, specific_object)) + || NM_DEVICE_GET_CLASS (self)->check_connection_available (self, connection, FALSE, specific_object)) g_ptr_array_add (array, connection); } } diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index e3d58c5bf0..2a1ac54bbd 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -137,18 +137,18 @@ typedef struct { * including any live network information like scan lists. The connection * is checked against the object defined by @specific_object, if given. * Returns TRUE if the connection is available; FALSE if not. + * + * If @for_user_activation_request, a connection might be considered + * available under additional circumstances. That means, if a connection + * is available for an internal, non-user request, it also must be available + * for an external, user request. */ gboolean (* check_connection_available) (NMDevice *self, NMConnection *connection, + gboolean for_user_activation_request, const char *specific_object); - /* Same as check_connection_available() but called if the connection - * is not present in the activating-connections array during activation, - * to give the device a chance to allow/deny the activation. This is a - * hack only meant for hidden WiFi networks. - */ - gboolean (* check_connection_available_wifi_hidden) (NMDevice *self, - NMConnection *connection); + gboolean check_connection_available_has_user_override; gboolean (* complete_connection) (NMDevice *self, NMConnection *connection, diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c index 88b1d0cb01..34d1812298 100644 --- a/src/devices/team/nm-device-team.c +++ b/src/devices/team/nm-device-team.c @@ -84,6 +84,7 @@ is_available (NMDevice *device) static gboolean check_connection_available (NMDevice *device, NMConnection *connection, + gboolean for_user_activation_request, const char *specific_object) { /* Connections are always available because the carrier state is determined diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 85e376dc43..0f1e7d48e4 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -864,10 +864,10 @@ check_connection_compatible (NMDevice *device, NMConnection *connection) static gboolean -_internal_check_connection_available (NMDevice *device, - NMConnection *connection, - const char *specific_object, - gboolean ignore_ap_list) +check_connection_available (NMDevice *device, + NMConnection *connection, + gboolean for_user_activation_request, + const char *specific_object) { NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (device); NMSettingWireless *s_wifi; @@ -892,8 +892,15 @@ _internal_check_connection_available (NMDevice *device, || g_strcmp0 (mode, NM_SETTING_WIRELESS_MODE_AP) == 0) return TRUE; - /* Hidden SSIDs obviously don't always appear in the scan list either */ - if (nm_setting_wireless_get_hidden (s_wifi) || ignore_ap_list) + /* Hidden SSIDs obviously don't always appear in the scan list either. + * + * For an explict user-activation-request, a connection is considered + * available because for hidden Wi-Fi, clients didn't consistently + * set the 'hidden' property to indicate hidden SSID networks. If + * activating but the network isn't available let the device recheck + * availability. + */ + if (nm_setting_wireless_get_hidden (s_wifi) || for_user_activation_request) return TRUE; /* check if its visible */ @@ -905,24 +912,6 @@ _internal_check_connection_available (NMDevice *device, return FALSE; } -static gboolean -check_connection_available (NMDevice *device, - NMConnection *connection, - const char *specific_object) -{ - return _internal_check_connection_available (device, connection, specific_object, FALSE); -} - -/* FIXME: remove this function when we require the 'hidden' property to be - * set before a hidden connection can be activated. - */ -static gboolean -check_connection_available_wifi_hidden (NMDevice *device, - NMConnection *connection) -{ - return _internal_check_connection_available (device, connection, NULL, TRUE); -} - /* * List of manufacturer default SSIDs that are often unchanged by users. * @@ -3341,7 +3330,7 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass) parent_class->is_available = is_available; parent_class->check_connection_compatible = check_connection_compatible; parent_class->check_connection_available = check_connection_available; - parent_class->check_connection_available_wifi_hidden = check_connection_available_wifi_hidden; + parent_class->check_connection_available_has_user_override = TRUE; parent_class->complete_connection = complete_connection; parent_class->set_enabled = set_enabled; diff --git a/src/devices/wimax/nm-device-wimax.c b/src/devices/wimax/nm-device-wimax.c index 466cd97930..a7f63fdc97 100644 --- a/src/devices/wimax/nm-device-wimax.c +++ b/src/devices/wimax/nm-device-wimax.c @@ -334,6 +334,7 @@ check_connection_compatible (NMDevice *device, NMConnection *connection) static gboolean check_connection_available (NMDevice *device, NMConnection *connection, + gboolean for_user_activation_request, const char *specific_object) { NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (device); diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c index 0a9dc1ea0d..7046e72b6e 100644 --- a/src/devices/wwan/nm-device-modem.c +++ b/src/devices/wwan/nm-device-modem.c @@ -394,6 +394,7 @@ check_connection_compatible (NMDevice *device, NMConnection *connection) static gboolean check_connection_available (NMDevice *device, NMConnection *connection, + gboolean for_user_activation_request, const char *specific_object) { NMDeviceModem *self = NM_DEVICE_MODEM (device); |