diff --git a/ChangeLog b/ChangeLog index 574a476136..d350d88d80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2006-06-19 Dan Williams + + * src/NetworkManagerAP.c + - Clarify usage of user_created + + * src/nm-ap-security-wep.c + src/nm-ap-security-wpa-eap.c + src/nm-ap-security-wpa-psk.c + src/nm-ap-security.c + src/nm-ap-security.h + - s/user_created/adhoc, because we really do mean adhoc + + Patch from Bernard Blackham + * src/nm-device-802-11-wireless.c + - (supplicant_send_network_config): instead of user_created, + use adhoc, and do AP_SCAN 2 for adhoc networks + 2006-06-15 Robert Love * gnome/applet/nm-gconf-wso-wpa-eap.c: Don't set the Gconf keys unless diff --git a/src/NetworkManagerAP.c b/src/NetworkManagerAP.c index 0660e0379e..a4747f9748 100644 --- a/src/NetworkManagerAP.c +++ b/src/NetworkManagerAP.c @@ -47,7 +47,12 @@ struct NMAccessPoint gboolean invalid; gboolean artificial; /* Whether or not the AP is from a scan */ gboolean broadcast; /* Whether or not the AP is broadcasting (hidden) */ - gboolean user_created; /* Whether or not the AP was created by the user with "Create network..." */ + gboolean user_created; /* Whether or not the AP was created + * by the user with "Create network..." + * A subset of Ad-Hoc mode. user_created + * implies Ad-Hoc, but not necessarily + * the other way around. + */ GTimeVal last_seen; /* Last time the AP was seen in a scan */ /* Things from user prefs/NetworkManagerInfo */ diff --git a/src/nm-ap-security-wep.c b/src/nm-ap-security-wep.c index c11953e0ad..a7f3c4c596 100644 --- a/src/nm-ap-security-wep.c +++ b/src/nm-ap-security-wep.c @@ -115,7 +115,7 @@ static gboolean real_write_supplicant_config (NMAPSecurity *instance, struct wpa_ctrl *ctrl, int nwid, - gboolean user_created) + gboolean adhoc) { gboolean success = FALSE; char * msg = NULL; diff --git a/src/nm-ap-security-wpa-eap.c b/src/nm-ap-security-wpa-eap.c index d7a6418bb7..8cc49a7750 100644 --- a/src/nm-ap-security-wpa-eap.c +++ b/src/nm-ap-security-wpa-eap.c @@ -169,7 +169,7 @@ static gboolean real_write_supplicant_config (NMAPSecurity *instance, struct wpa_ctrl *ctrl, int nwid, - gboolean user_created) + gboolean adhoc) { NMAPSecurityWPA_EAP * self = NM_AP_SECURITY_WPA_EAP (instance); gboolean success = FALSE; diff --git a/src/nm-ap-security-wpa-psk.c b/src/nm-ap-security-wpa-psk.c index 0c1372efd8..61f81a44ac 100644 --- a/src/nm-ap-security-wpa-psk.c +++ b/src/nm-ap-security-wpa-psk.c @@ -134,7 +134,7 @@ static gboolean real_write_supplicant_config (NMAPSecurity *instance, struct wpa_ctrl *ctrl, int nwid, - gboolean user_created) + gboolean adhoc) { NMAPSecurityWPA_PSK * self = NM_AP_SECURITY_WPA_PSK (instance); gboolean success = FALSE; @@ -161,7 +161,7 @@ real_write_supplicant_config (NMAPSecurity *instance, } /* Ad-Hoc has to be WPA-NONE */ - if (user_created) + if (adhoc) key_mgmt = "WPA-NONE"; if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, @@ -189,7 +189,7 @@ real_write_supplicant_config (NMAPSecurity *instance, pairwise_cipher = group_cipher = "NONE"; /* Ad-Hoc requires pairwise cipher of NONE */ - if (user_created) + if (adhoc) pairwise_cipher = "NONE"; /* If user selected "Automatic", we let wpa_supplicant sort it out */ diff --git a/src/nm-ap-security.c b/src/nm-ap-security.c index 3809d2c897..1f9f3cca97 100644 --- a/src/nm-ap-security.c +++ b/src/nm-ap-security.c @@ -155,7 +155,7 @@ gboolean nm_ap_security_write_supplicant_config (NMAPSecurity *self, struct wpa_ctrl *ctrl, int nwid, - gboolean user_created) + gboolean adhoc) { g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (ctrl != NULL, FALSE); @@ -164,7 +164,8 @@ nm_ap_security_write_supplicant_config (NMAPSecurity *self, if (self->priv->dispose_has_run) return FALSE; - return NM_AP_SECURITY_GET_CLASS (self)->write_supplicant_config_func (self, ctrl, nwid, user_created); + return NM_AP_SECURITY_GET_CLASS (self)->write_supplicant_config_func (self, + ctrl, nwid, adhoc); } void @@ -222,7 +223,7 @@ static gboolean real_write_supplicant_config (NMAPSecurity *self, struct wpa_ctrl *ctrl, int nwid, - gboolean user_created) + gboolean adhoc) { /* Unencrypted network setup */ if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, diff --git a/src/nm-ap-security.h b/src/nm-ap-security.h index 7d5f0f9c07..100c7336e9 100644 --- a/src/nm-ap-security.h +++ b/src/nm-ap-security.h @@ -67,7 +67,7 @@ struct _NMAPSecurityClass gboolean (*write_supplicant_config_func)(NMAPSecurity *self, struct wpa_ctrl *ctrl, int nwid, - gboolean user_created); + gboolean adhoc); guint32 (*get_default_capabilities_func)(NMAPSecurity *self); }; @@ -93,7 +93,7 @@ int nm_ap_security_serialize (NMAPSecurity *self, gboolean nm_ap_security_write_supplicant_config (NMAPSecurity *self, struct wpa_ctrl *ctrl, int nwid, - gboolean user_created); + gboolean adhoc); const char * nm_ap_security_get_description (NMAPSecurity *self); diff --git a/src/nm-device-802-11-wireless.c b/src/nm-device-802-11-wireless.c index 09a2763471..6de41c7e35 100644 --- a/src/nm-device-802-11-wireless.c +++ b/src/nm-device-802-11-wireless.c @@ -2768,7 +2768,7 @@ supplicant_send_network_config (NMDevice80211Wireless *self, 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; @@ -2792,11 +2792,11 @@ supplicant_send_network_config (NMDevice80211Wireless *self, || (caps & NM_802_11_CAP_PROTO_WPA2); /* Use "AP_SCAN 2" if: - * - The wireless network is non-broadcast or user created - * - The wireless driver does not support WPA + * - The wireless network is non-broadcast or Ad-Hoc + * - The wireless driver does not support WPA (stupid drivers...) */ - 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 */ @@ -2829,7 +2829,7 @@ supplicant_send_network_config (NMDevice80211Wireless *self, /* 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)) @@ -2837,7 +2837,7 @@ supplicant_send_network_config (NMDevice80211Wireless *self, } /* 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)) @@ -2847,7 +2847,7 @@ supplicant_send_network_config (NMDevice80211Wireless *self, 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, is_adhoc)) goto out; if (nm_device_activation_should_cancel (NM_DEVICE (self)))