git: caaa79c3f8c6 - main - LinuxKPI 802.11: change type of bssid in struct ieee80211_bss_conf
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 27 Aug 2022 14:56:03 UTC
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=caaa79c3f8c692b9822df74a2dc0a37e4ab33a3b commit caaa79c3f8c692b9822df74a2dc0a37e4ab33a3b Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2022-08-27 14:48:09 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2022-08-27 14:54:02 +0000 LinuxKPI 802.11: change type of bssid in struct ieee80211_bss_conf Enabling other driver code found that the bssid in struct ieee80211_bss_conf is not an array but expected to be a const pointer (const, != NULL checks). Adjust accordingly in the header and in the LinuxKPI compat code. There initialization now needs to be a static array always present as we need a value before we will have a BSS (node in scan_to_auth) as the mac80211 driver (*handlers) are expecting the pointer to be not NULL (copying without checks). This is a pre-req to enable d3 (CONFIG_PM[_SLEEP]) in the future. Tested by: Tomoaki AOKI (junchoon dec.sakura.ne.jp) Tested by: Berislav Purgar (bpurgar gmail.com) Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/include/net/mac80211.h | 2 +- sys/compat/linuxkpi/common/src/linux_80211.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h index 4320edc90eba..13ae7bb99376 100644 --- a/sys/compat/linuxkpi/common/include/net/mac80211.h +++ b/sys/compat/linuxkpi/common/include/net/mac80211.h @@ -215,7 +215,7 @@ struct mac80211_fils_discovery { struct ieee80211_bss_conf { /* TODO FIXME */ - uint8_t bssid[ETH_ALEN]; + const uint8_t *bssid; uint8_t transmitter_bssid[ETH_ALEN]; struct ieee80211_ftm_responder_params *ftmr_params; struct ieee80211_p2p_noa_attr p2p_noa_attr; diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index a98ed56fcdad..4ec54400c166 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -115,6 +115,9 @@ SYSCTL_INT(_compat_linuxkpi_80211, OID_AUTO, debug, CTLFLAG_RWTUN, #define PREP_TX_INFO_DURATION 0 /* Let the driver do its thing. */ #endif +/* c.f. ieee80211_ioctl.c */ +static const uint8_t zerobssid[IEEE80211_ADDR_LEN]; + /* This is DSAP | SSAP | CTRL | ProtoID/OrgCode{3}. */ const uint8_t rfc1042_header[6] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; @@ -996,7 +999,7 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int /* Set bss info (bss_info_changed). */ bss_changed = 0; - IEEE80211_ADDR_COPY(vif->bss_conf.bssid, ni->ni_bssid); + vif->bss_conf.bssid = ni->ni_bssid; bss_changed |= BSS_CHANGED_BSSID; vif->bss_conf.txpower = ni->ni_txpower; bss_changed |= BSS_CHANGED_TXPOWER; @@ -2230,6 +2233,15 @@ lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], vif->bss_conf.ht_operation_mode = IEEE80211_HT_OP_MODE_PROTECTION_NONE; vif->bss_conf.assoc = false; vif->bss_conf.aid = 0; + /* + * We need to initialize it to something as the bss_info_changed call + * will try to copy from it in iwlwifi and NULL is a panic. + * We will set the proper one in scan_to_auth() before being assoc. + * NB: the logic there with using an array as bssid_override and checking + * for non-NULL later is flawed but in their workflow does not seem to + * matter. + */ + vif->bss_conf.bssid = zerobssid; #endif #if 0 vif->bss_conf.dtim_period = 0; /* IEEE80211_DTIM_DEFAULT ; must stay 0. */