Update comments and value handling for key indexes to make clear which values should...
authormentor <mentor@0192ed92-7a03-0410-a25b-9323aeb14dbd>
Wed, 2 Jan 2008 23:43:23 +0000 (23:43 +0000)
committermentor <mentor@0192ed92-7a03-0410-a25b-9323aeb14dbd>
Wed, 2 Jan 2008 23:43:23 +0000 (23:43 +0000)
git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3111 0192ed92-7a03-0410-a25b-9323aeb14dbd

net80211/ieee80211_ioctl.h
net80211/ieee80211_wireless.c

index 5d422b8f8e6de9aab6955840f994e18af9a8110c..06ecb529191c49076d290b46cc47ff199674d02e 100644 (file)
@@ -221,6 +221,8 @@ struct ieee80211req_key {
  * to IEEE80211_KEYIX_NONE when deleting a unicast key.
  */
 struct ieee80211req_del_key {
+       /* NB: This is different to ieee80211_keyix_t, but this is OK as 
+        * values are unique over the low order bits. */
        u_int8_t idk_keyix;     /* key index */
        u_int8_t idk_macaddr[IEEE80211_ADDR_LEN];
 };
index a6032daf4a715f4fe042755af2909a0862528901..f026c6c3b4f1b8b1714e72ec4a3e321458054947 100644 (file)
@@ -3292,6 +3292,11 @@ ieee80211_ioctl_setkey(struct net_device *dev, struct iw_request_info *info,
                if (ni == NULL)
                        return -ENOENT;
                wk = &ni->ni_ucastkey;
+       } else if (((uint8_t)IEEE80211_KEYIX_NONE <= kix) && 
+                       (kix < IEEE80211_KEYIX_NONE)) {
+               /* These values must never be used as they are ambiguous as 
+                * some of the API uses 8-bit integers for keyix. */
+               return -EINVAL;
        } else {
                if (kix >= IEEE80211_WEP_NKID)
                        return -EINVAL;
@@ -3355,6 +3360,11 @@ ieee80211_ioctl_getkey(struct net_device *dev, struct iwreq *iwr)
                if (ni == NULL)
                        return -ENOENT;
                wk = &ni->ni_ucastkey;
+       } else if (((uint8_t)IEEE80211_KEYIX_NONE <= kix) && 
+                       (kix < IEEE80211_KEYIX_NONE)) {
+               /* These values must never be used as they are ambiguous as 
+                * some of the API uses 8-bit integers for keyix. */
+               return -EINVAL;
        } else {
                if (kix >= IEEE80211_WEP_NKID)
                        return -EINVAL;
@@ -3399,7 +3409,7 @@ ieee80211_ioctl_delkey(struct net_device *dev, struct iw_request_info *info,
        ieee80211_keyix_t kix;
 
        kix = dk->idk_keyix;
-       if (dk->idk_keyix == (u_int8_t) IEEE80211_KEYIX_NONE)
+       if (dk->idk_keyix == (u_int8_t)IEEE80211_KEYIX_NONE)
                kix = IEEE80211_KEYIX_NONE;
 
        if (kix == IEEE80211_KEYIX_NONE) {