From nobody Mon Sep 30 13:20:48 2024 X-Original-To: dev-commits-src-all@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 4XHMC42pY8z5YGjd; Mon, 30 Sep 2024 13:20:48 +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 4XHMC42PMSz4VJt; Mon, 30 Sep 2024 13:20:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727702448; 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=8q5n4RYHEY4CZHLgoO2NbzvBgi0aQoIAy+7kbFwbhdQ=; b=K8Osid9hUGikllKySD6Ez9HjhT3MN9cOf+el0Cwmb2nrEIhiFD5gAzgRQ90woI/4yhY8EJ jEYhGSSib20MBYARiV5axYj5JNvEn6AHo2VSxsBfsdAO8N44Iy1Obptqx0rm5iPHLLz1bV eAfsQsI2zyRs12zJOL5ndswF91pKQBnm4PQVo+sRQQ6VfntRAPr3wfDKqXmwbG8LoFp/tJ iRFUctYwpHlCd5eSaUrVYvTqmP6rqhPqGUifFl2b+TjxGjUngI6cUW288HhbfAJIAyJdxJ YFM/NCNRqP7/ma2D2dT8K6SR6K+0rkSKsc3fg9y0GqKrtN94Vz+wBiJrBw2nIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727702448; 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=8q5n4RYHEY4CZHLgoO2NbzvBgi0aQoIAy+7kbFwbhdQ=; b=Idv8eStpXwJP5j9WlkAHReVxj9OrLchiQMDKbWW6zfRKCcbUejZYDF7cROPE7biCUrSekD sMGUb5Jwz5zu7CuJUAIs2PfC4UucTwtNjrGjSsxSfuIA4vURr3W6W45JQQgD6BiE3pLrOA nqMAUPDv5KH+g7tAP5eWd8tAc92wJ8sxX8psv65C/faaQfPg9MvETcjJEbt6YXO22QdjlF ofhn156ITGkRSPUtZd9ZVuMaV4dSzxmTBoJJv0VLTLhEIIlRGG9K7IAwOYsN0Z9NRvF3fC rlHE8I+u2GtYg2mmYavjGB2dROChJcegqv+tTeZCjfXsNtUb/3MU3EntIgkOlw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727702448; a=rsa-sha256; cv=none; b=faSK2YFbi5ZVV2+g7pJdUZ+a5yAAP550nbBVtKgTT/PSf0lFpcrgAEaHCl9/daLIY5XnEn ARTHuGFWVfr1jR2ZD5JQiln3+P/ViP2TXG2ZpBxdPDwzAWO1fkD/qhKa41yJjiJGolK82n UiWgHe6JlRmSUhXPqmaOfXQeHOyi/pBoLAW9qjnw7bGXMgkMyie90ngIyJlMyYnq3TXnAu FMTtsfoQW38tDEu0RHJZ9w8c3mzXTGJkpXWPG3pGWTAUaOBk3zl1Lta2mgSeuUTC5ajOdx KcGYxNjIaKX97YrVMhu+lVnH7s/rn6ycJITUqno7MB3FPLvJXlW1LgZByWZ7wA== 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 4XHMC421gzztpt; Mon, 30 Sep 2024 13:20:48 +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 48UDKmuP067501; Mon, 30 Sep 2024 13:20:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48UDKmMY067498; Mon, 30 Sep 2024 13:20:48 GMT (envelope-from git) Date: Mon, 30 Sep 2024 13:20:48 GMT Message-Id: <202409301320.48UDKmMY067498@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: 335a234d72be - stable/13 - LinuxKPI: 802.11: support manual lladdr changes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/13 X-Git-Reftype: branch X-Git-Commit: 335a234d72be2a042e60ddd93a2644ffdc27e515 Auto-Submitted: auto-generated The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=335a234d72be2a042e60ddd93a2644ffdc27e515 commit 335a234d72be2a042e60ddd93a2644ffdc27e515 Author: Bjoern A. Zeeb AuthorDate: 2024-07-25 07:53:32 +0000 Commit: Bjoern A. Zeeb CommitDate: 2024-09-30 12:19:05 +0000 LinuxKPI: 802.11: support manual lladdr changes Allow a user to change the "ether" address by ifconfig while a VAP is not UP. Compared to net80211 (given we have no callback) we register an eventhandler per-vif (a global one would force us to use hacks to derive if a vap is indeed also a lkpi_80211 vif). Sponsored by: The FreeBSD Foundation PR: 277356 Tested by: lwhsu Differential Revision: https://reviews.freebsd.org/D46121 (cherry picked from commit 4aff4048f5b1b6ab0b905726853ba6083e37cc37) --- sys/compat/linuxkpi/common/src/linux_80211.c | 30 ++++++++++++++++++++++++++++ sys/compat/linuxkpi/common/src/linux_80211.h | 1 + 2 files changed, 31 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 288ae00b6949..ef742125dbac 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -2751,6 +2751,32 @@ lkpi_ic_wme_update(struct ieee80211com *ic) return (0); /* unused */ } +/* + * Change link-layer address on the vif (if the vap is not started/"UP"). + * This can happen if a user changes 'ether' using ifconfig. + * The code is based on net80211/ieee80211_freebsd.c::wlan_iflladdr() but + * we do use a per-[l]vif event handler to be sure we exist as we + * cannot assume that from every vap derives a vif and we have a hard + * time checking based on net80211 information. + */ +static void +lkpi_vif_iflladdr(void *arg, struct ifnet *ifp) +{ + struct epoch_tracker et; + struct ieee80211_vif *vif; + + NET_EPOCH_ENTER(et); + /* NB: identify vap's by if_init; left as an extra check. */ + if (ifp->if_init != ieee80211_init || (ifp->if_flags & IFF_UP) != 0) { + NET_EPOCH_EXIT(et); + return; + } + + vif = arg; + IEEE80211_ADDR_COPY(vif->bss_conf.addr, IF_LLADDR(ifp)); + NET_EPOCH_EXIT(et); +} + static struct ieee80211vap * lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, enum ieee80211_opmode opmode, int flags, @@ -2799,6 +2825,8 @@ lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], vif->bss_conf.vif = vif; /* vap->iv_myaddr is not set until net80211::vap_setup or vap_attach. */ IEEE80211_ADDR_COPY(vif->bss_conf.addr, mac); + lvif->lvif_ifllevent = EVENTHANDLER_REGISTER(iflladdr_event, + lkpi_vif_iflladdr, vif, EVENTHANDLER_PRI_ANY); vif->bss_conf.link_id = 0; /* Non-MLO operation. */ vif->bss_conf.chandef.width = NL80211_CHAN_WIDTH_20_NOHT; vif->bss_conf.use_short_preamble = false; /* vap->iv_flags IEEE80211_F_SHPREAMBLE */ @@ -2972,6 +3000,8 @@ lkpi_ic_vap_delete(struct ieee80211vap *vap) lhw = ic->ic_softc; hw = LHW_TO_HW(lhw); + EVENTHANDLER_DEREGISTER(iflladdr_event, lvif->lvif_ifllevent); + LKPI_80211_LHW_LVIF_LOCK(lhw); TAILQ_REMOVE(&lhw->lvif_head, lvif, lvif_entry); LKPI_80211_LHW_LVIF_UNLOCK(lhw); diff --git a/sys/compat/linuxkpi/common/src/linux_80211.h b/sys/compat/linuxkpi/common/src/linux_80211.h index a48cf719c693..516bc78a8c13 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.h +++ b/sys/compat/linuxkpi/common/src/linux_80211.h @@ -159,6 +159,7 @@ struct lkpi_sta { struct lkpi_vif { TAILQ_ENTRY(lkpi_vif) lvif_entry; struct ieee80211vap iv_vap; + eventhandler_tag lvif_ifllevent; struct mtx mtx; struct wireless_dev wdev;