@@ -45,7 +45,7 @@ static int wifi_gen_station_config(const char *ifname, const char *ssid, const c
4545 "autoscan=periodic:10\n"
4646 "ap_scan=1\n" );
4747 } else {
48- if (!encryption ) {
48+ if (!strcmp ( encryption , "disabled" ) ) {
4949 asprintf (& encryption_str , "key_mgmt=NONE" );
5050 } else {
5151 asprintf (& encryption_str , "key_mgmt=SAE WPA-PSK\npsk=\"%s\"" , secret );
@@ -177,7 +177,7 @@ int wifi_station_gen(struct lyd_node *cif, struct dagger *net)
177177 ssid_name = lydx_get_cattr (wifi , "ssid" );
178178 secret_name = lydx_get_cattr (wifi , "secret" );
179179 encryption = lydx_get_cattr (wifi , "encryption" );
180- if (encryption && secret_name ) {
180+ if (secret_name ) {
181181 secret_node = lydx_get_xpathf (cif , "../../keystore/symmetric-keys/symmetric-key[name='%s']" , secret_name );
182182 secret = lydx_get_cattr (secret_node , "cleartext-key" );
183183 }
@@ -253,9 +253,6 @@ int wifi_ap_gen(struct lyd_node *cif, struct dagger *net)
253253 fprintf (hostapd_conf , "# Generated by Infix confd\n" );
254254
255255 country = lydx_get_cattr (wifi , "country-code" );
256- if (!country )
257- country = "00" ;
258-
259256 band = lydx_get_cattr (wifi , "band" );
260257 channel = lydx_get_cattr (wifi , "channel" );
261258 freq_24GHz = !strcmp (band , "2.4GHz" );
@@ -267,15 +264,19 @@ int wifi_ap_gen(struct lyd_node *cif, struct dagger *net)
267264 "interface=%s\n"
268265 "driver=nl80211\n"
269266 "hw_mode=%c\n"
270- "country_code=%s\n"
271267 "wmm_enabled=1\n" /* QoS */
272268 "channel=%s\n"
273269 "logger_syslog=-1\n"
274270 "logger_syslog_level=0\n"
275271 "logger_stdout=0\n"
276272 "ctrl_interface=/var/run/hostapd\n"
277273 "ctrl_interface_group=0\n\n" ,
278- ifname , freq_24GHz ? 'g' : 'a' , country , channel );
274+ ifname , freq_24GHz ? 'g' : 'a' , channel );
275+
276+
277+ ERROR ("Country: %s" , country );
278+ if (strcmp (country , "00" ))
279+ fprintf (hostapd_conf , "country_code=%s\n" , country );
279280
280281 if (freq_24GHz )
281282 fprintf (hostapd_conf , "ieee80211n=1\n" );
@@ -350,7 +351,7 @@ int wifi_ap_gen(struct lyd_node *cif, struct dagger *net)
350351 fprintf (hostapd_conf , "bss=%s\n" , ap_ifname );
351352 fprintf (hostapd_conf , "# SSID: %s\n" , ssid );
352353 fprintf (hostapd_conf , "ssid=%s\n" , ssid );
353- if (encryption ) {
354+ if (! strcmp ( encryption , "mixed-wpa2-wpa3" ) ) {
354355 fprintf (hostapd_conf , "wpa_key_mgmt=WPA-PSK SAE\n" );
355356 fprintf (hostapd_conf , "wpa_passphrase=%s\n" , secret );
356357 fprintf (hostapd_conf , "sae_password=%s\n" , secret );
@@ -362,7 +363,7 @@ int wifi_ap_gen(struct lyd_node *cif, struct dagger *net)
362363 fputs ("ignore_broadcast_ssid=0\n" , hostapd_conf );
363364 }
364365 ly_set_free (ap_interfaces , NULL );
365-
366+ fclose ( hostapd_conf );
366367 hostapd_finit = dagger_fopen_net_init (net , ifname , NETDAG_INIT_POST , "hostapd.sh" );
367368 if (!hostapd_finit )
368369 return SR_ERR_INTERNAL ;
@@ -381,6 +382,7 @@ int wifi_ap_gen(struct lyd_node *cif, struct dagger *net)
381382
382383bool wifi_ap_must_delete (struct lyd_node * dif )
383384{
385+
384386 struct lyd_node * cwifi ;
385387 const char * radio_name ;
386388 struct lyd_node * radio_dif ;
0 commit comments