@@ -85,15 +85,17 @@ function iface_auth_type(config) {
8585 if (config .auth_type in [ 'sae' , 'owe' , 'eap2' , 'eap192' ]) {
8686 config .ieee80211w = 2 ;
8787 config .sae_require_mfp = 1 ;
88- config .sae_pwe = 2 ;
88+ if (!config .ppsk )
89+ config .sae_pwe = 2 ;
8990 }
9091
9192 if (config .auth_type in [ 'psk-sae' , 'eap-eap2' ]) {
9293 config .ieee80211w = 1 ;
9394 if (config .rsn_override )
9495 config .rsn_override_mfp = 2 ;
9596 config .sae_require_mfp = 1 ;
96- config .sae_pwe = 2 ;
97+ if (!config .ppsk )
98+ config .sae_pwe = 2 ;
9799 }
98100
99101 if (config .own_ip_addr )
@@ -121,20 +123,23 @@ function iface_auth_type(config) {
121123 config .vlan_possible = 1 ;
122124 config .wps_possible = 1 ;
123125
124- if (config .auth_type == 'psk' && config . ppsk ) {
126+ if (config .ppsk ) {
125127 iface_authentication_server (config );
126128 config .macaddr_acl = 2 ;
127129 config .wpa_psk_radius = 2 ;
128130 } else if (length (config .key ) == 64 ) {
129131 config .wpa_psk = key ;
130- } else if (length (config .key ) >= 8 ) {
132+ } else if (length (config .key ) >= 8 && length ( config . key ) <= 63 ) {
131133 config .wpa_passphrase = config .key ;
132- } else if (! config .wpa_psk_file ) {
134+ } else if (config .key ) {
133135 netifd .setup_failed ('INVALID_WPA_PSK' );
134136 }
135137
136138 set_default (config , 'wpa_psk_file' , `/var /run /hostapd -$ {config .ifname }.psk `);
137139 touch_file (config .wpa_psk_file );
140+
141+ set_default (config , 'sae_password_file' , `/var /run /hostapd -$ {config .ifname }.sae `);
142+ touch_file (config .sae_password_file );
138143 break ;
139144
140145 case 'eap' :
@@ -170,7 +175,7 @@ function iface_auth_type(config) {
170175 }
171176
172177 append_vars (config , [
173- 'sae_require_mfp' , 'sae_pwe' , 'sae_track_password' , 'time_advertisement' , 'time_zone' ,
178+ 'sae_require_mfp' , 'sae_password_file' , ' sae_pwe' , 'sae_track_password' , 'time_advertisement' , 'time_zone' ,
174179 'wpa_group_rekey' , 'wpa_ptk_rekey' , 'wpa_gmk_rekey' , 'wpa_strict_rekey' ,
175180 'macaddr_acl' , 'wpa_psk_radius' , 'wpa_psk' , 'wpa_passphrase' , 'wpa_psk_file' ,
176181 'eapol_version' , 'dynamic_vlan' , 'radius_request_cui' , 'eap_reauth_period' ,
@@ -297,7 +302,7 @@ function iface_vlan(interface, config, vlans) {
297302 ]);
298303}
299304
300- function iface_stations (config , stas ) {
305+ function iface_wpa_stations (config , stas ) {
301306 if (!length (stas ))
302307 return ;
303308
@@ -316,6 +321,30 @@ function iface_stations(config, stas) {
316321 set_default (config , 'wpa_psk_file' , path );
317322}
318323
324+ function iface_sae_stations (config , stas ) {
325+ if (!length (stas ))
326+ return ;
327+
328+ let path = `/var /run /hostapd -$ {config .ifname }.sae `;
329+
330+ let file = fs .open (path , 'w' );
331+ for (let k , sta in stas )
332+ if (sta .config .mac && sta .config .key ) {
333+ let mac = sta .config .mac ;
334+ if (mac == '00:00:00:00:00:00' )
335+ mac = 'ff:ff:ff:ff:ff:ff' ;
336+
337+ let station = `$ {sta .config .key }|mac =$ {mac }`;
338+ if (sta .config .vid )
339+ station = station + `|vlanid =$ {sta .config .vid }`;
340+ station = station + '\n' ;
341+ file .write (station );
342+ }
343+ file .close ();
344+
345+ set_default (config , 'sae_password_file' , path );
346+ }
347+
319348function iface_eap_server (config ) {
320349 if (!config .eap_server )
321350 return ;
@@ -435,7 +464,8 @@ function iface_interworking(config) {
435464export function generate (interface , data , config , vlans , stas , phy_features ) {
436465 config .ctrl_interface = '/var/run/hostapd' ;
437466
438- iface_stations (config , stas );
467+ iface_wpa_stations (config , stas );
468+ iface_sae_stations (config , stas );
439469
440470 config .start_disabled = data .ap_start_disabled ;
441471 iface_setup (config );
0 commit comments