From: Ivo van Doorn <ivdoorn@gmail.com>
To: Harvey Harrison <harvey.harrison@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 16:18:47 +0200 [thread overview]
Message-ID: <200806221618.47366.IvDoorn@gmail.com> (raw)
In-Reply-To: <1213939944.6591.13.camel@brick>
> 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.
> + if (skb->len < hdrlen + slack)
> + return 0;
> + else
> + return hdrlen;
> +}
> +EXPORT_SYMBOL(ieee80211_hdrlen_check_skb);
> +
> +void ieee80211_skb_trim_iv_icv(struct sk_buff *skb,
> + unsigned int iv, unsigned int icv)
> +{
> + struct ieee80211_hdr *hdr;
> + unsigned int hdrlen;
> +
> + if (icv)
> + skb_trim(skb, skb->len - icv);
> +
> + if (iv) {
> + hdr = (struct ieee80211_hdr *)skb->data;
> + hdrlen = ieee80211_hdrlen(hdr->frame_control);
hdrlen = ieee80211_get_hdrlen_from_skb(skb);
> + memmove(skb->data + iv, skb->data, hdrlen);
> + skb_pull(skb, iv);
> + }
> +}
> +
> int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
> {
> int ae = meshhdr->flags & IEEE80211S_FLAGS_AE;
> diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
> index e7b6344..39bd9c9 100644
> --- a/net/mac80211/wep.c
> +++ b/net/mac80211/wep.c
> @@ -104,22 +104,6 @@ static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local,
> return newhdr + hdrlen;
> }
>
next prev parent reply other threads:[~2008-06-22 14:00 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 [this message]
2008-06-22 20:30 ` Harvey Harrison
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=200806221618.47366.IvDoorn@gmail.com \
--to=ivdoorn@gmail.com \
--cc=harvey.harrison@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).