From nobody Tue Apr 29 11:41:40 2025 X-Original-To: dev-commits-src-branches@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 4Zmz1K2Ntdz5tvFD; Tue, 29 Apr 2025 11:41:41 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Zmz1J5gNZz3wVH; Tue, 29 Apr 2025 11:41:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1745926900; 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=weljQaDVcOBTsbMT/mbs9vK6lXEPiPjLw/PPJ4zNKoc=; b=SInO9Gp2CThAkbaqelgYsJzOavsCitkLWTAJtLACAbZ3AmFaqxpJhw5xsCw/nuBjLLeicV WhRoG6A9ep9wiyXUrMLhAoRwvt7TP2LH1eXbF/j0OxjX/L9gO4BIYuO0ZlxuyztAqX7WtW rA88LKe3AjUuu+Nzf1eOj3R0Ra33UArJEAmUbVX/fw7swuyArHaHsNaTBhuMU7tNAHdenW 8PFIwjgZC3gCVu+pm4JEct3GfSskpXY3QeqPd+bsyi0BN6kaRqfsARQCQunVt57U4KFxdH N7npSqSBZz/EALcv5ZZ8p6ldtgQ4x5qM9OqLy2yna38Apu4T375v+ud3fqb3KQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1745926900; a=rsa-sha256; cv=none; b=k9BCH8u3n1uA/28qKKjaFAkH6rm2VgFXGiB0IIK9eBTaY3ZeF4Qr+CJCdeRGoTjbEhR8sb 6F1GfdS1cWvMcQx2EBOi7cF7U1j2tTD52f4S8w1ijI+ebH4dnbp89tAdljfh6NP9chewsn v1tqE6lACOojLFZK3VxQf+dx8igAJ7KqVlt5bIWAbJ9zL3nNX+yfgN3hwGoxX8hwGrtuAi Y4x+3IBUepmXdux/zqlyg67Qwi38mGXB/GyAeYi56zzKiq3fkQaFMu12yqvwv+qPn47jWv lNpM7nDTE4QEh1RJtyz9Oxiqui9nRcJxBPZRWQ5zvDCUK7zph1zRtHKlRI6WbQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1745926900; 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=weljQaDVcOBTsbMT/mbs9vK6lXEPiPjLw/PPJ4zNKoc=; b=S68RrBduyf1iztV60u53i0PMQh9Np89IvyVjbiAEr8DJcEBEEU1HB3jh67/9r+x34XtuEJ xL82ud3pHzHWJmWM/GGWzz3GUR4oQ0URvH/TVZKY4Tf+zrgUoAio+iKdgpBvhVep+A5bC4 jm4n6wb+1DA48WJ3OPVGJtwOQ0RGfzw8QlM21s6PXvmSNZPSX2zs7c/J+9fn0b3eeUsrDq 5uGW4VOkKJ5E+O6dnte8+V3XJCXeIcYUzefnQKoRhG9AB40j74DIBQjygE5oJ7bGl5bepS g8z2aAV4pdLa0SlaBxUtsGwtWGFhK45NSInpY5E3pYcG0G/X6GxlEQao7f2SNw== 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 4Zmz1J5Bbpz3hq; Tue, 29 Apr 2025 11:41:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 53TBfekK045845; Tue, 29 Apr 2025 11:41:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 53TBfeYF045842; Tue, 29 Apr 2025 11:41:40 GMT (envelope-from git) Date: Tue, 29 Apr 2025 11:41:40 GMT Message-Id: <202504291141.53TBfeYF045842@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 28c5a37f07b3 - stable/14 - net80211; LinuxKPI 802.11: introduce IEEE80211_RX_F_ICV_STRIP List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 28c5a37f07b39ec7ff0e1be95d0b23db6f671fe6 Auto-Submitted: auto-generated The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=28c5a37f07b39ec7ff0e1be95d0b23db6f671fe6 commit 28c5a37f07b39ec7ff0e1be95d0b23db6f671fe6 Author: Bjoern A. Zeeb AuthorDate: 2025-04-17 19:33:59 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-04-29 10:49:28 +0000 net80211; LinuxKPI 802.11: introduce IEEE80211_RX_F_ICV_STRIP For TKIP with iwlwifi we are seeing DECRYPTED | ICV_STRIPPED | MMIC_STRIPPED. In tkip_decap() we however unconditionally stripped the ICV which resulted in a short frame and Gtk handshake never finished. Add IEEE80211_RX_F_ICV_STRIP to net80211. Add the extra check to the TKIP code. While there correct a comment and leave another about contiguous data assumptions. In LinuxKPI 802.11 translate the new flag and sort them into STRIP and FAIL while here. Sponsored by: The FreeBSD Foundation Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D49880 (cherry picked from commit 731ff40069d28ddab206dee276fbbdf0f28a2124) --- sys/compat/linuxkpi/common/src/linux_80211.c | 10 ++++++---- sys/net80211/_ieee80211.h | 1 + sys/net80211/ieee80211_crypto_tkip.c | 9 +++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 85c0945cb9d3..84241c2dd89f 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -6467,14 +6467,16 @@ lkpi_convert_rx_status(struct ieee80211_hw *hw, struct lkpi_sta *lsta, if (rx_status->flag & RX_FLAG_PN_VALIDATED) rx_stats->c_pktflags |= IEEE80211_RX_F_PN_VALIDATED; } + if (rx_status->flag & RX_FLAG_IV_STRIPPED) + rx_stats->c_pktflags |= IEEE80211_RX_F_IV_STRIP; + if (rx_status->flag & RX_FLAG_ICV_STRIPPED) + rx_stats->c_pktflags |= IEEE80211_RX_F_ICV_STRIP; + if (rx_status->flag & RX_FLAG_MIC_STRIPPED) + rx_stats->c_pktflags |= IEEE80211_RX_F_MIC_STRIP; if (rx_status->flag & RX_FLAG_MMIC_STRIPPED) rx_stats->c_pktflags |= IEEE80211_RX_F_MMIC_STRIP; if (rx_status->flag & RX_FLAG_MMIC_ERROR) rx_stats->c_pktflags |= IEEE80211_RX_F_FAIL_MMIC; - if (rx_status->flag & RX_FLAG_MIC_STRIPPED) - rx_stats->c_pktflags |= IEEE80211_RX_F_MIC_STRIP; - if (rx_status->flag & RX_FLAG_IV_STRIPPED) - rx_stats->c_pktflags |= IEEE80211_RX_F_IV_STRIP; if (rx_status->flag & RX_FLAG_FAILED_FCS_CRC) rx_stats->c_pktflags |= IEEE80211_RX_F_FAIL_FCSCRC; #endif diff --git a/sys/net80211/_ieee80211.h b/sys/net80211/_ieee80211.h index 798dde6fe08a..40e542e7372a 100644 --- a/sys/net80211/_ieee80211.h +++ b/sys/net80211/_ieee80211.h @@ -575,6 +575,7 @@ struct ieee80211_mimo_info { #define IEEE80211_RX_F_VHT 0x00008000 #define IEEE80211_RX_F_PN_VALIDATED 0x00010000 /* Decrypted; PN validated */ #define IEEE80211_RX_F_MIC_STRIP 0x00020000 /* Decrypted; MIC stripped */ +#define IEEE80211_RX_F_ICV_STRIP 0x00040000 /* Decrypted: ICV (ic_trailer) stripped */ /* Channel width */ #define IEEE80211_RX_FW_20MHZ 1 diff --git a/sys/net80211/ieee80211_crypto_tkip.c b/sys/net80211/ieee80211_crypto_tkip.c index 4b5cf73e1065..ca474b504fff 100644 --- a/sys/net80211/ieee80211_crypto_tkip.c +++ b/sys/net80211/ieee80211_crypto_tkip.c @@ -361,16 +361,17 @@ finish: * are required to. */ if (! ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP))) { + /* XXX this assumes the header + IV are contiguous in an mbuf. */ memmove(mtod(m, uint8_t *) + tkip.ic_header, mtod(m, void *), hdrlen); m_adj(m, tkip.ic_header); } /* - * XXX TODO: do we need an option to potentially not strip the - * WEP trailer? Does "MMIC_STRIP" also mean this? Or? + * Strip the ICV if hardware has not done so already. */ - m_adj(m, -tkip.ic_trailer); + if (rxs != NULL && (rxs->c_pktflags & IEEE80211_RX_F_ICV_STRIP) == 0) + m_adj(m, -tkip.ic_trailer); return 1; } @@ -403,7 +404,7 @@ tkip_demic(struct ieee80211_key *k, struct mbuf *m, int force) } /* - * If IV has been stripped, we skip most of the below. + * If MMIC has been stripped, we skip most of the below. */ if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_MMIC_STRIP)) goto finish;