Changeset View
Changeset View
Standalone View
Standalone View
sys/net80211/ieee80211_superg.c
Show First 20 Lines • Show All 267 Lines • ▼ Show 20 Lines | |||||
* Decap the encapsulated frame pair and dispatch the first | * Decap the encapsulated frame pair and dispatch the first | ||||
* for delivery. The second frame is returned for delivery | * for delivery. The second frame is returned for delivery | ||||
* via the normal path. | * via the normal path. | ||||
*/ | */ | ||||
struct mbuf * | struct mbuf * | ||||
ieee80211_ff_decap(struct ieee80211_node *ni, struct mbuf *m) | ieee80211_ff_decap(struct ieee80211_node *ni, struct mbuf *m) | ||||
{ | { | ||||
#define FF_LLC_SIZE (sizeof(struct ether_header) + sizeof(struct llc)) | #define FF_LLC_SIZE (sizeof(struct ether_header) + sizeof(struct llc)) | ||||
#define MS(x,f) (((x) & f) >> f##_S) | |||||
struct ieee80211vap *vap = ni->ni_vap; | struct ieee80211vap *vap = ni->ni_vap; | ||||
struct llc *llc; | struct llc *llc; | ||||
uint32_t ath; | uint32_t ath; | ||||
struct mbuf *n; | struct mbuf *n; | ||||
int framelen; | int framelen; | ||||
/* NB: we assume caller does this check for us */ | /* NB: we assume caller does this check for us */ | ||||
KASSERT(IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF), | KASSERT(IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF), | ||||
Show All 12 Lines | if (m->m_len < FF_LLC_SIZE && | ||||
return NULL; | return NULL; | ||||
} | } | ||||
llc = (struct llc *)(mtod(m, uint8_t *) + | llc = (struct llc *)(mtod(m, uint8_t *) + | ||||
sizeof(struct ether_header)); | sizeof(struct ether_header)); | ||||
if (llc->llc_snap.ether_type != htons(ATH_FF_ETH_TYPE)) | if (llc->llc_snap.ether_type != htons(ATH_FF_ETH_TYPE)) | ||||
return m; | return m; | ||||
m_adj(m, FF_LLC_SIZE); | m_adj(m, FF_LLC_SIZE); | ||||
m_copydata(m, 0, sizeof(uint32_t), (caddr_t) &ath); | m_copydata(m, 0, sizeof(uint32_t), (caddr_t) &ath); | ||||
if (MS(ath, ATH_FF_PROTO) != ATH_FF_PROTO_L2TUNNEL) { | if (_IEEE80211_MASKSHIFT(ath, ATH_FF_PROTO) != ATH_FF_PROTO_L2TUNNEL) { | ||||
IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, | IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, | ||||
ni->ni_macaddr, "fast-frame", | ni->ni_macaddr, "fast-frame", | ||||
"unsupport tunnel protocol, header 0x%x", ath); | "unsupport tunnel protocol, header 0x%x", ath); | ||||
vap->iv_stats.is_ff_badhdr++; | vap->iv_stats.is_ff_badhdr++; | ||||
m_freem(m); | m_freem(m); | ||||
return NULL; | return NULL; | ||||
} | } | ||||
/* NB: skip header and alignment padding */ | /* NB: skip header and alignment padding */ | ||||
Show All 32 Lines | #define FF_LLC_SIZE (sizeof(struct ether_header) + sizeof(struct llc)) | ||||
n = ieee80211_decap1(n, &framelen); | n = ieee80211_decap1(n, &framelen); | ||||
if (n == NULL) { | if (n == NULL) { | ||||
IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, | IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, | ||||
ni->ni_macaddr, "fast-frame", "%s", "second decap failed"); | ni->ni_macaddr, "fast-frame", "%s", "second decap failed"); | ||||
vap->iv_stats.is_ff_tooshort++; | vap->iv_stats.is_ff_tooshort++; | ||||
} | } | ||||
/* XXX verify framelen against mbuf contents */ | /* XXX verify framelen against mbuf contents */ | ||||
return n; /* 2nd delivered by caller */ | return n; /* 2nd delivered by caller */ | ||||
#undef MS | |||||
#undef FF_LLC_SIZE | #undef FF_LLC_SIZE | ||||
} | } | ||||
/* | /* | ||||
* Fast frame encapsulation. There must be two packets | * Fast frame encapsulation. There must be two packets | ||||
* chained with m_nextpkt. We do header adjustment for | * chained with m_nextpkt. We do header adjustment for | ||||
* each, add the tunnel encapsulation, and then concatenate | * each, add the tunnel encapsulation, and then concatenate | ||||
* the mbuf chains to form a single frame for transmission. | * the mbuf chains to form a single frame for transmission. | ||||
▲ Show 20 Lines • Show All 705 Lines • Show Last 20 Lines |