Search Linux Wireless

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

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

 



> 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;
>  }
>  

--
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