From 679f2d392dc24ca8de34ff9cb5cb6d2e613fab5c Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 19 Jan 2026 23:06:02 +0200 Subject: [PATCH] Update define name for Protected Frame field in Frame Control field The WEP field was renamed already in IEEE Std 802.11i-2004 to the Protected Frame field, so better rename the define for this field use the current name after 20 years.. Signed-off-by: Jouni Malinen --- src/ap/ieee802_11.c | 8 ++++---- src/common/ieee802_11_defs.h | 2 +- wlantest/ccmp.c | 6 +++--- wlantest/rx_data.c | 10 +++++----- wlantest/rx_mgmt.c | 14 +++++++------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 24ef8b75f8..a316730074 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -3320,10 +3320,10 @@ static void handle_auth(struct hostapd_data *hapd, challenge = &mgmt->u.auth.variable[2]; wpa_printf(MSG_DEBUG, "authentication: STA=" MACSTR " auth_alg=%d " - "auth_transaction=%d status_code=%d wep=%d%s " + "auth_transaction=%d status_code=%d protected=%d%s " "seq_ctrl=0x%x%s%s", MAC2STR(sa), auth_alg, auth_transaction, - status_code, !!(fc & WLAN_FC_ISWEP), + status_code, !!(fc & WLAN_FC_PROTECTED), challenge ? " challenge" : "", seq_ctrl, (fc & WLAN_FC_RETRY) ? " retry" : "", from_queue ? " (from queue)" : ""); @@ -3663,7 +3663,7 @@ static void handle_auth(struct hostapd_data *hapd, #ifndef CONFIG_NO_RC4 case WLAN_AUTH_SHARED_KEY: resp = auth_shared_key(hapd, sta, auth_transaction, challenge, - fc & WLAN_FC_ISWEP); + fc & WLAN_FC_PROTECTED); if (resp != 0) wpa_printf(MSG_DEBUG, "auth_shared_key() failed: status=%d", resp); @@ -6625,7 +6625,7 @@ static int handle_action(struct hostapd_data *hapd, } if (sta && (sta->flags & WLAN_STA_MFP) && - !(mgmt->frame_control & host_to_le16(WLAN_FC_ISWEP)) && + !(mgmt->frame_control & host_to_le16(WLAN_FC_PROTECTED)) && robust_action_frame(mgmt->u.action.category)) { hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_DEBUG, diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index 89f0a1bf8e..b5857c00a4 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -21,7 +21,7 @@ #define WLAN_FC_RETRY 0x0800 #define WLAN_FC_PWRMGT 0x1000 #define WLAN_FC_MOREDATA 0x2000 -#define WLAN_FC_ISWEP 0x4000 +#define WLAN_FC_PROTECTED 0x4000 #define WLAN_FC_HTC 0x8000 #define WLAN_FC_S1G_BEACON_NEXT_TBTT 0x0100 diff --git a/wlantest/ccmp.c b/wlantest/ccmp.c index d6594b9ca2..6acd75c823 100644 --- a/wlantest/ccmp.c +++ b/wlantest/ccmp.c @@ -46,7 +46,7 @@ static void ccmp_aad_nonce(const struct ieee80211_hdr *hdr, const u8 *data, nonce[0] |= 0x10; /* Management */ fc &= ~(WLAN_FC_RETRY | WLAN_FC_PWRMGT | WLAN_FC_MOREDATA); - fc |= WLAN_FC_ISWEP; + fc |= WLAN_FC_PROTECTED; WPA_PUT_LE16(aad, fc); pos = aad + 2; os_memcpy(pos, hdr->addr1, 3 * ETH_ALEN); @@ -223,7 +223,7 @@ u8 * ccmp_encrypt(const u8 *tk, u8 *frame, size_t len, size_t hdrlen, os_memcpy(crypt, frame, hdrlen); hdr = (struct ieee80211_hdr *) crypt; - hdr->frame_control |= host_to_le16(WLAN_FC_ISWEP); + hdr->frame_control |= host_to_le16(WLAN_FC_PROTECTED); pos = crypt + hdrlen; *pos++ = pn[5]; /* PN0 */ *pos++ = pn[4]; /* PN1 */ @@ -356,7 +356,7 @@ u8 * ccmp_256_encrypt(const u8 *tk, u8 *frame, size_t len, size_t hdrlen, os_memcpy(crypt, frame, hdrlen); hdr = (struct ieee80211_hdr *) crypt; - hdr->frame_control |= host_to_le16(WLAN_FC_ISWEP); + hdr->frame_control |= host_to_le16(WLAN_FC_PROTECTED); pos = crypt + hdrlen; *pos++ = pn[5]; /* PN0 */ *pos++ = pn[4]; /* PN1 */ diff --git a/wlantest/rx_data.c b/wlantest/rx_data.c index 4b0a2244e8..2c1652e41b 100644 --- a/wlantest/rx_data.c +++ b/wlantest/rx_data.c @@ -768,7 +768,7 @@ static void rx_data_bss(struct wlantest *wt, const struct ieee80211_hdr *hdr, const u8 *src, const u8 *data, size_t len) { u16 fc = le_to_host16(hdr->frame_control); - int prot = !!(fc & WLAN_FC_ISWEP); + int prot = !!(fc & WLAN_FC_PROTECTED); if (qos) { u8 ack = (qos[0] & 0x60) >> 5; @@ -937,7 +937,7 @@ void rx_data(struct wlantest *wt, const u8 *data, size_t len) MACSTR " BSSID=" MACSTR, data_stype(WLAN_FC_GET_STYPE(fc)), fc & WLAN_FC_PWRMGT ? " PwrMgt" : "", - fc & WLAN_FC_ISWEP ? " Prot" : "", + fc & WLAN_FC_PROTECTED ? " Prot" : "", MAC2STR(hdr->addr1), MAC2STR(hdr->addr2), MAC2STR(hdr->addr3)); add_direct_link(wt, hdr->addr3, hdr->addr1, hdr->addr2); @@ -949,7 +949,7 @@ void rx_data(struct wlantest *wt, const u8 *data, size_t len) " BSSID=" MACSTR " SA=" MACSTR, data_stype(WLAN_FC_GET_STYPE(fc)), fc & WLAN_FC_PWRMGT ? " PwrMgt" : "", - fc & WLAN_FC_ISWEP ? " Prot" : "", + fc & WLAN_FC_PROTECTED ? " Prot" : "", MAC2STR(hdr->addr1), MAC2STR(hdr->addr2), MAC2STR(hdr->addr3)); add_ap_path(wt, hdr->addr2, hdr->addr1, hdr->addr3); @@ -961,7 +961,7 @@ void rx_data(struct wlantest *wt, const u8 *data, size_t len) " SA=" MACSTR " DA=" MACSTR, data_stype(WLAN_FC_GET_STYPE(fc)), fc & WLAN_FC_PWRMGT ? " PwrMgt" : "", - fc & WLAN_FC_ISWEP ? " Prot" : "", + fc & WLAN_FC_PROTECTED ? " Prot" : "", MAC2STR(hdr->addr1), MAC2STR(hdr->addr2), MAC2STR(hdr->addr3)); add_ap_path(wt, hdr->addr1, hdr->addr3, hdr->addr2); @@ -973,7 +973,7 @@ void rx_data(struct wlantest *wt, const u8 *data, size_t len) MACSTR " DA=" MACSTR " SA=" MACSTR, data_stype(WLAN_FC_GET_STYPE(fc)), fc & WLAN_FC_PWRMGT ? " PwrMgt" : "", - fc & WLAN_FC_ISWEP ? " Prot" : "", + fc & WLAN_FC_PROTECTED ? " Prot" : "", MAC2STR(hdr->addr1), MAC2STR(hdr->addr2), MAC2STR(hdr->addr3), MAC2STR((const u8 *) (hdr + 1))); diff --git a/wlantest/rx_mgmt.c b/wlantest/rx_mgmt.c index be4d53c6da..c79b06c183 100644 --- a/wlantest/rx_mgmt.c +++ b/wlantest/rx_mgmt.c @@ -1283,9 +1283,9 @@ static void rx_mgmt_deauth(struct wlantest *wt, const u8 *data, size_t len, sta->counters[WLANTEST_STA_COUNTER_DEAUTH_RX_AWAKE]++; fc = le_to_host16(mgmt->frame_control); - if (!(fc & WLAN_FC_ISWEP) && reason == 6) + if (!(fc & WLAN_FC_PROTECTED) && reason == 6) sta->counters[WLANTEST_STA_COUNTER_DEAUTH_RX_RC6]++; - else if (!(fc & WLAN_FC_ISWEP) && reason == 7) + else if (!(fc & WLAN_FC_PROTECTED) && reason == 7) sta->counters[WLANTEST_STA_COUNTER_DEAUTH_RX_RC7]++; } else sta->counters[valid ? WLANTEST_STA_COUNTER_VALID_DEAUTH_TX : @@ -2856,9 +2856,9 @@ static void rx_mgmt_disassoc(struct wlantest *wt, const u8 *data, size_t len, WLANTEST_STA_COUNTER_DISASSOC_RX_AWAKE]++; fc = le_to_host16(mgmt->frame_control); - if (!(fc & WLAN_FC_ISWEP) && reason == 6) + if (!(fc & WLAN_FC_PROTECTED) && reason == 6) sta->counters[WLANTEST_STA_COUNTER_DISASSOC_RX_RC6]++; - else if (!(fc & WLAN_FC_ISWEP) && reason == 7) + else if (!(fc & WLAN_FC_PROTECTED) && reason == 7) sta->counters[WLANTEST_STA_COUNTER_DISASSOC_RX_RC7]++; } else sta->counters[valid ? WLANTEST_STA_COUNTER_VALID_DISASSOC_TX : @@ -3953,11 +3953,11 @@ void rx_mgmt(struct wlantest *wt, const u8 *data, size_t len) " #%u", mgmt_stype(stype), fc & WLAN_FC_PWRMGT ? " PwrMgt" : "", - fc & WLAN_FC_ISWEP ? " Prot" : "", + fc & WLAN_FC_PROTECTED ? " Prot" : "", MAC2STR(hdr->addr1), MAC2STR(hdr->addr2), MAC2STR(hdr->addr3), wt->frame_num); - if ((fc & WLAN_FC_ISWEP) && + if ((fc & WLAN_FC_PROTECTED) && !(hdr->addr1[0] & 0x01) && (stype == WLAN_FC_STYPE_DEAUTH || stype == WLAN_FC_STYPE_DISASSOC || @@ -3972,7 +3972,7 @@ void rx_mgmt(struct wlantest *wt, const u8 *data, size_t len) valid = 0; } - if (!(fc & WLAN_FC_ISWEP) && + if (!(fc & WLAN_FC_PROTECTED) && !(hdr->addr1[0] & 0x01) && (stype == WLAN_FC_STYPE_DEAUTH || stype == WLAN_FC_STYPE_DISASSOC || -- 2.47.3