All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] packetspammer: few updates
@ 2010-04-08 20:13 Luis R. Rodriguez
  2010-04-08 20:13 ` [PATCH 1/2] packetspammer: update with the upstream radiotap header Luis R. Rodriguez
  2010-04-08 20:13 ` [PATCH 2/2] packetspammer: add frame count option Luis R. Rodriguez
  0 siblings, 2 replies; 3+ messages in thread
From: Luis R. Rodriguez @ 2010-04-08 20:13 UTC (permalink / raw)
  To: andy; +Cc: linux-wireless, Luis R. Rodriguez

While testing TX with focus on trying to avoid resets on AR9003
this minor change was useful. Unfortunately I never saw the frame
on the air even with AR92980, curious if anyone does see frames
generated by packetspammer on the air.

Luis R. Rodriguez (2):
  packetspammer:: update with the upstream radiotap header
  packetspammer: add frame count option

 ieee80211_radiotap.h |   27 +++++++++++----------------
 packetspammer.c      |   27 ++++++++++++++++++++++++---
 2 files changed, 35 insertions(+), 19 deletions(-)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] packetspammer: update with the upstream radiotap header
  2010-04-08 20:13 [PATCH 0/2] packetspammer: few updates Luis R. Rodriguez
@ 2010-04-08 20:13 ` Luis R. Rodriguez
  2010-04-08 20:13 ` [PATCH 2/2] packetspammer: add frame count option Luis R. Rodriguez
  1 sibling, 0 replies; 3+ messages in thread
From: Luis R. Rodriguez @ 2010-04-08 20:13 UTC (permalink / raw)
  To: andy; +Cc: linux-wireless, Luis R. Rodriguez

Skip the unaligned stuff, I'm too lazy to get that to compile
properly with older systems.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 ieee80211_radiotap.h |   27 +++++++++++----------------
 1 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/ieee80211_radiotap.h b/ieee80211_radiotap.h
index 44024a3..6d36832 100644
--- a/ieee80211_radiotap.h
+++ b/ieee80211_radiotap.h
@@ -1,7 +1,4 @@
-/* $FreeBSD: src/sys/net80211/ieee80211_radiotap.h,v 1.5 2005/01/22 20:12:05 sam Exp $ */
-/* $NetBSD: ieee80211_radiotap.h,v 1.11 2005/06/22 06:16:02 dyoung Exp $ */
-
-/*-
+/*
  * Copyright (c) 2003, 2004 David Young.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -41,8 +38,6 @@
 #include <linux/if_ether.h>
 #include <linux/kernel.h>
 
-/* Radiotap header version (from official NetBSD feed) */
-#define IEEE80211RADIOTAP_VERSION	"1.5"
 /* Base version of the radiotap packet header data */
 #define PKTHDR_RADIOTAP_VERSION		0
 
@@ -61,12 +56,8 @@
  * readers.
  */
 
-/* XXX tcpdump/libpcap do not tolerate variable-length headers,
- * yet, so we pad every radiotap header to 64 bytes. Ugh.
- */
-#define IEEE80211_RADIOTAP_HDRLEN	64
-
-/* The radio capture header precedes the 802.11 header.
+/*
+ * The radio capture header precedes the 802.11 header.
  * All data in the header is little endian on all platforms.
  */
 struct ieee80211_radiotap_header {
@@ -88,9 +79,7 @@ struct ieee80211_radiotap_header {
 				 * Additional extensions are made
 				 * by setting bit 31.
 				 */
-};
-
-#define IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK 0x80000000
+} __packed;
 
 /* Name                                 Data type    Units
  * ----                                 ---------    -----
@@ -208,6 +197,10 @@ enum ieee80211_radiotap_type {
 	IEEE80211_RADIOTAP_TX_FLAGS = 15,
 	IEEE80211_RADIOTAP_RTS_RETRIES = 16,
 	IEEE80211_RADIOTAP_DATA_RETRIES = 17,
+
+	/* valid in every it_present bitmap, even vendor namespaces */
+	IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
+	IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30,
 	IEEE80211_RADIOTAP_EXT = 31
 };
 
@@ -240,8 +233,10 @@ enum ieee80211_radiotap_type {
 						 * 802.11 header and payload
 						 * (to 32-bit boundary)
 						 */
+#define IEEE80211_RADIOTAP_F_BADFCS	0x40	/* bad FCS */
+
 /* For IEEE80211_RADIOTAP_RX_FLAGS */
-#define IEEE80211_RADIOTAP_F_RX_BADFCS	0x0001	/* frame failed crc check */
+#define IEEE80211_RADIOTAP_F_RX_BADPLCP	0x0002	/* frame has bad PLCP */
 
 /* For IEEE80211_RADIOTAP_TX_FLAGS */
 #define IEEE80211_RADIOTAP_F_TX_FAIL	0x0001	/* failed due to excessive
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] packetspammer: add frame count option
  2010-04-08 20:13 [PATCH 0/2] packetspammer: few updates Luis R. Rodriguez
  2010-04-08 20:13 ` [PATCH 1/2] packetspammer: update with the upstream radiotap header Luis R. Rodriguez
@ 2010-04-08 20:13 ` Luis R. Rodriguez
  1 sibling, 0 replies; 3+ messages in thread
