hostapd: Add multi_ap settings to get_config() output
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@mind.be>
This commit is contained in:
parent
3a3ea68a36
commit
871d6648f5
1 changed files with 46 additions and 0 deletions
|
@ -1223,6 +1223,52 @@ static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd,
|
||||||
return pos - buf;
|
return pos - buf;
|
||||||
pos += ret;
|
pos += ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hapd->conf->multi_ap) {
|
||||||
|
struct hostapd_ssid *ssid = &hapd->conf->multi_ap_backhaul_ssid;
|
||||||
|
|
||||||
|
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 (ssid->ssid) {
|
||||||
|
ret = os_snprintf(pos, end - pos,
|
||||||
|
"multi_ap_backhaul_ssid=%s\n",
|
||||||
|
wpa_ssid_txt(ssid->ssid,
|
||||||
|
ssid->ssid_len));
|
||||||
|
if (os_snprintf_error(end - pos, ret))
|
||||||
|
return pos - buf;
|
||||||
|
pos += ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hapd->conf->wps_state && hapd->conf->wpa &&
|
||||||
|
ssid->wpa_passphrase) {
|
||||||
|
ret = os_snprintf(pos, end - pos,
|
||||||
|
"multi_ap_backhaul_wpa_passphrase=%s\n",
|
||||||
|
ssid->wpa_passphrase);
|
||||||
|
if (os_snprintf_error(end - pos, ret))
|
||||||
|
return pos - buf;
|
||||||
|
pos += ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hapd->conf->wps_state && hapd->conf->wpa &&
|
||||||
|
ssid->wpa_psk &&
|
||||||
|
ssid->wpa_psk->group) {
|
||||||
|
char hex[PMK_LEN * 2 + 1];
|
||||||
|
|
||||||
|
wpa_snprintf_hex(hex, sizeof(hex), ssid->wpa_psk->psk,
|
||||||
|
PMK_LEN);
|
||||||
|
ret = os_snprintf(pos, end - pos,
|
||||||
|
"multi_ap_backhaul_wpa_psk=%s\n",
|
||||||
|
hex);
|
||||||
|
forced_memzero(hex, sizeof(hex));
|
||||||
|
if (os_snprintf_error(end - pos, ret))
|
||||||
|
return pos - buf;
|
||||||
|
pos += ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif /* CONFIG_WPS */
|
#endif /* CONFIG_WPS */
|
||||||
|
|
||||||
if (hapd->conf->wpa) {
|
if (hapd->conf->wpa) {
|
||||||
|
|
Loading…
Reference in a new issue