aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ipw2200.h
diff options
context:
space:
mode:
authorZhu Yi <yi.zhu@intel.com>2006-04-13 05:20:27 -0400
committerJohn W. Linville <linville@tuxdriver.com>2006-04-24 16:15:56 -0400
commitd685b8c226727bf5db907c7241f55461e7f1f008 (patch)
tree698e2194daef4c065ccbfd22802e7214caf6ea93 /drivers/net/wireless/ipw2200.h
parentc6c33a779dfe7aa8254be4da08c217914f1390a0 (diff)
[PATCH] ipw2200: Enable rtap interface for RF promiscuous mode while associated
With this patch, a new promiscuous mode is enabled. If the module is loaded with the rtap_iface=1 module parameter, two interfaces will be created (instead of just one). The second interface is prefixed 'rtap' and provides received 802.11 frames on the current channel to user space in a radiotap header format. Example usage: % modprobe ipw2200 rtap_iface=1 % iwconfig eth1 essid MyNetwork % dhcpcd eth1 % tcpdump -i rtap0 If you do not specify 'rtap_iface=1' then the rtap interface will not be created and you will need to turn it on via: % echo 1 > /sys/bus/pci/drivers/ipw2200/*/rtap_iface You can filter out what type of information is passed to user space via the rtap_filter sysfs entry. Currently you can tell the driver to transmit just the headers (which will provide the RADIOTAP and IEEE 802.11 header but not the payload), to filter based on frame control type (Management, Control, or Data), and whether to report transmitted frames, received frames, or both. The transmit frame reporting is based on a patch by Stefan Rompf. Filters can be get and set via a sysfs interface. For example, set the filter to only send headers (0x7), don't report Tx'd frames (0x10), and don't report data frames (0x100): % echo 0x117 > /sys/bus/pci/drivers/ipw2200/*/rtap_filter All your packets are belong to us: % tethereal -n -i rtap0 Signed-off-by: James Ketrenos <jketreno@linux.intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ipw2200.h')
-rw-r--r--drivers/net/wireless/ipw2200.h77
1 files changed, 76 insertions, 1 deletions
diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h
index 1f2cab3f9944..14fe79abca67 100644
--- a/drivers/net/wireless/ipw2200.h
+++ b/drivers/net/wireless/ipw2200.h
@@ -789,7 +789,7 @@ struct ipw_sys_config {
789 u8 bt_coexist_collision_thr; 789 u8 bt_coexist_collision_thr;
790 u8 silence_threshold; 790 u8 silence_threshold;
791 u8 accept_all_mgmt_bcpr; 791 u8 accept_all_mgmt_bcpr;
792 u8 accept_all_mgtm_frames; 792 u8 accept_all_mgmt_frames;
793 u8 pass_noise_stats_to_host; 793 u8 pass_noise_stats_to_host;
794 u8 reserved3; 794 u8 reserved3;
795} __attribute__ ((packed)); 795} __attribute__ ((packed));
@@ -1122,6 +1122,52 @@ struct ipw_fw_error {
1122 u8 payload[0]; 1122 u8 payload[0];
1123} __attribute__ ((packed)); 1123} __attribute__ ((packed));
1124 1124
1125#ifdef CONFIG_IPW2200_PROMISCUOUS
1126
1127enum ipw_prom_filter {
1128 IPW_PROM_CTL_HEADER_ONLY = (1 << 0),
1129 IPW_PROM_MGMT_HEADER_ONLY = (1 << 1),
1130 IPW_PROM_DATA_HEADER_ONLY = (1 << 2),
1131 IPW_PROM_ALL_HEADER_ONLY = 0xf, /* bits 0..3 */
1132 IPW_PROM_NO_TX = (1 << 4),
1133 IPW_PROM_NO_RX = (1 << 5),
1134 IPW_PROM_NO_CTL = (1 << 6),
1135 IPW_PROM_NO_MGMT = (1 << 7),
1136 IPW_PROM_NO_DATA = (1 << 8),
1137};
1138
1139struct ipw_priv;
1140struct ipw_prom_priv {
1141 struct ipw_priv *priv;
1142 struct ieee80211_device *ieee;
1143 enum ipw_prom_filter filter;
1144 int tx_packets;
1145 int rx_packets;
1146};
1147#endif
1148
1149#if defined(CONFIG_IEEE80211_RADIOTAP) || defined(CONFIG_IPW2200_PROMISCUOUS)
1150/* Magic struct that slots into the radiotap header -- no reason
1151 * to build this manually element by element, we can write it much
1152 * more efficiently than we can parse it. ORDER MATTERS HERE
1153 *
1154 * When sent to us via the simulated Rx interface in sysfs, the entire
1155 * structure is provided regardless of any bits unset.
1156 */
1157struct ipw_rt_hdr {
1158 struct ieee80211_radiotap_header rt_hdr;
1159 u64 rt_tsf; /* TSF */
1160 u8 rt_flags; /* radiotap packet flags */
1161 u8 rt_rate; /* rate in 500kb/s */
1162 u16 rt_channel; /* channel in mhz */
1163 u16 rt_chbitmask; /* channel bitfield */
1164 s8 rt_dbmsignal; /* signal in dbM, kluged to signed */
1165 s8 rt_dbmnoise;
1166 u8 rt_antenna; /* antenna number */
1167 u8 payload[0]; /* payload... */
1168} __attribute__ ((packed));
1169#endif
1170
1125struct ipw_priv { 1171struct ipw_priv {
1126 /* ieee device used by generic ieee processing code */ 1172 /* ieee device used by generic ieee processing code */
1127 struct ieee80211_device *ieee; 1173 struct ieee80211_device *ieee;
@@ -1133,6 +1179,12 @@ struct ipw_priv {
1133 struct pci_dev *pci_dev; 1179 struct pci_dev *pci_dev;
1134 struct net_device *net_dev; 1180 struct net_device *net_dev;
1135 1181
1182#ifdef CONFIG_IPW2200_PROMISCUOUS
1183 /* Promiscuous mode */
1184 struct ipw_prom_priv *prom_priv;
1185 struct net_device *prom_net_dev;
1186#endif
1187
1136 /* pci hardware address support */ 1188 /* pci hardware address support */
1137 void __iomem *hw_base; 1189 void __iomem *hw_base;
1138 unsigned long hw_len; 1190 unsigned long hw_len;
@@ -1306,6 +1358,29 @@ struct ipw_priv {
1306 1358
1307/* debug macros */ 1359/* debug macros */
1308 1360
1361/* Debug and printf string expansion helpers for printing bitfields */
1362#define BIT_FMT8 "%c%c%c%c-%c%c%c%c"
1363#define BIT_FMT16 BIT_FMT8 ":" BIT_FMT8
1364#define BIT_FMT32 BIT_FMT16 " " BIT_FMT16
1365
1366#define BITC(x,y) (((x>>y)&1)?'1':'0')
1367#define BIT_ARG8(x) \
1368BITC(x,7),BITC(x,6),BITC(x,5),BITC(x,4),\
1369BITC(x,3),BITC(x,2),BITC(x,1),BITC(x,0)
1370
1371#define BIT_ARG16(x) \
1372BITC(x,15),BITC(x,14),BITC(x,13),BITC(x,12),\
1373BITC(x,11),BITC(x,10),BITC(x,9),BITC(x,8),\
1374BIT_ARG8(x)
1375
1376#define BIT_ARG32(x) \
1377BITC(x,31),BITC(x,30),BITC(x,29),BITC(x,28),\
1378BITC(x,27),BITC(x,26),BITC(x,25),BITC(x,24),\
1379BITC(x,23),BITC(x,22),BITC(x,21),BITC(x,20),\
1380BITC(x,19),BITC(x,18),BITC(x,17),BITC(x,16),\
1381BIT_ARG16(x)
1382
1383
1309#ifdef CONFIG_IPW2200_DEBUG 1384#ifdef CONFIG_IPW2200_DEBUG
1310#define IPW_DEBUG(level, fmt, args...) \ 1385#define IPW_DEBUG(level, fmt, args...) \
1311do { if (ipw_debug_level & (level)) \ 1386do { if (ipw_debug_level & (level)) \