Search Linux Wireless

Re: [RFC-PATCH] mac80211: add helpers for skb manipulation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2008-06-22 at 16:18 +0200, Ivo van Doorn wrote:
> > diff --git a/net/mac80211/util.c b/net/mac80211/util.c
> > index ce62b16..493ce19 100644
> > --- a/net/mac80211/util.c
> > +++ b/net/mac80211/util.c
> > @@ -176,6 +176,40 @@ unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb)
> >  }
> >  EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
> >  
> > +unsigned int
> > +ieee80211_hdrlen_check_skb(const struct sk_buff *skb, unsigned int slack)
> > +{
> > +	const struct ieee80211_hdr *hdr;
> > +	unsigned int hdrlen;
> > +
> > +	hdr = (const struct ieee80211_hdr *)skb->data;
> > +	hdrlen = ieee80211_hdrlen(hdr->frame_control);
> 
> 	hdrlen = ieee80211_get_hdrlen_from_skb(skb);
> 
> That way you don't need the  const struct ieee80211_hdr *hdr variable.
> 

The problem is that ieee80211_get_hdrlen_from_skb returns 0 if the skb
is too short for the ieee80211_hdr...which is precisely what I'm
interested in with this helper (plus some slack).

So instead of checking for the length of the skb once in ...from_skb
and then again with some slack, I'm opencoding it here and just checking
the skb->len once against hdrlen + slack.


Cheers,

Harvey

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux