]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Allow config parameters to be set through ctrl_iface
authorShan Palanisamy <shanp@qca.qualcomm.com>
Thu, 16 Feb 2012 17:36:48 +0000 (19:36 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 16 Feb 2012 17:36:48 +0000 (19:36 +0200)
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

hostapd/config_file.c
hostapd/config_file.h
hostapd/ctrl_iface.c

index 6949d5237ad057cdf997f72c64bc28ecda479784..77a34fb608b2a33cbda07ce48d1538f211bb050a 100644 (file)
@@ -2276,3 +2276,28 @@ struct hostapd_config * hostapd_config_read(const char *fname)
 
        return conf;
 }
+
+
+int hostapd_set_iface(struct hostapd_config *conf,
+                     struct hostapd_bss_config *bss, char *field, char *value)
+{
+       int errors = 0;
+       size_t i;
+
+       errors = hostapd_config_fill(conf, bss, field, value, 0);
+       if (errors) {
+               wpa_printf(MSG_INFO, "Failed to set configuration field '%s' "
+                          "to value '%s'", field, value);
+               return -1;
+       }
+
+       for (i = 0; i < conf->num_bss; i++)
+               hostapd_set_security_params(&conf->bss[i]);
+
+       if (hostapd_config_check(conf)) {
+               wpa_printf(MSG_ERROR, "Configuration check failed");
+               errors++;
+       }
+
+       return 0;
+}
index 80d182e687ffb60732dbfcef4550a059c8a87641..fba57b87ad7c605652c6f0a9d01c76c9b2e7cf61 100644 (file)
@@ -10,5 +10,8 @@
 #define CONFIG_FILE_H
 
 struct hostapd_config * hostapd_config_read(const char *fname);
+int hostapd_set_iface(struct hostapd_config *conf,
+                     struct hostapd_bss_config *bss, char *field,
+                     char *value);
 
 #endif /* CONFIG_FILE_H */
index 9d5a67e39abc711f96a3d29050ab4c1a062b16f5..0cbb48393430f4379a51a3f1d613c04adb2df599 100644 (file)
@@ -31,6 +31,7 @@
 #include "ap/ap_drv_ops.h"
 #include "wps/wps_defs.h"
 #include "wps/wps.h"
+#include "config_file.h"
 #include "ctrl_iface.h"
 
 
@@ -774,7 +775,7 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd)
                           wps_testing_dummy_cred);
 #endif /* CONFIG_WPS_TESTING */
        } else {
-               ret = -1;
+               ret = hostapd_set_iface(hapd->iconf, hapd->conf, cmd, value);
        }
 
        return ret;