2007-08-25 Dan Williams <dcbw@redhat.com>

It's 2007. Remove support for drivers that don't support wireless scanning.

	* test/nm-tool.c
	  include/NetworkManager.h
	  src/NetworkManagerUtils.c
	  src/NetworkManagerPolicy.c
	  src/nm-device-802-11-wireless.c
		- Remove special handling for non-scanning devices and mark them
			as unsupported/unhandled



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2726 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2007-08-25 15:07:23 +00:00
parent d711aed2ef
commit 386998c983
6 changed files with 34 additions and 56 deletions

View File

@@ -1,3 +1,15 @@
2007-08-25 Dan Williams <dcbw@redhat.com>
It's 2007. Remove support for drivers that don't support wireless scanning.
* test/nm-tool.c
include/NetworkManager.h
src/NetworkManagerUtils.c
src/NetworkManagerPolicy.c
src/nm-device-802-11-wireless.c
- Remove special handling for non-scanning devices and mark them
as unsupported/unhandled
2007-08-20 Dan Williams <dcbw@redhat.com> 2007-08-20 Dan Williams <dcbw@redhat.com>
* src/nm-device-802-11-wireless.c * src/nm-device-802-11-wireless.c

View File

@@ -77,7 +77,6 @@ typedef enum NMDeviceType
#define NM_DEVICE_CAP_NONE 0x00000000 #define NM_DEVICE_CAP_NONE 0x00000000
#define NM_DEVICE_CAP_NM_SUPPORTED 0x00000001 #define NM_DEVICE_CAP_NM_SUPPORTED 0x00000001
#define NM_DEVICE_CAP_CARRIER_DETECT 0x00000002 #define NM_DEVICE_CAP_CARRIER_DETECT 0x00000002
#define NM_DEVICE_CAP_WIRELESS_SCAN 0x00000004
/* 802.11 wireless-specific device capability bits */ /* 802.11 wireless-specific device capability bits */

View File

@@ -111,10 +111,6 @@ static NMDevice * nm_policy_auto_get_best_device (NMPolicy *policy, NMAccessPoin
} }
else if (NM_IS_DEVICE_802_11_WIRELESS (dev) && else if (NM_IS_DEVICE_802_11_WIRELESS (dev) &&
nm_manager_wireless_enabled (policy->manager)) { nm_manager_wireless_enabled (policy->manager)) {
/* Don't automatically choose a device that doesn't support wireless scanning */
if (!(caps & NM_DEVICE_CAP_WIRELESS_SCAN))
continue;
/* Bump by 1 so that _something_ gets chosen every time */ /* Bump by 1 so that _something_ gets chosen every time */
prio += 1; prio += 1;
@@ -250,13 +246,15 @@ nm_policy_device_change_check (gpointer user_data)
goto out; goto out;
} }
/* Don't interrupt semi-supported devices either. If the user chose one, they must /* Don't interrupt semi-supported devices either. If the user chose
* explicitly choose to move to another device, we're not going to move for them. * one, they must explicitly choose to move to another device, we're not
* going to move for them.
*/ */
if ((NM_IS_DEVICE_802_3_ETHERNET (old_dev) && !(caps & NM_DEVICE_CAP_CARRIER_DETECT)) if ( (NM_IS_DEVICE_802_3_ETHERNET (old_dev)
|| (NM_IS_DEVICE_802_11_WIRELESS (old_dev) && !(caps & NM_DEVICE_CAP_WIRELESS_SCAN))) { && !(caps & NM_DEVICE_CAP_CARRIER_DETECT))) {
nm_info ("Old device '%s' was semi-supported and user chosen, won't change unless told to.", nm_info ("Old device '%s' was semi-supported and user chosen, won't"
nm_device_get_iface (old_dev)); " change unless told to.",
nm_device_get_iface (old_dev));
goto out; goto out;
} }
} }
@@ -462,19 +460,15 @@ nm_policy_device_list_update_from_allowed_list (gpointer user_data)
continue; continue;
wdev = NM_DEVICE_802_11_WIRELESS (dev); wdev = NM_DEVICE_802_11_WIRELESS (dev);
if (nm_device_get_capabilities (dev) & NM_DEVICE_CAP_WIRELESS_SCAN) { /* Once we have the list, copy in any relevant information from our
/* Once we have the list, copy in any relevant information from our * Allowed list and fill in the SSID of base stations that aren't
* Allowed list and fill in the SSID of base stations that aren't * broadcasting their SSID, if we have their MAC address in our
* broadcasting their SSID, if we have their MAC address in our * allowed list.
* allowed list. */
*/ nm_ap_list_copy_ssids_by_address (nm_device_802_11_wireless_ap_list_get (wdev),
nm_ap_list_copy_ssids_by_address (nm_device_802_11_wireless_ap_list_get (wdev), data->allowed_ap_list);
data->allowed_ap_list); nm_ap_list_copy_properties (nm_device_802_11_wireless_ap_list_get (wdev),
nm_ap_list_copy_properties (nm_device_802_11_wireless_ap_list_get (wdev), data->allowed_ap_list);
data->allowed_ap_list);
} else {
nm_device_802_11_wireless_copy_allowed_to_dev_list (wdev, data->allowed_ap_list);
}
nm_ap_list_remove_duplicate_ssids (nm_device_802_11_wireless_ap_list_get (wdev)); nm_ap_list_remove_duplicate_ssids (nm_device_802_11_wireless_ap_list_get (wdev));
} }

View File

