Add external EAPOL transmission option for testing purposes
The new ext_eapol_frame_io parameter can be used to configure hostapd and wpa_supplicant to use control interface for receiving and transmitting EAPOL frames. This makes it easier to implement automated test cases for protocol testing. This functionality is included only in CONFIG_TESTING_OPTIONS=y builds. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
61fc90483f
commit
9d4ff04af3
8 changed files with 160 additions and 1 deletions
|
@ -247,7 +247,8 @@ struct hostapd_data {
|
|||
#endif /* CONFIG_SAE */
|
||||
|
||||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
int ext_mgmt_frame_handling;
|
||||
unsigned int ext_mgmt_frame_handling:1;
|
||||
unsigned int ext_eapol_frame_io:1;
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
};
|
||||
|
||||
|
|
|
@ -66,6 +66,20 @@ static void ieee802_1x_send(struct hostapd_data *hapd, struct sta_info *sta,
|
|||
|
||||
if (wpa_auth_pairwise_set(sta->wpa_sm))
|
||||
encrypt = 1;
|
||||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
if (hapd->ext_eapol_frame_io) {
|
||||
size_t hex_len = 2 * len + 1;
|
||||
char *hex = os_malloc(hex_len);
|
||||
|
||||
if (hex) {
|
||||
wpa_snprintf_hex(hex, hex_len, buf, len);
|
||||
wpa_msg(hapd->msg_ctx, MSG_INFO,
|
||||
"EAPOL-TX " MACSTR " %s",
|
||||
MAC2STR(sta->addr), hex);
|
||||
os_free(hex);
|
||||
}
|
||||
} else
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
if (sta->flags & WLAN_STA_PREAUTH) {
|
||||
rsn_preauth_send(hapd, sta, buf, len);
|
||||
} else {
|
||||
|
|
|
@ -299,6 +299,21 @@ static int hostapd_wpa_auth_send_eapol(void *ctx, const u8 *addr,
|
|||
struct sta_info *sta;
|
||||
u32 flags = 0;
|
||||
|
||||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
if (hapd->ext_eapol_frame_io) {
|
||||
size_t hex_len = 2 * data_len + 1;
|
||||
char *hex = os_malloc(hex_len);
|
||||
|
||||
if (hex == NULL)
|
||||
return -1;
|
||||
wpa_snprintf_hex(hex, hex_len, data, data_len);
|
||||
wpa_msg(hapd->msg_ctx, MSG_INFO, "EAPOL-TX " MACSTR " %s",
|
||||
MAC2STR(addr), hex);
|
||||
os_free(hex);
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
|
||||
sta = ap_get_sta(hapd, addr);
|
||||
if (sta)
|
||||
flags = hostapd_sta_flags_to_drv(sta->flags);
|
||||
|
@ -404,6 +419,21 @@ static int hostapd_wpa_auth_send_ether(void *ctx, const u8 *dst, u16 proto,
|
|||
struct l2_ethhdr *buf;
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
if (hapd->ext_eapol_frame_io && proto == ETH_P_EAPOL) {
|
||||
size_t hex_len = 2 * data_len + 1;
|
||||
char *hex = os_malloc(hex_len);
|
||||
|
||||
if (hex == NULL)
|
||||
return -1;
|
||||
wpa_snprintf_hex(hex, hex_len, data, data_len);
|
||||
wpa_msg(hapd->msg_ctx, MSG_INFO, "EAPOL-TX " MACSTR " %s",
|
||||
MAC2STR(dst), hex);
|
||||
os_free(hex);
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
|
||||
#ifdef CONFIG_IEEE80211R
|
||||
if (proto == ETH_P_RRB && hapd->iface->interfaces &&
|
||||
hapd->iface->interfaces->for_each_interface) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue