]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd configuration file update using control interface
authorSai Pratyusha Magam <quic_smagam@quicinc.com>
Wed, 8 Nov 2023 04:10:21 +0000 (09:40 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 14 Dec 2023 10:58:23 +0000 (12:58 +0200)
Add support for reload_config hostapd_cli command as an alternative
mechanism for SIGHUP on the hostapd process.

When AP parameters such as ssid/encryption/password etc. are changed
externally in hostapd.conf, RELOAD_CONFIG cli will re-read the .conf,
update the in-memory contents and issue a change_beacon to update
beacon_ies.

For full config update, the following example sequence of commands can
be used:

hostapd_cli -i ath0 -p /var/run/hostapd-wifi0 disable
hostapd_cli -i ath0 -p /var/run/hostapd-wifi0 reload_config
hostapd_cli -i ath0 -p /var/run/hostapd-wifi0 enable

Signed-off-by: Sai Pratyusha Magam <quic_smagam@quicinc.com>
hostapd/ctrl_iface.c
hostapd/hostapd_cli.c

index 9d42b60ae67f9b3903fd840983c08cf95ee558a4..8b01eda6df9a214be94b2908e097eba5b96d118c 100644 (file)
@@ -3596,6 +3596,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
        } else if (os_strcmp(buf, "RELOAD_BSS") == 0) {
                if (hostapd_ctrl_iface_reload_bss(hapd))
                        reply_len = -1;
+       } else if (os_strcmp(buf, "RELOAD_CONFIG") == 0) {
+               if (hostapd_reload_config(hapd->iface))
+                       reply_len = -1;
        } else if (os_strncmp(buf, "RELOAD", 6) == 0) {
                if (hostapd_ctrl_iface_reload(hapd->iface))
                        reply_len = -1;
index 45497cd018d85093b0d1165d4d2f7575471acc26..be3c23ca9569c01fb58797860e4895fa8be623b4 100644 (file)
@@ -1235,6 +1235,13 @@ static int hostapd_cli_cmd_reload_bss(struct wpa_ctrl *ctrl, int argc,
 }
 
 
+static int hostapd_cli_cmd_reload_config(struct wpa_ctrl *ctrl, int argc,
+                                        char *argv[])
+{
+       return wpa_ctrl_command(ctrl, "RELOAD_CONFIG");
+}
+
+
 static int hostapd_cli_cmd_disable(struct wpa_ctrl *ctrl, int argc,
                                      char *argv[])
 {
@@ -1710,6 +1717,8 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
          "= reload configuration for current interface" },
        { "reload_bss", hostapd_cli_cmd_reload_bss, NULL,
          "= reload configuration for current BSS" },
+       { "reload_config", hostapd_cli_cmd_reload_config, NULL,
+         "= reload configuration for current interface" },
        { "disable", hostapd_cli_cmd_disable, NULL,
          "= disable hostapd on current interface" },
        { "update_beacon", hostapd_cli_cmd_update_beacon, NULL,