mac80211: dont advertise WEP if unavailable
authorJohannes Berg <johannes.berg@intel.com>
Tue, 10 Aug 2010 07:46:41 +0000 (09:46 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 16 Aug 2010 20:45:21 +0000 (16:45 -0400)
When WEP is unavailable, don't advertise it
to cfg80211.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/main.c

index 06b9608a213075fa8e8d6c7c3693f2db78105684..0afccda42a24a04c32a61796997a1cf65ee2cf44 100644 (file)
@@ -536,6 +536,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
        int channels, max_bitrates;
        bool supp_ht;
        static const u32 cipher_suites[] = {
+               /* keep WEP first, it may be removed below */
                WLAN_CIPHER_SUITE_WEP40,
                WLAN_CIPHER_SUITE_WEP104,
                WLAN_CIPHER_SUITE_TKIP,
@@ -623,6 +624,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
        local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
        if (!(local->hw.flags & IEEE80211_HW_MFP_CAPABLE))
                local->hw.wiphy->n_cipher_suites--;
+       if (IS_ERR(local->wep_tx_tfm) || IS_ERR(local->wep_rx_tfm)) {
+               local->hw.wiphy->cipher_suites += 2;
+               local->hw.wiphy->n_cipher_suites -= 2;
+       }
 
        result = wiphy_register(local->hw.wiphy);
        if (result < 0)