@@ -311,13 +311,7 @@ void nm_print_device_capabilities (NMDevice *dev)
} }
else if (NM_IS_DEVICE_802_11_WIRELESS (dev)) else if (NM_IS_DEVICE_802_11_WIRELESS (dev))
{ {
if (!(caps & NM_DEVICE_CAP_WIRELESS_SCAN)) /* Print out WPA support */
{
nm_info ("%s: Driver '%s' does not support wireless scanning.\n"
"\tSome features will not be available.",
nm_device_get_iface (dev), driver);
full_support = FALSE;
}
} }
if (full_support) if (full_support)

View File

@@ -321,10 +321,11 @@ real_get_generic_capabilities (NMDevice *dev)
else else
caps |= NM_DEVICE_CAP_NM_SUPPORTED; caps |= NM_DEVICE_CAP_NM_SUPPORTED;
/* Card's that don't scan aren't supported */
memset (&wrq, 0, sizeof (struct iwreq)); memset (&wrq, 0, sizeof (struct iwreq));
err = iw_set_ext (nm_dev_sock_get_fd (sk), nm_device_get_iface (dev), SIOCSIWSCAN, &wrq); err = iw_set_ext (nm_dev_sock_get_fd (sk), nm_device_get_iface (dev), SIOCSIWSCAN, &wrq);
if (!((err == -1) && (errno == EOPNOTSUPP))) if (!((err == -1) && (errno == EOPNOTSUPP)))
caps |= NM_DEVICE_CAP_WIRELESS_SCAN; caps = NM_DEVICE_CAP_NONE;
out: out:
if (sk) if (sk)
@@ -402,7 +403,6 @@ constructor (GType type,
NMDevice80211WirelessPrivate *priv; NMDevice80211WirelessPrivate *priv;
NMData *app_data; NMData *app_data;
const char *iface; const char *iface;
guint32 caps;
NMSock *sk; NMSock *sk;
object = G_OBJECT_CLASS (nm_device_802_11_wireless_parent_class)->constructor (type, object = G_OBJECT_CLASS (nm_device_802_11_wireless_parent_class)->constructor (type,
@@ -415,14 +415,6 @@ constructor (GType type,
priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (self); priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (self);
app_data = nm_device_get_app_data (NM_DEVICE (self)); app_data = nm_device_get_app_data (NM_DEVICE (self));
/* Non-scanning devices show the entire allowed AP list as their
* available networks.
*/
caps = nm_device_get_capabilities (NM_DEVICE (self));
if (!(caps & NM_DEVICE_CAP_WIRELESS_SCAN))
nm_device_802_11_wireless_copy_allowed_to_dev_list (self, app_data->allowed_ap_list);
iface = nm_device_get_iface (NM_DEVICE (self)); iface = nm_device_get_iface (NM_DEVICE (self));
if ((sk = nm_dev_sock_open (iface, DEV_WIRELESS, __FUNCTION__, NULL))) { if ((sk = nm_dev_sock_open (iface, DEV_WIRELESS, __FUNCTION__, NULL))) {
@@ -878,13 +870,6 @@ nm_device_802_11_wireless_get_best_ap (NMDevice80211Wireless *self)
app_data = nm_device_get_app_data (NM_DEVICE (self)); app_data = nm_device_get_app_data (NM_DEVICE (self));
g_assert (app_data); g_assert (app_data);
/* Devices that can't scan don't do anything automatic.
* The user must choose the access point from the menu.
*/
if ( !(nm_device_get_capabilities (NM_DEVICE (self)) & NM_DEVICE_CAP_WIRELESS_SCAN)
&& !nm_device_has_active_link (NM_DEVICE (self)))
return NULL;
if (!(ap_list = nm_device_802_11_wireless_ap_list_get (self))) if (!(ap_list = nm_device_802_11_wireless_ap_list_get (self)))
return NULL; return NULL;
@@ -2264,11 +2249,8 @@ supplicant_iface_state_cb_handler (gpointer user_data)
old_state); old_state);
if (new_state == NM_SUPPLICANT_INTERFACE_STATE_READY) { if (new_state == NM_SUPPLICANT_INTERFACE_STATE_READY) {
/* Schedule scanning for devices that can do scanning */ nm_device_802_11_wireless_reset_scan_interval (self);
if (nm_device_get_capabilities (NM_DEVICE (self)) & NM_DEVICE_CAP_WIRELESS_SCAN) { schedule_scan (self);
nm_device_802_11_wireless_reset_scan_interval (self);
schedule_scan (self);
}
} else if (new_state == NM_SUPPLICANT_INTERFACE_STATE_DOWN) { } else if (new_state == NM_SUPPLICANT_INTERFACE_STATE_DOWN) {
cancel_pending_scan (self); cancel_pending_scan (self);
cleanup_association_attempt (self, FALSE); cleanup_association_attempt (self, FALSE);

View File

@@ -284,9 +284,6 @@ detail_device (gpointer data, gpointer user_data)
printf ("\n Wireless Settings\n"); printf ("\n Wireless Settings\n");
if (caps & NM_DEVICE_CAP_WIRELESS_SCAN)
print_string (" Scanning", "yes");
wireless_caps = nm_device_802_11_wireless_get_capabilities (NM_DEVICE_802_11_WIRELESS (device)); wireless_caps = nm_device_802_11_wireless_get_capabilities (NM_DEVICE_802_11_WIRELESS (device));
if (wireless_caps & NM_802_11_CAP_PROTO_WEP) if (wireless_caps & NM_802_11_CAP_PROTO_WEP)