mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
LinuxKPI: 802.11: implement ieee80211_get_hdrlen_from_skb()
Implement ieee80211_get_hdrlen_from_skb() doing basic sanity checks on lengths (minimal length or skb data length vs. header length). Sponsored by: The FreeBSD Foundation MFC after: 10 days
This commit is contained in:
parent
13d87d92e4
commit
3391199496
|
@ -1720,12 +1720,23 @@ ieee80211_get_channel(struct wiphy *wiphy, uint32_t freq)
|
|||
return (linuxkpi_ieee80211_get_channel(wiphy, freq));
|
||||
}
|
||||
|
||||
static __inline size_t
|
||||
static inline size_t
|
||||
ieee80211_get_hdrlen_from_skb(struct sk_buff *skb)
|
||||
{
|
||||
const struct ieee80211_hdr *hdr;
|
||||
size_t len;
|
||||
|
||||
TODO();
|
||||
return (-1);
|
||||
if (skb->len < 10) /* sizeof(ieee80211_frame_[ack,cts]) */
|
||||
return (0);
|
||||
|
||||
hdr = (const struct ieee80211_hdr *)skb->data;
|
||||
len = ieee80211_hdrlen(hdr->frame_control);
|
||||
|
||||
/* If larger than what is in the skb return. */
|
||||
if (len > skb->len)
|
||||
return (0);
|
||||
|
||||
return (len);
|
||||
}
|
||||
|
||||
static __inline bool
|
||||
|
|
Loading…
Reference in a new issue