From e4225c3b0ec16c755f1edebb65c7a7f1e57bd97b Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Fri, 7 Feb 2020 14:34:27 +0100 Subject: [PATCH] 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 --- .../compat/freebsd_wlan/net80211/ieee80211.c | 1 + .../freebsd_wlan/net80211/ieee80211_ioctl.c | 22 ------------------- .../freebsd_wlan/net80211/ieee80211_ioctl.h | 14 ------------ .../freebsd_wlan/net80211/ieee80211_output.c | 1 + .../freebsd_wlan/net80211/ieee80211_ratectl.c | 1 + 5 files changed, 3 insertions(+), 36 deletions(-) diff --git a/src/libs/compat/freebsd_wlan/net80211/ieee80211.c b/src/libs/compat/freebsd_wlan/net80211/ieee80211.c index 03a7ef4c4c..7736d9fa3e 100644 --- a/src/libs/compat/freebsd_wlan/net80211/ieee80211.c +++ b/src/libs/compat/freebsd_wlan/net80211/ieee80211.c @@ -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 = ""; diff --git a/src/libs/compat/freebsd_wlan/net80211/ieee80211_ioctl.c b/src/libs/compat/freebsd_wlan/net80211/ieee80211_ioctl.c index a0373980f2..bd81bcd71e 100644 --- a/src/libs/compat/freebsd_wlan/net80211/ieee80211_ioctl.c +++ b/src/libs/compat/freebsd_wlan/net80211/ieee80211_ioctl.c @@ -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; } diff --git a/src/libs/compat/freebsd_wlan/net80211/ieee80211_ioctl.h b/src/libs/compat/freebsd_wlan/net80211/ieee80211_ioctl.h index 0791b4aaf6..81864b176a 100644 --- a/src/libs/compat/freebsd_wlan/net80211/ieee80211_ioctl.h +++ b/src/libs/compat/freebsd_wlan/net80211/ieee80211_ioctl.h @@ -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 */ diff --git a/src/libs/compat/freebsd_wlan/net80211/ieee80211_output.c b/src/libs/compat/freebsd_wlan/net80211/ieee80211_output.c index af1162c7f6..91db50444c 100644 --- a/src/libs/compat/freebsd_wlan/net80211/ieee80211_output.c +++ b/src/libs/compat/freebsd_wlan/net80211/ieee80211_output.c @@ -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 diff --git a/src/libs/compat/freebsd_wlan/net80211/ieee80211_ratectl.c b/src/libs/compat/freebsd_wlan/net80211/ieee80211_ratectl.c index 43f81392f2..4fd449c0a0 100644 --- a/src/libs/compat/freebsd_wlan/net80211/ieee80211_ratectl.c +++ b/src/libs/compat/freebsd_wlan/net80211/ieee80211_ratectl.c @@ -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);