linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: andy@warmcat.com
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH 4/4] mac80211: Monitor mode radiotap-based packet  injection
Date: Wed, 21 Mar 2007 19:28:53 +0100	[thread overview]
Message-ID: <1174501733.3944.28.camel@johannes.berg> (raw)
In-Reply-To: <20070320104104.837354764@warmcat.com>

[-- Attachment #1: Type: text/plain, Size: 2371 bytes --]

On Tue, 2007-03-20 at 10:39 +0000, andy@warmcat.com wrote:

> --- a/net/mac80211/ieee80211.c
> +++ b/net/mac80211/ieee80211.c
> @@ -1054,7 +1054,180 @@ ieee80211_tx_h_ps_buf(struct ieee80211_txrx_data *tx)
>  }
>  
> 
> -static void inline
> +/* deal with packet injection down monitor interface
> + * with Radiotap Header -- only called for monitor mode interface
> + */
> +
> +static ieee80211_txrx_result
> +__ieee80211_convert_radiotap_to_control_and_remove(
> +	struct ieee80211_txrx_data *tx,
> +	struct sk_buff *skb, struct ieee80211_tx_control *control)
> +{

The actual parsing should live in cfg80211 (preferably in a new file) so
that others can use it. If it's a lot of code then add a new invisible
Kconfig symbol for it that drivers/stacks can select.

> +	 * There is also some pervacious arg padding, so that args

perwhat?

> +	static const u8 radiotap_entry_sizes[] = {
> +		8, /* IEEE80211_RADIOTAP_TSFT */
> +		1, /* IEEE80211_RADIOTAP_FLAGS */
[...]

I'd prefer C99 style for this.

> +		return TXRX_DROP; /* version byte as magic */

Bad idea. At least the comment. If you mean "drop the packet if it has a
radiotap version we don't parse" then say so.

> +	if (le32_to_cpu(rthdr->it_present) & 0x80000000) {
> +		while (le32_to_cpu(*((u32 *)tap_arg)) & 0x80000000)

Use a constant for that, introduce one if necessary.

> +	control->key_idx = -1; /* no encryption key */

Is there any way to indicate encryption? I think there might need to be
for 802.11w.

> +	control->flags &= ~(IEEE80211_TXCTL_USE_RTS_CTS |
> +		IEEE80211_TXCTL_USE_CTS_PROTECT);

These really should be selectable as well.

> +	control->flags |= (IEEE80211_TXCTL_DO_NOT_ENCRYPT |
> +		IEEE80211_TXCTL_NO_ACK);

And NO_ACK is a really really totally bad idea for a userspace MLME.
Needs to be selectable for sure.

We also need to be able to assign some magic cookie to a packet that we
get back along with the packet so that we know when the injected packet
has been acked by the peer.

> +	/* remove the radiotap header */
> +	skb_pull(skb, le16_to_cpu(rthdr->it_len));

Shouldn't there be some sort of sanity check here so we don't pull too
much if userspace asks us to?

> +			/* radiotap version used as magic */

Same comment as above, there's nothing magic about the radiotap version.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

  reply	other threads:[~2007-03-22 10:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-20 10:39 [PATCH 0/4] Try #5: Radiotap on Monitor Mode interfaces for rx and tx andy
2007-03-20 10:39 ` [PATCH 1/4] mac80211: Coding style cleanups andy
2007-03-21 18:58   ` Johannes Berg
2007-03-29 11:17     ` Andy Green
2007-03-20 10:39 ` [PATCH 2/4] mac80211: Add radiotap support for Monitor mode RX andy
2007-03-21 18:51   ` Johannes Berg
2007-03-22 23:18     ` Michael Wu
2007-03-23 13:44       ` Johannes Berg
2007-03-20 10:39 ` [PATCH 3/4] mac80211: Monitor mode radiotap injection docs andy
2007-03-21 18:15   ` Johannes Berg
2007-03-29 11:18     ` Andy Green
2007-03-29 11:26       ` Johannes Berg
2007-03-20 10:39 ` [PATCH 4/4] mac80211: Monitor mode radiotap-based packet injection andy
2007-03-21 18:28   ` Johannes Berg [this message]
2007-03-29 11:14     ` Andy Green
2007-03-29 11:19       ` Johannes Berg
2007-03-29 11:33         ` Andy Green
2007-03-29 11:48           ` Johannes Berg
2007-03-21 18:10 ` [PATCH 0/4] Try #5: Radiotap on Monitor Mode interfaces for rx and tx Johannes Berg
2007-03-22 22:58   ` Michael Wu
2007-03-23 14:01     ` Johannes Berg
2007-03-23  8:57   ` Andy Green
2007-03-23 13:57     ` Johannes Berg
2007-03-21 18:46 ` Johannes Berg
2007-03-22 23:10   ` Michael Wu

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=1174501733.3944.28.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=andy@warmcat.com \
    --cc=linux-wireless@vger.kernel.org \
    /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).