From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Marek Lindner <lindner_marek@yahoo.de>
Subject: Re: [B.A.T.M.A.N.] [PATCH] batctl: add raw wifi packet decapsulation support
Date: Wed, 26 Jan 2011 16:02:32 +0100 [thread overview]
Message-ID: <201101261602.38873.sven@narfation.org> (raw)
In-Reply-To: <1296052208-6041-1-git-send-email-lindner_marek@yahoo.de>
[-- Attachment #1: Type: Text/Plain, Size: 1655 bytes --]
On Wednesday 26 January 2011 15:30:08 Marek Lindner wrote:
> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
> ---
> + buff_len -= PRISM_HEADER_LEN;
> + packet_buff += PRISM_HEADER_LEN;
> +
> + /* we assume a minimum size of 38 bytes
> + * (802.11 data frame + LLC)
> + * before we calculate the real size */
> + if (buff_len <= 38)
> + return;
> +
> + wifi_hdr = (struct ieee80211_hdr *)packet_buff;
> + fc = wifi_hdr->frame_control;
> +
> + /* not carrying payload */
> + if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA)
> + return;
Didn't we say yesterday that we must either use ntohs or only read the first
byte of the framecontrol? The last option which comes to my mind is to define
IEEE80211_FCTL_FTYPE and IEEE80211_FTYPE_DATA for big and little endian
independently.
The same for
IEEE80211_FCTL_TODS 0x0100
IEEE80211_FCTL_FROMDS 0x0200
IEEE80211_FCTL_PROTECTED 0x4000
IEEE80211_STYPE_QOS_DATA 0x0080
Your current version should only work on little endian systems. I would
suggest following version:
#define IEEE80211_FCTL_FTYPE 0x0c00
#define IEEE80211_FTYPE_DATA 0x0800
#define IEEE80211_FCTL_TODS 0x0001
#define IEEE80211_FCTL_FROMDS 0x0002
#define IEEE80211_FCTL_PROTECTED 0x0040
#define IEEE80211_STYPE_QOS_DATA 0x8000
fc = ntohs(wifi_hdr->frame_control);
> + if (fc & IEEE80211_STYPE_QOS_DATA)
> + hdr_len += 2;
Here are you testing only on bit. Are you sure that the other 3 bits aren't
interesting? At least one combination isn't well defined by the 802.11
standard from 2007 and some others are null data types.
Best regards,
Sven
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2011-01-26 15:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-26 14:30 [B.A.T.M.A.N.] [PATCH] batctl: add raw wifi packet decapsulation support Marek Lindner
2011-01-26 15:02 ` Sven Eckelmann [this message]
2011-01-27 12:37 ` Marek Lindner
2011-01-26 15:41 ` Andrew Lunn
2011-01-27 12:27 ` Marek Lindner
2011-01-28 17:24 ` Andrew Lunn
2011-01-28 20:14 ` Marek Lindner
2011-01-29 16:16 ` [B.A.T.M.A.N.] [PATCHv2] " Marek Lindner
2011-02-01 22:08 ` Marek Lindner
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=201101261602.38873.sven@narfation.org \
--to=sven@narfation.org \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=lindner_marek@yahoo.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.