openbsd_wlan: Synchronize with upstream OpenBSD.

This commit is contained in:
Augustin Cavalier
2024-06-24 22:05:52 -04:00
parent 95ce8f21aa
commit 25e0933970
6 changed files with 26 additions and 16 deletions
@@ -1,4 +1,4 @@
/* $OpenBSD: ieee80211.c,v 1.88 2022/03/19 10:25:09 stsp Exp $ */
/* $OpenBSD: ieee80211.c,v 1.89 2024/02/15 15:40:56 stsp Exp $ */
/* $NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $ */
/*-
@@ -1182,7 +1182,7 @@ ieee80211_next_mode(struct ifnet *ifp)
* Indicate a wrap-around if we're running in a fixed, user-specified
* phy mode.
*/
if (IFM_MODE(ic->ic_media.ifm_cur->ifm_media) != IFM_AUTO)
if (IFM_SUBTYPE(ic->ic_media.ifm_cur->ifm_media) != IFM_AUTO)
return (IEEE80211_MODE_AUTO);
/*
@@ -1,4 +1,4 @@
/* $OpenBSD: ieee80211_crypto.c,v 1.78 2021/05/11 08:46:31 stsp Exp $ */
/* $OpenBSD: ieee80211_crypto.c,v 1.79 2024/04/14 03:26:25 jsg Exp $ */
/*-
* Copyright (c) 2008 Damien Bergamini <[email protected]>
@@ -538,7 +538,8 @@ ieee80211_eapol_key_encrypt(struct ieee80211com *ic,
/* set IV to the lower 16 octets of our global key counter */
memcpy(key->iv, ic->ic_globalcnt + 16, 16);
/* increment our global key counter (256-bit, big-endian) */
for (n = 31; n >= 0 && ++ic->ic_globalcnt[n] == 0; n--);
for (n = 31; n >= 0 && ++ic->ic_globalcnt[n] == 0; n--)
;
/* concatenate the EAPOL-Key IV field and the KEK */
memcpy(keybuf, key->iv, EAPOL_KEY_IV_LEN);
@@ -1,4 +1,4 @@
/* $OpenBSD: ieee80211_input.c,v 1.250 2023/01/09 00:22:47 daniel Exp $ */
/* $OpenBSD: ieee80211_input.c,v 1.254 2024/05/23 11:19:13 stsp Exp $ */
/* $NetBSD: ieee80211_input.c,v 1.24 2004/05/31 11:12:24 dyoung Exp $ */
/*-
@@ -75,7 +75,6 @@ void ieee80211_ba_move_window(struct ieee80211com *,
struct ieee80211_node *, u_int8_t, u_int16_t, struct mbuf_list *);
void ieee80211_input_ba_seq(struct ieee80211com *,
struct ieee80211_node *, uint8_t, uint16_t, struct mbuf_list *);
struct mbuf *ieee80211_align_mbuf(struct mbuf *);
void ieee80211_decap(struct ieee80211com *, struct mbuf *,
struct ieee80211_node *, int, struct mbuf_list *);
int ieee80211_amsdu_decap_validate(struct ieee80211com *, struct mbuf *,
@@ -190,8 +189,10 @@ ieee80211_input_hwdecrypt(struct ieee80211com *ic, struct ieee80211_node *ni,
*/
break;
}
if (ieee80211_ccmp_get_pn(&pn, &prsc, m, k) != 0)
if (ieee80211_ccmp_get_pn(&pn, &prsc, m, k) != 0) {
ic->ic_stats.is_ccmp_dec_errs++;
return NULL;
}
if (rxi->rxi_flags & IEEE80211_RXI_HWDEC_SAME_PN) {
if (pn < *prsc) {
ic->ic_stats.is_ccmp_replays++;
@@ -1901,7 +1902,7 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m,
* This probe response indicates the AP is still serving us
* so don't allow ieee80211_watchdog() to move us into SCAN.
*/
if ((ic->ic_flags & IEEE80211_F_BGSCAN) == 0)
if ((ic->ic_flags & IEEE80211_F_BGSCAN) == 0)
ic->ic_mgt_timer = 0;
}
/*
@@ -2838,6 +2839,11 @@ ieee80211_recv_addba_req(struct ieee80211com *ic, struct mbuf *m,
u_int8_t token, tid;
int err = 0;
/* Ignore if we are not ready to receive data frames. */
if (ic->ic_state != IEEE80211_S_RUN ||
((ic->ic_flags & IEEE80211_F_RSNON) && !ni->ni_port_valid))
return;
if (!(ni->ni_flags & IEEE80211_NODE_HT)) {
DPRINTF(("received ADDBA req from non-HT STA %s\n",
ether_sprintf(ni->ni_macaddr)));
@@ -1,4 +1,4 @@
/* $OpenBSD: ieee80211_output.c,v 1.137 2022/03/14 15:07:24 stsp Exp $ */
/* $OpenBSD: ieee80211_output.c,v 1.139 2024/05/08 14:02:59 stsp Exp $ */
/* $NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung Exp $ */
/*-
@@ -575,6 +575,9 @@ ieee80211_encap(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node **pni)
#endif
fallback:
if (ic->ic_opmode == IEEE80211_M_MONITOR)
goto bad;
if (m->m_len < sizeof(struct ether_header)) {
m = m_pullup(m, sizeof(struct ether_header));
if (m == NULL) {
@@ -804,14 +807,16 @@ ieee80211_add_tim(u_int8_t *frm, struct ieee80211com *ic)
u_int i, offset = 0, len;
/* find first non-zero octet in the virtual bit map */
for (i = 0; i < ic->ic_tim_len && ic->ic_tim_bitmap[i] == 0; i++);
for (i = 0; i < ic->ic_tim_len && ic->ic_tim_bitmap[i] == 0; i++)
;
/* clear the lsb as it is reserved for the broadcast indication bit */
if (i < ic->ic_tim_len)
offset = i & ~1;
/* find last non-zero octet in the virtual bit map */
for (i = ic->ic_tim_len - 1; i > 0 && ic->ic_tim_bitmap[i] == 0; i--);
for (i = ic->ic_tim_len - 1; i > 0 && ic->ic_tim_bitmap[i] == 0; i--)
;
len = i - offset + 1;
@@ -1,4 +1,4 @@
/* $OpenBSD: ieee80211_proto.c,v 1.108 2022/03/14 15:07:24 stsp Exp $ */
/* $OpenBSD: ieee80211_proto.c,v 1.109 2024/02/08 00:05:46 jsg Exp $ */
/* $NetBSD: ieee80211_proto.c,v 1.8 2004/04/30 23:58:20 dyoung Exp $ */
/*-
@@ -864,7 +864,7 @@ ieee80211_try_another_bss(struct ieee80211com *ic)
/* Should not happen but seriously, don't try the same AP again. */
if (memcmp(selbs->ni_macaddr, ic->ic_bss->ni_macaddr,
IEEE80211_NWID_LEN) == 0)
IEEE80211_ADDR_LEN) == 0)
return;
if (ifp->if_flags & IFF_DEBUG)
@@ -1,4 +1,4 @@
/* $OpenBSD: ieee80211_proto.h,v 1.48 2022/03/14 15:07:24 stsp Exp $ */
/* $OpenBSD: ieee80211_proto.h,v 1.49 2024/05/29 00:48:15 jsg Exp $ */
/* $NetBSD: ieee80211_proto.h,v 1.3 2003/10/13 04:23:56 dyoung Exp $ */
/*-
@@ -119,8 +119,6 @@ extern u_int8_t *ieee80211_add_capinfo(u_int8_t *, struct ieee80211com *,
extern u_int8_t *ieee80211_add_ssid(u_int8_t *, const u_int8_t *, u_int);
extern u_int8_t *ieee80211_add_rates(u_int8_t *,
const struct ieee80211_rateset *);
extern u_int8_t *ieee80211_add_fh_params(u_int8_t *, struct ieee80211com *,
const struct ieee80211_node *);
extern u_int8_t *ieee80211_add_ds_params(u_int8_t *, struct ieee80211com *,
const struct ieee80211_node *);
extern u_int8_t *ieee80211_add_tim(u_int8_t *, struct ieee80211com *);