[PATCH] hostapd: Add multi_ap settings to get_config() output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 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


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux