Remove struct size hacks in net80211

wpa_supplicant needs to be rebuilt
against it and then this needs to be tested.

Added some FIXMEs to keep track of places I'm not sure if we need to
change anything.

Fixes #14805

Change-Id: I6379dc32b772289960afbfb362365a542a986983
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2225
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Adrien Destugues
2020-04-12 21:09:30 +00:00
committed by waddlesplash
parent 7bc364740d
commit e4225c3b0e
5 changed files with 3 additions and 36 deletions
@@ -304,6 +304,7 @@ sysctl_ieee80211coms(SYSCTL_HANDLER_ARGS)
if (error)
return (error);
#ifndef __HAIKU__
// sysctl not used in Haiku, no need to fill the reply
sbuf_new_for_sysctl(&sb, NULL, 8, req);
sbuf_clear_flags(&sb, SBUF_INCLUDENUL);
sp = "";
@@ -698,18 +698,9 @@ ieee80211_ioctl_getdevcaps(struct ieee80211com *ic,
maxchans = 1 + ((ireq->i_len - sizeof(struct ieee80211_devcaps_req)) /
sizeof(struct ieee80211_channel));
#ifdef __HAIKU__
/* HACK */
if (ireq->i_len < sizeof(struct ieee80211_devcaps_req))
maxchans = 0;
#endif
/* NB: require 1 so we know ic_nchans is accessible */
if (maxchans < 1)
#ifndef __HAIKU__
return EINVAL;
#else
maxchans = 0;
#endif
/* constrain max request size, 2K channels is ~24Kbytes */
if (maxchans > 2048)
maxchans = 2048;
@@ -721,26 +712,13 @@ ieee80211_ioctl_getdevcaps(struct ieee80211com *ic,
dc->dc_drivercaps = ic->ic_caps;
dc->dc_cryptocaps = ic->ic_cryptocaps;
dc->dc_htcaps = ic->ic_htcaps;
#ifndef __HAIKU__
dc->dc_vhtcaps = ic->ic_vhtcaps;
#endif
ci = &dc->dc_chaninfo;
#ifdef __HAIKU__
if (maxchans != 0) {
#endif
ic->ic_getradiocaps(ic, maxchans, &ci->ic_nchans, ci->ic_chans);
KASSERT(ci->ic_nchans <= maxchans,
("nchans %d maxchans %d", ci->ic_nchans, maxchans));
ieee80211_sort_channels(ci->ic_chans, ci->ic_nchans);
#ifdef __HAIKU__
} else
dc->dc_chaninfo.ic_nchans = 0; /* HACK */
#endif
#ifdef __HAIKU__
error = copyout(dc, ireq->i_data, ireq->i_len);
#else
error = copyout(dc, ireq->i_data, IEEE80211_DEVCAPS_SPACE(dc));
#endif
IEEE80211_FREE(dc, M_TEMP);
return error;
}
@@ -428,14 +428,8 @@ struct ieee80211req_sta_info {
uint16_t isi_len; /* total length (mult of 4) */
uint16_t isi_ie_off; /* offset to IE data */
uint16_t isi_ie_len; /* IE length */
#ifdef __HAIKU__
uint32_t isi_flags; /* channel flags */
uint16_t isi_freq; /* MHz */
int8_t padding[10];
#else
uint16_t isi_freq; /* MHz */
uint32_t isi_flags; /* channel flags */
#endif
uint32_t isi_state; /* state flags */
uint8_t isi_authmode; /* authentication algorithm */
int8_t isi_rssi; /* receive signal strength */
@@ -568,9 +562,7 @@ struct ieee80211_devcaps_req {
uint32_t dc_drivercaps; /* general driver caps */
uint32_t dc_cryptocaps; /* hardware crypto support */
uint32_t dc_htcaps; /* HT/802.11n support */
#ifndef __HAIKU__
uint32_t dc_vhtcaps; /* VHT/802.11ac capabilities */
#endif
struct ieee80211req_chaninfo dc_chaninfo;
};
#define IEEE80211_DEVCAPS_SIZE(_nchan) \
@@ -837,14 +829,8 @@ struct ieee80211req_scan_result {
uint16_t isr_len; /* total length (mult of 4) */
uint16_t isr_ie_off; /* offset to SSID+IE data */
uint16_t isr_ie_len; /* IE length */
#ifdef __HAIKU__
uint32_t isr_flags; /* channel flags */
uint16_t isr_freq; /* MHz */
int8_t padding[10];
#else
uint16_t isr_freq; /* MHz */
uint16_t isr_flags; /* channel flags */
#endif
int8_t isr_noise;
int8_t isr_rssi;
uint16_t isr_intval; /* beacon interval */
@@ -640,6 +640,7 @@ ieee80211_output(struct ifnet *ifp, struct mbuf *m,
* a raw 802.11 frame.
*/
#ifdef __HAIKU__
// FIXME why is this different on Haiku?
if (!dst || dst->sa_family != AF_IEEE80211)
return ieee80211_vap_xmitpkt(vap, m);
#else
@@ -93,6 +93,7 @@ ieee80211_ratectl_sysctl_stats(SYSCTL_HANDLER_ARGS)
if (error)
return (error);
#ifndef __HAIKU__
// sysctl not used in Haiku, no need to compute the stats
sbuf_new_for_sysctl(&sb, NULL, 8, req);
sbuf_clear_flags(&sb, SBUF_INCLUDENUL);