Ad-hoc vs user-created
- From: Bernard Blackham <bernard blackham com au>
- To: networkmanager-list gnome org
- Subject: Ad-hoc vs user-created
- Date: Mon, 19 Jun 2006 14:22:24 +0800
Hi,
Some background first - I'm running network-manager 0.6.2 from
Ubuntu dapper, and had issues associating with my ad-hoc network
with an ipw2200 chipset. I have an ad-hoc network at home with a
server that hands out DHCP leases, and it appears in the applet's
drop-down menu. However when I click on it to associate, it fails
(tries to, and eventually times out). A little investigation reveals
that it never actually enters ad-hoc mode when trying to associate
because I didn't personally create the network, thus it never sees
the network.
Staring at the code of supplicant_send_network_config(), it appears
that ad-hoc networks are assumed to be user created. Would it be
possible to unblur the difference between ad-hoc and user-created?
As user-created implies ad-hoc, but not vice-versa, simply testing
for ad-hoc instead of user-created in supplicant_send_network_config
fixes my issues. (Specifically, setting ap_scan = "AP_SCAN 2", and
setting ad-hoc mode). Patch attached (applies against current CVS
too).
Though if I've done something grossly wrong, feel free to flame me
instead :)
Thanks,
Bernard.
Index: network-manager-0.6.2/src/nm-device-802-11-wireless.c
===================================================================
--- network-manager-0.6.2.orig/src/nm-device-802-11-wireless.c 2006-03-28 00:12:34.000000000 +0800
+++ network-manager-0.6.2/src/nm-device-802-11-wireless.c 2006-06-14 02:26:33.000000000 +0800
@@ -2465,7 +2465,7 @@
int nwid;
const char * essid;
struct wpa_ctrl * ctrl;
- gboolean user_created;
+ gboolean is_adhoc;
const char * hex_essid;
const char * ap_scan = "AP_SCAN 1";
guint32 caps;
@@ -2489,11 +2489,11 @@
|| (caps & NM_802_11_CAP_PROTO_WPA2);
/* Use "AP_SCAN 2" if:
- * - The wireless network is non-broadcast or user created
+ * - The wireless network is non-broadcast or ad-hoc (including user created)
* - The wireless driver does not support WPA
*/
- user_created = nm_ap_get_user_created (ap);
- if (!nm_ap_get_broadcast (ap) || user_created || !supports_wpa)
+ is_adhoc = (nm_ap_get_mode(ap) == IW_MODE_ADHOC);
+ if (!nm_ap_get_broadcast (ap) || is_adhoc || !supports_wpa)
ap_scan = "AP_SCAN 2";
/* Tell wpa_supplicant that we'll do the scanning */
@@ -2526,7 +2526,7 @@
/* For non-broadcast networks, we need to set "scan_ssid 1" to scan with probe request frames.
* However, don't try to probe Ad-Hoc networks.
*/
- if (!nm_ap_get_broadcast (ap) && !user_created)
+ if (!nm_ap_get_broadcast (ap) && !is_adhoc)
{
if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL,
"SET_NETWORK %i scan_ssid 1", nwid))
@@ -2534,7 +2534,7 @@
}
/* Ad-Hoc ? */
- if (user_created)
+ if (is_adhoc)
{
if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL,
"SET_NETWORK %i mode 1", nwid))
@@ -2544,7 +2544,7 @@
if (nm_device_activation_should_cancel (NM_DEVICE (self)))
goto out;
- if (!nm_ap_security_write_supplicant_config (nm_ap_get_security (ap), ctrl, nwid, user_created))
+ if (!nm_ap_security_write_supplicant_config (nm_ap_get_security (ap), ctrl, nwid, nm_ap_get_user_created(ap)))
goto out;
if (nm_device_activation_should_cancel (NM_DEVICE (self)))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]