Commit 9a1771e86756212041b32d80b850cc4c8063360a

Authored by Johannes Berg
Committed by John W. Linville
1 parent e3c5a64e70

[PATCH] softmac: add SIOCSIWMLME

This patch adds the SIOCSIWMLME wext to softmac, this functionality
appears to be used by wpa_supplicant and is softmac-specific.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Jouni Malinen <jkm@devicescape.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Showing 4 changed files with 39 additions and 1 deletions Side-by-side Diff

include/net/ieee80211softmac_wx.h
... ... @@ -91,5 +91,10 @@
91 91 struct iw_request_info *info,
92 92 union iwreq_data *wrqu,
93 93 char *extra);
  94 +extern int
  95 +ieee80211softmac_wx_set_mlme(struct net_device *dev,
  96 + struct iw_request_info *info,
  97 + union iwreq_data *wrqu,
  98 + char *extra);
94 99 #endif /* _IEEE80211SOFTMAC_WX */
net/ieee80211/softmac/ieee80211softmac_assoc.c
... ... @@ -82,7 +82,7 @@
82 82 }
83 83  
84 84 /* Sends out a disassociation request to the desired AP */
85   -static void
  85 +void
86 86 ieee80211softmac_disassoc(struct ieee80211softmac_device *mac, u16 reason)
87 87 {
88 88 unsigned long flags;
net/ieee80211/softmac/ieee80211softmac_priv.h
... ... @@ -150,6 +150,7 @@
150 150 int ieee80211softmac_handle_reassoc_req(struct net_device * dev,
151 151 struct ieee80211_reassoc_request * reassoc);
152 152 void ieee80211softmac_assoc_timeout(void *d);
  153 +void ieee80211softmac_disassoc(struct ieee80211softmac_device *mac, u16 reason);
153 154  
154 155 /* some helper functions */
155 156 static inline int ieee80211softmac_scan_handlers_check_self(struct ieee80211softmac_device *sm)
net/ieee80211/softmac/ieee80211softmac_wx.c
... ... @@ -430,4 +430,37 @@
430 430 return err;
431 431 }
432 432 EXPORT_SYMBOL_GPL(ieee80211softmac_wx_get_genie);
  433 +
  434 +int
  435 +ieee80211softmac_wx_set_mlme(struct net_device *dev,
  436 + struct iw_request_info *info,
  437 + union iwreq_data *wrqu,
  438 + char *extra)
  439 +{
  440 + struct ieee80211softmac_device *mac = ieee80211_priv(dev);
  441 + struct iw_mlme *mlme = (struct iw_mlme *)extra;
  442 + u16 reason = cpu_to_le16(mlme->reason_code);
  443 + struct ieee80211softmac_network *net;
  444 +
  445 + if (memcmp(mac->associnfo.bssid, mlme->addr.sa_data, ETH_ALEN)) {
  446 + printk(KERN_DEBUG PFX "wx_set_mlme: requested operation on net we don't use\n");
  447 + return -EINVAL;
  448 + }
  449 +
  450 + switch (mlme->cmd) {
  451 + case IW_MLME_DEAUTH:
  452 + net = ieee80211softmac_get_network_by_bssid_locked(mac, mlme->addr.sa_data);
  453 + if (!net) {
  454 + printk(KERN_DEBUG PFX "wx_set_mlme: we should know the net here...\n");
  455 + return -EINVAL;
  456 + }
  457 + return ieee80211softmac_deauth_req(mac, net, reason);
  458 + case IW_MLME_DISASSOC:
  459 + ieee80211softmac_disassoc(mac, reason);
  460 + return 0;
  461 + default:
  462 + return -EOPNOTSUPP;
  463 + }
  464 +}
  465 +EXPORT_SYMBOL_GPL(ieee80211softmac_wx_set_mlme);