diff options
author | Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | 2009-08-28 05:59:15 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-28 14:40:57 -0400 |
commit | 7b1fff996a5408261ca458f82369d1f5b7aad2d4 (patch) | |
tree | 16973d190cad0b5e42abf5cbd499e13df36e325c /drivers/net/wireless | |
parent | 0848e6c698237ba51c69eca10580d2f38a1179ad (diff) |
rndis_wlan: use is_zero_ether_addr() and is_broadcast_ether_addr()
Use is_zero_ether_addr() and is_broadcast_ether_addr() instead of
memcmp against ffff_bssid/zero_bssid.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/rndis_wlan.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index dc3083ba8380..c28fde59c32b 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -514,11 +514,6 @@ static struct cfg80211_ops rndis_config_ops = { | |||
514 | static void *rndis_wiphy_privid = &rndis_wiphy_privid; | 514 | static void *rndis_wiphy_privid = &rndis_wiphy_privid; |
515 | 515 | ||
516 | 516 | ||
517 | static const unsigned char zero_bssid[ETH_ALEN] = {0,}; | ||
518 | static const unsigned char ffff_bssid[ETH_ALEN] = { 0xff, 0xff, 0xff, | ||
519 | 0xff, 0xff, 0xff }; | ||
520 | |||
521 | |||
522 | static struct rndis_wlan_private *get_rndis_wlan_priv(struct usbnet *dev) | 517 | static struct rndis_wlan_private *get_rndis_wlan_priv(struct usbnet *dev) |
523 | { | 518 | { |
524 | return (struct rndis_wlan_private *)dev->driver_priv; | 519 | return (struct rndis_wlan_private *)dev->driver_priv; |
@@ -995,7 +990,7 @@ static int is_associated(struct usbnet *usbdev) | |||
995 | 990 | ||
996 | ret = get_bssid(usbdev, bssid); | 991 | ret = get_bssid(usbdev, bssid); |
997 | 992 | ||
998 | return(ret == 0 && memcmp(bssid, zero_bssid, ETH_ALEN) != 0); | 993 | return (ret == 0 && !is_zero_ether_addr(bssid)); |
999 | } | 994 | } |
1000 | 995 | ||
1001 | 996 | ||
@@ -1293,8 +1288,8 @@ static int add_wpa_key(struct usbnet *usbdev, const u8 *key, int key_len, | |||
1293 | devdbg(usbdev, "add_wpa_key: recv seq flag without buffer"); | 1288 | devdbg(usbdev, "add_wpa_key: recv seq flag without buffer"); |
1294 | return -EINVAL; | 1289 | return -EINVAL; |
1295 | } | 1290 | } |
1296 | is_addr_ok = addr && memcmp(addr, zero_bssid, ETH_ALEN) != 0 && | 1291 | is_addr_ok = addr && !is_zero_ether_addr(addr) && |
1297 | memcmp(addr, ffff_bssid, ETH_ALEN) != 0; | 1292 | !is_broadcast_ether_addr(addr); |
1298 | if ((flags & NDIS_80211_ADDKEY_PAIRWISE_KEY) && !is_addr_ok) { | 1293 | if ((flags & NDIS_80211_ADDKEY_PAIRWISE_KEY) && !is_addr_ok) { |
1299 | devdbg(usbdev, "add_wpa_key: pairwise but bssid invalid (%pM)", | 1294 | devdbg(usbdev, "add_wpa_key: pairwise but bssid invalid (%pM)", |
1300 | addr); | 1295 | addr); |
@@ -1379,8 +1374,8 @@ static int restore_key(struct usbnet *usbdev, int key_idx) | |||
1379 | /*if (priv->encr_tx_key_index == key_idx) | 1374 | /*if (priv->encr_tx_key_index == key_idx) |
1380 | flags |= NDIS_80211_ADDKEY_TRANSMIT_KEY;*/ | 1375 | flags |= NDIS_80211_ADDKEY_TRANSMIT_KEY;*/ |
1381 | 1376 | ||
1382 | if (memcmp(key.bssid, zero_bssid, ETH_ALEN) != 0 && | 1377 | if (!is_zero_ether_addr(key.bssid) && |
1383 | memcmp(key.bssid, ffff_bssid, ETH_ALEN) != 0) | 1378 | !is_broadcast_ether_addr(key.bssid)) |
1384 | flags |= NDIS_80211_ADDKEY_PAIRWISE_KEY; | 1379 | flags |= NDIS_80211_ADDKEY_PAIRWISE_KEY; |
1385 | 1380 | ||
1386 | return add_wpa_key(usbdev, key.material, key.len, key_idx, | 1381 | return add_wpa_key(usbdev, key.material, key.len, key_idx, |
@@ -1430,7 +1425,7 @@ static int remove_key(struct usbnet *usbdev, int index, u8 bssid[ETH_ALEN]) | |||
1430 | remove_key.index = cpu_to_le32(index); | 1425 | remove_key.index = cpu_to_le32(index); |
1431 | if (bssid) { | 1426 | if (bssid) { |
1432 | /* pairwise key */ | 1427 | /* pairwise key */ |
1433 | if (memcmp(bssid, ffff_bssid, ETH_ALEN) != 0) | 1428 | if (!is_broadcast_ether_addr(bssid)) |
1434 | remove_key.index |= | 1429 | remove_key.index |= |
1435 | NDIS_80211_ADDKEY_PAIRWISE_KEY; | 1430 | NDIS_80211_ADDKEY_PAIRWISE_KEY; |
1436 | memcpy(remove_key.bssid, bssid, | 1431 | memcpy(remove_key.bssid, bssid, |