Cleanup compat shims for FreeBSD versions that predate 10.0-RELEASE.
There are no plans to merge anything save a trivial bugfix to stable/9. Discussed with: adrian
This commit is contained in:
parent
272f6ade9b
commit
e14a2a4cf4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=283541
@ -245,15 +245,9 @@ null_transmit(struct ifnet *ifp, struct mbuf *m)
|
||||
return EACCES; /* XXX EIO/EPERM? */
|
||||
}
|
||||
|
||||
#if __FreeBSD_version >= 1000031
|
||||
static int
|
||||
null_output(struct ifnet *ifp, struct mbuf *m,
|
||||
const struct sockaddr *dst, struct route *ro)
|
||||
#else
|
||||
static int
|
||||
null_output(struct ifnet *ifp, struct mbuf *m,
|
||||
struct sockaddr *dst, struct route *ro)
|
||||
#endif
|
||||
{
|
||||
if_printf(ifp, "discard raw packet\n");
|
||||
return null_transmit(ifp, m);
|
||||
|
@ -66,10 +66,8 @@ SYSCTL_INT(_net_wlan, OID_AUTO, debug, CTLFLAG_RW, &ieee80211_debug,
|
||||
|
||||
static MALLOC_DEFINE(M_80211_COM, "80211com", "802.11 com state");
|
||||
|
||||
#if __FreeBSD_version >= 1000020
|
||||
static const char wlanname[] = "wlan";
|
||||
static struct if_clone *wlan_cloner;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Allocate/free com structure in conjunction with ifnet;
|
||||
@ -136,18 +134,10 @@ wlan_clone_create(struct if_clone *ifc, int unit, caddr_t params)
|
||||
if_printf(ifp, "TDMA not supported\n");
|
||||
return EOPNOTSUPP;
|
||||
}
|
||||
#if __FreeBSD_version >= 1000020
|
||||
vap = ic->ic_vap_create(ic, wlanname, unit,
|
||||
cp.icp_opmode, cp.icp_flags, cp.icp_bssid,
|
||||
cp.icp_flags & IEEE80211_CLONE_MACADDR ?
|
||||
cp.icp_macaddr : (const uint8_t *)IF_LLADDR(ifp));
|
||||
#else
|
||||
vap = ic->ic_vap_create(ic, ifc->ifc_name, unit,
|
||||
cp.icp_opmode, cp.icp_flags, cp.icp_bssid,
|
||||
cp.icp_flags & IEEE80211_CLONE_MACADDR ?
|
||||
cp.icp_macaddr : (const uint8_t *)IF_LLADDR(ifp));
|
||||
|
||||
#endif
|
||||
|
||||
return (vap == NULL ? EIO : 0);
|
||||
}
|
||||
@ -161,19 +151,11 @@ wlan_clone_destroy(struct ifnet *ifp)
|
||||
ic->ic_vap_delete(vap);
|
||||
}
|
||||
|
||||
#if __FreeBSD_version < 1000020
|
||||
IFC_SIMPLE_DECLARE(wlan, 0);
|
||||
#endif
|
||||
|
||||
void
|
||||
ieee80211_vap_destroy(struct ieee80211vap *vap)
|
||||
{
|
||||
CURVNET_SET(vap->iv_ifp->if_vnet);
|
||||
#if __FreeBSD_version >= 1000020
|
||||
if_clone_destroyif(wlan_cloner, vap->iv_ifp);
|
||||
#else
|
||||
if_clone_destroyif(&wlan_cloner, vap->iv_ifp);
|
||||
#endif
|
||||
CURVNET_RESTORE();
|
||||
}
|
||||
|
||||
@ -891,21 +873,13 @@ wlan_modevent(module_t mod, int type, void *unused)
|
||||
bpf_track, 0, EVENTHANDLER_PRI_ANY);
|
||||
wlan_ifllevent = EVENTHANDLER_REGISTER(iflladdr_event,
|
||||
wlan_iflladdr, NULL, EVENTHANDLER_PRI_ANY);
|
||||
#if __FreeBSD_version >= 1000020
|
||||
wlan_cloner = if_clone_simple(wlanname, wlan_clone_create,
|
||||
wlan_clone_destroy, 0);
|
||||
#else
|
||||
if_clone_attach(&wlan_cloner);
|
||||
#endif
|
||||
if_register_com_alloc(IFT_IEEE80211, wlan_alloc, wlan_free);
|
||||
return 0;
|
||||
case MOD_UNLOAD:
|
||||
if_deregister_com_alloc(IFT_IEEE80211);
|
||||
#if __FreeBSD_version >= 1000020
|
||||
if_clone_detach(wlan_cloner);
|
||||
#else
|
||||
if_clone_detach(&wlan_cloner);
|
||||
#endif
|
||||
EVENTHANDLER_DEREGISTER(bpf_track, wlan_bpfevent);
|
||||
EVENTHANDLER_DEREGISTER(iflladdr_event, wlan_ifllevent);
|
||||
return 0;
|
||||
@ -914,11 +888,7 @@ wlan_modevent(module_t mod, int type, void *unused)
|
||||
}
|
||||
|
||||
static moduledata_t wlan_mod = {
|
||||
#if __FreeBSD_version >= 1000020
|
||||
wlanname,
|
||||
#else
|
||||
"wlan",
|
||||
#endif
|
||||
wlan_modevent,
|
||||
0
|
||||
};
|
||||
|
@ -234,21 +234,9 @@ struct mbuf *ieee80211_getmgtframe(uint8_t **frm, int headroom, int pktlen);
|
||||
#define M_FF M_PROTO6 /* fast frame */
|
||||
#define M_TXCB M_PROTO7 /* do tx complete callback */
|
||||
#define M_AMPDU_MPDU M_PROTO8 /* ok for A-MPDU aggregation */
|
||||
|
||||
/*
|
||||
* FreeBSD-HEAD from 1000046 retired M_*FRAG* flags and turned them
|
||||
* into header flags instead. So, we use the new protocol-specific
|
||||
* flags.
|
||||
*
|
||||
* Earlier FreeBSD versions overload M_FRAG, M_FIRSTFRAG and M_LASTFRAG.
|
||||
*
|
||||
* XXX TODO: rename these fields so there are no namespace clashes!
|
||||
*/
|
||||
#if __FreeBSD_version >= 1000046
|
||||
#define M_FRAG M_PROTO9 /* frame fragmentation */
|
||||
#define M_FIRSTFRAG M_PROTO10 /* first frame fragment */
|
||||
#define M_LASTFRAG M_PROTO11 /* last frame fragment */
|
||||
#endif
|
||||
|
||||
#define M_80211_TX \
|
||||
(M_ENCAP|M_EAPOL|M_PWR_SAV|M_MORE_DATA|M_FF|M_TXCB| \
|
||||
@ -262,18 +250,10 @@ struct mbuf *ieee80211_getmgtframe(uint8_t **frm, int headroom, int pktlen);
|
||||
#endif
|
||||
#define M_80211_RX (M_AMPDU|M_WEP|M_AMPDU_MPDU)
|
||||
|
||||
#if __FreeBSD_version >= 1000046
|
||||
#define IEEE80211_MBUF_TX_FLAG_BITS \
|
||||
M_FLAG_BITS \
|
||||
"\15M_ENCAP\17M_EAPOL\20M_PWR_SAV\21M_MORE_DATA\22M_FF\23M_TXCB" \
|
||||
"\24M_AMPDU_MPDU\25M_FRAG\26M_FIRSTFRAG\27M_LASTFRAG"
|
||||
#else
|
||||
/* There aren't any flag bits available for versions before this */
|
||||
/* XXX TODO: implement M_FLAG_BITS for this! */
|
||||
#define IEEE80211_MBUF_TX_FLAG_BITS \
|
||||
"\15M_ENCAP\17M_EAPOL\20M_PWR_SAV\21M_MORE_DATA\22M_FF\23M_TXCB" \
|
||||
"\24M_AMPDU_MPDU"
|
||||
#endif
|
||||
|
||||
#define IEEE80211_MBUF_RX_FLAG_BITS \
|
||||
M_FLAG_BITS \
|
||||
|
@ -357,12 +357,8 @@ hostap_deliver_data(struct ieee80211vap *vap,
|
||||
struct ifnet *ifp = vap->iv_ifp;
|
||||
|
||||
/* clear driver/net80211 flags before passing up */
|
||||
#if __FreeBSD_version >= 1000046
|
||||
m->m_flags &= ~(M_MCAST | M_BCAST);
|
||||
m_clrprotoflags(m);
|
||||
#else
|
||||
m->m_flags &= ~(M_80211_RX | M_MCAST | M_BCAST);
|
||||
#endif
|
||||
|
||||
KASSERT(vap->iv_opmode == IEEE80211_M_HOSTAP,
|
||||
("gack, opmode %d", vap->iv_opmode));
|
||||
|
@ -253,9 +253,7 @@ ieee80211_deliver_data(struct ieee80211vap *vap,
|
||||
|
||||
/* clear driver/net80211 flags before passing up */
|
||||
m->m_flags &= ~(M_MCAST | M_BCAST);
|
||||
#if __FreeBSD_version >= 1000046
|
||||
m_clrprotoflags(m);
|
||||
#endif
|
||||
|
||||
/* NB: see hostap_deliver_data, this path doesn't handle hostap */
|
||||
KASSERT(vap->iv_opmode != IEEE80211_M_HOSTAP, ("gack, hostap"));
|
||||
|
@ -516,15 +516,9 @@ ieee80211_raw_output(struct ieee80211vap *vap, struct ieee80211_node *ni,
|
||||
* connect bpf write calls to the 802.11 layer for injecting
|
||||
* raw 802.11 frames.
|
||||
*/
|
||||
#if __FreeBSD_version >= 1000031
|
||||
int
|
||||
ieee80211_output(struct ifnet *ifp, struct mbuf *m,
|
||||
const struct sockaddr *dst, struct route *ro)
|
||||
#else
|
||||
int
|
||||
ieee80211_output(struct ifnet *ifp, struct mbuf *m,
|
||||
struct sockaddr *dst, struct route *ro)
|
||||
#endif
|
||||
{
|
||||
#define senderr(e) do { error = (e); goto bad;} while (0)
|
||||
struct ieee80211_node *ni = NULL;
|
||||
|
@ -101,13 +101,8 @@ int ieee80211_mgmt_output(struct ieee80211_node *, struct mbuf *, int,
|
||||
struct ieee80211_bpf_params *);
|
||||
int ieee80211_raw_xmit(struct ieee80211_node *, struct mbuf *,
|
||||
const struct ieee80211_bpf_params *);
|
||||
#if __FreeBSD_version >= 1000031
|
||||
int ieee80211_output(struct ifnet *, struct mbuf *,
|
||||
const struct sockaddr *, struct route *ro);
|
||||
#else
|
||||
int ieee80211_output(struct ifnet *, struct mbuf *,
|
||||
struct sockaddr *, struct route *ro);
|
||||
#endif
|
||||
int ieee80211_vap_pkt_send_dest(struct ieee80211vap *, struct mbuf *,
|
||||
struct ieee80211_node *);
|
||||
int ieee80211_raw_output(struct ieee80211vap *, struct ieee80211_node *,
|
||||
|
@ -502,13 +502,8 @@ struct ieee80211vap {
|
||||
int (*iv_newstate)(struct ieee80211vap *,
|
||||
enum ieee80211_state, int);
|
||||
/* 802.3 output method for raw frame xmit */
|
||||
#if __FreeBSD_version >= 1000031
|
||||
int (*iv_output)(struct ifnet *, struct mbuf *,
|
||||
const struct sockaddr *, struct route *);
|
||||
#else
|
||||
int (*iv_output)(struct ifnet *, struct mbuf *,
|
||||
struct sockaddr *, struct route *);
|
||||
#endif
|
||||
uint64_t iv_spare[6];
|
||||
};
|
||||
MALLOC_DECLARE(M_80211_VAP);
|
||||
|
Loading…
Reference in New Issue
Block a user