The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=d4de0a69a92e560c77df83d7b342566ce353792c
commit d4de0a69a92e560c77df83d7b342566ce353792c Author: EN-WEU WU <[email protected]> AuthorDate: 2026-06-16 14:35:20 +0000 Commit: Adrian Chadd <[email protected]> CommitDate: 2026-06-16 14:35:20 +0000 wtap(4): Implement STA/HostAP mode and support WPA/WPA2 Below is the commit message: ``` Wtap originally only supported mesh/ad-hoc mode, and cannot be combined with wpa_supplicant(8) and hostapd(8) since it's unaware of encryption/decryption. This commit adds support for hostap and sta mode with WPA/WPA2, thus wtap(4) can now be used with hostapd(8) and wpa_supplicant(8). ``` Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D36243 --- sys/dev/wtap/if_wtap.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/sys/dev/wtap/if_wtap.c b/sys/dev/wtap/if_wtap.c index 51733a05bd93..d22b79a20dc4 100644 --- a/sys/dev/wtap/if_wtap.c +++ b/sys/dev/wtap/if_wtap.c @@ -297,6 +297,7 @@ wtap_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) switch (vap->iv_opmode) { case IEEE80211_M_IBSS: case IEEE80211_M_MBSS: + case IEEE80211_M_HOSTAP: /* * Stop any previous beacon callout. This may be * necessary, for example, when an ibss merge @@ -600,6 +601,16 @@ wtap_transmit(struct ieee80211com *ic, struct mbuf *m) (struct ieee80211_node *) m->m_pkthdr.rcvif; struct ieee80211vap *vap = ni->ni_vap; struct wtap_vap *avp = WTAP_VAP(vap); + struct ieee80211_key *k; + struct ieee80211_frame *wh; + + wh = mtod(m, struct ieee80211_frame *); + + if (IEEE80211_IS_PROTECTED(wh)) { + k = ieee80211_crypto_encap(ni, m); + if (k == NULL) + return (ENOBUFS); + } if (ieee80211_radiotap_active_vap(vap)) ieee80211_radiotap_tx(vap, m); @@ -652,7 +663,18 @@ wtap_attach(struct wtap_softc *sc, const uint8_t *macaddr) ic->ic_name = sc->name; ic->ic_phytype = IEEE80211_T_DS; ic->ic_opmode = IEEE80211_M_MBSS; - ic->ic_caps = IEEE80211_C_MBSS | IEEE80211_C_IBSS; + ic->ic_caps = + IEEE80211_C_MBSS /* mesh point link mode */ + | IEEE80211_C_IBSS /* ibss, nee adhoc, mode */ + | IEEE80211_C_STA /* station mode */ + | IEEE80211_C_HOSTAP /* hostap mode */ + | IEEE80211_C_WPA; /* capable of WPA1+WPA2 */ + + ic->ic_cryptocaps = + IEEE80211_CRYPTO_WEP + | IEEE80211_CRYPTO_AES_CCM + | IEEE80211_CRYPTO_TKIP + | IEEE80211_CRYPTO_TKIPMIC; ic->ic_max_keyix = 128; /* A value read from Atheros ATH_KEYMAX */
