[PATCH] hostapd: Add multi_ap settings to get_config() output
Raphaël Mélotte
raphael.melotte at mind.be
Wed Dec 2 11:51:45 EST 2020
Since a running hostapd is not necessarily using the settings that are
in the configuration file (if they were changed at runtime, or the
file was changed but not reloaded, etc.), being able to get their
value at runtime can be useful (to know if they have to be updated for
example).
If multi_ap is set, also print the ssid and passphrase (or psk).
Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>
---
hostapd/ctrl_iface.c | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index e2ae0ad44..19c5cc2fe 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -1222,6 +1222,45 @@ static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd,
return pos - buf;
pos += ret;
}
+
+ if (hapd->conf->multi_ap) {
+ ret = os_snprintf(pos, end - pos, "multi_ap=%d\n",
+ hapd->conf->multi_ap);
+ if (os_snprintf_error(end - pos, ret))
+ return pos - buf;
+ pos += ret;
+
+ if (hapd->conf->multi_ap_backhaul_ssid.ssid) {
+ ret = os_snprintf(pos, end - pos, "multi_ap_backhaul_ssid=%s\n",
+ hapd->conf->multi_ap_backhaul_ssid.ssid);
+ if (os_snprintf_error(end - pos, ret))
+ return pos - buf;
+ pos += ret;
+ }
+
+ if (hapd->conf->wps_state && hapd->conf->wpa &&
+ hapd->conf->multi_ap_backhaul_ssid.wpa_passphrase) {
+ ret = os_snprintf(pos, end - pos,
+ "multi_ap_backhaul_wpa_passphrase=%s\n",
+ hapd->conf->multi_ap_backhaul_ssid.wpa_passphrase);
+ if (os_snprintf_error(end - pos, ret))
+ return pos - buf;
+ pos += ret;
+ }
+
+ if (hapd->conf->wps_state && hapd->conf->wpa &&
+ hapd->conf->multi_ap_backhaul_ssid.wpa_psk &&
+ hapd->conf->multi_ap_backhaul_ssid.wpa_psk->group) {
+ char hex[PMK_LEN * 2 + 1];
+ wpa_snprintf_hex(hex, sizeof(hex),
+ hapd->conf->multi_ap_backhaul_ssid.wpa_psk->psk, PMK_LEN);
+ ret = os_snprintf(pos, end - pos, "multi_ap_backhaul_wpa_psk=%s\n", hex);
+ if (os_snprintf_error(end - pos, ret))
+ return pos - buf;
+ pos += ret;
+ }
+ }
+
#endif /* CONFIG_WPS */
if (hapd->conf->wpa) {
--
2.28.0
More information about the Hostap
mailing list