diff options
author | Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | 2009-05-22 10:40:20 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-05-22 14:06:03 -0400 |
commit | b4703a2e32fdffbf83caf699817b21c4fc6d987c (patch) | |
tree | 3f861398c59de9895225aef476a6dd80a749f2a9 /drivers/net/wireless/rndis_wlan.c | |
parent | 9656e85ba24a9814f1705e0e3639281d15d6a419 (diff) |
rndis_wlan: explain bits used in key setup code.
Driver uses some unnamed bits to control encryption setup. Move these to
enumerations with proper names explaining their meaning.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rndis_wlan.c')
-rw-r--r-- | drivers/net/wireless/rndis_wlan.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index 4b3e04699a67..041680019a8e 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -196,6 +196,18 @@ enum ndis_80211_priv_filter { | |||
196 | ndis_80211_priv_8021x_wep | 196 | ndis_80211_priv_8021x_wep |
197 | }; | 197 | }; |
198 | 198 | ||
199 | enum ndis_80211_addkey_bits { | ||
200 | ndis_80211_addkey_8021x_auth = cpu_to_le32(1 << 28), | ||
201 | ndis_80211_addkey_set_init_recv_seq = cpu_to_le32(1 << 29), | ||
202 | ndis_80211_addkey_pairwise_key = cpu_to_le32(1 << 30), | ||
203 | ndis_80211_addkey_transmit_key = cpu_to_le32(1 << 31), | ||
204 | }; | ||
205 | |||
206 | enum ndis_80211_addwep_bits { | ||
207 | ndis_80211_addwep_perclient_key = cpu_to_le32(1 << 30), | ||
208 | ndis_80211_addwep_transmit_key = cpu_to_le32(1 << 31), | ||
209 | }; | ||
210 | |||
199 | struct ndis_80211_ssid { | 211 | struct ndis_80211_ssid { |
200 | __le32 length; | 212 | __le32 length; |
201 | u8 essid[NDIS_802_11_LENGTH_SSID]; | 213 | u8 essid[NDIS_802_11_LENGTH_SSID]; |
@@ -998,7 +1010,7 @@ static int add_wep_key(struct usbnet *usbdev, char *key, int key_len, int index) | |||
998 | memcpy(&ndis_key.material, key, key_len); | 1010 | memcpy(&ndis_key.material, key, key_len); |
999 | 1011 | ||
1000 | if (index == priv->encr_tx_key_index) { | 1012 | if (index == priv->encr_tx_key_index) { |
1001 | ndis_key.index |= cpu_to_le32(1 << 31); | 1013 | ndis_key.index |= ndis_80211_addwep_transmit_key; |
1002 | ret = set_encr_mode(usbdev, IW_AUTH_CIPHER_WEP104, | 1014 | ret = set_encr_mode(usbdev, IW_AUTH_CIPHER_WEP104, |
1003 | IW_AUTH_CIPHER_NONE); | 1015 | IW_AUTH_CIPHER_NONE); |
1004 | if (ret) | 1016 | if (ret) |
@@ -1044,7 +1056,8 @@ static int remove_key(struct usbnet *usbdev, int index, u8 bssid[ETH_ALEN]) | |||
1044 | if (bssid) { | 1056 | if (bssid) { |
1045 | /* pairwise key */ | 1057 | /* pairwise key */ |
1046 | if (memcmp(bssid, ffff_bssid, ETH_ALEN) != 0) | 1058 | if (memcmp(bssid, ffff_bssid, ETH_ALEN) != 0) |
1047 | remove_key.index |= cpu_to_le32(1 << 30); | 1059 | remove_key.index |= |
1060 | ndis_80211_addkey_pairwise_key; | ||
1048 | memcpy(remove_key.bssid, bssid, | 1061 | memcpy(remove_key.bssid, bssid, |
1049 | sizeof(remove_key.bssid)); | 1062 | sizeof(remove_key.bssid)); |
1050 | } else | 1063 | } else |
@@ -1626,7 +1639,7 @@ static int rndis_iw_set_encode_ext(struct net_device *dev, | |||
1626 | 1639 | ||
1627 | if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { | 1640 | if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { |
1628 | memcpy(ndis_key.rsc, ext->rx_seq, 6); | 1641 | memcpy(ndis_key.rsc, ext->rx_seq, 6); |
1629 | ndis_key.index |= cpu_to_le32(1 << 29); | 1642 | ndis_key.index |= ndis_80211_addkey_set_init_recv_seq; |
1630 | } | 1643 | } |
1631 | 1644 | ||
1632 | addr = ext->addr.sa_data; | 1645 | addr = ext->addr.sa_data; |
@@ -1638,12 +1651,12 @@ static int rndis_iw_set_encode_ext(struct net_device *dev, | |||
1638 | get_bssid(usbdev, ndis_key.bssid); | 1651 | get_bssid(usbdev, ndis_key.bssid); |
1639 | } else { | 1652 | } else { |
1640 | /* pairwise key */ | 1653 | /* pairwise key */ |
1641 | ndis_key.index |= cpu_to_le32(1 << 30); | 1654 | ndis_key.index |= ndis_80211_addkey_pairwise_key; |
1642 | memcpy(ndis_key.bssid, addr, ETH_ALEN); | 1655 | memcpy(ndis_key.bssid, addr, ETH_ALEN); |
1643 | } | 1656 | } |
1644 | 1657 | ||
1645 | if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) | 1658 | if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) |
1646 | ndis_key.index |= cpu_to_le32(1 << 31); | 1659 | ndis_key.index |= ndis_80211_addkey_transmit_key; |
1647 | 1660 | ||
1648 | if (ext->alg == IW_ENCODE_ALG_TKIP && ext->key_len == 32) { | 1661 | if (ext->alg == IW_ENCODE_ALG_TKIP && ext->key_len == 32) { |
1649 | /* wpa_supplicant gives us the Michael MIC RX/TX keys in | 1662 | /* wpa_supplicant gives us the Michael MIC RX/TX keys in |