Skip to content

Commit

Permalink
Add VHT caps if necessary.
Browse files Browse the repository at this point in the history
  • Loading branch information
zxystd committed Apr 24, 2021
1 parent b411ca9 commit c448fbd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
15 changes: 8 additions & 7 deletions itl80211/openbsd/net80211/ieee80211_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ uint8_t *
ieee80211_add_htcaps(uint8_t *frm, struct ieee80211com *ic)
{
*frm++ = IEEE80211_ELEMID_HTCAPS;
*frm++ = 26;
*frm++ = sizeof(struct ieee80211_ie_htcap) - 2;
LE_WRITE_2(frm, ic->ic_htcaps); frm += 2;
*frm++ = ic->ic_ampdu_params;
memcpy(frm, ic->ic_sup_mcs, 10); frm += 10;
Expand Down Expand Up @@ -1353,7 +1353,8 @@ ieee80211_get_probe_req(struct ieee80211com *ic, struct ieee80211_node *ni)
2 + min(rs->rs_nrates, IEEE80211_RATE_SIZE) +
((rs->rs_nrates > IEEE80211_RATE_SIZE) ?
2 + rs->rs_nrates - IEEE80211_RATE_SIZE : 0) +
((ic->ic_flags & IEEE80211_F_HTON) ? 28 + 9 : 0));
((ic->ic_flags & IEEE80211_F_HTON) ? sizeof(struct ieee80211_ie_htcap) + sizeof(struct ieee80211_wme_info) : 0) +
((ic->ic_flags & IEEE80211_F_VHTON) ? sizeof(struct ieee80211_ie_vhtcap) : 0));
if (m == NULL)
return NULL;

Expand All @@ -1366,6 +1367,8 @@ ieee80211_get_probe_req(struct ieee80211com *ic, struct ieee80211_node *ni)
frm = ieee80211_add_htcaps(frm, ic);
frm = ieee80211_add_wme_info(frm, ic);
}
if (ic->ic_flags & IEEE80211_F_VHTON)
frm = ieee80211_add_vhtcaps(frm, ic);
size_t l = frm - mtod(m, u_int8_t *);
mbuf_pkthdr_setlen(m, l);
mbuf_setlen(m, l);
Expand Down Expand Up @@ -1538,7 +1541,7 @@ ieee80211_get_assoc_req(struct ieee80211com *ic, struct ieee80211_node *ni,
(((ic->ic_flags & IEEE80211_F_RSNON) &&
(ni->ni_rsnprotos & IEEE80211_PROTO_WPA)) ?
2 + IEEE80211_WPAIE_MAXLEN : 0) +
((ic->ic_flags & IEEE80211_F_HTON) ? 28 + 9 : 0) +
((ic->ic_flags & IEEE80211_F_HTON) ? sizeof(struct ieee80211_ie_htcap) + sizeof(struct ieee80211_wme_info) : 0) +
((ic->ic_flags & IEEE80211_F_VHTON) ? sizeof(struct ieee80211_ie_vhtcap) + 2 : 0) +
((ic->ic_flags & IEEE80211_F_HEON) ? (sizeof(struct ieee80211_he_cap_elem) + 2 + 1 + sizeof(struct ieee80211_he_mcs_nss_supp) + IEEE80211_HE_PPE_THRES_MAX_LEN) : 0));
if (m == NULL)
Expand Down Expand Up @@ -1592,13 +1595,11 @@ ieee80211_get_assoc_req(struct ieee80211com *ic, struct ieee80211_node *ni,
frm = ieee80211_add_wme_info(frm, ic);
}

if (ic->ic_flags & IEEE80211_F_VHTON) {
if (ic->ic_flags & IEEE80211_F_VHTON)
frm = ieee80211_add_vhtcaps(frm, ic);
}

if (ic->ic_flags & IEEE80211_F_HEON) {
if (ic->ic_flags & IEEE80211_F_HEON)
frm = ieee80211_add_hecaps(frm, ic);
}

size_t l = frm - mtod(m, u_int8_t *);
mbuf_pkthdr_setlen(m, l);
Expand Down
7 changes: 6 additions & 1 deletion itlwm/hal_iwm/scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,16 @@ iwm_fill_probe_req(struct iwm_softc *sc, struct iwm_scan_probe_req *preq)
preq->common_data.offset = htole16(frm - (uint8_t *)wh);
pos = frm;
if (ic->ic_flags & IEEE80211_F_HTON) {
if (remain < 28)
if (remain < sizeof(struct ieee80211_ie_htcap))
return ENOBUFS;
frm = ieee80211_add_htcaps(frm, ic);
/* XXX add WME info? */
}
if (ic->ic_flags & IEEE80211_F_VHTON) {
if (remain < sizeof(struct ieee80211_ie_vhtcap))
return ENOBUFS;
frm = ieee80211_add_vhtcaps(frm, ic);
}
preq->common_data.len = htole16(frm - pos);

return 0;
Expand Down

0 comments on commit c448fbd

Please sign in to comment.