@@ -1844,8 +1844,10 @@ static s32
18441844brcmf_add_keyext (struct wiphy * wiphy , struct net_device * ndev ,
18451845 u8 key_idx , const u8 * mac_addr , struct key_params * params )
18461846{
1847+ struct brcmf_if * ifp = netdev_priv (ndev );
18471848 struct brcmf_wsec_key key ;
18481849 s32 err = 0 ;
1850+ u8 keybuf [8 ];
18491851
18501852 memset (& key , 0 , sizeof (key ));
18511853 key .index = (u32 ) key_idx ;
@@ -1869,8 +1871,9 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev,
18691871 brcmf_dbg (CONN , "Setting the key index %d\n" , key .index );
18701872 memcpy (key .data , params -> key , key .len );
18711873
1872- if (params -> cipher == WLAN_CIPHER_SUITE_TKIP ) {
1873- u8 keybuf [8 ];
1874+ if ((ifp -> vif -> mode != WL_MODE_AP ) &&
1875+ (params -> cipher == WLAN_CIPHER_SUITE_TKIP )) {
1876+ brcmf_dbg (CONN , "Swapping RX/TX MIC key\n" );
18741877 memcpy (keybuf , & key .data [24 ], sizeof (keybuf ));
18751878 memcpy (& key .data [24 ], & key .data [16 ], sizeof (keybuf ));
18761879 memcpy (& key .data [16 ], keybuf , sizeof (keybuf ));
@@ -1966,7 +1969,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
19661969 break ;
19671970 case WLAN_CIPHER_SUITE_TKIP :
19681971 if (ifp -> vif -> mode != WL_MODE_AP ) {
1969- brcmf_dbg (CONN , "Swapping key\n" );
1972+ brcmf_dbg (CONN , "Swapping RX/TX MIC key\n" );
19701973 memcpy (keybuf , & key .data [24 ], sizeof (keybuf ));
19711974 memcpy (& key .data [24 ], & key .data [16 ], sizeof (keybuf ));
19721975 memcpy (& key .data [16 ], keybuf , sizeof (keybuf ));
@@ -2071,8 +2074,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
20712074 err = - EAGAIN ;
20722075 goto done ;
20732076 }
2074- switch (wsec & ~SES_OW_ENABLED ) {
2075- case WEP_ENABLED :
2077+ if (wsec & WEP_ENABLED ) {
20762078 sec = & profile -> sec ;
20772079 if (sec -> cipher_pairwise & WLAN_CIPHER_SUITE_WEP40 ) {
20782080 params .cipher = WLAN_CIPHER_SUITE_WEP40 ;
@@ -2081,16 +2083,13 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
20812083 params .cipher = WLAN_CIPHER_SUITE_WEP104 ;
20822084 brcmf_dbg (CONN , "WLAN_CIPHER_SUITE_WEP104\n" );
20832085 }
2084- break ;
2085- case TKIP_ENABLED :
2086+ } else if (wsec & TKIP_ENABLED ) {
20862087 params .cipher = WLAN_CIPHER_SUITE_TKIP ;
20872088 brcmf_dbg (CONN , "WLAN_CIPHER_SUITE_TKIP\n" );
2088- break ;
2089- case AES_ENABLED :
2089+ } else if (wsec & AES_ENABLED ) {
20902090 params .cipher = WLAN_CIPHER_SUITE_AES_CMAC ;
20912091 brcmf_dbg (CONN , "WLAN_CIPHER_SUITE_AES_CMAC\n" );
2092- break ;
2093- default :
2092+ } else {
20942093 brcmf_err ("Invalid algo (0x%x)\n" , wsec );
20952094 err = - EINVAL ;
20962095 goto done ;
@@ -3774,25 +3773,31 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
37743773static int brcmf_cfg80211_stop_ap (struct wiphy * wiphy , struct net_device * ndev )
37753774{
37763775 struct brcmf_if * ifp = netdev_priv (ndev );
3777- s32 err = - EPERM ;
3776+ s32 err ;
37783777 struct brcmf_fil_bss_enable_le bss_enable ;
3778+ struct brcmf_join_params join_params ;
37793779
37803780 brcmf_dbg (TRACE , "Enter\n" );
37813781
37823782 if (ifp -> vif -> wdev .iftype == NL80211_IFTYPE_AP ) {
37833783 /* Due to most likely deauths outstanding we sleep */
37843784 /* first to make sure they get processed by fw. */
37853785 msleep (400 );
3786- err = brcmf_fil_cmd_int_set (ifp , BRCMF_C_SET_AP , 0 );
3787- if (err < 0 ) {
3788- brcmf_err ("setting AP mode failed %d\n" , err );
3789- goto exit ;
3790- }
3786+
3787+ memset (& join_params , 0 , sizeof (join_params ));
3788+ err = brcmf_fil_cmd_data_set (ifp , BRCMF_C_SET_SSID ,
3789+ & join_params , sizeof (join_params ));
3790+ if (err < 0 )
3791+ brcmf_err ("SET SSID error (%d)\n" , err );
37913792 err = brcmf_fil_cmd_int_set (ifp , BRCMF_C_UP , 0 );
3792- if (err < 0 ) {
3793+ if (err < 0 )
37933794 brcmf_err ("BRCMF_C_UP error %d\n" , err );
3794- goto exit ;
3795- }
3795+ err = brcmf_fil_cmd_int_set (ifp , BRCMF_C_SET_AP , 0 );
3796+ if (err < 0 )
3797+ brcmf_err ("setting AP mode failed %d\n" , err );
3798+ err = brcmf_fil_cmd_int_set (ifp , BRCMF_C_SET_INFRA , 0 );
3799+ if (err < 0 )
3800+ brcmf_err ("setting INFRA mode failed %d\n" , err );
37963801 } else {
37973802 bss_enable .bsscfg_idx = cpu_to_le32 (ifp -> bssidx );
37983803 bss_enable .enable = cpu_to_le32 (0 );
@@ -3805,7 +3810,6 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
38053810 set_bit (BRCMF_VIF_STATUS_AP_CREATING , & ifp -> vif -> sme_state );
38063811 clear_bit (BRCMF_VIF_STATUS_AP_CREATED , & ifp -> vif -> sme_state );
38073812
3808- exit :
38093813 return err ;
38103814}
38113815
0 commit comments