Search Linux Wireless

Re: [RFC 1/4] orinoco: add cfg80211 connect and disconnect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2009-08-05 at 21:32 +0100, David Kilroy wrote:

> +static int __orinoco_connect(struct wiphy *wiphy,
> +			     struct ieee80211_channel *channel,
> +			     const u8 *bssid, const u8 *ssid,
> +			     u8 ssid_len)
> +{
> +	struct orinoco_private *priv = wiphy_priv(wiphy);
> +

> +		/* Intersil firmware hangs if you try to roam manually
> +		 * without an ESSID set. */
> +		if ((priv->firmware_type == FIRMWARE_TYPE_INTERSIL) &&
> +		    (priv->desired_essid[0] == 0)) {

This is a wrong way to check for an empty SSID, since \0 is a valid byte
in the SSID. You should check for ssid_len == 0 instead.

However, it's also not necessary, cfg80211 will never call this function
without an SSID. So you can even just BUG_ON(!ssid_len); or something :)

> +	switch (sme->auth_type) {
> +	case NL80211_AUTHTYPE_OPEN_SYSTEM:
> +		priv->wep_restrict = 0;
> +		break;
> +	case NL80211_AUTHTYPE_SHARED_KEY:
> +		priv->wep_restrict = 1;
> +		break;
> +	/* Ignore all other settings */
> +	default:
> +		break;

I think you should return -EINVAL for other values.

> +	}
> +
> +	switch (sme->crypto.cipher_group) {
> +	case WLAN_CIPHER_SUITE_TKIP:
> +		encode_alg = ORINOCO_ALG_TKIP;
> +		break;
> +
> +	case WLAN_CIPHER_SUITE_WEP40:
> +	case WLAN_CIPHER_SUITE_WEP104:
> +		encode_alg = ORINOCO_ALG_WEP;
> +		break;
> +
> +	default:
> +		encode_alg = ORINOCO_ALG_NONE;
> +	}

Same here, I guess, although that can't really happen since you only
advertised these ones.

Other than that, as noted in my reply to 0/5, this won't work properly
since you don't ever call cfg80211_connect_result().

johannes

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux