@@ -837,6 +837,33 @@ static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
837837 return 0 ;
838838}
839839
840+ static int ieee80211_set_fils_discovery (struct ieee80211_sub_if_data * sdata ,
841+ struct cfg80211_fils_discovery * params )
842+ {
843+ struct fils_discovery_data * new , * old = NULL ;
844+ struct ieee80211_fils_discovery * fd ;
845+
846+ if (!params -> tmpl || !params -> tmpl_len )
847+ return - EINVAL ;
848+
849+ fd = & sdata -> vif .bss_conf .fils_discovery ;
850+ fd -> min_interval = params -> min_interval ;
851+ fd -> max_interval = params -> max_interval ;
852+
853+ old = sdata_dereference (sdata -> u .ap .fils_discovery , sdata );
854+ new = kzalloc (sizeof (* new ) + params -> tmpl_len , GFP_KERNEL );
855+ if (!new )
856+ return - ENOMEM ;
857+ new -> len = params -> tmpl_len ;
858+ memcpy (new -> data , params -> tmpl , params -> tmpl_len );
859+ rcu_assign_pointer (sdata -> u .ap .fils_discovery , new );
860+
861+ if (old )
862+ kfree_rcu (old , rcu_head );
863+
864+ return 0 ;
865+ }
866+
840867static int ieee80211_set_ftm_responder_params (
841868 struct ieee80211_sub_if_data * sdata ,
842869 const u8 * lci , size_t lci_len ,
@@ -1099,21 +1126,26 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
10991126 }
11001127
11011128 err = ieee80211_assign_beacon (sdata , & params -> beacon , NULL );
1102- if (err < 0 ) {
1103- ieee80211_vif_release_channel (sdata );
1104- return err ;
1105- }
1129+ if (err < 0 )
1130+ goto error ;
11061131 changed |= err ;
11071132
1133+ if (params -> fils_discovery .max_interval ) {
1134+ err = ieee80211_set_fils_discovery (sdata ,
1135+ & params -> fils_discovery );
1136+ if (err < 0 )
1137+ goto error ;
1138+ changed |= BSS_CHANGED_FILS_DISCOVERY ;
1139+ }
1140+
11081141 err = drv_start_ap (sdata -> local , sdata );
11091142 if (err ) {
11101143 old = sdata_dereference (sdata -> u .ap .beacon , sdata );
11111144
11121145 if (old )
11131146 kfree_rcu (old , rcu_head );
11141147 RCU_INIT_POINTER (sdata -> u .ap .beacon , NULL );
1115- ieee80211_vif_release_channel (sdata );
1116- return err ;
1148+ goto error ;
11171149 }
11181150
11191151 ieee80211_recalc_dtim (local , sdata );
@@ -1124,6 +1156,10 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
11241156 netif_carrier_on (vlan -> dev );
11251157
11261158 return 0 ;
1159+
1160+ error :
1161+ ieee80211_vif_release_channel (sdata );
1162+ return err ;
11271163}
11281164
11291165static int ieee80211_change_beacon (struct wiphy * wiphy , struct net_device * dev ,
@@ -1160,6 +1196,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
11601196 struct ieee80211_local * local = sdata -> local ;
11611197 struct beacon_data * old_beacon ;
11621198 struct probe_resp * old_probe_resp ;
1199+ struct fils_discovery_data * old_fils_discovery ;
11631200 struct cfg80211_chan_def chandef ;
11641201
11651202 sdata_assert_lock (sdata );
@@ -1168,6 +1205,8 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
11681205 if (!old_beacon )
11691206 return - ENOENT ;
11701207 old_probe_resp = sdata_dereference (sdata -> u .ap .probe_resp , sdata );
1208+ old_fils_discovery = sdata_dereference (sdata -> u .ap .fils_discovery ,
1209+ sdata );
11711210
11721211 /* abort any running channel switch */
11731212 mutex_lock (& local -> mtx );
@@ -1191,9 +1230,12 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
11911230 /* remove beacon and probe response */
11921231 RCU_INIT_POINTER (sdata -> u .ap .beacon , NULL );
11931232 RCU_INIT_POINTER (sdata -> u .ap .probe_resp , NULL );
1233+ RCU_INIT_POINTER (sdata -> u .ap .fils_discovery , NULL );
11941234 kfree_rcu (old_beacon , rcu_head );
11951235 if (old_probe_resp )
11961236 kfree_rcu (old_probe_resp , rcu_head );
1237+ if (old_fils_discovery )
1238+ kfree_rcu (old_fils_discovery , rcu_head );
11971239
11981240 kfree (sdata -> vif .bss_conf .ftmr_params );
11991241 sdata -> vif .bss_conf .ftmr_params = NULL ;
0 commit comments