提交 b4703a2e 编写于 作者: J Jussi Kivilinna 提交者: John W. Linville

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: NJussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 9656e85b
...@@ -196,6 +196,18 @@ enum ndis_80211_priv_filter { ...@@ -196,6 +196,18 @@ enum ndis_80211_priv_filter {
ndis_80211_priv_8021x_wep ndis_80211_priv_8021x_wep
}; };
enum ndis_80211_addkey_bits {
ndis_80211_addkey_8021x_auth = cpu_to_le32(1 << 28),
ndis_80211_addkey_set_init_recv_seq = cpu_to_le32(1 << 29),
ndis_80211_addkey_pairwise_key = cpu_to_le32(1 << 30),
ndis_80211_addkey_transmit_key = cpu_to_le32(1 << 31),
};
enum ndis_80211_addwep_bits {
ndis_80211_addwep_perclient_key = cpu_to_le32(1 << 30),
ndis_80211_addwep_transmit_key = cpu_to_le32(1 << 31),
};
struct ndis_80211_ssid { struct ndis_80211_ssid {
__le32 length; __le32 length;
u8 essid[NDIS_802_11_LENGTH_SSID]; 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,7 +1010,7 @@ static int add_wep_key(struct usbnet *usbdev, char *key, int key_len, int index)
memcpy(&ndis_key.material, key, key_len); memcpy(&ndis_key.material, key, key_len);
if (index == priv->encr_tx_key_index) { if (index == priv->encr_tx_key_index) {
ndis_key.index |= cpu_to_le32(1 << 31); ndis_key.index |= ndis_80211_addwep_transmit_key;
ret = set_encr_mode(usbdev, IW_AUTH_CIPHER_WEP104, ret = set_encr_mode(usbdev, IW_AUTH_CIPHER_WEP104,
IW_AUTH_CIPHER_NONE); IW_AUTH_CIPHER_NONE);
if (ret) if (ret)
...@@ -1044,7 +1056,8 @@ static int remove_key(struct usbnet *usbdev, int index, u8 bssid[ETH_ALEN]) ...@@ -1044,7 +1056,8 @@ static int remove_key(struct usbnet *usbdev, int index, u8 bssid[ETH_ALEN])
if (bssid) { if (bssid) {
/* pairwise key */ /* pairwise key */
if (memcmp(bssid, ffff_bssid, ETH_ALEN) != 0) if (memcmp(bssid, ffff_bssid, ETH_ALEN) != 0)
remove_key.index |= cpu_to_le32(1 << 30); remove_key.index |=
ndis_80211_addkey_pairwise_key;
memcpy(remove_key.bssid, bssid, memcpy(remove_key.bssid, bssid,
sizeof(remove_key.bssid)); sizeof(remove_key.bssid));
} else } else
...@@ -1626,7 +1639,7 @@ static int rndis_iw_set_encode_ext(struct net_device *dev, ...@@ -1626,7 +1639,7 @@ static int rndis_iw_set_encode_ext(struct net_device *dev,
if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
memcpy(ndis_key.rsc, ext->rx_seq, 6); memcpy(ndis_key.rsc, ext->rx_seq, 6);
ndis_key.index |= cpu_to_le32(1 << 29); ndis_key.index |= ndis_80211_addkey_set_init_recv_seq;
} }
addr = ext->addr.sa_data; addr = ext->addr.sa_data;
...@@ -1638,12 +1651,12 @@ static int rndis_iw_set_encode_ext(struct net_device *dev, ...@@ -1638,12 +1651,12 @@ static int rndis_iw_set_encode_ext(struct net_device *dev,
get_bssid(usbdev, ndis_key.bssid); get_bssid(usbdev, ndis_key.bssid);
} else { } else {
/* pairwise key */ /* pairwise key */
ndis_key.index |= cpu_to_le32(1 << 30); ndis_key.index |= ndis_80211_addkey_pairwise_key;
memcpy(ndis_key.bssid, addr, ETH_ALEN); memcpy(ndis_key.bssid, addr, ETH_ALEN);
} }
if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
ndis_key.index |= cpu_to_le32(1 << 31); ndis_key.index |= ndis_80211_addkey_transmit_key;
if (ext->alg == IW_ENCODE_ALG_TKIP && ext->key_len == 32) { if (ext->alg == IW_ENCODE_ALG_TKIP && ext->key_len == 32) {
/* wpa_supplicant gives us the Michael MIC RX/TX keys in /* wpa_supplicant gives us the Michael MIC RX/TX keys in
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册