svn commit: r275966 - head/sys/dev/wpi
Adrian Chadd
adrian at FreeBSD.org
Sat Dec 20 20:07:50 UTC 2014
Author: adrian
Date: Sat Dec 20 20:07:48 2014
New Revision: 275966
URL: https://svnweb.freebsd.org/changeset/base/275966
Log:
Remove some hard-coded IE assembly over to use net80211 methods.
PR: kern/196069
Submitted by: Andriy Voskoboinyk <s3erios at gmail.com>
Modified:
head/sys/dev/wpi/if_wpi.c
head/sys/dev/wpi/if_wpireg.h
Modified: head/sys/dev/wpi/if_wpi.c
==============================================================================
--- head/sys/dev/wpi/if_wpi.c Sat Dec 20 19:47:51 2014 (r275965)
+++ head/sys/dev/wpi/if_wpi.c Sat Dec 20 20:07:48 2014 (r275966)
@@ -2564,7 +2564,7 @@ wpi_scan(struct wpi_softc *sc)
struct ieee80211_channel *c;
enum ieee80211_phymode mode;
uint8_t *frm;
- int nrates, pktlen, error, i, nssid;
+ int pktlen, error, i, nssid;
bus_addr_t physaddr;
desc = &ring->desc[ring->cur];
@@ -2613,7 +2613,7 @@ wpi_scan(struct wpi_softc *sc)
nssid = MIN(ss->ss_nssid, WPI_SCAN_MAX_ESSIDS);
for (i = 0; i < nssid; i++) {
hdr->scan_essids[i].id = IEEE80211_ELEMID_SSID;
- hdr->scan_essids[i].esslen = MIN(ss->ss_ssid[i].len, 32);
+ hdr->scan_essids[i].esslen = MIN(ss->ss_ssid[i].len, IEEE80211_NWID_LEN);
memcpy(hdr->scan_essids[i].essid, ss->ss_ssid[i].ssid,
hdr->scan_essids[i].esslen);
#ifdef WPI_DEBUG
@@ -2630,7 +2630,7 @@ wpi_scan(struct wpi_softc *sc)
* Build a probe request frame. Most of the following code is a
* copy & paste of what is done in net80211.
*/
- wh = (struct ieee80211_frame *)&hdr->scan_essids[4];
+ wh = (struct ieee80211_frame *)&hdr->scan_essids[WPI_SCAN_MAX_ESSIDS];
wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | IEEE80211_FC0_TYPE_MGT |
IEEE80211_FC0_SUBTYPE_PROBE_REQ;
wh->i_fc[1] = IEEE80211_FC1_DIR_NODS;
@@ -2642,30 +2642,12 @@ wpi_scan(struct wpi_softc *sc)
frm = (uint8_t *)(wh + 1);
- /* add essid IE, the hardware will fill this in for us */
- *frm++ = IEEE80211_ELEMID_SSID;
- *frm++ = 0;
-
mode = ieee80211_chan2mode(ic->ic_curchan);
rs = &ic->ic_sup_rates[mode];
- /* add supported rates IE */
- *frm++ = IEEE80211_ELEMID_RATES;
- nrates = rs->rs_nrates;
- if (nrates > IEEE80211_RATE_SIZE)
- nrates = IEEE80211_RATE_SIZE;
- *frm++ = nrates;
- memcpy(frm, rs->rs_rates, nrates);
- frm += nrates;
-
- /* add supported xrates IE */
- if (rs->rs_nrates > IEEE80211_RATE_SIZE) {
- nrates = rs->rs_nrates - IEEE80211_RATE_SIZE;
- *frm++ = IEEE80211_ELEMID_XRATES;
- *frm++ = nrates;
- memcpy(frm, rs->rs_rates + IEEE80211_RATE_SIZE, nrates);
- frm += nrates;
- }
+ frm = ieee80211_add_ssid(frm, NULL, 0);
+ frm = ieee80211_add_rates(frm, rs);
+ frm = ieee80211_add_xrates(frm, rs);
/* setup length of probe request */
hdr->tx.len = htole16(frm - (uint8_t *)wh);
Modified: head/sys/dev/wpi/if_wpireg.h
==============================================================================
--- head/sys/dev/wpi/if_wpireg.h Sat Dec 20 19:47:51 2014 (r275965)
+++ head/sys/dev/wpi/if_wpireg.h Sat Dec 20 20:07:48 2014 (r275966)
@@ -511,7 +511,7 @@ struct {
struct {
uint8_t id;
uint8_t esslen;
- uint8_t essid[32];
+ uint8_t essid[IEEE80211_NWID_LEN];
}scan_essids[WPI_SCAN_MAX_ESSIDS];
/* followed by probe request body */
/* followed by nchan x wpi_scan_chan */
More information about the svn-src-all
mailing list