From nobody Sun Aug 14 16:49:06 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M5NfV4MFsz4Zhxq; Sun, 14 Aug 2022 16:49:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M5NfV3HyPz3t9s; Sun, 14 Aug 2022 16:49:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660495746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SeBh77bkLrvnMl9sDVN/WPM9MDSJJqjPW0nk9Dey3R0=; b=ItqjSHIqU60C5uIuNaKPMC23eolZTd+6kU+gpWsxT7d23GiQimZb1BZxZyqNbt8IupHD4/ PhCilplgId6OwXXXNo8hxSnmyN/eI2fUOv4naBiaiD6abhXX/YYSX0oS6z7DTZNhS2P44f OGY32Q/LyrO8wcZFboS09kZixHPntv4KPSNeRXO312hsp/YfeudAA4fcEOK8PdBluiPZ4Q A3XjviP1rq60aTHxPlglPXhk46bXLLj2aAbGpxzyV9sc7OcWJuRvRfHuPecM2P7tGX8DH4 5H90/WdXY+HZDVXCXqVi2JdiNVM9ie4ndyOLbjkkhtD5szM5+LRk2cojRI3sIA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4M5NfV2GPxzxqC; Sun, 14 Aug 2022 16:49:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27EGn6eG018705; Sun, 14 Aug 2022 16:49:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27EGn6T6018704; Sun, 14 Aug 2022 16:49:06 GMT (envelope-from git) Date: Sun, 14 Aug 2022 16:49:06 GMT Message-Id: <202208141649.27EGn6T6018704@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 2889cbe29e30 - main - net80211: add an IEEE80211_IS_PROTECTED() macro List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2889cbe29e30cc03412e4727b4ad753950094c32 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660495746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SeBh77bkLrvnMl9sDVN/WPM9MDSJJqjPW0nk9Dey3R0=; b=UtAWidQ15IWLYNu07MPgu7/IJPiq/ys0QAMqePElzO7i5wNkGdFCZwAQX129fDDNUz39i1 stFmjdZj5yKSyqwn9BIPBI+81x8spbTZEk86RM9mkvwCgfulDiiSEP6g18sB0o1D7a9Gun KLJRBZYYEOtjqw9Qix87EV089tS1c8pUjRqjt44wwGCnfxVreY3IYDo/r/9/JAuoIZk/Tb sPTZPs/R0RhirVUa3BdDfHS3zwYNJXO6r2y8Iw2cqIPwJNhuj4IxeKqf1Slv4GwFqH9sON boeLlEEq5ZizsqqcKSSZbB2lImB5nXL5r9nTVfry8veujjNytBMVj6t7CcLjhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660495746; a=rsa-sha256; cv=none; b=MPRLXiV3OHFashlPeiA69DgB8FojYzd2qvcFrxyIdDmEkfNtV/6FDFSvd988K/Arca/jk+ NhiGvILEZq10kx1OXV9tdKbdc/AxBLqjYhPph9VxUFKaZ4ZN/x1rXDoFdJpm/Ch6IXGjw5 nTvDJFM1g4jniwoSi0ESQxnq5XBegmTQUlgp6qP/LLsuVHzlmy8N8glhHUvdJ9fuMV5ZQR XXwYxkAmJc7xDPR47aDDWUroSw9QpA8mdoO5jVcxJ4zN1OiXoDMSAyk7upjuFpHOiOiPMK veFVNUu/zWPtYF39qGeQSTn38EqlegBcva5WiHmNl3XUn9C3uPHLj6YVBHB2Hg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=2889cbe29e30cc03412e4727b4ad753950094c32 commit 2889cbe29e30cc03412e4727b4ad753950094c32 Author: Adrian Chadd AuthorDate: 2022-08-12 20:56:00 +0000 Commit: Adrian Chadd CommitDate: 2022-08-14 16:48:06 +0000 net80211: add an IEEE80211_IS_PROTECTED() macro Summary: This returns whether the given 802.11 frame has the protected bit set. Test Plan: * tested in AP/STA mode * STA mode - local athp/ath10k driver * AP mode - in tree ath driver Subscribers: imp, melifaro, glebius Reviewed by: bz Approved by: bz Differential Revision: https://reviews.freebsd.org/D36183 --- sys/net80211/ieee80211.h | 3 +++ sys/net80211/ieee80211_adhoc.c | 4 ++-- sys/net80211/ieee80211_hostap.c | 4 ++-- sys/net80211/ieee80211_mesh.c | 2 +- sys/net80211/ieee80211_output.c | 2 +- sys/net80211/ieee80211_proto.c | 2 +- sys/net80211/ieee80211_sta.c | 4 ++-- sys/net80211/ieee80211_wds.c | 4 ++-- 8 files changed, 14 insertions(+), 11 deletions(-) diff --git a/sys/net80211/ieee80211.h b/sys/net80211/ieee80211.h index 715bb3da898e..1125810ee6ac 100644 --- a/sys/net80211/ieee80211.h +++ b/sys/net80211/ieee80211.h @@ -196,6 +196,9 @@ struct ieee80211_qosframe_addr4 { #define IEEE80211_FC1_PROTECTED 0x40 #define IEEE80211_FC1_ORDER 0x80 +#define IEEE80211_IS_PROTECTED(wh) \ + ((wh)->i_fc[1] & IEEE80211_FC1_PROTECTED) + #define IEEE80211_HAS_SEQ(type, subtype) \ ((type) != IEEE80211_FC0_TYPE_CTL && \ !((type) == IEEE80211_FC0_TYPE_DATA && \ diff --git a/sys/net80211/ieee80211_adhoc.c b/sys/net80211/ieee80211_adhoc.c index 57e46dd5ad0b..6aa66db59cac 100644 --- a/sys/net80211/ieee80211_adhoc.c +++ b/sys/net80211/ieee80211_adhoc.c @@ -495,7 +495,7 @@ adhoc_input(struct ieee80211_node *ni, struct mbuf *m, * crypto cipher modules used to do delayed update * of replay sequence numbers. */ - if (is_hw_decrypted || wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + if (is_hw_decrypted || IEEE80211_IS_PROTECTED(wh)) { if ((vap->iv_flags & IEEE80211_F_PRIVACY) == 0) { /* * Discard encrypted frames when privacy is off. @@ -655,7 +655,7 @@ adhoc_input(struct ieee80211_node *ni, struct mbuf *m, ether_sprintf(wh->i_addr2), rssi); } #endif - if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + if (IEEE80211_IS_PROTECTED(wh)) { IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT, wh, NULL, "%s", "WEP set but not permitted"); vap->iv_stats.is_rx_mgtdiscard++; /* XXX */ diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c index f3a85848fc84..17c1de6c2894 100644 --- a/sys/net80211/ieee80211_hostap.c +++ b/sys/net80211/ieee80211_hostap.c @@ -683,7 +683,7 @@ hostap_input(struct ieee80211_node *ni, struct mbuf *m, * crypto cipher modules used to do delayed update * of replay sequence numbers. */ - if (is_hw_decrypted || wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + if (is_hw_decrypted || IEEE80211_IS_PROTECTED(wh)) { if ((vap->iv_flags & IEEE80211_F_PRIVACY) == 0) { /* * Discard encrypted frames when privacy is off. @@ -849,7 +849,7 @@ hostap_input(struct ieee80211_node *ni, struct mbuf *m, ether_sprintf(wh->i_addr2), rssi); } #endif - if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + if (IEEE80211_IS_PROTECTED(wh)) { if (subtype != IEEE80211_FC0_SUBTYPE_AUTH) { /* * Only shared key auth frames with a challenge diff --git a/sys/net80211/ieee80211_mesh.c b/sys/net80211/ieee80211_mesh.c index 8dcbfa918e3b..6d1f5a99fda5 100644 --- a/sys/net80211/ieee80211_mesh.c +++ b/sys/net80211/ieee80211_mesh.c @@ -1797,7 +1797,7 @@ mesh_input(struct ieee80211_node *ni, struct mbuf *m, ether_sprintf(wh->i_addr2), rssi); } #endif - if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + if (IEEE80211_IS_PROTECTED(wh)) { IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT, wh, NULL, "%s", "WEP set but not permitted"); vap->iv_stats.is_rx_mgtdiscard++; /* XXX */ diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index 69d25d5b1ba2..17904672a72b 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -622,7 +622,7 @@ ieee80211_validate_frame(struct mbuf *m, } if ((params && (params->ibp_flags & IEEE80211_BPF_CRYPTO) != 0) || - (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) != 0) { + (IEEE80211_IS_PROTECTED(wh))) { int subtype; subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c index 0e485590abd0..01da0c2a0768 100644 --- a/sys/net80211/ieee80211_proto.c +++ b/sys/net80211/ieee80211_proto.c @@ -602,7 +602,7 @@ ieee80211_dump_pkt(struct ieee80211com *ic, printf(" QoS [TID %u%s]", qwh->i_qos[0] & IEEE80211_QOS_TID, qwh->i_qos[0] & IEEE80211_QOS_ACKPOLICY ? " ACM" : ""); } - if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + if (IEEE80211_IS_PROTECTED(wh)) { int off; off = ieee80211_anyhdrspace(ic, wh); diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c index 9e103f6877c4..3bc6a2bdb3bb 100644 --- a/sys/net80211/ieee80211_sta.c +++ b/sys/net80211/ieee80211_sta.c @@ -767,7 +767,7 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m, * crypto cipher modules used to do delayed update * of replay sequence numbers. */ - if (is_hw_decrypted || wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + if (is_hw_decrypted || IEEE80211_IS_PROTECTED(wh)) { if ((vap->iv_flags & IEEE80211_F_PRIVACY) == 0) { /* * Discard encrypted frames when privacy is off. @@ -939,7 +939,7 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m, * Again, having encrypted flag set check would be good, but * then we have to also handle crypto_decap() like above. */ - if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + if (IEEE80211_IS_PROTECTED(wh)) { if (subtype != IEEE80211_FC0_SUBTYPE_AUTH) { /* * Only shared key auth frames with a challenge diff --git a/sys/net80211/ieee80211_wds.c b/sys/net80211/ieee80211_wds.c index 464e658797e6..debe89436d3d 100644 --- a/sys/net80211/ieee80211_wds.c +++ b/sys/net80211/ieee80211_wds.c @@ -556,7 +556,7 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m, * crypto cipher modules used to do delayed update * of replay sequence numbers. */ - if (is_hw_decrypted || wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + if (is_hw_decrypted || IEEE80211_IS_PROTECTED(wh)) { if ((vap->iv_flags & IEEE80211_F_PRIVACY) == 0) { /* * Discard encrypted frames when privacy is off. @@ -712,7 +712,7 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m, ether_sprintf(wh->i_addr2), rssi); } #endif - if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + if (IEEE80211_IS_PROTECTED(wh)) { IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT, wh, NULL, "%s", "WEP set but not permitted"); vap->iv_stats.is_rx_mgtdiscard++; /* XXX */