@@ -2575,6 +2575,39 @@ static int hostapd_ctrl_get_pmk(struct hostapd_data *hapd, const char *cmd,
}
+static int hostapd_ctrl_get_gtk(struct hostapd_data *hapd, char *buf,
+ size_t buflen)
+{
+ if (hapd->last_gtk_alg == WPA_ALG_NONE)
+ return -1;
+
+ return wpa_snprintf_hex(buf, buflen, hapd->last_gtk,
+ hapd->last_gtk_len);
+}
+
+
+static int hostapd_ctrl_get_igtk(struct hostapd_data *hapd, char *buf,
+ size_t buflen)
+{
+ if (hapd->last_igtk_alg == WPA_ALG_NONE)
+ return -1;
+
+ return wpa_snprintf_hex(buf, buflen, hapd->last_igtk,
+ hapd->last_igtk_len);
+}
+
+
+static int hostapd_ctrl_get_bigtk(struct hostapd_data *hapd, char *buf,
+ size_t buflen)
+{
+ if (hapd->last_bigtk_alg == WPA_ALG_NONE)
+ return -1;
+
+ return wpa_snprintf_hex(buf, buflen, hapd->last_bigtk,
+ hapd->last_bigtk_len);
+}
+
+
static int hostapd_ctrl_register_frame(struct hostapd_data *hapd,
const char *cmd)
{
@@ -4502,6 +4535,12 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
} else if (os_strncmp(buf, "GET_PMK ", 8) == 0) {
reply_len = hostapd_ctrl_get_pmk(hapd, buf + 8, reply,
reply_size);
+ } else if (os_strcmp(buf, "GET_GTK") == 0) {
+ reply_len = hostapd_ctrl_get_gtk(hapd, reply, reply_size);
+ } else if (os_strcmp(buf, "GET_IGTK") == 0) {
+ reply_len = hostapd_ctrl_get_igtk(hapd, reply, reply_size);
+ } else if (os_strcmp(buf, "GET_BIGTK") == 0) {
+ reply_len = hostapd_ctrl_get_bigtk(hapd, reply, reply_size);
} else if (os_strncmp(buf, "REGISTER_FRAME ", 15) == 0) {
if (hostapd_ctrl_register_frame(hapd, buf + 16) < 0)
reply_len = -1;