linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: andy@warmcat.com
To: linux-wireless@vger.kernel.org
Subject: [PATCH 3/4] mac80211: Monitor mode radiotap injection docs
Date: Tue, 20 Mar 2007 10:39:58 +0000	[thread overview]
Message-ID: <20070320104104.575903961@warmcat.com> (raw)
In-Reply-To: 20070320103955.600509703@warmcat.com

From: Andy Green <andy@warmcat.com>


diff --git a/Documentation/networking/mac80211-injection.txt b/Documentation/networking/mac80211-injection.txt
new file mode 100644
index 0000000..bee8931
--- /dev/null
+++ b/Documentation/networking/mac80211-injection.txt
@@ -0,0 +1,77 @@
+How to use packet injection with mac80211
+=========================================
+
+mac80211 now allows arbitrary packets to be injected down any Monitor Mode
+interface from userland.  The packet you inject needs to be composed in the
+following format:
+
+ [ radiotap header  ]
+ [ ieee80211 header ]
+ [ payload ]
+
+Radiotap headers are variable-length and extensible, you can get most of the
+information you need to know on them from:
+
+./include/net/ieee80211_radiotap.h
+
+But note: all fields in the radiotap header are *little endian*.
+
+There is a fixed portion at the start which contains a u32 bitmap that defines
+if the possible argument is present or not.  At the moment there are only 13
+possible arguments defined, but in case we run out of space in the u32 it is
+defined that b31 set indicates that there is another u32 bitmap following, and
+the start of the arguments is moved forward 4 bytes each time.
+
+After the fixed part of the header, the arguments follow.
+
+ - the arguments are all little-endian!
+
+ - the arguments must be aligned to a boundary of the argument size using
+   padding.  So a u16 argument must start on the next u16 boundary if it isn't
+   already on one, a u32 must start on the next u32 boundary and so on.
+
+Despite 13 radiotap argument types are currently defined, most only make sense
+to appear on received packets.  Currently three kinds of argument are used by
+the injection code, although it knows to skip any other arguments that are
+present (facilitating replay of captured radiotap headers directly):
+
+ - IEEE80211_RADIOTAP_RATE - u8 arg in 500kbps units (0x02 --> 1Mbps)
+
+ - IEEE80211_RADIOTAP_ANTENNA - u8 arg, 0x00 = ant1, 0x01 = ant2
+
+ - IEEE80211_RADIOTAP_DBM_TX_POWER - u8 arg, dBm
+
+Here is an example valid radiotap header defining these three parameters
+
+	0x00, 0x00, // <-- radiotap version
+	0x0b, 0x00, // <- radiotap header length
+	0x04, 0x0c, 0x00, 0x00, // <-- bitmap
+	0x6c, // <-- rate
+	0x0c, //<-- tx power
+	0x01 //<-- antenna
+
+The ieee80211 header follows immediately afterwards, looking for example like
+this:
+
+	0x08, 0x01, 0x00, 0x00,
+	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+	0x13, 0x22, 0x33, 0x44, 0x55, 0x66,
+	0x13, 0x22, 0x33, 0x44, 0x55, 0x66,
+	0x10, 0x86
+
+Then lastly there is the payload.
+
+After composing the packet contents, it is sent by send()-ing it to a logical
+mac80211 interface that is in Monitor mode.  Libpcap can also be used,
+(which is easier than doing the work to bind the socket to the right
+interface), along the following lines:
+
+	ppcap = pcap_open_live(szInterfaceName, 800, 1, 20, szErrbuf);
+...
+	r = pcap_inject(ppcap, u8aSendBuffer, nLength);
+
+You can also find sources for a complete inject test applet here:
+
+http://penumbra.warmcat.com/_twk/tiki-index.php?page=packetspammer
+
+Andy Green <andy@warmcat.com>

-- 

  parent reply	other threads:[~2007-03-20 10:41 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 ` andy [this message]
2007-03-21 18:15   ` [PATCH 3/4] mac80211: Monitor mode radiotap injection docs 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
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=20070320104104.575903961@warmcat.com \
    --to=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).