]> err.no Git - linux-2.6/commitdiff
[PATCH] ieee80211: common wx auth code
authorLarry Finger <Larry.Finger@lwfinger.net>
Mon, 30 Jan 2006 12:12:50 +0000 (13:12 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 31 Jan 2006 01:35:35 +0000 (20:35 -0500)
This patch creates two functions ieee80211_wx_set_auth and
ieee80211_wx_get_auth that can be used by drivers for the wireless
extension handlers instead of writing their own, if the implementation
should be software only.

These patches enable using bcm43xx devices with WPA and this seems (as
far as I can tell) to be the only difference between the stock ieee80211
and softmac's ieee80211 left.

Signed-Off-By: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
include/net/ieee80211.h
net/ieee80211/ieee80211_wx.c

index ff6ef9e1a691d260faf0ba05cd99efdaaf6a826a..4725ff861c57f74390a66735ee03b50de7492c9e 100644 (file)
@@ -1285,6 +1285,14 @@ extern int ieee80211_wx_set_encodeext(struct ieee80211_device *ieee,
 extern int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee,
                                      struct iw_request_info *info,
                                      union iwreq_data *wrqu, char *extra);
+extern int ieee80211_wx_set_auth(struct net_device *dev,
+                                struct iw_request_info *info,
+                                union iwreq_data *wrqu,
+                                char *extra);
+extern int ieee80211_wx_get_auth(struct net_device *dev,
+                                struct iw_request_info *info,
+                                union iwreq_data *wrqu,
+                                char *extra);
 
 static inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
 {
index 9496918e6106310fc1cf1d915e39e765f01b6354..e8c55a4d58344e6a57ca7a0a1a7f965b84506337 100644 (file)
@@ -761,9 +761,98 @@ int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee,
        return 0;
 }
 
+int ieee80211_wx_set_auth(struct net_device *dev,
+                         struct iw_request_info *info,
+                         union iwreq_data *wrqu,
+                         char *extra)
+{
+       struct ieee80211_device *ieee = netdev_priv(dev);
+       unsigned long flags;
+       int err = 0;
+
+       spin_lock_irqsave(&ieee->lock, flags);
+       
+       switch (wrqu->param.flags & IW_AUTH_INDEX) {
+       case IW_AUTH_WPA_VERSION:
+       case IW_AUTH_CIPHER_PAIRWISE:
+       case IW_AUTH_CIPHER_GROUP:
+       case IW_AUTH_KEY_MGMT:
+               /*
+                * Host AP driver does not use these parameters and allows
+                * wpa_supplicant to control them internally.
+                */
+               break;
+       case IW_AUTH_TKIP_COUNTERMEASURES:
+               break;          /* FIXME */
+       case IW_AUTH_DROP_UNENCRYPTED:
+               ieee->drop_unencrypted = !!wrqu->param.value;
+               break;
+       case IW_AUTH_80211_AUTH_ALG:
+               break;          /* FIXME */
+       case IW_AUTH_WPA_ENABLED:
+               ieee->privacy_invoked = ieee->wpa_enabled = !!wrqu->param.value;
+               break;
+       case IW_AUTH_RX_UNENCRYPTED_EAPOL:
+               ieee->ieee802_1x = !!wrqu->param.value;
+               break;
+       case IW_AUTH_PRIVACY_INVOKED:
+               ieee->privacy_invoked = !!wrqu->param.value;
+               break;
+       default:
+               err = -EOPNOTSUPP;
+               break;
+       }
+       spin_unlock_irqrestore(&ieee->lock, flags);
+       return err;
+}
+
+int ieee80211_wx_get_auth(struct net_device *dev,
+                         struct iw_request_info *info,
+                         union iwreq_data *wrqu,
+                         char *extra)
+{
+       struct ieee80211_device *ieee = netdev_priv(dev);
+       unsigned long flags;
+       int err = 0;
+
+       spin_lock_irqsave(&ieee->lock, flags);
+       
+       switch (wrqu->param.flags & IW_AUTH_INDEX) {
+       case IW_AUTH_WPA_VERSION:
+       case IW_AUTH_CIPHER_PAIRWISE:
+       case IW_AUTH_CIPHER_GROUP:
+       case IW_AUTH_KEY_MGMT:
+       case IW_AUTH_TKIP_COUNTERMEASURES:              /* FIXME */
+       case IW_AUTH_80211_AUTH_ALG:                    /* FIXME */
+               /*
+                * Host AP driver does not use these parameters and allows
+                * wpa_supplicant to control them internally.
+                */
+               err = -EOPNOTSUPP;
+               break;
+       case IW_AUTH_DROP_UNENCRYPTED:
+               wrqu->param.value = ieee->drop_unencrypted;
+               break;
+       case IW_AUTH_WPA_ENABLED:
+               wrqu->param.value = ieee->wpa_enabled;
+               break;
+       case IW_AUTH_RX_UNENCRYPTED_EAPOL:
+               wrqu->param.value = ieee->ieee802_1x;
+               break;
+       default:
+               err = -EOPNOTSUPP;
+               break;
+       }
+       spin_unlock_irqrestore(&ieee->lock, flags);
+       return err;
+}
+
 EXPORT_SYMBOL(ieee80211_wx_set_encodeext);
 EXPORT_SYMBOL(ieee80211_wx_get_encodeext);
 
 EXPORT_SYMBOL(ieee80211_wx_get_scan);
 EXPORT_SYMBOL(ieee80211_wx_set_encode);
 EXPORT_SYMBOL(ieee80211_wx_get_encode);
+
+EXPORT_SYMBOL_GPL(ieee80211_wx_set_auth);
+EXPORT_SYMBOL_GPL(ieee80211_wx_get_auth);