mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
fragattack: add GET_CHANNEL to both wpa_s and hostapd
This commit is contained in:
parent
be4d268a60
commit
f73b151698
@ -2476,6 +2476,25 @@ static int hostapd_get_gtk(struct hostapd_data *hapd, char *buf, size_t buflen)
|
|||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int hostapd_get_channel(struct hostapd_data *hapd, char *buf, size_t buflen)
|
||||||
|
{
|
||||||
|
struct wpa_channel_info ci;
|
||||||
|
u8 op_class, channel;
|
||||||
|
|
||||||
|
if (hostapd_drv_channel_info(hapd, &ci) != 0 ||
|
||||||
|
ieee80211_chaninfo_to_channel(ci.frequency, ci.chanwidth,
|
||||||
|
ci.sec_channel, &op_class,
|
||||||
|
&channel) < 0) {
|
||||||
|
wpa_printf(MSG_WARNING, "Failed to get channel info from drive, falling "
|
||||||
|
"back to channel provided in the current config.");
|
||||||
|
channel = hapd->iconf->channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
return os_snprintf(buf, buflen, "%d\n", channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* CONFIG_TESTING_OPTIONS */
|
#endif /* CONFIG_TESTING_OPTIONS */
|
||||||
|
|
||||||
|
|
||||||
@ -3354,6 +3373,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
|
|||||||
reply_len = hostapd_get_tk(hapd, buf + 7, reply, reply_size);
|
reply_len = hostapd_get_tk(hapd, buf + 7, reply, reply_size);
|
||||||
} else if (os_strcmp(buf, "GET_GTK") == 0) {
|
} else if (os_strcmp(buf, "GET_GTK") == 0) {
|
||||||
reply_len = hostapd_get_gtk(hapd, reply, reply_size);
|
reply_len = hostapd_get_gtk(hapd, reply, reply_size);
|
||||||
|
} else if (os_strcmp(buf, "GET_CHANNEL") == 0) {
|
||||||
|
reply_len = hostapd_get_channel(hapd, reply, reply_size);
|
||||||
#endif /* CONFIG_TESTING_OPTIONS */
|
#endif /* CONFIG_TESTING_OPTIONS */
|
||||||
} else if (os_strncmp(buf, "CHAN_SWITCH ", 12) == 0) {
|
} else if (os_strncmp(buf, "CHAN_SWITCH ", 12) == 0) {
|
||||||
if (hostapd_ctrl_iface_chan_switch(hapd->iface, buf + 12))
|
if (hostapd_ctrl_iface_chan_switch(hapd->iface, buf + 12))
|
||||||
|
@ -9445,6 +9445,27 @@ static int wpa_supplicant_ctrl_iface_get_gtk(struct wpa_supplicant *wpa_s,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int wpa_supplicant_ctrl_iface_get_channel(struct wpa_supplicant *wpa_s,
|
||||||
|
char *buf, size_t buflen)
|
||||||
|
{
|
||||||
|
struct wpa_channel_info ci;
|
||||||
|
u8 op_class, channel;
|
||||||
|
|
||||||
|
if (wpa_drv_channel_info(wpa_s, &ci) != 0 ||
|
||||||
|
ieee80211_chaninfo_to_channel(ci.frequency, ci.chanwidth,
|
||||||
|
ci.sec_channel, &op_class,
|
||||||
|
&channel) < 0) {
|
||||||
|
wpa_printf(MSG_WARNING, "Failed to get channel info from drive, falling "
|
||||||
|
"back to channel provided in the current config. assoc_freq=%d", wpa_s->assoc_freq);
|
||||||
|
if (ieee80211_chaninfo_to_channel(wpa_s->assoc_freq, CHAN_WIDTH_20, 0,
|
||||||
|
&op_class, &channel) < 0)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return os_snprintf(buf, buflen, "%d\n", channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int wpas_ctrl_get_assoc_resp_ies(struct wpa_supplicant *wpa_s,
|
static int wpas_ctrl_get_assoc_resp_ies(struct wpa_supplicant *wpa_s,
|
||||||
char *buf, size_t buflen)
|
char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
@ -10833,6 +10854,8 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
|
|||||||
WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA);
|
WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA);
|
||||||
} else if (os_strcmp(buf, "GET_GTK") == 0) {
|
} else if (os_strcmp(buf, "GET_GTK") == 0) {
|
||||||
reply_len = wpa_supplicant_ctrl_iface_get_gtk(wpa_s, reply, reply_size);
|
reply_len = wpa_supplicant_ctrl_iface_get_gtk(wpa_s, reply, reply_size);
|
||||||
|
} else if (os_strcmp(buf, "GET_CHANNEL") == 0) {
|
||||||
|
reply_len = wpa_supplicant_ctrl_iface_get_channel(wpa_s, reply, reply_size);
|
||||||
} else if (os_strcmp(buf, "GET_ASSOC_RESP_IES") == 0) {
|
} else if (os_strcmp(buf, "GET_ASSOC_RESP_IES") == 0) {
|
||||||
reply_len = wpas_ctrl_get_assoc_resp_ies(wpa_s, reply, reply_size);
|
reply_len = wpas_ctrl_get_assoc_resp_ies(wpa_s, reply, reply_size);
|
||||||
} else if (os_strncmp(buf, "SET_ASSOC_RESP_IES ", 19) == 0) {
|
} else if (os_strncmp(buf, "SET_ASSOC_RESP_IES ", 19) == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user