FT: Add control interface command to show configured RxKHs
The new GET_RXKHS control interface command can be used to list the currently configured RxKHs. Signed-off-by: Dariusz Kopka <dariusz@plume.com>
This commit is contained in:
parent
392114a179
commit
542ccf00b5
2 changed files with 67 additions and 0 deletions
|
@ -1471,6 +1471,58 @@ static int hostapd_ctrl_iface_reload_wpa_psk(struct hostapd_data *hapd)
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_IEEE80211R_AP
|
#ifdef CONFIG_IEEE80211R_AP
|
||||||
|
|
||||||
|
static int hostapd_ctrl_iface_get_rxkhs(struct hostapd_data *hapd,
|
||||||
|
char *buf, size_t buflen)
|
||||||
|
{
|
||||||
|
int ret, start_pos;
|
||||||
|
char *pos, *end;
|
||||||
|
struct ft_remote_r0kh *r0kh;
|
||||||
|
struct ft_remote_r1kh *r1kh;
|
||||||
|
struct hostapd_bss_config *conf = hapd->conf;
|
||||||
|
|
||||||
|
pos = buf;
|
||||||
|
end = buf + buflen;
|
||||||
|
|
||||||
|
for (r0kh = conf->r0kh_list; r0kh; r0kh=r0kh->next) {
|
||||||
|
start_pos = pos - buf;
|
||||||
|
ret = os_snprintf(pos, end - pos, "r0kh=" MACSTR " ",
|
||||||
|
MAC2STR(r0kh->addr));
|
||||||
|
if (os_snprintf_error(end - pos, ret))
|
||||||
|
return start_pos;
|
||||||
|
pos += ret;
|
||||||
|
if (r0kh->id_len + 1 >= (size_t) (end - pos))
|
||||||
|
return start_pos;
|
||||||
|
os_memcpy(pos, r0kh->id, r0kh->id_len);
|
||||||
|
pos += r0kh->id_len;
|
||||||
|
*pos++ = ' ';
|
||||||
|
pos += wpa_snprintf_hex(pos, end - pos, r0kh->key,
|
||||||
|
sizeof(r0kh->key));
|
||||||
|
ret = os_snprintf(pos, end - pos, "\n");
|
||||||
|
if (os_snprintf_error(end - pos, ret))
|
||||||
|
return start_pos;
|
||||||
|
pos += ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (r1kh = conf->r1kh_list; r1kh; r1kh=r1kh->next) {
|
||||||
|
start_pos = pos - buf;
|
||||||
|
ret = os_snprintf(pos, end - pos, "r1kh=" MACSTR " " MACSTR " ",
|
||||||
|
MAC2STR(r1kh->addr), MAC2STR(r1kh->id));
|
||||||
|
if (os_snprintf_error(end - pos, ret))
|
||||||
|
return start_pos;
|
||||||
|
pos += ret;
|
||||||
|
pos += wpa_snprintf_hex(pos, end - pos, r1kh->key,
|
||||||
|
sizeof(r1kh->key));
|
||||||
|
ret = os_snprintf(pos, end - pos, "\n");
|
||||||
|
if (os_snprintf_error(end - pos, ret))
|
||||||
|
return start_pos;
|
||||||
|
pos += ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pos - buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int hostapd_ctrl_iface_reload_rxkhs(struct hostapd_data *hapd)
|
static int hostapd_ctrl_iface_reload_rxkhs(struct hostapd_data *hapd)
|
||||||
{
|
{
|
||||||
struct hostapd_bss_config *conf = hapd->conf;
|
struct hostapd_bss_config *conf = hapd->conf;
|
||||||
|
@ -1487,6 +1539,7 @@ static int hostapd_ctrl_iface_reload_rxkhs(struct hostapd_data *hapd)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_IEEE80211R_AP */
|
#endif /* CONFIG_IEEE80211R_AP */
|
||||||
|
|
||||||
|
|
||||||
|
@ -3620,6 +3673,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
|
||||||
if (hostapd_ctrl_iface_reload_wpa_psk(hapd))
|
if (hostapd_ctrl_iface_reload_wpa_psk(hapd))
|
||||||
reply_len = -1;
|
reply_len = -1;
|
||||||
#ifdef CONFIG_IEEE80211R_AP
|
#ifdef CONFIG_IEEE80211R_AP
|
||||||
|
} else if (os_strcmp(buf, "GET_RXKHS") == 0) {
|
||||||
|
reply_len = hostapd_ctrl_iface_get_rxkhs(hapd, reply,
|
||||||
|
reply_size);
|
||||||
} else if (os_strcmp(buf, "RELOAD_RXKHS") == 0) {
|
} else if (os_strcmp(buf, "RELOAD_RXKHS") == 0) {
|
||||||
if (hostapd_ctrl_iface_reload_rxkhs(hapd))
|
if (hostapd_ctrl_iface_reload_rxkhs(hapd))
|
||||||
reply_len = -1;
|
reply_len = -1;
|
||||||
|
|
|
@ -1592,11 +1592,20 @@ static int hostapd_cli_cmd_reload_wpa_psk(struct wpa_ctrl *ctrl, int argc,
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_IEEE80211R_AP
|
#ifdef CONFIG_IEEE80211R_AP
|
||||||
|
|
||||||
|
static int hostapd_cli_cmd_get_rxkhs(struct wpa_ctrl *ctrl, int argc,
|
||||||
|
char *argv[])
|
||||||
|
{
|
||||||
|
return wpa_ctrl_command(ctrl, "GET_RXKHS");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int hostapd_cli_cmd_reload_rxkhs(struct wpa_ctrl *ctrl, int argc,
|
static int hostapd_cli_cmd_reload_rxkhs(struct wpa_ctrl *ctrl, int argc,
|
||||||
char *argv[])
|
char *argv[])
|
||||||
{
|
{
|
||||||
return wpa_ctrl_command(ctrl, "RELOAD_RXKHS");
|
return wpa_ctrl_command(ctrl, "RELOAD_RXKHS");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_IEEE80211R_AP */
|
#endif /* CONFIG_IEEE80211R_AP */
|
||||||
|
|
||||||
|
|
||||||
|
@ -1816,6 +1825,8 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
|
||||||
#ifdef CONFIG_IEEE80211R_AP
|
#ifdef CONFIG_IEEE80211R_AP
|
||||||
{ "reload_rxkhs", hostapd_cli_cmd_reload_rxkhs, NULL,
|
{ "reload_rxkhs", hostapd_cli_cmd_reload_rxkhs, NULL,
|
||||||
"= reload R0KHs and R1KHs" },
|
"= reload R0KHs and R1KHs" },
|
||||||
|
{ "get_rxkhs", hostapd_cli_cmd_get_rxkhs, NULL,
|
||||||
|
"= get R0KHs and R1KHs" },
|
||||||
#endif /* CONFIG_IEEE80211R_AP */
|
#endif /* CONFIG_IEEE80211R_AP */
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
{ "driver", hostapd_cli_cmd_driver, NULL,
|
{ "driver", hostapd_cli_cmd_driver, NULL,
|
||||||
|
|
Loading…
Reference in a new issue