From: Harvey Harrison <harvey.harrison@gmail.com>
To: Ivo van Doorn <ivdoorn@gmail.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
John Linville <linville@tuxdriver.com>,
linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [RFC-PATCH] mac80211: add helpers for skb manipulation
Date: Sun, 22 Jun 2008 13:30:07 -0700 [thread overview]
Message-ID: <1214166608.21092.5.camel@brick> (raw)
In-Reply-To: <200806221618.47366.IvDoorn@gmail.com>
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
prev parent reply other threads:[~2008-06-22 20:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-20 5:32 [RFC-PATCH] mac80211: add helpers for skb manipulation Harvey Harrison
2008-06-20 6:42 ` Johannes Berg
2008-06-22 14:18 ` Ivo van Doorn
2008-06-22 20:30 ` Harvey Harrison [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1214166608.21092.5.camel@brick \
--to=harvey.harrison@gmail.com \
--cc=ivdoorn@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).