2006-02-05 Dan Williams <dcbw@redhat.com>

Remove anything having to do with device_setup_func from the
	AP security objects, since it's no longer used.

	* src/nm-ap-security.h
		- Kill device_setup_func and nm_ap_security_device_setup()

	* src/nm-ap-security-wep.c
	  src/nm-ap-security-wpa-psk.c
		- (real_device_setup): remove

	* src/nm-ap-security.c
		- (real_device_setup): remove
		- (nm_ap_security_device_setup): remove

	* src/nm-device-802-11-wireless.[ch]
		- (nm_device_802_11_wireless_set_wep_enc_key): make static
		- (set_wireless_config, wireless_configure_adhoc): remove; unused
			and done by wpa_supplicant now anyway


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1446 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2006-02-05 06:05:55 +00:00
parent 53a4703ea8
commit a0d0719dfb
7 changed files with 27 additions and 214 deletions

View file

@ -1,3 +1,24 @@
2006-02-05 Dan Williams <dcbw@redhat.com>
Remove anything having to do with device_setup_func from the
AP security objects, since it's no longer used.
* src/nm-ap-security.h
- Kill device_setup_func and nm_ap_security_device_setup()
* src/nm-ap-security-wep.c
src/nm-ap-security-wpa-psk.c
- (real_device_setup): remove
* src/nm-ap-security.c
- (real_device_setup): remove
- (nm_ap_security_device_setup): remove
* src/nm-device-802-11-wireless.[ch]
- (nm_device_802_11_wireless_set_wep_enc_key): make static
- (set_wireless_config, wireless_configure_adhoc): remove; unused
and done by wpa_supplicant now anyway
2006-02-05 Dan Williams <dcbw@redhat.com>
* src/nm-device-802-11-wireless.c

View file

@ -140,16 +140,6 @@ out:
return success;
}
static int
real_device_setup (NMAPSecurity *instance, NMDevice80211Wireless * dev)
{
NMAPSecurityWEP * self = NM_AP_SECURITY_WEP (instance);
nm_device_802_11_wireless_set_wep_enc_key (dev, nm_ap_security_get_key (instance),
self->priv->auth_algorithm);
return 0;
}
static NMAPSecurity *
real_copy_constructor (NMAPSecurity *instance)
{
@ -177,7 +167,6 @@ nm_ap_security_wep_class_init (NMAPSecurityWEPClass *klass)
par_class->copy_constructor_func = real_copy_constructor;
par_class->serialize_func = real_serialize;
par_class->write_supplicant_config_func = real_write_supplicant_config;
par_class->device_setup_func = real_device_setup;
g_type_class_add_private (object_class, sizeof (NMAPSecurityWEPPrivate));
}

View file

@ -210,13 +210,6 @@ out:
return success;
}
static int
real_device_setup (NMAPSecurity *self, NMDevice80211Wireless * dev)
{
/* Stub; should be farmed out to wpa_supplicant eventually */
return 0;
}
static NMAPSecurity *
real_copy_constructor (NMAPSecurity *instance)
{
@ -246,7 +239,6 @@ nm_ap_security_wpa_psk_class_init (NMAPSecurityWPA_PSKClass *klass)
par_class->copy_constructor_func = real_copy_constructor;
par_class->serialize_func = real_serialize;
par_class->write_supplicant_config_func = real_write_supplicant_config;
par_class->device_setup_func = real_device_setup;
g_type_class_add_private (object_class, sizeof (NMAPSecurityWPA_PSKPrivate));
}

View file

@ -208,14 +208,6 @@ real_write_supplicant_config (NMAPSecurity *self,
return TRUE;
}
static int
real_device_setup (NMAPSecurity *self, NMDevice80211Wireless * dev)
{
/* unencrypted */
nm_device_802_11_wireless_set_wep_enc_key (dev, NULL, 0);
return 0;
}
int
nm_ap_security_get_we_cipher (NMAPSecurity *self)
{
@ -249,18 +241,6 @@ nm_ap_security_set_description (NMAPSecurity *self, const char *desc)
self->priv->description = (char *) desc;
}
int
nm_ap_security_device_setup (NMAPSecurity *self, NMDevice80211Wireless *dev)
{
g_return_val_if_fail (self != NULL, -1);
g_return_val_if_fail (dev != NULL, -1);
if (self->priv->dispose_has_run)
return -1;
return NM_AP_SECURITY_GET_CLASS (self)->device_setup_func (self, dev);
}
int
nm_ap_security_serialize (NMAPSecurity *self, DBusMessageIter *iter)
{
@ -365,7 +345,6 @@ nm_ap_security_class_init (NMAPSecurityClass *klass)
klass->copy_constructor_func = real_copy_constructor;
klass->serialize_func = real_serialize;
klass->write_supplicant_config_func = real_write_supplicant_config;
klass->device_setup_func = real_device_setup;
g_type_class_add_private (object_class, sizeof (NMAPSecurityPrivate));
}

View file

@ -68,8 +68,6 @@ struct _NMAPSecurityClass
struct wpa_ctrl *ctrl,
int nwid,
gboolean user_created);
int (*device_setup_func) (NMAPSecurity *self, NMDevice80211Wireless * dev);
};
@ -93,9 +91,6 @@ gboolean nm_ap_security_write_supplicant_config (NMAPSecurity *self,
int nwid,
gboolean user_created);
int nm_ap_security_device_setup (NMAPSecurity *self,
NMDevice80211Wireless *dev);
const char * nm_ap_security_get_description (NMAPSecurity *self);
G_END_DECLS

View file

@ -126,6 +126,11 @@ static void supplicant_cleanup (NMDevice80211Wireless *self);
static void remove_link_timeout (NMDevice80211Wireless *self);
static void nm_device_802_11_wireless_set_wep_enc_key (NMDevice80211Wireless *self,
const char *key,
int auth_method);
static guint32
real_get_generic_capabilities (NMDevice *dev)
{
@ -1498,7 +1503,7 @@ nm_device_802_11_wireless_get_bssid (NMDevice80211Wireless *self,
*
* key: encryption key to use, or NULL or "" to disable encryption.
*/
void
static void
nm_device_802_11_wireless_set_wep_enc_key (NMDevice80211Wireless *self,
const char *key,
int auth_method)
@ -1875,170 +1880,6 @@ reschedule:
}
#ifdef UNUSED
/*
* nm_device_set_wireless_config
*
* Bring up a wireless card with the essid and wep key of its "best" ap
*
* Returns: TRUE on successful activation
* FALSE on unsuccessful activation (ie no best AP)
*
*/
static gboolean
set_wireless_config (NMDevice80211Wireless *self,
NMAccessPoint *ap)
{
const char * essid = NULL;
NMAPSecurity * security;
int we_cipher;
g_return_val_if_fail (ap != NULL, FALSE);
g_return_val_if_fail (nm_ap_get_essid (ap) != NULL, FALSE);
security = nm_ap_get_security (ap);
g_return_val_if_fail (security != NULL, FALSE);
self->priv->failed_link_count = 0;
/* Force the card into Managed/Infrastructure mode */
nm_device_bring_down_wait (NM_DEVICE (self), 0);
nm_device_bring_up_wait (NM_DEVICE (self), 0);
nm_device_802_11_wireless_set_mode (self, IW_MODE_INFRA);
essid = nm_ap_get_essid (ap);
nm_device_802_11_wireless_set_mode (self, nm_ap_get_mode (ap));
nm_device_802_11_wireless_set_bitrate (self, 0);
if (nm_ap_get_user_created (ap) || (nm_ap_get_freq (ap) && (nm_ap_get_mode (ap) == IW_MODE_ADHOC)))
nm_device_802_11_wireless_set_frequency (self, nm_ap_get_freq (ap));
else
nm_device_802_11_wireless_set_frequency (self, 0); /* auto */
/* FIXME: set card's config using wpa_supplicant, not ourselves */
nm_ap_security_device_setup (security, self);
nm_device_802_11_wireless_set_essid (self, essid);
nm_info ("Activation (%s/wireless): using essid '%s', with '%s' security.",
nm_device_get_iface (NM_DEVICE (self)), essid, nm_ap_security_get_description (security));
/* Bring the device up and pause to allow card to associate. After we set the ESSID
* on the card, the card has to scan all channels to find our requested AP (which can
* take a long time if it is an A/B/G chipset like the Atheros 5212, for example).
*/
is_up_and_associated_wait (self, 2, 100);
/* Some cards don't really work well in ad-hoc mode unless you explicitly set the bitrate
* on them. (Netgear WG511T/Atheros 5212 with madwifi drivers). Until we can get rate information
* from scanned access points out of iwlib, clamp bitrate for these cards at 11Mbps.
*/
if ((nm_ap_get_mode (ap) == IW_MODE_ADHOC) && (nm_device_802_11_wireless_get_bitrate (self) <= 0))
nm_device_802_11_wireless_set_bitrate (self, 11000); /* In Kbps */
return TRUE;
}
/*
* nm_device_wireless_configure_adhoc
*
* Create an ad-hoc network (rather than associating with one).
*
*/
static NMActStageReturn
wireless_configure_adhoc (NMDevice80211Wireless *self,
NMAccessPoint *ap,
NMActRequest *req)
{
NMData * data;
int auth = 0;
NMAPListIter * iter;
NMAccessPoint * tmp_ap;
double card_freqs[IW_MAX_FREQUENCIES];
int num_freqs = 0, i;
double freq_to_use = 0;
iwrange range;
NMSock * sk;
int err;
const char * iface;
g_assert (req);
data = nm_act_request_get_data (req);
g_assert (data);
if (nm_ap_get_encrypted (ap))
auth = IW_AUTH_ALG_SHARED_KEY;
/* Build our local list of frequencies to whittle down until we find a free one */
memset (&card_freqs, 0, sizeof (card_freqs));
num_freqs = MIN (self->priv->num_freqs, IW_MAX_FREQUENCIES);
for (i = 0; i < num_freqs; i++)
card_freqs[i] = self->priv->freqs[i];
/* Compile a list of wireless channels that are currently in use */
iter = nm_ap_list_iter_new (nm_device_802_11_wireless_ap_list_get (self));
while ((tmp_ap = nm_ap_list_iter_next (iter)))
{
double ap_freq = nm_ap_get_freq (tmp_ap);
for (i = 0; i < num_freqs && ap_freq; i++)
{
if (card_freqs[i] == ap_freq)
card_freqs[i] = 0;
}
}
nm_ap_list_iter_free (iter);
if ((sk = nm_dev_sock_open (NM_DEVICE (self), DEV_WIRELESS, __func__, NULL)) == NULL)
return NM_ACT_STAGE_RETURN_FAILURE;
iface = nm_device_get_iface (NM_DEVICE (self));
err = iw_get_range_info (nm_dev_sock_get_fd (sk), iface, &range);
nm_dev_sock_close (sk);
if (err < 0)
return NM_ACT_STAGE_RETURN_FAILURE;
/* Ok, find the first non-zero freq in our table and use it.
* For now we only try to use a channel in the 802.11b channel
* space so that most everyone can see it.
*/
for (i = 0; i < num_freqs; i++)
{
int channel = iw_freq_to_channel (card_freqs[i], &range);
if (card_freqs[i] && (channel > 0) && (channel < 15))
{
freq_to_use = card_freqs[i];
break;
}
}
/* Hmm, no free channels in 802.11b space. Pick one more or less randomly */
if (!freq_to_use)
{
double pfreq;
int channel = (int)(random () % 14);
int err;
err = iw_channel_to_freq (channel, &pfreq, &range);
if (err == channel)
freq_to_use = pfreq;
}
if (!freq_to_use)
return NM_ACT_STAGE_RETURN_FAILURE;
nm_ap_set_freq (ap, freq_to_use);
nm_info ("Will create network '%s' with frequency %f.", nm_ap_get_essid (ap), nm_ap_get_freq (ap));
set_wireless_config (self, ap);
return NM_ACT_STAGE_RETURN_SUCCESS;
}
#endif /* UNUSED */
/*
* is_associated
*

View file

@ -98,10 +98,6 @@ NMAccessPoint * nm_device_802_11_wireless_get_activation_ap (NMDevice80211Wirele
const char *essid,
NMAPSecurity *security);
void nm_device_802_11_wireless_set_wep_enc_key (NMDevice80211Wireless *dev,
const char *key,
int auth_method);
void nm_device_802_11_wireless_set_scan_interval (struct NMData *data,
NMDevice80211Wireless *dev,
NMWirelessScanInterval interval);