From: Luis R. Rodriguez @ 2010-04-08 20:13 UTC (permalink / raw)
  To: andy; +Cc: linux-wireless, Luis R. Rodriguez

This allows you to specify the number of frames you want to TX
from the command line.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 packetspammer.c |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/packetspammer.c b/packetspammer.c
index b7a1367..d068fbe 100644
--- a/packetspammer.c
+++ b/packetspammer.c
@@ -20,6 +20,7 @@
 
 #include "packetspammer.h"
 #include "radiotap.h"
+#include <stdbool.h>
 
 /* wifi bitrate to use in 500kHz units */
 
@@ -143,6 +144,7 @@ usage(void)
 	    "\n"
 	    "Usage: packetspammer [options] <interface>\n\nOptions\n"
 	    "-d/--delay <delay> Delay between packets\n\n"
+	    "-c/--frame-count <frame-count> Number of frames to transmit\n\n"
 	    "-f/--fcs           Mark as having FCS (CRC) already\n"
 	    "                   (pkt ends with 4 x sacrificial - chars)\n"
 	    "Example:\n"
@@ -162,13 +164,14 @@ main(int argc, char *argv[])
 	u8 u8aSendBuffer[500];
 	char szErrbuf[PCAP_ERRBUF_SIZE];
 	int nCaptureHeaderLength = 0, n80211HeaderLength = 0, nLinkEncap = 0;
-	int nOrdinal = 0, r, nDelay = 100000;
+	int nOrdinal = 0, r, nDelay = 100000, num_frames = 0, frame_num = 0;
 	int nRateIndex = 0, retval, bytes;
 	pcap_t *ppcap = NULL;
 	struct bpf_program bpfprogram;
 	char * szProgram = "", fBrokenSocket = 0;
 	u16 u16HeaderLen;
 	char szHostname[PATH_MAX];
+	bool count = false;
 
 	if (gethostname(szHostname, sizeof (szHostname) - 1)) {
 		perror("unable to get hostname");
@@ -182,11 +185,12 @@ main(int argc, char *argv[])
 		int nOptionIndex;
 		static const struct option optiona[] = {
 			{ "delay", required_argument, NULL, 'd' },
+			{ "frame-count", required_argument, NULL, 'c' },
 			{ "fcs", no_argument, &flagMarkWithFCS, 1 },
 			{ "help", no_argument, &flagHelp, 1 },
 			{ 0, 0, 0, 0 }
 		};
-		int c = getopt_long(argc, argv, "d:hf",
+		int c = getopt_long(argc, argv, "d:c:hf",
 			optiona, &nOptionIndex);
 
 		if (c == -1)
@@ -206,6 +210,15 @@ main(int argc, char *argv[])
 			flagMarkWithFCS = 1;
 			break;
 
+		case 'c': // count
+			num_frames = atoi(optarg);
+			if (num_frames > 0) {
+				count = true;
+				frame_num = 1;
+			}
+			break;
+
+
 		default:
 			printf("unknown switch %c\n", c);
 			usage();
@@ -269,10 +282,12 @@ main(int argc, char *argv[])
 	pcap_setnonblock(ppcap, 1, szErrbuf);
 
 	printf("   (delay between packets %dus)\n", nDelay);
+	if (count)
+		printf("   (number of frames to transmit: %d)\n", num_frames);
 
 	memset(u8aSendBuffer, 0, sizeof (u8aSendBuffer));
 
-	while (!fBrokenSocket) {
+	while (!fBrokenSocket && (!count || (count && num_frames > 0))) {
 		u8 * pu8 = u8aSendBuffer;
 		struct pcap_pkthdr * ppcapPacketHeader = NULL;
 		struct ieee80211_radiotap_iterator rti;
@@ -281,6 +296,8 @@ main(int argc, char *argv[])
 		int n, nRate;
 
 		// receive
+		if (count)
+			printf("Frame #%d:\n", frame_num);
 
 		retval = pcap_next_ex(ppcap, &ppcapPacketHeader,
 		    (const u_char**)&pu8Payload);
@@ -378,8 +395,12 @@ main(int argc, char *argv[])
 			perror("Trouble injecting packet");
 			return (1);
 		}
+
 		if (nDelay)
 			usleep(nDelay);
+
+		num_frames--;
+		frame_num++;
 	}
 
 
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-04-08 20:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-08 20:13 [PATCH 0/2] packetspammer: few updates Luis R. Rodriguez
2010-04-08 20:13 ` [PATCH 1/2] packetspammer: update with the upstream radiotap header Luis R. Rodriguez
2010-04-08 20:13 ` [PATCH 2/2] packetspammer: add frame count option Luis R. Rodriguez

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.