mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-25 21:40:37 +02:00
remove obsolete and unmaintained packages, as soon as 2.6.17 is out, dscape and bcm43xx driver is integrated into mainstream
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@3773 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
a1d1cc5f82
commit
cd8d40b662
@ -6,8 +6,6 @@ package-y += base-files
|
||||
package-$(BR2_PACKAGE_KMOD_ALSA) += alsa
|
||||
package-$(BR2_PACKAGE_KMOD_FUSE) += fuse
|
||||
package-$(BR2_PACKAGE_KMOD_HOSTAP) += hostap
|
||||
package-$(BR2_PACKAGE_KMOD_BCM43XX_STANDALONE) += bcm43xx-standalone
|
||||
package-$(BR2_PACKAGE_KMOD_IEEE80211_DSCAPE) += ieee80211-dscape
|
||||
package-$(BR2_PACKAGE_KMOD_MADWIFI) += madwifi
|
||||
package-$(BR2_PACKAGE_KMOD_MADWIFI_OLD) += madwifi-old
|
||||
package-$(BR2_PACKAGE_KMOD_MINI_FO) += mini_fo
|
||||
@ -20,7 +18,6 @@ package-$(BR2_PACKAGE_KMOD_DIAG) += diag
|
||||
package-$(BR2_PACKAGE_KMOD_WLCOMPAT) += wlcompat
|
||||
package-$(BR2_PACKAGE_KMOD_ZD1211) += zd1211
|
||||
|
||||
bcm43xx-standalone-compile: ieee80211-dscape-compile
|
||||
wlcompat-compile: base-files-compile
|
||||
|
||||
all: compile install
|
||||
|
@ -1,12 +0,0 @@
|
||||
config BR2_PACKAGE_KMOD_BCM43XX_STANDALONE
|
||||
prompt "kmod-bcm43xx-standalone............... Free Broadcom 43xx wireless driver (devicescape stack)"
|
||||
tristate
|
||||
depends BR2_LINUX_2_6_BRCM
|
||||
select BR2_PACKAGE_KMOD_IEEE80211_DSCAPE
|
||||
default n
|
||||
help
|
||||
Free driver for the Broadcom 43xx wireless chipset
|
||||
This driver uses the DeviceScape 802.11 stack
|
||||
|
||||
http://bcm43xx.berlios.de
|
||||
|
@ -1,57 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include ../../rules.mk
|
||||
|
||||
PKG_NAME := bcm43xx-standalone
|
||||
PKG_VERSION := 060313
|
||||
PKG_RELEASE := 1
|
||||
PKG_MD%SUM := 773b26a164a54f0da544764969ca019b
|
||||
|
||||
PKG_SOURCE_URL := ftp://bu3sch.de/bcm43xx-snapshots/standalone/bcm43xx/
|
||||
PKG_SOURCE := $(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_CAT := bzcat
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
FIRMWARE_BLOB := wl_apsta-3.130.20.0.o
|
||||
FIRMWARE_BLOB_URL := http://downloads.openwrt.org/sources
|
||||
FIRMWARE_BLOB_MD5SUM := e08665c5c5b66beb9c3b2dd54aa80cb3
|
||||
|
||||
include $(TOPDIR)/package/rules.mk
|
||||
|
||||
$(eval $(call PKG_template,KMOD_BCM43XX_DSCAPE,kmod-$(PKG_NAME),$(LINUX_VERSION)-$(BOARD)+0.$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))))
|
||||
|
||||
$(PKG_BUILD_DIR)/.configured:
|
||||
touch $@
|
||||
|
||||
$(PKG_BUILD_DIR)/fwcutter/.built:
|
||||
mkdir -p $(PKG_BUILD_DIR)/fwcutter
|
||||
$(CP) ./fwcutter/* $(PKG_BUILD_DIR)/fwcutter/
|
||||
$(SCRIPT_DIR)/download.pl "$(PKG_BUILD_DIR)/fwcutter" "$(FIRMWARE_BLOB)" "$(FIRMWARE_BLOB_MD5SUM)" $(FIRMWARE_BLOB_URL)
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/fwcutter
|
||||
$(PKG_BUILD_DIR)/fwcutter/fwcutter -w $(PKG_BUILD_DIR)/fwcutter $(PKG_BUILD_DIR)/fwcutter/$(FIRMWARE_BLOB)
|
||||
touch $@
|
||||
|
||||
$(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/fwcutter/.built
|
||||
$(MAKE) -C "$(LINUX_DIR)" \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
PATH="$(TARGET_PATH)" \
|
||||
SUBDIRS="$(PKG_BUILD_DIR)" \
|
||||
LINUXINCLUDE="-I$(STAGING_DIR)/usr/include/ieee80211-dscape -I$(LINUX_DIR)/include -DBCM47XX=1" \
|
||||
modules
|
||||
touch $@
|
||||
|
||||
$(IPKG_KMOD_BCM43XX_DSCAPE):
|
||||
install -m0755 -d $(IDIR_KMOD_BCM43XX_DSCAPE)/lib/modules/$(LINUX_VERSION)
|
||||
install -m0755 -d $(IDIR_KMOD_BCM43XX_DSCAPE)/etc/modules.d
|
||||
( \
|
||||
echo 80211; \
|
||||
echo rate_control; \
|
||||
echo bcm43xx; \
|
||||
) >& $(IDIR_KMOD_BCM43XX_DSCAPE)/etc/modules.d/50-bcm43xx
|
||||
$(CP) $(PKG_BUILD_DIR)/*.ko $(IDIR_KMOD_BCM43XX_DSCAPE)/lib/modules/$(LINUX_VERSION)
|
||||
install -m0755 -d $(IDIR_KMOD_BCM43XX_DSCAPE)/lib/firmware
|
||||
$(CP) $(PKG_BUILD_DIR)/fwcutter/*.fw $(IDIR_KMOD_BCM43XX_DSCAPE)/lib/firmware/
|
||||
$(IPKG_BUILD) $(IDIR_KMOD_BCM43XX_DSCAPE) $(PACKAGE_DIR)
|
@ -1,32 +0,0 @@
|
||||
VERSION = 0.0.1
|
||||
|
||||
FIRMWARE_INSTALL_DIR ?= /lib/firmware
|
||||
|
||||
CC = cc
|
||||
PREFIX = /usr/local
|
||||
CFLAGS = -std=c99 -O2 -fomit-frame-pointer -Wall -pedantic -D_BSD_SOURCE
|
||||
LDFLAGS =
|
||||
|
||||
|
||||
OBJECTS = fwcutter.o md5.o
|
||||
|
||||
CFLAGS += -DFWCUTTER_VERSION_=$(VERSION)
|
||||
|
||||
all: fwcutter
|
||||
|
||||
fwcutter: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) -o fwcutter $(OBJECTS) $(LDFLAGS)
|
||||
|
||||
install: all
|
||||
-install -o 0 -g 0 -m 755 fwcutter $(PREFIX)/bin/
|
||||
|
||||
clean:
|
||||
-rm -f *~ *.o *.orig *.rej *.fw fwcutter
|
||||
|
||||
installfw:
|
||||
-if ! [ -d $(FIRMWARE_INSTALL_DIR) ]; then mkdir $(FIRMWARE_INSTALL_DIR); fi
|
||||
-install -o 0 -g 0 -m 600 bcm43xx_*.fw $(FIRMWARE_INSTALL_DIR)
|
||||
|
||||
# dependencies
|
||||
fwcutter.o: md5.h fwcutter_list.h
|
||||
md5.o: md5.h
|
@ -1,562 +0,0 @@
|
||||
/*
|
||||
* firmware cutter for broadcom 43xx wireless driver files
|
||||
*
|
||||
* Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
|
||||
* 2005 Michael Buesch <mbuesch@freenet.de>
|
||||
* 2005 Alex Beregszaszi
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
typedef unsigned char byte;
|
||||
|
||||
#define DRIVER_UNSUPPORTED 0x01 /* no support for this driver file */
|
||||
#define BYTE_ORDER_BIG_ENDIAN 0x02 /* ppc driver files */
|
||||
#define BYTE_ORDER_LITTLE_ENDIAN 0x04 /* x86, mips driver files */
|
||||
|
||||
#define MISSING_INITVAL_08 0x10 /* initval 8 is missing */
|
||||
#define MISSING_INITVAL_80211_A 0x20 /* initvals 3,7,9,10 (802.11a cards) are empty */
|
||||
|
||||
#define FIRMWARE_UCODE_OFFSET 100
|
||||
#define FIRMWARE_UNDEFINED 0
|
||||
#define FIRMWARE_PCM_4 4
|
||||
#define FIRMWARE_PCM_5 5
|
||||
#define FIRMWARE_UCODE_2 (FIRMWARE_UCODE_OFFSET + 2)
|
||||
#define FIRMWARE_UCODE_4 (FIRMWARE_UCODE_OFFSET + 4)
|
||||
#define FIRMWARE_UCODE_5 (FIRMWARE_UCODE_OFFSET + 5)
|
||||
#define FIRMWARE_UCODE_11 (FIRMWARE_UCODE_OFFSET + 11)
|
||||
|
||||
|
||||
#define fwcutter_stringify_1(x) #x
|
||||
#define fwcutter_stringify(x) fwcutter_stringify_1(x)
|
||||
#define FWCUTTER_VERSION fwcutter_stringify(FWCUTTER_VERSION_)
|
||||
|
||||
#include "md5.h"
|
||||
#include "fwcutter_list.h"
|
||||
|
||||
|
||||
struct cmdline_args {
|
||||
const char *infile;
|
||||
const char *postfix;
|
||||
const char *target_dir;
|
||||
int identify_only;
|
||||
};
|
||||
|
||||
static struct cmdline_args cmdargs;
|
||||
int big_endian_cpu;
|
||||
|
||||
|
||||
static void write_little_endian(FILE *f, byte *buffer, int len)
|
||||
{
|
||||
byte swapbuf[4];
|
||||
|
||||
while (len > 0) {
|
||||
swapbuf[0] = buffer[3]; swapbuf[1] = buffer[2];
|
||||
swapbuf[2] = buffer[1]; swapbuf[3] = buffer[0];
|
||||
fwrite(swapbuf, 4, 1, f);
|
||||
buffer = buffer + 4;
|
||||
len = len - 4;
|
||||
}
|
||||
}
|
||||
|
||||
static void write_big_endian(FILE *f, byte *buffer, int len)
|
||||
{
|
||||
while (len > 0) {
|
||||
fwrite(buffer, 4, 1, f);
|
||||
buffer = buffer + 4;
|
||||
len = len - 4;
|
||||
}
|
||||
}
|
||||
|
||||
static void write_fw(const char *outfilename, uint8_t flags, byte *data, int len)
|
||||
{
|
||||
FILE* fw;
|
||||
char outfile[2048];
|
||||
|
||||
snprintf(outfile, sizeof(outfile),
|
||||
"%s/%s", cmdargs.target_dir, outfilename);
|
||||
|
||||
fw = fopen(outfile, "w");
|
||||
if (!fw) {
|
||||
perror(outfile);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (flags & BYTE_ORDER_LITTLE_ENDIAN)
|
||||
write_little_endian(fw, data, len);
|
||||
else if (flags & BYTE_ORDER_BIG_ENDIAN)
|
||||
write_big_endian(fw, data, len);
|
||||
else
|
||||
printf("unknown byteorder...\n");
|
||||
|
||||
fflush(fw);
|
||||
fclose(fw);
|
||||
}
|
||||
|
||||
static void write_iv(uint8_t flags, byte *data)
|
||||
{
|
||||
FILE* fw;
|
||||
char ivfilename[2048];
|
||||
int i;
|
||||
|
||||
for (i = 1; i <= 10; i++) {
|
||||
|
||||
if ((flags & MISSING_INITVAL_08) && (i==8)) {
|
||||
printf("*****: Sorry, initval08 is not available in driver file \"%s\".\n", cmdargs.infile);
|
||||
printf("*****: Extracting firmware from an old driver is bad. Choose a more recent one.\n");
|
||||
printf("*****: Luckily bcm43xx driver doesn't include initval08 uploads at the moment.\n");
|
||||
printf("*****: But this can be added in the future...\n");
|
||||
i++;
|
||||
}
|
||||
|
||||
snprintf(ivfilename, sizeof(ivfilename),
|
||||
"%s/bcm43xx_initval%02d%s.fw",
|
||||
cmdargs.target_dir, i, cmdargs.postfix);
|
||||
fw = fopen(ivfilename, "w");
|
||||
|
||||
if (!fw) {
|
||||
perror(ivfilename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("extracting bcm43xx_initval%02d%s.fw ...\n", i, cmdargs.postfix);
|
||||
|
||||
while (1) {
|
||||
|
||||
if ((data[0]==0xff) && (data[1]==0xff) && (data[2]==0x00) && (data[3]==0x00)) {
|
||||
data = data + 8;
|
||||
break;
|
||||
}
|
||||
|
||||
if (flags & BYTE_ORDER_LITTLE_ENDIAN)
|
||||
fprintf(fw, "%c%c%c%c%c%c%c%c",
|
||||
data[1], data[0], /* offset */
|
||||
data[3], data[2], /* size */
|
||||
data[7], data[6], data[5], data[4]); /* value */
|
||||
else if (flags & BYTE_ORDER_BIG_ENDIAN)
|
||||
fprintf(fw, "%c%c%c%c%c%c%c%c",
|
||||
data[0], data[1], /* offset */
|
||||
data[2], data[3], /* size */
|
||||
data[4], data[5], data[6], data[7]); /* value */
|
||||
else {
|
||||
printf("unknown byteorder...\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
data = data + 8;
|
||||
}
|
||||
fflush(fw);
|
||||
fclose(fw);
|
||||
}
|
||||
}
|
||||
|
||||
static byte* read_file(const char* filename)
|
||||
{
|
||||
FILE* file;
|
||||
long len;
|
||||
byte* data;
|
||||
|
||||
file = fopen(filename, "rb");
|
||||
if (!file) {
|
||||
perror(filename);
|
||||
exit(1);
|
||||
}
|
||||
if (fseek(file, 0, SEEK_END)) {
|
||||
perror("cannot seek");
|
||||
exit(1);
|
||||
}
|
||||
len = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
data = malloc(len);
|
||||
if (!data) {
|
||||
fputs("out of memory\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
if (fread(data, 1, len, file) != len) {
|
||||
perror("cannot read");
|
||||
exit(1);
|
||||
}
|
||||
fclose(file);
|
||||
return data;
|
||||
}
|
||||
|
||||
static void extract_fw(uint8_t fwtype, uint8_t flags, uint32_t pos, uint32_t length)
|
||||
{
|
||||
byte* filedata;
|
||||
char outfile[1024];
|
||||
|
||||
switch (fwtype) {
|
||||
case FIRMWARE_UCODE_2:
|
||||
case FIRMWARE_UCODE_4:
|
||||
case FIRMWARE_UCODE_5:
|
||||
case FIRMWARE_UCODE_11:
|
||||
snprintf(outfile, sizeof(outfile), "bcm43xx_microcode%i%s.fw",
|
||||
fwtype - FIRMWARE_UCODE_OFFSET, cmdargs.postfix);
|
||||
break;
|
||||
case FIRMWARE_PCM_4:
|
||||
case FIRMWARE_PCM_5:
|
||||
snprintf(outfile, sizeof(outfile), "bcm43xx_pcm%i%s.fw",
|
||||
fwtype, cmdargs.postfix);
|
||||
break;
|
||||
default:
|
||||
snprintf(outfile, sizeof(outfile), "bcm43xx_unknown.fw");
|
||||
}
|
||||
|
||||
if (length > 0) {
|
||||
printf("extracting %s ...\n", outfile);
|
||||
filedata = read_file(cmdargs.infile);
|
||||
write_fw(outfile, flags, filedata + pos, length);
|
||||
free(filedata);
|
||||
} else {
|
||||
printf("*****: Sorry, it's not posible to extract \"%s\".\n", outfile);
|
||||
printf("*****: Extracting firmware from an old driver is bad. Choose a more recent one.\n");
|
||||
|
||||
switch (fwtype) {
|
||||
case FIRMWARE_UCODE_2:
|
||||
printf("*****: bcm43xx driver will not work with with core revision 2.\n");
|
||||
break;
|
||||
case FIRMWARE_UCODE_4:
|
||||
printf("*****: bcm43xx driver will not work with with core revision 4.\n");
|
||||
break;
|
||||
case FIRMWARE_UCODE_5:
|
||||
printf("*****: bcm43xx driver will not work with with core revision 5 or higher.\n");
|
||||
break;
|
||||
case FIRMWARE_UCODE_11:
|
||||
printf("*****: Luckily bcm43xx driver doesn't include microcode11 uploads at the moment.\n");
|
||||
printf("*****: But this can be added in the future...\n");
|
||||
break;
|
||||
case FIRMWARE_PCM_4:
|
||||
printf("*****: bcm43xx driver will not work with with core revision 4 or smaller.\n");
|
||||
break;
|
||||
case FIRMWARE_PCM_5:
|
||||
printf("*****: bcm43xx driver will not work with with core revision 5 or higher.\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void extract_iv(uint8_t flags, uint32_t pos)
|
||||
{
|
||||
byte* filedata;
|
||||
|
||||
if (pos > 0) {
|
||||
filedata = read_file(cmdargs.infile);
|
||||
write_iv(flags, filedata + pos);
|
||||
free(filedata);
|
||||
}
|
||||
}
|
||||
|
||||
static void print_banner(void)
|
||||
{
|
||||
printf("fwcutter " FWCUTTER_VERSION "\n");
|
||||
}
|
||||
|
||||
static void print_file(const struct file *file)
|
||||
{
|
||||
printf("%s\t", file->name);
|
||||
if (strlen(file->name) < 8)
|
||||
printf("\t");
|
||||
|
||||
printf("%s\t", file->version);
|
||||
if (strlen(file->version) < 8)
|
||||
printf("\t");
|
||||
if (strlen(file->version) < 16)
|
||||
printf("\t");
|
||||
|
||||
if (!(file->flags & DRIVER_UNSUPPORTED)) {
|
||||
if (file->flags & MISSING_INITVAL_80211_A)
|
||||
printf("b/g ");
|
||||
else
|
||||
printf("a/b/g");
|
||||
}
|
||||
|
||||
printf(" %s", file->md5);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void print_supported_files(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
print_banner();
|
||||
printf("\nExtracting firmware is possible from these binary driver files:\n\n");
|
||||
printf("<filename>\t<version>\t <802.11><MD5 checksum>\n\n");
|
||||
for (i = 0; i < FILES; i++) {
|
||||
if (files[i].flags & DRIVER_UNSUPPORTED)
|
||||
continue;
|
||||
print_file(&files[i]);
|
||||
}
|
||||
printf("\n\nExtracting firmware is IMPOSSIBLE from these binary driver files:\n\n");
|
||||
printf("<filename>\t<version>\t <MD5 checksum>\n\n");
|
||||
for (i = 0; i < FILES; i++) {
|
||||
if (!(files[i].flags & DRIVER_UNSUPPORTED))
|
||||
continue;
|
||||
print_file(&files[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static const struct file * find_file(FILE *fd)
|
||||
{
|
||||
unsigned char buffer[16384], signature[16];
|
||||
struct MD5Context md5c;
|
||||
char md5sig[33];
|
||||
int i;
|
||||
|
||||
MD5Init(&md5c);
|
||||
while ((i = (int) fread(buffer, 1, sizeof(buffer), fd)) > 0)
|
||||
MD5Update(&md5c, buffer, (unsigned) i);
|
||||
MD5Final(signature, &md5c);
|
||||
|
||||
snprintf(md5sig, sizeof(md5sig),
|
||||
"%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x",
|
||||
signature[0], signature[1], signature[2], signature[3],
|
||||
signature[4], signature[5], signature[6], signature[7],
|
||||
signature[8], signature[9], signature[10], signature[11],
|
||||
signature[12], signature[13], signature[14], signature[15]);
|
||||
|
||||
for (i = 0; i < FILES; ++i) {
|
||||
if (strcasecmp(md5sig, files[i].md5) == 0) {
|
||||
if (files[i].flags & DRIVER_UNSUPPORTED) {
|
||||
printf("Extracting firmware from this file is IMPOSSIBLE. (too old)\n");
|
||||
return 0;
|
||||
}
|
||||
printf("fwcutter can cut the firmware out of %s\n", cmdargs.infile);
|
||||
printf(" filename : %s\n", files[i].name);
|
||||
printf(" version : %s\n", files[i].version);
|
||||
printf(" MD5 : %s\n\n", files[i].md5);
|
||||
if (files[i].flags & MISSING_INITVAL_80211_A) {
|
||||
printf("WARNING! This firmware doesn't include support for 802.11a cards.\n");
|
||||
printf("WARNING! Use this firmware only for 802.11b/g cards.\n\n");
|
||||
}
|
||||
return &(files[i]);
|
||||
}
|
||||
}
|
||||
printf("Sorry, the input file is either wrong or not supported by fwcutter.\n");
|
||||
printf("I can't find the MD5sum %s :(\n", md5sig);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void get_endianess(void)
|
||||
{
|
||||
const unsigned char x[] = { 0xde, 0xad, 0xbe, 0xef, };
|
||||
const uint32_t *p = (uint32_t *)x;
|
||||
|
||||
if (*p == 0xdeadbeef) {
|
||||
big_endian_cpu = 1;
|
||||
} else if (*p == 0xefbeadde) {
|
||||
big_endian_cpu = 0;
|
||||
} else {
|
||||
printf("Confused: NUXI endian machine??\n");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
static void print_usage(int argc, char *argv[])
|
||||
{
|
||||
print_banner();
|
||||
printf("\nUsage: %s [OPTION] [driver.sys]\n", argv[0]);
|
||||
printf(" -l|--list List supported driver versions\n");
|
||||
printf(" -i|--identify Only identify the driver file (don't extract)\n");
|
||||
printf(" -w|--target-dir DIR Extract and write firmware to DIR\n");
|
||||
printf(" -p|--postfix \".FOO\" Postfix for firmware filenames (.FOO.fw)\n");
|
||||
printf(" -v|--version Print fwcutter version\n");
|
||||
printf(" -h|--help Print this help\n");
|
||||
printf("\nExample: %s bcmwl5.sys\n"
|
||||
" to extract the firmware blobs from bcmwl5.sys\n", argv[0]);
|
||||
}
|
||||
|
||||
#define ARG_MATCH 0
|
||||
#define ARG_NOMATCH 1
|
||||
#define ARG_ERROR -1
|
||||
|
||||
static int do_cmp_arg(char **argv, int *pos,
|
||||
const char *template,
|
||||
int allow_merged,
|
||||
char **param)
|
||||
{
|
||||
char *arg;
|
||||
char *next_arg;
|
||||
size_t arg_len, template_len;
|
||||
|
||||
arg = argv[*pos];
|
||||
next_arg = argv[*pos + 1];
|
||||
arg_len = strlen(arg);
|
||||
template_len = strlen(template);
|
||||
|
||||
if (param) {
|
||||
/* Maybe we have a merged parameter here.
|
||||
* A merged parameter is "-pfoobar" for example.
|
||||
*/
|
||||
if (allow_merged && arg_len > template_len) {
|
||||
if (memcmp(arg, template, template_len) == 0) {
|
||||
*param = arg + template_len;
|
||||
return ARG_MATCH;
|
||||
}
|
||||
return ARG_NOMATCH;
|
||||
} else if (arg_len != template_len)
|
||||
return ARG_NOMATCH;
|
||||
*param = next_arg;
|
||||
}
|
||||
if (strcmp(arg, template) == 0) {
|
||||
if (param) {
|
||||
/* Skip the parameter on the next iteration. */
|
||||
(*pos)++;
|
||||
if (*param == 0) {
|
||||
printf("%s needs a parameter\n", arg);
|
||||
return ARG_ERROR;
|
||||
}
|
||||
}
|
||||
return ARG_MATCH;
|
||||
}
|
||||
|
||||
return ARG_NOMATCH;
|
||||
}
|
||||
|
||||
/* Simple and lean command line argument parsing. */
|
||||
static int cmp_arg(char **argv, int *pos,
|
||||
const char *long_template,
|
||||
const char *short_template,
|
||||
char **param)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (long_template) {
|
||||
err = do_cmp_arg(argv, pos, long_template, 0, param);
|
||||
if (err == ARG_MATCH || err == ARG_ERROR)
|
||||
return err;
|
||||
}
|
||||
err = ARG_NOMATCH;
|
||||
if (short_template)
|
||||
err = do_cmp_arg(argv, pos, short_template, 1, param);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int parse_args(int argc, char *argv[])
|
||||
{
|
||||
int i, res;
|
||||
char *param;
|
||||
|
||||
if (argc < 2)
|
||||
goto out_usage;
|
||||
for (i = 1; i < argc; i++) {
|
||||
res = cmp_arg(argv, &i, "--list", "-l", 0);
|
||||
if (res == ARG_MATCH) {
|
||||
print_supported_files();
|
||||
return 1;
|
||||
} else if (res == ARG_ERROR)
|
||||
goto out;
|
||||
|
||||
res = cmp_arg(argv, &i, "--version", "-v", 0);
|
||||
if (res == ARG_MATCH) {
|
||||
print_banner();
|
||||
return 1;
|
||||
} else if (res == ARG_ERROR)
|
||||
goto out;
|
||||
|
||||
res = cmp_arg(argv, &i, "--help", "-h", 0);
|
||||
if (res == ARG_MATCH)
|
||||
goto out_usage;
|
||||
else if (res == ARG_ERROR)
|
||||
goto out;
|
||||
|
||||
res = cmp_arg(argv, &i, "--identify", "-i", 0);
|
||||
if (res == ARG_MATCH) {
|
||||
cmdargs.identify_only = 1;
|
||||
continue;
|
||||
} else if (res == ARG_ERROR)
|
||||
goto out;
|
||||
|
||||
res = cmp_arg(argv, &i, "--target-dir", "-w", ¶m);
|
||||
if (res == ARG_MATCH) {
|
||||
cmdargs.target_dir = param;
|
||||
continue;
|
||||
} else if (res == ARG_ERROR)
|
||||
goto out;
|
||||
|
||||
res = cmp_arg(argv, &i, "--postfix", "-p", ¶m);
|
||||
if (res == ARG_MATCH) {
|
||||
cmdargs.postfix = param;
|
||||
continue;
|
||||
} else if (res == ARG_ERROR)
|
||||
goto out;
|
||||
|
||||
cmdargs.infile = argv[i];
|
||||
break;
|
||||
}
|
||||
|
||||
if (!cmdargs.infile)
|
||||
goto out_usage;
|
||||
return 0;
|
||||
|
||||
out_usage:
|
||||
print_usage(argc, argv);
|
||||
out:
|
||||
return -1;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
FILE *fd;
|
||||
const struct file *file;
|
||||
int err;
|
||||
|
||||
get_endianess();
|
||||
|
||||
cmdargs.target_dir = ".";
|
||||
cmdargs.postfix = "";
|
||||
err = parse_args(argc, argv);
|
||||
if (err == 1)
|
||||
return 0;
|
||||
else if (err != 0)
|
||||
return err;
|
||||
|
||||
fd = fopen(cmdargs.infile, "rb");
|
||||
if (!fd) {
|
||||
fprintf(stderr, "Cannot open input file %s\n", cmdargs.infile);
|
||||
return 2;
|
||||
}
|
||||
|
||||
err = -1;
|
||||
file = find_file(fd);
|
||||
if (!file)
|
||||
goto out_close;
|
||||
if (cmdargs.identify_only) {
|
||||
err = 0;
|
||||
goto out_close;
|
||||
}
|
||||
|
||||
extract_fw(FIRMWARE_UCODE_2, file->flags, file->uc2_pos, file->uc2_length);
|
||||
extract_fw(FIRMWARE_UCODE_4, file->flags, file->uc4_pos, file->uc4_length);
|
||||
extract_fw(FIRMWARE_UCODE_5, file->flags, file->uc5_pos, file->uc5_length);
|
||||
extract_fw(FIRMWARE_UCODE_11, file->flags, file->uc11_pos, file->uc11_length);
|
||||
extract_fw(FIRMWARE_PCM_4, file->flags, file->pcm4_pos, file->pcm4_length);
|
||||
extract_fw(FIRMWARE_PCM_5, file->flags, file->pcm5_pos, file->pcm5_length);
|
||||
extract_iv(file->flags, file->iv_pos);
|
||||
|
||||
err = 0;
|
||||
out_close:
|
||||
fclose(fd);
|
||||
|
||||
return err;
|
||||
}
|
@ -1,810 +0,0 @@
|
||||
|
||||
static const struct file {
|
||||
const char *name;
|
||||
const char *version;
|
||||
const char *md5;
|
||||
const uint8_t flags;
|
||||
const uint32_t iv_pos;
|
||||
const uint32_t uc2_pos;
|
||||
const uint32_t uc2_length;
|
||||
const uint32_t uc4_pos;
|
||||
const uint32_t uc4_length;
|
||||
const uint32_t uc5_pos;
|
||||
const uint32_t uc5_length;
|
||||
const uint32_t uc11_pos;
|
||||
const uint32_t uc11_length;
|
||||
const uint32_t pcm4_pos;
|
||||
const uint32_t pcm4_length;
|
||||
const uint32_t pcm5_pos;
|
||||
const uint32_t pcm5_length;
|
||||
} files[] =
|
||||
{
|
||||
{
|
||||
.name = "AppleAirPort2",
|
||||
.version = "3.30.15.p3 (3.1.1b2)",
|
||||
.md5 = "a8275cc50107a13b5be15d067b2245a0",
|
||||
.flags = BYTE_ORDER_BIG_ENDIAN |
|
||||
MISSING_INITVAL_08,
|
||||
.iv_pos = 0x42550,
|
||||
.uc2_pos = 0x45630, .uc2_length = 0x3d88,
|
||||
.uc4_pos = 0x493bc, .uc4_length = 0x44a0,
|
||||
.uc5_pos = 0x4d860, .uc5_length = 0x4ec0,
|
||||
.pcm4_pos = 0x52724, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x52ba0, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "AppleAirPort2",
|
||||
.version = "3.30.15.p3 (3.1.2b3)",
|
||||
.md5 = "55134c1298abaa85f190331f016d4d36",
|
||||
.flags = BYTE_ORDER_BIG_ENDIAN |
|
||||
MISSING_INITVAL_08,
|
||||
.iv_pos = 0x42c24,
|
||||
.uc2_pos = 0x45d04, .uc2_length = 0x3d88,
|
||||
.uc4_pos = 0x49a90, .uc4_length = 0x44a0,
|
||||
.uc5_pos = 0x4df34, .uc5_length = 0x4ec0,
|
||||
.pcm4_pos = 0x52df8, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x53274, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "AppleAirPort2",
|
||||
.version = "3.30.15.p7 (3.2)",
|
||||
.md5 = "e74e8d2df2e4eb97e28602f3b2dd4647",
|
||||
.flags = BYTE_ORDER_BIG_ENDIAN |
|
||||
MISSING_INITVAL_08,
|
||||
.iv_pos = 0x40efc,
|
||||
.uc2_pos = 0x43fdc, .uc2_length = 0x3d88,
|
||||
.uc4_pos = 0x47d68, .uc4_length = 0x44a0,
|
||||
.uc5_pos = 0x4c20c, .uc5_length = 0x4ec0,
|
||||
.pcm4_pos = 0x510d0, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x5154c, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "AppleAirPort2",
|
||||
.version = "3.30.15.p8 (3.3b1)", /* 01/19/2004 */
|
||||
.md5 = "87c74c55d2501d2e968f8c132e160b6e",
|
||||
.flags = BYTE_ORDER_BIG_ENDIAN,
|
||||
.iv_pos = 0x41c8c,
|
||||
.uc2_pos = 0x43fe4, .uc2_length = 0x3d88,
|
||||
.uc4_pos = 0x47d70, .uc4_length = 0x44b2,
|
||||
.uc5_pos = 0x4c214, .uc5_length = 0x4ec0,
|
||||
.pcm4_pos = 0x510d8, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x51554, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "AppleAirPort2",
|
||||
.version = "3.50.37.p4 (3.4.2b1)",
|
||||
.md5 = "1739c357ade1d04c9be47e8604afb1c2",
|
||||
.flags = BYTE_ORDER_BIG_ENDIAN,
|
||||
.iv_pos = 0x4f2b8,
|
||||
.uc2_pos = 0x52da0, .uc2_length = 0x3d30,
|
||||
.uc4_pos = 0x56ad4, .uc4_length = 0x45c8,
|
||||
.uc5_pos = 0x5b0a0, .uc5_length = 0x5500,
|
||||
.pcm4_pos = 0x605a4, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x60a20, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "AppleAirPort2",
|
||||
.version = "3.50.37.p4 (3.4.3f1)", /* 09/29/2004 */
|
||||
.md5 = "c672b8c218c5dc4a55060bdfa9f58a69",
|
||||
.flags = BYTE_ORDER_BIG_ENDIAN |
|
||||
MISSING_INITVAL_08,
|
||||
.iv_pos = 0x4f378,
|
||||
.uc2_pos = 0x52e60, .uc2_length = 0x3d30,
|
||||
.uc4_pos = 0x56b94, .uc4_length = 0x45c8,
|
||||
.uc5_pos = 0x5b160, .uc5_length = 0x5500,
|
||||
.pcm4_pos = 0x60664, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x60ae0, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "AppleAirPort2",
|
||||
.version = "3.50.37.p4 (3.4.4f5)",
|
||||
.md5 = "2c388e3e8ea9310a58cf76a3757e8ccc",
|
||||
.flags = BYTE_ORDER_BIG_ENDIAN,
|
||||
.iv_pos = 0x4f5f0,
|
||||
.uc2_pos = 0x530d8, .uc2_length = 0x3d30,
|
||||
.uc4_pos = 0x56e0c, .uc4_length = 0x45c8,
|
||||
.uc5_pos = 0x5b3d8, .uc5_length = 0x5500,
|
||||
.pcm4_pos = 0x608dc, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x60d58, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "AppleAirPort2",
|
||||
.version = "3.50.37.p4 (3.4.4f5)",
|
||||
.md5 = "3860545266b554d2955664db55452f5a",
|
||||
.flags = BYTE_ORDER_BIG_ENDIAN,
|
||||
.iv_pos = 0x4f5f0,
|
||||
.uc2_pos = 0x530d8, .uc2_length = 0x3d30,
|
||||
.uc4_pos = 0x56e0c, .uc4_length = 0x45c8,
|
||||
.uc5_pos = 0x5b3d8, .uc5_length = 0x5500,
|
||||
.pcm4_pos = 0x608dc, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x60d58, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "AppleAirPort2",
|
||||
.version = "3.50.37.p6 (3.5f1)",
|
||||
.md5 = "a62e35ee9956b286c46b145d35bd6e0c",
|
||||
.flags = BYTE_ORDER_BIG_ENDIAN,
|
||||
.iv_pos = 0x4f9b8,
|
||||
.uc2_pos = 0x534a0, .uc2_length = 0x3d30,
|
||||
.uc4_pos = 0x571d4, .uc4_length = 0x45c8,
|
||||
.uc5_pos = 0x5b7a0, .uc5_length = 0x5500,
|
||||
.pcm4_pos = 0x60ca4, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x61120, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "AppleAirPort2",
|
||||
.version = "3.50.37.p6 (3.5f1)",
|
||||
.md5 = "b6f3d2437c40277c197f0afcf12208e9",
|
||||
.flags = BYTE_ORDER_BIG_ENDIAN,
|
||||
.iv_pos = 0x4f9b8,
|
||||
.uc2_pos = 0x534a0, .uc2_length = 0x3d30,
|
||||
.uc4_pos = 0x571d4, .uc4_length = 0x45c8,
|
||||
.uc5_pos = 0x5b7a0, .uc5_length = 0x5500,
|
||||
.pcm4_pos = 0x60ca4, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x61120, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "AppleAirPort2",
|
||||
.version = "3.90.34.0.p11 (400.17)", /* 09/13/2005 (??) */
|
||||
.md5 = "ca0f34df2f0bfb8b5cfd83b5848d2bf5",
|
||||
.flags = BYTE_ORDER_BIG_ENDIAN |
|
||||
MISSING_INITVAL_80211_A,
|
||||
.iv_pos = 0x4ff2c, /* A-PHY init vals empty */
|
||||
.uc2_pos = 0x5181c, .uc2_length = 0x3f48,
|
||||
.uc4_pos = 0x55764, .uc4_length = 0x4df0,
|
||||
.uc5_pos = 0x5a554, .uc5_length = 0x57e0,
|
||||
.pcm4_pos = 0x5fd34, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x60254, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "AppleAirPort2",
|
||||
.version = "3.90.34.0.p11 (400.17)",
|
||||
.md5 = "dc3a69aac95c68fe8edc760e39bbb2c9",
|
||||
.flags = BYTE_ORDER_BIG_ENDIAN |
|
||||
MISSING_INITVAL_80211_A,
|
||||
.iv_pos = 0x50efc, /* A-PHY init vals empty */
|
||||
.uc2_pos = 0x527ec, .uc2_length = 0x3f48,
|
||||
.uc4_pos = 0x56734, .uc4_length = 0x4df0,
|
||||
.uc5_pos = 0x5b524, .uc5_length = 0x57e0,
|
||||
.pcm4_pos = 0x60d04, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x61224, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "AppleAirPort2",
|
||||
.version = "3.90.34.0.p13 (401.2)", /* 07/10/2005 */
|
||||
.md5 = "6ecf38e5ab6997c7ec483c0d637f5c68",
|
||||
.flags = BYTE_ORDER_BIG_ENDIAN |
|
||||
MISSING_INITVAL_80211_A,
|
||||
.iv_pos = 0x50fcc, /* A-PHY init vals empty */
|
||||
.uc2_pos = 0x528bc, .uc2_length = 0x3f48,
|
||||
.uc4_pos = 0x56804, .uc4_length = 0x4df0,
|
||||
.uc5_pos = 0x5b5f4, .uc5_length = 0x57e0,
|
||||
.pcm4_pos = 0x60dd4, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x612f4, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "AppleAirPort2",
|
||||
.version = "3.90.34.0.p16 (404.2)",
|
||||
.md5 = "7200d1aef5f413ebc811046d068b40dc",
|
||||
.flags = BYTE_ORDER_BIG_ENDIAN |
|
||||
MISSING_INITVAL_80211_A,
|
||||
.iv_pos = 0x511ec, /* A-PHY init vals empty */
|
||||
.uc2_pos = 0x52adc, .uc2_length = 0x3f48,
|
||||
.uc4_pos = 0x56a24, .uc4_length = 0x4df0,
|
||||
.uc5_pos = 0x5b814, .uc5_length = 0x57f0,
|
||||
.pcm4_pos = 0x61004, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x61524, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "AppleAirPort2",
|
||||
.version = "3.90.34.0.p16 (404.2)",
|
||||
.md5 = "86cc708e8df3b035a1dbea41ac4eb7d2",
|
||||
.flags = BYTE_ORDER_BIG_ENDIAN |
|
||||
MISSING_INITVAL_80211_A,
|
||||
.iv_pos = 0x5021c, /* A-PHY init vals empty */
|
||||
.uc2_pos = 0x51b0c, .uc2_length = 0x3f48,
|
||||
.uc4_pos = 0x55a54, .uc4_length = 0x4df0,
|
||||
.uc5_pos = 0x5a844, .uc5_length = 0x57f0,
|
||||
.pcm4_pos = 0x60034, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x60554, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.10.8.0", /* 10/04/2002 */
|
||||
.md5 = "288923b401e87ef76b7ae2652601ee47",
|
||||
.flags = DRIVER_UNSUPPORTED, /* file differs from later ones */
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.10.53.6", /* 04/28/2003 */
|
||||
.md5 = "b43c593fd7c2a47cdc40580fe341f674",
|
||||
.flags = DRIVER_UNSUPPORTED, /* file differs from later ones */
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.20.23.0", /* 06/13/2003 */
|
||||
.md5 = "1b1cf5e962c15abca83d1ef2b3906e2f", /* pcm5 not available, driver is too old */
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN |
|
||||
MISSING_INITVAL_08,
|
||||
.iv_pos = 0x2a1d0,
|
||||
.uc2_pos = 0x2d228, .uc2_length = 0x3da8,
|
||||
.uc4_pos = 0x30fd8, .uc4_length = 0x4470,
|
||||
.uc5_pos = 0x35450, .uc5_length = 0x4ba0,
|
||||
.pcm4_pos = 0x39ff8, .pcm4_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.30.15.0", /* 07/17/2003 */
|
||||
.md5 = "ebf36d658d0da5b1ea667fa403919c26",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN |
|
||||
MISSING_INITVAL_08,
|
||||
.iv_pos = 0x2c658,
|
||||
.uc2_pos = 0x2f738, .uc2_length = 0x3d88,
|
||||
.uc4_pos = 0x334c8, .uc4_length = 0x44a0,
|
||||
.uc5_pos = 0x37970, .uc5_length = 0x4ec0,
|
||||
.pcm4_pos = 0x3c838, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x3ccb8, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.40.20.0", /* 09/24/2003 */
|
||||
.md5 = "0c3fc803184f6f85e665dd012611225b",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x302f0,
|
||||
.uc2_pos = 0x33d88, .uc2_length = 0x3db8,
|
||||
.uc4_pos = 0x37b48, .uc4_length = 0x45d8,
|
||||
.uc5_pos = 0x3c128, .uc5_length = 0x5050,
|
||||
.pcm4_pos = 0x41180, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x41600, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.40.25.3", /* 10/28/2003 */
|
||||
.md5 = "5e58a3148b98c9f356cde6049435cb21",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x30970,
|
||||
.uc2_pos = 0x34408, .uc2_length = 0x3db0,
|
||||
.uc4_pos = 0x381c0, .uc4_length = 0x45d0,
|
||||
.uc5_pos = 0x3c798, .uc5_length = 0x5050,
|
||||
.pcm4_pos = 0x417f0, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x41c70, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.40.73.0", /* 06/25/2004 */
|
||||
.md5 = "52d67c5465c01913b03b7daca0cc4077",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x37398,
|
||||
.uc2_pos = 0x3ae30, .uc2_length = 0x3ff0,
|
||||
.uc4_pos = 0x3ee28, .uc4_length = 0x47f0,
|
||||
.uc5_pos = 0x43620, .uc5_length = 0x5260,
|
||||
.pcm4_pos = 0x48888, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x48d08, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.40.100.0", /* 02/07/2004 */
|
||||
.md5 = "431195b941dff794f23c2077fcbf8377",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x34d18,
|
||||
.uc2_pos = 0x387b0, .uc2_length = 0x3ff0,
|
||||
.uc4_pos = 0x3c7a8, .uc4_length = 0x47f0,
|
||||
.uc5_pos = 0x40fa0, .uc5_length = 0x5260,
|
||||
.pcm4_pos = 0x46208, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x46688, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.50.21.11", /* 02/19/2004 */
|
||||
.md5 = "ae96075a3aed5c40f1ead477ea94acd7",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x33370,
|
||||
.uc2_pos = 0x36e58, .uc2_length = 0x3e00,
|
||||
.uc4_pos = 0x3ac60, .uc4_length = 0x4628,
|
||||
.uc5_pos = 0x3f290, .uc5_length = 0x5548,
|
||||
.pcm4_pos = 0x447e0, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x44c60, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.60.7.0", /* 03/22/2004 */
|
||||
.md5 = "c5616736df4e83930780dca5795387ca",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x3b988,
|
||||
.uc2_pos = 0x3f580, .uc2_length = 0x3e08,
|
||||
.uc4_pos = 0x43390, .uc4_length = 0x4e58,
|
||||
.uc5_pos = 0x481f0, .uc5_length = 0x5608,
|
||||
.pcm4_pos = 0x4d800, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x4dc80, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.60.7.5", /* 06/07/2004 */
|
||||
.md5 = "d2ae116c741c215ef3ef68603db9917f",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x3b988,
|
||||
.uc2_pos = 0x3f580, .uc2_length = 0x3e08,
|
||||
.uc4_pos = 0x43390, .uc4_length = 0x4e58,
|
||||
.uc5_pos = 0x481f0, .uc5_length = 0x5608,
|
||||
.pcm4_pos = 0x4d800, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x4dc80, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.70.12.0", /* 06/02/2004 */
|
||||
.md5 = "d409b089370486521d5408baed9bffde",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x39480,
|
||||
.uc2_pos = 0x3d0c8, .uc2_length = 0x3e80,
|
||||
.uc4_pos = 0x40f50, .uc4_length = 0x4ed0,
|
||||
.uc5_pos = 0x45e28, .uc5_length = 0x5680,
|
||||
.pcm4_pos = 0x4b4b0, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x4b930, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.70.17.0", /* 06/25/2004 */
|
||||
.md5 = "d87b4e14e890091d8e64fb5c570cf192",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x39600,
|
||||
.uc2_pos = 0x3d248, .uc2_length = 0x3e80,
|
||||
.uc4_pos = 0x410d0, .uc4_length = 0x4ed0,
|
||||
.uc5_pos = 0x45fa8, .uc5_length = 0x5680,
|
||||
.pcm4_pos = 0x4b630, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x4bab0, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.70.22.0", /* 10/20/2004 */
|
||||
.md5 = "185a6dc6d655dc31c0b228cc94fb99ac",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x39a88,
|
||||
.uc2_pos = 0x3d6d0, .uc2_length = 0x3e80,
|
||||
.uc4_pos = 0x41558, .uc4_length = 0x4ed0,
|
||||
.uc5_pos = 0x46430, .uc5_length = 0x5680,
|
||||
.pcm4_pos = 0x4bab8, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x4bf38, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.90.41.1", /* 07/04/2005 */
|
||||
.md5 = "0a87541dd24c6f046a4bf8f671f74de2",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x3bec8,
|
||||
.uc2_pos = 0x3fb38, .uc2_length = 0x3f48,
|
||||
.uc4_pos = 0x43a88, .uc4_length = 0x4df0,
|
||||
.uc5_pos = 0x48880, .uc5_length = 0x57e0,
|
||||
.pcm4_pos = 0x4e068, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x4e590, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.100.35.0", /* 11/27/2004 */
|
||||
.md5 = "c3ab2d6954c7b5103770832a3a6a591b",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x3de80,
|
||||
.uc2_pos = 0x41af0, .uc2_length = 0x3f58,
|
||||
.uc4_pos = 0x45a50, .uc4_length = 0x4df8,
|
||||
.uc5_pos = 0x4a850, .uc5_length = 0x57f8,
|
||||
.pcm4_pos = 0x50050, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x50578, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.100.35.1", /* 02/10/2005 */
|
||||
.md5 = "da7ca369a1a3593ceac85dec2d267a08",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x3df00,
|
||||
.uc2_pos = 0x41b70, .uc2_length = 0x3f58,
|
||||
.uc4_pos = 0x45ad0, .uc4_length = 0x4df8,
|
||||
.uc5_pos = 0x4a8d0, .uc5_length = 0x57f8,
|
||||
.pcm4_pos = 0x500d0, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x505f8, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.100.46.0", /* 12/22/2004 */
|
||||
.md5 = "38ca1443660d0f5f06887c6a2e692aeb",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x3de80,
|
||||
.uc2_pos = 0x41af0, .uc2_length = 0x3f58,
|
||||
.uc4_pos = 0x45a50, .uc4_length = 0x4df8,
|
||||
.uc5_pos = 0x4a850, .uc5_length = 0x57f8,
|
||||
.pcm4_pos = 0x50050, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x50578, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.100.64.0", /* 02/11/2005 */
|
||||
.md5 = "e7debb46b9ef1f28932e533be4a3d1a9",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x3e980,
|
||||
.uc2_pos = 0x425f0, .uc2_length = 0x3f58,
|
||||
.uc4_pos = 0x46550, .uc4_length = 0x4e00,
|
||||
.uc5_pos = 0x4b358, .uc5_length = 0x5800,
|
||||
.pcm4_pos = 0x50b60, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x51088, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.100.64.50", /* 04/05/2005 */
|
||||
.md5 = "4b3e367b829b9b2c0c088909a617e04e",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x3e900,
|
||||
.uc2_pos = 0x42570, .uc2_length = 0x3f58,
|
||||
.uc4_pos = 0x464d0, .uc4_length = 0x4e00,
|
||||
.uc5_pos = 0x4b2d8, .uc5_length = 0x5800,
|
||||
.pcm4_pos = 0x50ae0, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x51008, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.100.65.1", /* 04/21/2005 */
|
||||
.md5 = "d5f1ab1aab8b81bca6f19da9554a267a",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x3e980,
|
||||
.uc2_pos = 0x425f0, .uc2_length = 0x3f58,
|
||||
.uc4_pos = 0x46550, .uc4_length = 0x4e00,
|
||||
.uc5_pos = 0x4b358, .uc5_length = 0x5800,
|
||||
.pcm4_pos = 0x50b60, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x51088, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.120.27.0", /* 05/19/2005 */
|
||||
.md5 = "8d49f11238815a320880fee9f98b2c92",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x3f700,
|
||||
.uc2_pos = 0x43370, .uc2_length = 0x3f68,
|
||||
.uc4_pos = 0x472e0, .uc4_length = 0x4e10,
|
||||
.uc5_pos = 0x4c0f8, .uc5_length = 0x5800,
|
||||
.pcm4_pos = 0x51900, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x51e28, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5.sys",
|
||||
.version = "3.140.16.0", /* 07/21/2005 */
|
||||
.md5 = "fa4a4a50b4b2647afedc676cc68c69cc",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x3f700,
|
||||
.uc2_pos = 0x43370, .uc2_length = 0x3f68,
|
||||
.uc4_pos = 0x472e0, .uc4_length = 0x4e10,
|
||||
.uc5_pos = 0x4c0f8, .uc5_length = 0x5800,
|
||||
.pcm4_pos = 0x51900, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x51e28, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl564.sys",
|
||||
.version = "3.70.17.5", /* 09/21/2004 */
|
||||
.md5 = "f5590c8784b91dfd9ee092d3040b6e40", /* for 64bit machines */
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x566f0,
|
||||
.uc2_pos = 0x5a360, .uc2_length = 0x3e80,
|
||||
.uc4_pos = 0x5e1f0, .uc4_length = 0x4ed0,
|
||||
.uc5_pos = 0x630d0, .uc5_length = 0x5680,
|
||||
.pcm4_pos = 0x68760, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x68be0, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl564.sys",
|
||||
.version = "3.100.64.10", /* 05/12/2005 */
|
||||
.md5 = "b8d76da338ecf2c650f5f7ca226ccf89", /* for 64bit machines */
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x50bf0,
|
||||
.uc2_pos = 0x54860, .uc2_length = 0x3f58,
|
||||
.uc4_pos = 0x587c0, .uc4_length = 0x4e00,
|
||||
.uc5_pos = 0x5d5d0, .uc5_length = 0x5800,
|
||||
.pcm4_pos = 0x62de0, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x63310, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "bcmwl5a.sys",
|
||||
.version = "3.90.16.0", /* 12/06/2004 */
|
||||
.md5 = "e6d927deea6c75bddf84080e6c3837b7",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x3b4c8,
|
||||
.uc2_pos = 0x3f138, .uc2_length = 0x3f48,
|
||||
.uc4_pos = 0x43088, .uc4_length = 0x4de8,
|
||||
.uc5_pos = 0x47e78, .uc5_length = 0x57d8,
|
||||
.pcm4_pos = 0x4d658, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x4db80, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "d11ucode.o",
|
||||
.version = "3.31.16.0 ?", /*FIXME: version correct? */
|
||||
.md5 = "31e6cac8a8129bf8f91291293e017329",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN |
|
||||
MISSING_INITVAL_08,
|
||||
.iv_pos = 0x40,
|
||||
.uc2_pos = 0x3120, .uc2_length = 0x3d88,
|
||||
.uc4_pos = 0x6eac, .uc4_length = 0x44a0,
|
||||
.uc5_pos = 0xb350, .uc5_length = 0x4ec0,
|
||||
.pcm4_pos = 0x10214, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x10690, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "d11ucode.o",
|
||||
.version = "3.60.7.0 ? (1.3.2)", /* no version number found */
|
||||
.md5 = "7774e5dda1daa2b3f83d279552ca1cc4", /* but same fw files are also */
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN, /* in bcmwl5.sys 3.60.7.0 */
|
||||
.iv_pos = 0x40,
|
||||
.uc2_pos = 0x3c38, .uc2_length = 0x3e08,
|
||||
.uc4_pos = 0x7a44, .uc4_length = 0x4e58,
|
||||
.uc5_pos = 0xc8a0, .uc5_length = 0x5608,
|
||||
.pcm4_pos = 0x11eac, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x12328, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "d11ucode.o",
|
||||
.version = "3.90.7.0 ? (3.90.RC7)", /* 10/14/2004 */
|
||||
.md5 = "b2580361620881b06fa810422ec8b7ce",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x60,
|
||||
.uc2_pos = 0x3cd0, .uc2_length = 0x3ec0,
|
||||
.uc4_pos = 0x7b94, .uc4_length = 0x4d60,
|
||||
.uc5_pos = 0xc8f8, .uc5_length = 0x5750,
|
||||
.pcm4_pos = 0x1204c, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x12570, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "d11ucode.o",
|
||||
.version = "3.90.37.0",
|
||||
.md5 = "2543935259739a8a879ccb8386647ac7",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x60,
|
||||
.uc2_pos = 0x3cd0, .uc2_length = 0x3f48,
|
||||
.uc4_pos = 0x7c1c, .uc4_length = 0x4df0,
|
||||
.uc5_pos = 0xca10, .uc5_length = 0x57e0,
|
||||
.pcm4_pos = 0x121f4, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x12718, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "wl.o",
|
||||
.version = "3.31.15.0", /* 07/28/2003 */
|
||||
.md5 = "a85af65b5ae1d64ee11eab714faab843",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN |
|
||||
MISSING_INITVAL_08,
|
||||
.iv_pos = 0x32270,
|
||||
.uc2_pos = 0x35350, .uc2_length = 0x3d88,
|
||||
.uc4_pos = 0x390dc, .uc4_length = 0x44a0,
|
||||
.uc5_pos = 0x3d580, .uc5_length = 0x4ec0,
|
||||
.pcm4_pos = 0x42444, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x428c0, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "wl.o",
|
||||
.version = "3.31.15.0", /* 07/28/2003 */
|
||||
.md5 = "98dd50a95b02c8bcb3725c770df81dfc",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN |
|
||||
MISSING_INITVAL_08,
|
||||
.iv_pos = 0x32270,
|
||||
.uc2_pos = 0x35350, .uc2_length = 0x3d88,
|
||||
.uc4_pos = 0x390dc, .uc4_length = 0x44a0,
|
||||
.uc5_pos = 0x3d580, .uc5_length = 0x4ec0,
|
||||
.pcm4_pos = 0x42444, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x428c0, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "wl.o",
|
||||
.version = "3.50.21.0", /* 05/11/2003 */
|
||||
.md5 = "f71be0e1d14f68c98d916465a300d835",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x38990,
|
||||
.uc2_pos = 0x3c428, .uc2_length = 0x3db8,
|
||||
.uc4_pos = 0x401e4, .uc4_length = 0x45d8,
|
||||
.uc5_pos = 0x447c0, .uc5_length = 0x5050,
|
||||
.pcm4_pos = 0x49814, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x49c90, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "wl.o",
|
||||
.version = "3.50.21.10", /* 01/21/2004 */
|
||||
.md5 = "191029d5e7097ed7db92cbd6e6131f85",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x3a5d0,
|
||||
.uc2_pos = 0x3e0b8, .uc2_length = 0x3e00,
|
||||
.uc4_pos = 0x41ebc, .uc4_length = 0x4628,
|
||||
.uc5_pos = 0x464e8, .uc5_length = 0x5548,
|
||||
.pcm4_pos = 0x4ba34, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x4beb0, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "wl.o",
|
||||
.version = "3.60.7.0 ? (1.3.2.0)", /* 02/04/2004 */
|
||||
.md5 = "7009220d84c445797443aa0221b7d8a4", /* no bcm version found */
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN, /* but same fw files are also */
|
||||
.iv_pos = 0x545e0, /* in bcmwl5.sys 3.60.7.0, */
|
||||
.uc2_pos = 0x581d8, .uc2_length = 0x3e08,
|
||||
.uc4_pos = 0x5bfe4, .uc4_length = 0x4e58,
|
||||
.uc5_pos = 0x60e40, .uc5_length = 0x5608,
|
||||
.pcm4_pos = 0x6644c, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x668c8, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "wl.o",
|
||||
.version = "3.60.13.0", /* 05/05/2004 */
|
||||
.md5 = "275dd4958eb94058d4650f58d534c635",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x3b740,
|
||||
.uc2_pos = 0x3f388, .uc2_length = 0x3e30,
|
||||
.uc4_pos = 0x431bc, .uc4_length = 0x4e80,
|
||||
.uc5_pos = 0x48040, .uc5_length = 0x5630,
|
||||
.pcm4_pos = 0x4d674, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x4daf0, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "wl.o",
|
||||
.version = "3.60.13.0", /* 08/02/2004 */
|
||||
.md5 = "4f20653a0b7c0bb3bd1ee0dd79f77785",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x3b730,
|
||||
.uc2_pos = 0x3f378, .uc2_length = 0x3e30,
|
||||
.uc4_pos = 0x431ac, .uc4_length = 0x4e80,
|
||||
.uc5_pos = 0x48030, .uc5_length = 0x5630,
|
||||
.pcm4_pos = 0x4d664, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x4dae0, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "wl.o",
|
||||
.version = "3.90.7.0", /* 14/10/2004 */
|
||||
.md5 = "f15b59ad4d6f6ad2c7f45193d033aff8",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x4d890,
|
||||
.uc2_pos = 0x51500, .uc2_length = 0x3ec0,
|
||||
.uc4_pos = 0x553c4, .uc4_length = 0x4d60,
|
||||
.uc5_pos = 0x5a128, .uc5_length = 0x5750,
|
||||
.pcm4_pos = 0x5f87c, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x5fda0, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "wl.o",
|
||||
.version = "3.90.37.0", /* 15/02/2005 */
|
||||
.md5 = "984c42947552652d5ab61b78e7d12227",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x4cf50,
|
||||
.uc2_pos = 0x50bc0, .uc2_length = 0x3f48,
|
||||
.uc4_pos = 0x54b0c, .uc4_length = 0x4df0,
|
||||
.uc5_pos = 0x59900, .uc5_length = 0x57e0,
|
||||
.pcm4_pos = 0x5f0e4, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x5f608, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "wl_ap.o",
|
||||
.version = "3.31.16.0", /* 08/06/2003 */
|
||||
.md5 = "463633e7bf0efc6c0f8eac2514a71024",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN |
|
||||
MISSING_INITVAL_08,
|
||||
.iv_pos = 0x32270,
|
||||
.uc2_pos = 0x35350, .uc2_length = 0x3d88,
|
||||
.uc4_pos = 0x390dc, .uc4_length = 0x44a0,
|
||||
.uc5_pos = 0x3d580, .uc5_length = 0x4ec0,
|
||||
.pcm4_pos = 0x42444, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x428c0, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "wl_ap.o",
|
||||
.version = "3.90.37.0", /* 15/02/2005 */
|
||||
.md5 = "0538296d46a854d2facc9a0db2088180",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x3eac0,
|
||||
.uc2_pos = 0x42730, .uc2_length = 0x3f48,
|
||||
.uc4_pos = 0x4667c, .uc4_length = 0x4df0,
|
||||
.uc5_pos = 0x4b470, .uc5_length = 0x57e0,
|
||||
.pcm4_pos = 0x50c54, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x51178, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "wl_ap.o",
|
||||
.version = "3.90.37.0", /* 15/02/2005 */
|
||||
.md5 = "6c9073531a528dd455b716b5e821e696",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x3eac0,
|
||||
.uc2_pos = 0x42730, .uc2_length = 0x3f48,
|
||||
.uc4_pos = 0x4667c, .uc4_length = 0x4df0,
|
||||
.uc5_pos = 0x4b470, .uc5_length = 0x57e0,
|
||||
.pcm4_pos = 0x50c54, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x51178, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "wl_apsta.o",
|
||||
.version = "3.31.16.0", /* 06/08/2003 */
|
||||
.md5 = "22b90e4cbeee45ad7f78ff536c65712a",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN |
|
||||
MISSING_INITVAL_08,
|
||||
.iv_pos = 0x38020,
|
||||
.uc2_pos = 0x3b100, .uc2_length = 0x3d88,
|
||||
.uc4_pos = 0x3ee8c, .uc4_length = 0x44a0,
|
||||
.uc5_pos = 0x43330, .uc5_length = 0x4ec0,
|
||||
.pcm4_pos = 0x481f4, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x48670, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "wl_apsta.o",
|
||||
.version = "3.31.16.0", /* 06/08/2003 */
|
||||
.md5 = "dfce35a8b5cb6e53e1ab75342c7e7194",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN |
|
||||
MISSING_INITVAL_08,
|
||||
.iv_pos = 0x38020,
|
||||
.uc2_pos = 0x3b100, .uc2_length = 0x3d88,
|
||||
.uc4_pos = 0x3ee8c, .uc4_length = 0x44a0,
|
||||
.uc5_pos = 0x43330, .uc5_length = 0x4ec0,
|
||||
.pcm4_pos = 0x481f4, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x48670, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "wl_apsta.o",
|
||||
.version = "3.90.37.0", /* 15/02/2005 */
|
||||
.md5 = "2922e6c48917eacd6c8c094347d2ec4b",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x4ebc0,
|
||||
.uc2_pos = 0x52830, .uc2_length = 0x3f48,
|
||||
.uc4_pos = 0x5677c, .uc4_length = 0x4df0,
|
||||
.uc5_pos = 0x5b570, .uc5_length = 0x57e0,
|
||||
.pcm4_pos = 0x60d54, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x61278, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "wl_apsta.o",
|
||||
.version = "3.90.37.0", /* 15/02/2005 */
|
||||
.md5 = "f9fa565a766e8befeb495a8a8c0c134b",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x4ebc0,
|
||||
.uc2_pos = 0x52830, .uc2_length = 0x3f48,
|
||||
.uc4_pos = 0x5677c, .uc4_length = 0x4df0,
|
||||
.uc5_pos = 0x5b570, .uc5_length = 0x57e0,
|
||||
.pcm4_pos = 0x60d54, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x61278, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "wl_apsta.o",
|
||||
.version = "3.130.20.0", /* 19/05/2005 */
|
||||
.md5 = "e08665c5c5b66beb9c3b2dd54aa80cb3",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x56020,
|
||||
.uc2_pos = 0x59ca0, .uc2_length = 0x3fe0,
|
||||
.uc4_pos = 0x5dc84, .uc4_length = 0x4e78,
|
||||
.uc5_pos = 0x62b00, .uc5_length = 0x5700,
|
||||
.uc11_pos = 0x68204, .uc11_length = 0x54a8,
|
||||
.pcm4_pos = 0x6d6b0, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x6dbd4, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "wl_sta.o",
|
||||
.version = "3.31.16.0", /* 08/06/2003 */
|
||||
.md5 = "c3e663cb78b2fc299088de69fc11a9a9",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN |
|
||||
MISSING_INITVAL_08,
|
||||
.iv_pos = 0x317b0,
|
||||
.uc2_pos = 0x34890, .uc2_length = 0x3d88,
|
||||
.uc4_pos = 0x3861c, .uc4_length = 0x44a0,
|
||||
.uc5_pos = 0x3cac0, .uc5_length = 0x4ec0,
|
||||
.pcm4_pos = 0x41984, .pcm4_length = 0x478,
|
||||
.pcm5_pos = 0x41e00, .pcm5_length = 0x478,
|
||||
},
|
||||
{
|
||||
.name = "wl_sta.o",
|
||||
.version = "3.90.37.0", /* 15/02/2005 */
|
||||
.md5 = "4631d4d4c3ab943462e1ea24f4dba7bd",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x47040,
|
||||
.uc2_pos = 0x4acb0, .uc2_length = 0x3f48,
|
||||
.uc4_pos = 0x4ebfc, .uc4_length = 0x4df0,
|
||||
.uc5_pos = 0x539f0, .uc5_length = 0x57e0,
|
||||
.pcm4_pos = 0x591d4, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x596f8, .pcm5_length = 0x520,
|
||||
},
|
||||
{
|
||||
.name = "wl_sta.o",
|
||||
.version = "3.90.37.0", /* 15/02/2005 */
|
||||
.md5 = "bf824b38b3993e0a8b5a9bf717c428ed",
|
||||
.flags = BYTE_ORDER_LITTLE_ENDIAN,
|
||||
.iv_pos = 0x47040,
|
||||
.uc2_pos = 0x4acb0, .uc2_length = 0x3f48,
|
||||
.uc4_pos = 0x4ebfc, .uc4_length = 0x4df0,
|
||||
.uc5_pos = 0x539f0, .uc5_length = 0x57e0,
|
||||
.pcm4_pos = 0x591d4, .pcm4_length = 0x520,
|
||||
.pcm5_pos = 0x596f8, .pcm5_length = 0x520,
|
||||
},
|
||||
};
|
||||
|
||||
#define FILES (sizeof(files) / sizeof(files[0]))
|
@ -1,253 +0,0 @@
|
||||
/*
|
||||
* This code implements the MD5 message-digest algorithm.
|
||||
* The algorithm is due to Ron Rivest. This code was
|
||||
* written by Colin Plumb in 1993, no copyright is claimed.
|
||||
* This code is in the public domain; do with it what you wish.
|
||||
*
|
||||
* Equivalent code is available from RSA Data Security, Inc.
|
||||
* This code has been tested against that, and is equivalent,
|
||||
* except that you don't need to include two pages of legalese
|
||||
* with every copy.
|
||||
*
|
||||
* To compute the message digest of a chunk of bytes, declare an
|
||||
* MD5Context structure, pass it to MD5Init, call MD5Update as
|
||||
* needed on buffers full of bytes, and then call MD5Final, which
|
||||
* will fill a supplied 16-byte array with the digest.
|
||||
*/
|
||||
|
||||
/* Brutally hacked by John Walker back from ANSI C to K&R (no
|
||||
prototypes) to maintain the tradition that Netfone will compile
|
||||
with Sun's original "cc". */
|
||||
/* Ripped out ugly K&R again ;) --mbuesch */
|
||||
|
||||
#include <memory.h> /* for memcpy() */
|
||||
#include "md5.h"
|
||||
|
||||
extern int big_endian_cpu;
|
||||
|
||||
/*
|
||||
* Note: this code is harmless on little-endian machines,
|
||||
* but we return early nevertheless.
|
||||
*/
|
||||
static void byteReverse(unsigned char *buf, unsigned longs)
|
||||
{
|
||||
uint32_t t;
|
||||
|
||||
if (!big_endian_cpu)
|
||||
return;
|
||||
|
||||
do {
|
||||
t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
|
||||
((unsigned) buf[1] << 8 | buf[0]);
|
||||
*(uint32_t *) buf = t;
|
||||
buf += 4;
|
||||
} while (--longs);
|
||||
}
|
||||
|
||||
/* The four core functions - F1 is optimized somewhat */
|
||||
|
||||
/* #define F1(x, y, z) (x & y | ~x & z) */
|
||||
#define F1(x, y, z) (z ^ (x & (y ^ z)))
|
||||
#define F2(x, y, z) F1(z, x, y)
|
||||
#define F3(x, y, z) (x ^ y ^ z)
|
||||
#define F4(x, y, z) (y ^ (x | ~z))
|
||||
|
||||
/* This is the central step in the MD5 algorithm. */
|
||||
#define MD5STEP(f, w, x, y, z, data, s) \
|
||||
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
|
||||
|
||||
/*
|
||||
* The core of the MD5 algorithm, this alters an existing MD5 hash to
|
||||
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
||||
* the data and converts bytes into longwords for this routine.
|
||||
*/
|
||||
static void MD5Transform(uint32_t *buf, uint32_t *in)
|
||||
{
|
||||
register uint32_t a, b, c, d;
|
||||
|
||||
a = buf[0];
|
||||
b = buf[1];
|
||||
c = buf[2];
|
||||
d = buf[3];
|
||||
|
||||
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
|
||||
|
||||
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
|
||||
|
||||
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
|
||||
|
||||
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
|
||||
|
||||
buf[0] += a;
|
||||
buf[1] += b;
|
||||
buf[2] += c;
|
||||
buf[3] += d;
|
||||
}
|
||||
|
||||
/*
|
||||
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
|
||||
* initialization constants.
|
||||
*/
|
||||
void MD5Init(struct MD5Context *ctx)
|
||||
{
|
||||
ctx->buf[0] = 0x67452301;
|
||||
ctx->buf[1] = 0xefcdab89;
|
||||
ctx->buf[2] = 0x98badcfe;
|
||||
ctx->buf[3] = 0x10325476;
|
||||
|
||||
ctx->bits[0] = 0;
|
||||
ctx->bits[1] = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update context to reflect the concatenation of another buffer full
|
||||
* of bytes.
|
||||
*/
|
||||
void MD5Update(struct MD5Context *ctx, unsigned char *buf, unsigned len)
|
||||
{
|
||||
uint32_t t;
|
||||
|
||||
/* Update bitcount */
|
||||
|
||||
t = ctx->bits[0];
|
||||
if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t)
|
||||
ctx->bits[1]++; /* Carry from low to high */
|
||||
ctx->bits[1] += len >> 29;
|
||||
|
||||
t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
|
||||
|
||||
/* Handle any leading odd-sized chunks */
|
||||
|
||||
if (t) {
|
||||
unsigned char *p = (unsigned char *) ctx->in + t;
|
||||
|
||||
t = 64 - t;
|
||||
if (len < t) {
|
||||
memcpy(p, buf, len);
|
||||
return;
|
||||
}
|
||||
memcpy(p, buf, t);
|
||||
byteReverse(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, (uint32_t *) ctx->in);
|
||||
buf += t;
|
||||
len -= t;
|
||||
}
|
||||
/* Process data in 64-byte chunks */
|
||||
|
||||
while (len >= 64) {
|
||||
memcpy(ctx->in, buf, 64);
|
||||
byteReverse(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, (uint32_t *) ctx->in);
|
||||
buf += 64;
|
||||
len -= 64;
|
||||
}
|
||||
|
||||
/* Handle any remaining bytes of data. */
|
||||
|
||||
memcpy(ctx->in, buf, len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Final wrapup - pad to 64-byte boundary with the bit pattern
|
||||
* 1 0* (64-bit count of bits processed, MSB-first)
|
||||
*/
|
||||
void MD5Final(unsigned char *digest, struct MD5Context *ctx)
|
||||
{
|
||||
unsigned count;
|
||||
unsigned char *p;
|
||||
|
||||
/* Compute number of bytes mod 64 */
|
||||
count = (ctx->bits[0] >> 3) & 0x3F;
|
||||
|
||||
/* Set the first char of padding to 0x80. This is safe since there is
|
||||
always at least one byte free */
|
||||
p = ctx->in + count;
|
||||
*p++ = 0x80;
|
||||
|
||||
/* Bytes of padding needed to make 64 bytes */
|
||||
count = 64 - 1 - count;
|
||||
|
||||
/* Pad out to 56 mod 64 */
|
||||
if (count < 8) {
|
||||
/* Two lots of padding: Pad the first block to 64 bytes */
|
||||
memset(p, 0, count);
|
||||
byteReverse(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, (uint32_t *) ctx->in);
|
||||
|
||||
/* Now fill the next block with 56 bytes */
|
||||
memset(ctx->in, 0, 56);
|
||||
} else {
|
||||
/* Pad block to 56 bytes */
|
||||
memset(p, 0, count - 8);
|
||||
}
|
||||
byteReverse(ctx->in, 14);
|
||||
|
||||
/* Append length in bits and transform */
|
||||
((uint32_t *) ctx->in)[14] = ctx->bits[0];
|
||||
((uint32_t *) ctx->in)[15] = ctx->bits[1];
|
||||
|
||||
MD5Transform(ctx->buf, (uint32_t *) ctx->in);
|
||||
byteReverse((unsigned char *) ctx->buf, 4);
|
||||
memcpy(digest, ctx->buf, 16);
|
||||
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
#ifndef FWCUTTER_MD5_H_
|
||||
#define FWCUTTER_MD5_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct MD5Context {
|
||||
uint32_t buf[4];
|
||||
uint32_t bits[2];
|
||||
unsigned char in[64];
|
||||
};
|
||||
|
||||
void MD5Init(struct MD5Context *ctx);
|
||||
void MD5Update(struct MD5Context *ctx, unsigned char *buf, unsigned len);
|
||||
void MD5Final(unsigned char *digest, struct MD5Context *ctx);
|
||||
|
||||
#endif /* FWCUTTER_MD5_H_ */
|
@ -1,4 +0,0 @@
|
||||
Package: kmod-bcm43xx-standalone
|
||||
Priority: optional
|
||||
Section: sys
|
||||
Description: Free BCM43xx wireless driver (devicescape)
|
@ -1,10 +0,0 @@
|
||||
config BR2_PACKAGE_KMOD_IEEE80211_DSCAPE
|
||||
prompt "kmod-ieee80211-dscape............. IEEE 802.11 stack (devicescape)"
|
||||
tristate
|
||||
default n
|
||||
depends BR2_LINUX_2_6_BRCM || BR2_LINUX_2_6_X86
|
||||
|
||||
help
|
||||
IEEE 802.11 stack (devicescape)
|
||||
|
||||
http://ftp.kernel.org/pub/linux/kernel/people/jbenc/
|
@ -1,46 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include ../../rules.mk
|
||||
|
||||
PKG_NAME := kmod-ieee80211-dscape
|
||||
PKG_RELEASE := 1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(TOPDIR)/package/rules.mk
|
||||
|
||||
$(eval $(call PKG_template,KMOD_IEEE80211_DSCAPE,$(PKG_NAME),$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))))
|
||||
|
||||
$(PKG_BUILD_DIR)/.prepared:
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
touch $@
|
||||
|
||||
$(PKG_BUILD_DIR)/.configured:
|
||||
touch $@
|
||||
|
||||
$(PKG_BUILD_DIR)/.built:
|
||||
$(MAKE) -C "$(LINUX_DIR)" \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
PATH="$(TARGET_PATH)" \
|
||||
SUBDIRS="$(PKG_BUILD_DIR)" \
|
||||
LINUXINCLUDE="-I$(shell pwd)/src/include -I$(LINUX_DIR)/include" \
|
||||
modules
|
||||
touch $@
|
||||
|
||||
$(IPKG_KMOD_IEEE80211_DSCAPE):
|
||||
install -m0755 -d $(IDIR_KMOD_IEEE80211_DSCAPE)/lib/modules/$(LINUX_VERSION)
|
||||
#install -m0755 -d $(IDIR_KMOD_IEEE80211_DSCAPE)/etc/modules.d
|
||||
$(CP) $(PKG_BUILD_DIR)/*.ko $(IDIR_KMOD_IEEE80211_DSCAPE)/lib/modules/$(LINUX_VERSION)
|
||||
$(IPKG_BUILD) $(IDIR_KMOD_IEEE80211_DSCAPE) $(PACKAGE_DIR)
|
||||
|
||||
install-dev:
|
||||
mkdir -p $(STAGING_DIR)/usr/include/ieee80211-dscape
|
||||
$(CP) src/include/* $(STAGING_DIR)/usr/include/ieee80211-dscape/
|
||||
|
||||
uninstall-dev:
|
||||
rm -rf $(STAGING_DIR)/usr/include/ieee80211-dscape
|
||||
|
||||
compile-targets: install-dev
|
||||
clean-targets: uninstall-dev
|
@ -1,4 +0,0 @@
|
||||
Package: kmod-ieee80211-dscape
|
||||
Priority: optional
|
||||
Section: sys
|
||||
Description: IEEE 802.11 stack (devicescape)
|
@ -1,32 +0,0 @@
|
||||
config IEEE80211
|
||||
tristate "Generic IEEE 802.11 Networking Stack"
|
||||
---help---
|
||||
This option enables the hardware independent IEEE 802.11
|
||||
networking stack.
|
||||
|
||||
config IEEE80211_DEBUG
|
||||
bool "Enable debugging output"
|
||||
depends on IEEE80211
|
||||
---help---
|
||||
This option will enable debug tracing output for the
|
||||
ieee80211 network stack.
|
||||
|
||||
If you are not trying to debug or develop the ieee80211
|
||||
subsystem, you most likely want to say N here.
|
||||
|
||||
config IEEE80211_VERBOSE_DEBUG
|
||||
bool "Verbose debugging output"
|
||||
depends on IEEE80211_DEBUG
|
||||
|
||||
config TKIP_DEBUG
|
||||
bool "TKIP debugging"
|
||||
depends on IEEE80211_DEBUG
|
||||
|
||||
config IEEE80211_DEBUG_COUNTERS
|
||||
bool "Extra statistics for TX/RX debugging"
|
||||
depends on IEEE80211_DEBUG
|
||||
|
||||
config HOSTAPD_WPA_TESTING
|
||||
bool "Support for TKIP countermeasures testing"
|
||||
depends on IEEE80211_DEBUG
|
||||
|
@ -1,23 +0,0 @@
|
||||
obj-$(CONFIG_IEEE80211) += 80211.o rate_control.o
|
||||
|
||||
80211-objs := \
|
||||
ieee80211.o \
|
||||
ieee80211_ioctl.o \
|
||||
sta_info.o \
|
||||
wep.o \
|
||||
wpa.o \
|
||||
ieee80211_proc.o \
|
||||
ieee80211_scan.o \
|
||||
ieee80211_sta.o \
|
||||
michael.o \
|
||||
tkip.o \
|
||||
aes_ccm.o \
|
||||
wme.o
|
||||
|
||||
ifeq ($(CONFIG_NET_SCHED),)
|
||||
80211-objs += fifo_qdisc.o
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_IEEE80211_LEDS),y)
|
||||
80211-objs += ieee80211_led.o
|
||||
endif
|
@ -1,564 +0,0 @@
|
||||
/* Based on Rijndael implementation that has been placed in the public domain,
|
||||
* although heavily modified.
|
||||
*
|
||||
* Modifications Copyright 2003, Instant802 Networks, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Optimized both speed and size by removing not used key lengths (only
|
||||
* 128-bit is used in IEEE 802.11i).
|
||||
*/
|
||||
|
||||
/* Use 256-byte Te4 table instead of larger 1024-byte */
|
||||
#define SMALL_TE4
|
||||
|
||||
/* Save data size by using only one 1k table, but with a drawback of having to
|
||||
* rotate entries at lookup. This can be useful, if the CPU supports free
|
||||
* rotate on memory read. However, if this is not the case, this is much slower
|
||||
* than four-table implementation. */
|
||||
/* #define ONLY_ONE_TABLE */
|
||||
|
||||
|
||||
/* --- start of code that is based on public domain AES implementation --- */
|
||||
|
||||
/**
|
||||
* rijndael-alg-fst.c
|
||||
*
|
||||
* @version 3.0 (December 2000)
|
||||
*
|
||||
* Optimised ANSI C code for the Rijndael cipher (now AES)
|
||||
*
|
||||
* @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>
|
||||
* @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>
|
||||
* @author Paulo Barreto <paulo.barreto@terra.com.br>
|
||||
*
|
||||
* This code is hereby placed in the public domain.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
Te0[x] = S [x].[02, 01, 01, 03];
|
||||
Te1[x] = S [x].[03, 02, 01, 01];
|
||||
Te2[x] = S [x].[01, 03, 02, 01];
|
||||
Te3[x] = S [x].[01, 01, 03, 02];
|
||||
Te4[x] = S [x].[01, 01, 01, 01];
|
||||
*/
|
||||
|
||||
static const u32 Te0[256] =
|
||||
{
|
||||
0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU,
|
||||
0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U,
|
||||
0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU,
|
||||
0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU,
|
||||
0x8fcaca45U, 0x1f82829dU, 0x89c9c940U, 0xfa7d7d87U,
|
||||
0xeffafa15U, 0xb25959ebU, 0x8e4747c9U, 0xfbf0f00bU,
|
||||
0x41adadecU, 0xb3d4d467U, 0x5fa2a2fdU, 0x45afafeaU,
|
||||
0x239c9cbfU, 0x53a4a4f7U, 0xe4727296U, 0x9bc0c05bU,
|
||||
0x75b7b7c2U, 0xe1fdfd1cU, 0x3d9393aeU, 0x4c26266aU,
|
||||
0x6c36365aU, 0x7e3f3f41U, 0xf5f7f702U, 0x83cccc4fU,
|
||||
0x6834345cU, 0x51a5a5f4U, 0xd1e5e534U, 0xf9f1f108U,
|
||||
0xe2717193U, 0xabd8d873U, 0x62313153U, 0x2a15153fU,
|
||||
0x0804040cU, 0x95c7c752U, 0x46232365U, 0x9dc3c35eU,
|
||||
0x30181828U, 0x379696a1U, 0x0a05050fU, 0x2f9a9ab5U,
|
||||
0x0e070709U, 0x24121236U, 0x1b80809bU, 0xdfe2e23dU,
|
||||
0xcdebeb26U, 0x4e272769U, 0x7fb2b2cdU, 0xea75759fU,
|
||||
0x1209091bU, 0x1d83839eU, 0x582c2c74U, 0x341a1a2eU,
|
||||
0x361b1b2dU, 0xdc6e6eb2U, 0xb45a5aeeU, 0x5ba0a0fbU,
|
||||
0xa45252f6U, 0x763b3b4dU, 0xb7d6d661U, 0x7db3b3ceU,
|
||||
0x5229297bU, 0xdde3e33eU, 0x5e2f2f71U, 0x13848497U,
|
||||
0xa65353f5U, 0xb9d1d168U, 0x00000000U, 0xc1eded2cU,
|
||||
0x40202060U, 0xe3fcfc1fU, 0x79b1b1c8U, 0xb65b5bedU,
|
||||
0xd46a6abeU, 0x8dcbcb46U, 0x67bebed9U, 0x7239394bU,
|
||||
0x944a4adeU, 0x984c4cd4U, 0xb05858e8U, 0x85cfcf4aU,
|
||||
0xbbd0d06bU, 0xc5efef2aU, 0x4faaaae5U, 0xedfbfb16U,
|
||||
0x864343c5U, 0x9a4d4dd7U, 0x66333355U, 0x11858594U,
|
||||
0x8a4545cfU, 0xe9f9f910U, 0x04020206U, 0xfe7f7f81U,
|
||||
0xa05050f0U, 0x783c3c44U, 0x259f9fbaU, 0x4ba8a8e3U,
|
||||
0xa25151f3U, 0x5da3a3feU, 0x804040c0U, 0x058f8f8aU,
|
||||
0x3f9292adU, 0x219d9dbcU, 0x70383848U, 0xf1f5f504U,
|
||||
0x63bcbcdfU, 0x77b6b6c1U, 0xafdada75U, 0x42212163U,
|
||||
0x20101030U, 0xe5ffff1aU, 0xfdf3f30eU, 0xbfd2d26dU,
|
||||
0x81cdcd4cU, 0x180c0c14U, 0x26131335U, 0xc3ecec2fU,
|
||||
0xbe5f5fe1U, 0x359797a2U, 0x884444ccU, 0x2e171739U,
|
||||
0x93c4c457U, 0x55a7a7f2U, 0xfc7e7e82U, 0x7a3d3d47U,
|
||||
0xc86464acU, 0xba5d5de7U, 0x3219192bU, 0xe6737395U,
|
||||
0xc06060a0U, 0x19818198U, 0x9e4f4fd1U, 0xa3dcdc7fU,
|
||||
0x44222266U, 0x542a2a7eU, 0x3b9090abU, 0x0b888883U,
|
||||
0x8c4646caU, 0xc7eeee29U, 0x6bb8b8d3U, 0x2814143cU,
|
||||
0xa7dede79U, 0xbc5e5ee2U, 0x160b0b1dU, 0xaddbdb76U,
|
||||
0xdbe0e03bU, 0x64323256U, 0x743a3a4eU, 0x140a0a1eU,
|
||||
0x924949dbU, 0x0c06060aU, 0x4824246cU, 0xb85c5ce4U,
|
||||
0x9fc2c25dU, 0xbdd3d36eU, 0x43acacefU, 0xc46262a6U,
|
||||
0x399191a8U, 0x319595a4U, 0xd3e4e437U, 0xf279798bU,
|
||||
0xd5e7e732U, 0x8bc8c843U, 0x6e373759U, 0xda6d6db7U,
|
||||
0x018d8d8cU, 0xb1d5d564U, 0x9c4e4ed2U, 0x49a9a9e0U,
|
||||
0xd86c6cb4U, 0xac5656faU, 0xf3f4f407U, 0xcfeaea25U,
|
||||
0xca6565afU, 0xf47a7a8eU, 0x47aeaee9U, 0x10080818U,
|
||||
0x6fbabad5U, 0xf0787888U, 0x4a25256fU, 0x5c2e2e72U,
|
||||
0x381c1c24U, 0x57a6a6f1U, 0x73b4b4c7U, 0x97c6c651U,
|
||||
0xcbe8e823U, 0xa1dddd7cU, 0xe874749cU, 0x3e1f1f21U,
|
||||
0x964b4bddU, 0x61bdbddcU, 0x0d8b8b86U, 0x0f8a8a85U,
|
||||
0xe0707090U, 0x7c3e3e42U, 0x71b5b5c4U, 0xcc6666aaU,
|
||||
0x904848d8U, 0x06030305U, 0xf7f6f601U, 0x1c0e0e12U,
|
||||
0xc26161a3U, 0x6a35355fU, 0xae5757f9U, 0x69b9b9d0U,
|
||||
0x17868691U, 0x99c1c158U, 0x3a1d1d27U, 0x279e9eb9U,
|
||||
0xd9e1e138U, 0xebf8f813U, 0x2b9898b3U, 0x22111133U,
|
||||
0xd26969bbU, 0xa9d9d970U, 0x078e8e89U, 0x339494a7U,
|
||||
0x2d9b9bb6U, 0x3c1e1e22U, 0x15878792U, 0xc9e9e920U,
|
||||
0x87cece49U, 0xaa5555ffU, 0x50282878U, 0xa5dfdf7aU,
|
||||
0x038c8c8fU, 0x59a1a1f8U, 0x09898980U, 0x1a0d0d17U,
|
||||
0x65bfbfdaU, 0xd7e6e631U, 0x844242c6U, 0xd06868b8U,
|
||||
0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U,
|
||||
0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU,
|
||||
};
|
||||
|
||||
#ifndef ONLY_ONE_TABLE
|
||||
static const u32 Te1[256] =
|
||||
{
|
||||
0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU,
|
||||
0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U,
|
||||
0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU,
|
||||
0x19e7fefeU, 0x62b5d7d7U, 0xe64dababU, 0x9aec7676U,
|
||||
0x458fcacaU, 0x9d1f8282U, 0x4089c9c9U, 0x87fa7d7dU,
|
||||
0x15effafaU, 0xebb25959U, 0xc98e4747U, 0x0bfbf0f0U,
|
||||
0xec41adadU, 0x67b3d4d4U, 0xfd5fa2a2U, 0xea45afafU,
|
||||
0xbf239c9cU, 0xf753a4a4U, 0x96e47272U, 0x5b9bc0c0U,
|
||||
0xc275b7b7U, 0x1ce1fdfdU, 0xae3d9393U, 0x6a4c2626U,
|
||||
0x5a6c3636U, 0x417e3f3fU, 0x02f5f7f7U, 0x4f83ccccU,
|
||||
0x5c683434U, 0xf451a5a5U, 0x34d1e5e5U, 0x08f9f1f1U,
|
||||
0x93e27171U, 0x73abd8d8U, 0x53623131U, 0x3f2a1515U,
|
||||
0x0c080404U, 0x5295c7c7U, 0x65462323U, 0x5e9dc3c3U,
|
||||
0x28301818U, 0xa1379696U, 0x0f0a0505U, 0xb52f9a9aU,
|
||||
0x090e0707U, 0x36241212U, 0x9b1b8080U, 0x3ddfe2e2U,
|
||||
0x26cdebebU, 0x694e2727U, 0xcd7fb2b2U, 0x9fea7575U,
|
||||
0x1b120909U, 0x9e1d8383U, 0x74582c2cU, 0x2e341a1aU,
|
||||
0x2d361b1bU, 0xb2dc6e6eU, 0xeeb45a5aU, 0xfb5ba0a0U,
|
||||
0xf6a45252U, 0x4d763b3bU, 0x61b7d6d6U, 0xce7db3b3U,
|
||||
0x7b522929U, 0x3edde3e3U, 0x715e2f2fU, 0x97138484U,
|
||||
0xf5a65353U, 0x68b9d1d1U, 0x00000000U, 0x2cc1ededU,
|
||||
0x60402020U, 0x1fe3fcfcU, 0xc879b1b1U, 0xedb65b5bU,
|
||||
0xbed46a6aU, 0x468dcbcbU, 0xd967bebeU, 0x4b723939U,
|
||||
0xde944a4aU, 0xd4984c4cU, 0xe8b05858U, 0x4a85cfcfU,
|
||||
0x6bbbd0d0U, 0x2ac5efefU, 0xe54faaaaU, 0x16edfbfbU,
|
||||
0xc5864343U, 0xd79a4d4dU, 0x55663333U, 0x94118585U,
|
||||
0xcf8a4545U, 0x10e9f9f9U, 0x06040202U, 0x81fe7f7fU,
|
||||
0xf0a05050U, 0x44783c3cU, 0xba259f9fU, 0xe34ba8a8U,
|
||||
0xf3a25151U, 0xfe5da3a3U, 0xc0804040U, 0x8a058f8fU,
|
||||
0xad3f9292U, 0xbc219d9dU, 0x48703838U, 0x04f1f5f5U,
|
||||
0xdf63bcbcU, 0xc177b6b6U, 0x75afdadaU, 0x63422121U,
|
||||
0x30201010U, 0x1ae5ffffU, 0x0efdf3f3U, 0x6dbfd2d2U,
|
||||
0x4c81cdcdU, 0x14180c0cU, 0x35261313U, 0x2fc3ececU,
|
||||
0xe1be5f5fU, 0xa2359797U, 0xcc884444U, 0x392e1717U,
|
||||
0x5793c4c4U, 0xf255a7a7U, 0x82fc7e7eU, 0x477a3d3dU,
|
||||
0xacc86464U, 0xe7ba5d5dU, 0x2b321919U, 0x95e67373U,
|
||||
0xa0c06060U, 0x98198181U, 0xd19e4f4fU, 0x7fa3dcdcU,
|
||||
0x66442222U, 0x7e542a2aU, 0xab3b9090U, 0x830b8888U,
|
||||
0xca8c4646U, 0x29c7eeeeU, 0xd36bb8b8U, 0x3c281414U,
|
||||
0x79a7dedeU, 0xe2bc5e5eU, 0x1d160b0bU, 0x76addbdbU,
|
||||
0x3bdbe0e0U, 0x56643232U, 0x4e743a3aU, 0x1e140a0aU,
|
||||
0xdb924949U, 0x0a0c0606U, 0x6c482424U, 0xe4b85c5cU,
|
||||
0x5d9fc2c2U, 0x6ebdd3d3U, 0xef43acacU, 0xa6c46262U,
|
||||
0xa8399191U, 0xa4319595U, 0x37d3e4e4U, 0x8bf27979U,
|
||||
0x32d5e7e7U, 0x438bc8c8U, 0x596e3737U, 0xb7da6d6dU,
|
||||
0x8c018d8dU, 0x64b1d5d5U, 0xd29c4e4eU, 0xe049a9a9U,
|
||||
0xb4d86c6cU, 0xfaac5656U, 0x07f3f4f4U, 0x25cfeaeaU,
|
||||
0xafca6565U, 0x8ef47a7aU, 0xe947aeaeU, 0x18100808U,
|
||||
0xd56fbabaU, 0x88f07878U, 0x6f4a2525U, 0x725c2e2eU,
|
||||
0x24381c1cU, 0xf157a6a6U, 0xc773b4b4U, 0x5197c6c6U,
|
||||
0x23cbe8e8U, 0x7ca1ddddU, 0x9ce87474U, 0x213e1f1fU,
|
||||
0xdd964b4bU, 0xdc61bdbdU, 0x860d8b8bU, 0x850f8a8aU,
|
||||
0x90e07070U, 0x427c3e3eU, 0xc471b5b5U, 0xaacc6666U,
|
||||
0xd8904848U, 0x05060303U, 0x01f7f6f6U, 0x121c0e0eU,
|
||||
0xa3c26161U, 0x5f6a3535U, 0xf9ae5757U, 0xd069b9b9U,
|
||||
0x91178686U, 0x5899c1c1U, 0x273a1d1dU, 0xb9279e9eU,
|
||||
0x38d9e1e1U, 0x13ebf8f8U, 0xb32b9898U, 0x33221111U,
|
||||
0xbbd26969U, 0x70a9d9d9U, 0x89078e8eU, 0xa7339494U,
|
||||
0xb62d9b9bU, 0x223c1e1eU, 0x92158787U, 0x20c9e9e9U,
|
||||
0x4987ceceU, 0xffaa5555U, 0x78502828U, 0x7aa5dfdfU,
|
||||
0x8f038c8cU, 0xf859a1a1U, 0x80098989U, 0x171a0d0dU,
|
||||
0xda65bfbfU, 0x31d7e6e6U, 0xc6844242U, 0xb8d06868U,
|
||||
0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU,
|
||||
0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U,
|
||||
};
|
||||
|
||||
static const u32 Te2[256] =
|
||||
{
|
||||
0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU,
|
||||
0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U,
|
||||
0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU,
|
||||
0xfe19e7feU, 0xd762b5d7U, 0xabe64dabU, 0x769aec76U,
|
||||
0xca458fcaU, 0x829d1f82U, 0xc94089c9U, 0x7d87fa7dU,
|
||||
0xfa15effaU, 0x59ebb259U, 0x47c98e47U, 0xf00bfbf0U,
|
||||
0xadec41adU, 0xd467b3d4U, 0xa2fd5fa2U, 0xafea45afU,
|
||||
0x9cbf239cU, 0xa4f753a4U, 0x7296e472U, 0xc05b9bc0U,
|
||||
0xb7c275b7U, 0xfd1ce1fdU, 0x93ae3d93U, 0x266a4c26U,
|
||||
0x365a6c36U, 0x3f417e3fU, 0xf702f5f7U, 0xcc4f83ccU,
|
||||
0x345c6834U, 0xa5f451a5U, 0xe534d1e5U, 0xf108f9f1U,
|
||||
0x7193e271U, 0xd873abd8U, 0x31536231U, 0x153f2a15U,
|
||||
0x040c0804U, 0xc75295c7U, 0x23654623U, 0xc35e9dc3U,
|
||||
0x18283018U, 0x96a13796U, 0x050f0a05U, 0x9ab52f9aU,
|
||||
0x07090e07U, 0x12362412U, 0x809b1b80U, 0xe23ddfe2U,
|
||||
0xeb26cdebU, 0x27694e27U, 0xb2cd7fb2U, 0x759fea75U,
|
||||
0x091b1209U, 0x839e1d83U, 0x2c74582cU, 0x1a2e341aU,
|
||||
0x1b2d361bU, 0x6eb2dc6eU, 0x5aeeb45aU, 0xa0fb5ba0U,
|
||||
0x52f6a452U, 0x3b4d763bU, 0xd661b7d6U, 0xb3ce7db3U,
|
||||
0x297b5229U, 0xe33edde3U, 0x2f715e2fU, 0x84971384U,
|
||||
0x53f5a653U, 0xd168b9d1U, 0x00000000U, 0xed2cc1edU,
|
||||
0x20604020U, 0xfc1fe3fcU, 0xb1c879b1U, 0x5bedb65bU,
|
||||
0x6abed46aU, 0xcb468dcbU, 0xbed967beU, 0x394b7239U,
|
||||
0x4ade944aU, 0x4cd4984cU, 0x58e8b058U, 0xcf4a85cfU,
|
||||
0xd06bbbd0U, 0xef2ac5efU, 0xaae54faaU, 0xfb16edfbU,
|
||||
0x43c58643U, 0x4dd79a4dU, 0x33556633U, 0x85941185U,
|
||||
0x45cf8a45U, 0xf910e9f9U, 0x02060402U, 0x7f81fe7fU,
|
||||
0x50f0a050U, 0x3c44783cU, 0x9fba259fU, 0xa8e34ba8U,
|
||||
0x51f3a251U, 0xa3fe5da3U, 0x40c08040U, 0x8f8a058fU,
|
||||
0x92ad3f92U, 0x9dbc219dU, 0x38487038U, 0xf504f1f5U,
|
||||
0xbcdf63bcU, 0xb6c177b6U, 0xda75afdaU, 0x21634221U,
|
||||
0x10302010U, 0xff1ae5ffU, 0xf30efdf3U, 0xd26dbfd2U,
|
||||
0xcd4c81cdU, 0x0c14180cU, 0x13352613U, 0xec2fc3ecU,
|
||||
0x5fe1be5fU, 0x97a23597U, 0x44cc8844U, 0x17392e17U,
|
||||
0xc45793c4U, 0xa7f255a7U, 0x7e82fc7eU, 0x3d477a3dU,
|
||||
0x64acc864U, 0x5de7ba5dU, 0x192b3219U, 0x7395e673U,
|
||||
0x60a0c060U, 0x81981981U, 0x4fd19e4fU, 0xdc7fa3dcU,
|
||||
0x22664422U, 0x2a7e542aU, 0x90ab3b90U, 0x88830b88U,
|
||||
0x46ca8c46U, 0xee29c7eeU, 0xb8d36bb8U, 0x143c2814U,
|
||||
0xde79a7deU, 0x5ee2bc5eU, 0x0b1d160bU, 0xdb76addbU,
|
||||
0xe03bdbe0U, 0x32566432U, 0x3a4e743aU, 0x0a1e140aU,
|
||||
0x49db9249U, 0x060a0c06U, 0x246c4824U, 0x5ce4b85cU,
|
||||
0xc25d9fc2U, 0xd36ebdd3U, 0xacef43acU, 0x62a6c462U,
|
||||
0x91a83991U, 0x95a43195U, 0xe437d3e4U, 0x798bf279U,
|
||||
0xe732d5e7U, 0xc8438bc8U, 0x37596e37U, 0x6db7da6dU,
|
||||
0x8d8c018dU, 0xd564b1d5U, 0x4ed29c4eU, 0xa9e049a9U,
|
||||
0x6cb4d86cU, 0x56faac56U, 0xf407f3f4U, 0xea25cfeaU,
|
||||
0x65afca65U, 0x7a8ef47aU, 0xaee947aeU, 0x08181008U,
|
||||
0xbad56fbaU, 0x7888f078U, 0x256f4a25U, 0x2e725c2eU,
|
||||
0x1c24381cU, 0xa6f157a6U, 0xb4c773b4U, 0xc65197c6U,
|
||||
0xe823cbe8U, 0xdd7ca1ddU, 0x749ce874U, 0x1f213e1fU,
|
||||
0x4bdd964bU, 0xbddc61bdU, 0x8b860d8bU, 0x8a850f8aU,
|
||||
0x7090e070U, 0x3e427c3eU, 0xb5c471b5U, 0x66aacc66U,
|
||||
0x48d89048U, 0x03050603U, 0xf601f7f6U, 0x0e121c0eU,
|
||||
0x61a3c261U, 0x355f6a35U, 0x57f9ae57U, 0xb9d069b9U,
|
||||
0x86911786U, 0xc15899c1U, 0x1d273a1dU, 0x9eb9279eU,
|
||||
0xe138d9e1U, 0xf813ebf8U, 0x98b32b98U, 0x11332211U,
|
||||
0x69bbd269U, 0xd970a9d9U, 0x8e89078eU, 0x94a73394U,
|
||||
0x9bb62d9bU, 0x1e223c1eU, 0x87921587U, 0xe920c9e9U,
|
||||
0xce4987ceU, 0x55ffaa55U, 0x28785028U, 0xdf7aa5dfU,
|
||||
0x8c8f038cU, 0xa1f859a1U, 0x89800989U, 0x0d171a0dU,
|
||||
0xbfda65bfU, 0xe631d7e6U, 0x42c68442U, 0x68b8d068U,
|
||||
0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU,
|
||||
0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U,
|
||||
};
|
||||
|
||||
static const u32 Te3[256] =
|
||||
{
|
||||
0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U,
|
||||
0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U,
|
||||
0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U,
|
||||
0xfefe19e7U, 0xd7d762b5U, 0xababe64dU, 0x76769aecU,
|
||||
0xcaca458fU, 0x82829d1fU, 0xc9c94089U, 0x7d7d87faU,
|
||||
0xfafa15efU, 0x5959ebb2U, 0x4747c98eU, 0xf0f00bfbU,
|
||||
0xadadec41U, 0xd4d467b3U, 0xa2a2fd5fU, 0xafafea45U,
|
||||
0x9c9cbf23U, 0xa4a4f753U, 0x727296e4U, 0xc0c05b9bU,
|
||||
0xb7b7c275U, 0xfdfd1ce1U, 0x9393ae3dU, 0x26266a4cU,
|
||||
0x36365a6cU, 0x3f3f417eU, 0xf7f702f5U, 0xcccc4f83U,
|
||||
0x34345c68U, 0xa5a5f451U, 0xe5e534d1U, 0xf1f108f9U,
|
||||
0x717193e2U, 0xd8d873abU, 0x31315362U, 0x15153f2aU,
|
||||
0x04040c08U, 0xc7c75295U, 0x23236546U, 0xc3c35e9dU,
|
||||
0x18182830U, 0x9696a137U, 0x05050f0aU, 0x9a9ab52fU,
|
||||
0x0707090eU, 0x12123624U, 0x80809b1bU, 0xe2e23ddfU,
|
||||
0xebeb26cdU, 0x2727694eU, 0xb2b2cd7fU, 0x75759feaU,
|
||||
0x09091b12U, 0x83839e1dU, 0x2c2c7458U, 0x1a1a2e34U,
|
||||
0x1b1b2d36U, 0x6e6eb2dcU, 0x5a5aeeb4U, 0xa0a0fb5bU,
|
||||
0x5252f6a4U, 0x3b3b4d76U, 0xd6d661b7U, 0xb3b3ce7dU,
|
||||
0x29297b52U, 0xe3e33eddU, 0x2f2f715eU, 0x84849713U,
|
||||
0x5353f5a6U, 0xd1d168b9U, 0x00000000U, 0xeded2cc1U,
|
||||
0x20206040U, 0xfcfc1fe3U, 0xb1b1c879U, 0x5b5bedb6U,
|
||||
0x6a6abed4U, 0xcbcb468dU, 0xbebed967U, 0x39394b72U,
|
||||
0x4a4ade94U, 0x4c4cd498U, 0x5858e8b0U, 0xcfcf4a85U,
|
||||
0xd0d06bbbU, 0xefef2ac5U, 0xaaaae54fU, 0xfbfb16edU,
|
||||
0x4343c586U, 0x4d4dd79aU, 0x33335566U, 0x85859411U,
|
||||
0x4545cf8aU, 0xf9f910e9U, 0x02020604U, 0x7f7f81feU,
|
||||
0x5050f0a0U, 0x3c3c4478U, 0x9f9fba25U, 0xa8a8e34bU,
|
||||
0x5151f3a2U, 0xa3a3fe5dU, 0x4040c080U, 0x8f8f8a05U,
|
||||
0x9292ad3fU, 0x9d9dbc21U, 0x38384870U, 0xf5f504f1U,
|
||||
0xbcbcdf63U, 0xb6b6c177U, 0xdada75afU, 0x21216342U,
|
||||
0x10103020U, 0xffff1ae5U, 0xf3f30efdU, 0xd2d26dbfU,
|
||||
0xcdcd4c81U, 0x0c0c1418U, 0x13133526U, 0xecec2fc3U,
|
||||
0x5f5fe1beU, 0x9797a235U, 0x4444cc88U, 0x1717392eU,
|
||||
0xc4c45793U, 0xa7a7f255U, 0x7e7e82fcU, 0x3d3d477aU,
|
||||
0x6464acc8U, 0x5d5de7baU, 0x19192b32U, 0x737395e6U,
|
||||
0x6060a0c0U, 0x81819819U, 0x4f4fd19eU, 0xdcdc7fa3U,
|
||||
0x22226644U, 0x2a2a7e54U, 0x9090ab3bU, 0x8888830bU,
|
||||
0x4646ca8cU, 0xeeee29c7U, 0xb8b8d36bU, 0x14143c28U,
|
||||
0xdede79a7U, 0x5e5ee2bcU, 0x0b0b1d16U, 0xdbdb76adU,
|
||||
0xe0e03bdbU, 0x32325664U, 0x3a3a4e74U, 0x0a0a1e14U,
|
||||
0x4949db92U, 0x06060a0cU, 0x24246c48U, 0x5c5ce4b8U,
|
||||
0xc2c25d9fU, 0xd3d36ebdU, 0xacacef43U, 0x6262a6c4U,
|
||||
0x9191a839U, 0x9595a431U, 0xe4e437d3U, 0x79798bf2U,
|
||||
0xe7e732d5U, 0xc8c8438bU, 0x3737596eU, 0x6d6db7daU,
|
||||
0x8d8d8c01U, 0xd5d564b1U, 0x4e4ed29cU, 0xa9a9e049U,
|
||||
0x6c6cb4d8U, 0x5656faacU, 0xf4f407f3U, 0xeaea25cfU,
|
||||
0x6565afcaU, 0x7a7a8ef4U, 0xaeaee947U, 0x08081810U,
|
||||
0xbabad56fU, 0x787888f0U, 0x25256f4aU, 0x2e2e725cU,
|
||||
0x1c1c2438U, 0xa6a6f157U, 0xb4b4c773U, 0xc6c65197U,
|
||||
0xe8e823cbU, 0xdddd7ca1U, 0x74749ce8U, 0x1f1f213eU,
|
||||
0x4b4bdd96U, 0xbdbddc61U, 0x8b8b860dU, 0x8a8a850fU,
|
||||
0x707090e0U, 0x3e3e427cU, 0xb5b5c471U, 0x6666aaccU,
|
||||
0x4848d890U, 0x03030506U, 0xf6f601f7U, 0x0e0e121cU,
|
||||
0x6161a3c2U, 0x35355f6aU, 0x5757f9aeU, 0xb9b9d069U,
|
||||
0x86869117U, 0xc1c15899U, 0x1d1d273aU, 0x9e9eb927U,
|
||||
0xe1e138d9U, 0xf8f813ebU, 0x9898b32bU, 0x11113322U,
|
||||
0x6969bbd2U, 0xd9d970a9U, 0x8e8e8907U, 0x9494a733U,
|
||||
0x9b9bb62dU, 0x1e1e223cU, 0x87879215U, 0xe9e920c9U,
|
||||
0xcece4987U, 0x5555ffaaU, 0x28287850U, 0xdfdf7aa5U,
|
||||
0x8c8c8f03U, 0xa1a1f859U, 0x89898009U, 0x0d0d171aU,
|
||||
0xbfbfda65U, 0xe6e631d7U, 0x4242c684U, 0x6868b8d0U,
|
||||
0x4141c382U, 0x9999b029U, 0x2d2d775aU, 0x0f0f111eU,
|
||||
0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU,
|
||||
};
|
||||
|
||||
#define TE0(v) (Te0[(v) >> 24])
|
||||
#define TE1(v) (Te1[((v) >> 16) & 0xff])
|
||||
#define TE2(v) (Te2[((v) >> 8) & 0xff])
|
||||
#define TE3(v) (Te3[(v) & 0xff])
|
||||
|
||||
#else /* ONLY_ONE_TABLE */
|
||||
|
||||
|
||||
static inline u32 ROR8(u32 v)
|
||||
{
|
||||
return (v >> 8) | (v << 24);
|
||||
}
|
||||
|
||||
static inline u32 ROR16(u32 v)
|
||||
{
|
||||
return (v >> 16) | (v << 16);
|
||||
}
|
||||
|
||||
static inline u32 ROR24(u32 v)
|
||||
{
|
||||
return (v >> 24) | (v << 8);
|
||||
}
|
||||
|
||||
#define TE0(v) (Te0[(v) >> 24])
|
||||
#define TE1(v) (ROR8(Te0[((v) >> 16) & 0xff]))
|
||||
#define TE2(v) (ROR16(Te0[((v) >> 8) & 0xff]))
|
||||
#define TE3(v) (ROR24(Te0[(v) & 0xff]))
|
||||
|
||||
#endif /* ONLY_ONE_TABLE */
|
||||
|
||||
|
||||
|
||||
#ifdef SMALL_TE4
|
||||
static const u8 Te4s[256] = {
|
||||
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5,
|
||||
0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
|
||||
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0,
|
||||
0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
|
||||
0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc,
|
||||
0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
|
||||
0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a,
|
||||
0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
|
||||
0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0,
|
||||
0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
|
||||
0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b,
|
||||
0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
|
||||
0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85,
|
||||
0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
|
||||
0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5,
|
||||
0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
|
||||
0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17,
|
||||
0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
|
||||
0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88,
|
||||
0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
|
||||
0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c,
|
||||
0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
|
||||
0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9,
|
||||
0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
|
||||
0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6,
|
||||
0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
|
||||
0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e,
|
||||
0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
|
||||
0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94,
|
||||
0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
|
||||
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68,
|
||||
0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16,
|
||||
};
|
||||
|
||||
#define TE4_1(v) (Te4s[(v) & 0xff] << 24)
|
||||
#define TE4_2(v) (Te4s[(v) & 0xff] << 16)
|
||||
#define TE4_3(v) (Te4s[(v) & 0xff] << 8)
|
||||
#define TE4_4(v) (Te4s[(v) & 0xff])
|
||||
|
||||
#else /* SMALL_TE4 */
|
||||
|
||||
static const u32 Te4[256] =
|
||||
{
|
||||
0x63636363U, 0x7c7c7c7cU, 0x77777777U, 0x7b7b7b7bU,
|
||||
0xf2f2f2f2U, 0x6b6b6b6bU, 0x6f6f6f6fU, 0xc5c5c5c5U,
|
||||
0x30303030U, 0x01010101U, 0x67676767U, 0x2b2b2b2bU,
|
||||
0xfefefefeU, 0xd7d7d7d7U, 0xababababU, 0x76767676U,
|
||||
0xcacacacaU, 0x82828282U, 0xc9c9c9c9U, 0x7d7d7d7dU,
|
||||
0xfafafafaU, 0x59595959U, 0x47474747U, 0xf0f0f0f0U,
|
||||
0xadadadadU, 0xd4d4d4d4U, 0xa2a2a2a2U, 0xafafafafU,
|
||||
0x9c9c9c9cU, 0xa4a4a4a4U, 0x72727272U, 0xc0c0c0c0U,
|
||||
0xb7b7b7b7U, 0xfdfdfdfdU, 0x93939393U, 0x26262626U,
|
||||
0x36363636U, 0x3f3f3f3fU, 0xf7f7f7f7U, 0xccccccccU,
|
||||
0x34343434U, 0xa5a5a5a5U, 0xe5e5e5e5U, 0xf1f1f1f1U,
|
||||
0x71717171U, 0xd8d8d8d8U, 0x31313131U, 0x15151515U,
|
||||
0x04040404U, 0xc7c7c7c7U, 0x23232323U, 0xc3c3c3c3U,
|
||||
0x18181818U, 0x96969696U, 0x05050505U, 0x9a9a9a9aU,
|
||||
0x07070707U, 0x12121212U, 0x80808080U, 0xe2e2e2e2U,
|
||||
0xebebebebU, 0x27272727U, 0xb2b2b2b2U, 0x75757575U,
|
||||
0x09090909U, 0x83838383U, 0x2c2c2c2cU, 0x1a1a1a1aU,
|
||||
0x1b1b1b1bU, 0x6e6e6e6eU, 0x5a5a5a5aU, 0xa0a0a0a0U,
|
||||
0x52525252U, 0x3b3b3b3bU, 0xd6d6d6d6U, 0xb3b3b3b3U,
|
||||
0x29292929U, 0xe3e3e3e3U, 0x2f2f2f2fU, 0x84848484U,
|
||||
0x53535353U, 0xd1d1d1d1U, 0x00000000U, 0xededededU,
|
||||
0x20202020U, 0xfcfcfcfcU, 0xb1b1b1b1U, 0x5b5b5b5bU,
|
||||
0x6a6a6a6aU, 0xcbcbcbcbU, 0xbebebebeU, 0x39393939U,
|
||||
0x4a4a4a4aU, 0x4c4c4c4cU, 0x58585858U, 0xcfcfcfcfU,
|
||||
0xd0d0d0d0U, 0xefefefefU, 0xaaaaaaaaU, 0xfbfbfbfbU,
|
||||
0x43434343U, 0x4d4d4d4dU, 0x33333333U, 0x85858585U,
|
||||
0x45454545U, 0xf9f9f9f9U, 0x02020202U, 0x7f7f7f7fU,
|
||||
0x50505050U, 0x3c3c3c3cU, 0x9f9f9f9fU, 0xa8a8a8a8U,
|
||||
0x51515151U, 0xa3a3a3a3U, 0x40404040U, 0x8f8f8f8fU,
|
||||
0x92929292U, 0x9d9d9d9dU, 0x38383838U, 0xf5f5f5f5U,
|
||||
0xbcbcbcbcU, 0xb6b6b6b6U, 0xdadadadaU, 0x21212121U,
|
||||
0x10101010U, 0xffffffffU, 0xf3f3f3f3U, 0xd2d2d2d2U,
|
||||
0xcdcdcdcdU, 0x0c0c0c0cU, 0x13131313U, 0xececececU,
|
||||
0x5f5f5f5fU, 0x97979797U, 0x44444444U, 0x17171717U,
|
||||
0xc4c4c4c4U, 0xa7a7a7a7U, 0x7e7e7e7eU, 0x3d3d3d3dU,
|
||||
0x64646464U, 0x5d5d5d5dU, 0x19191919U, 0x73737373U,
|
||||
0x60606060U, 0x81818181U, 0x4f4f4f4fU, 0xdcdcdcdcU,
|
||||
0x22222222U, 0x2a2a2a2aU, 0x90909090U, 0x88888888U,
|
||||
0x46464646U, 0xeeeeeeeeU, 0xb8b8b8b8U, 0x14141414U,
|
||||
0xdedededeU, 0x5e5e5e5eU, 0x0b0b0b0bU, 0xdbdbdbdbU,
|
||||
0xe0e0e0e0U, 0x32323232U, 0x3a3a3a3aU, 0x0a0a0a0aU,
|
||||
0x49494949U, 0x06060606U, 0x24242424U, 0x5c5c5c5cU,
|
||||
0xc2c2c2c2U, 0xd3d3d3d3U, 0xacacacacU, 0x62626262U,
|
||||
0x91919191U, 0x95959595U, 0xe4e4e4e4U, 0x79797979U,
|
||||
0xe7e7e7e7U, 0xc8c8c8c8U, 0x37373737U, 0x6d6d6d6dU,
|
||||
0x8d8d8d8dU, 0xd5d5d5d5U, 0x4e4e4e4eU, 0xa9a9a9a9U,
|
||||
0x6c6c6c6cU, 0x56565656U, 0xf4f4f4f4U, 0xeaeaeaeaU,
|
||||
0x65656565U, 0x7a7a7a7aU, 0xaeaeaeaeU, 0x08080808U,
|
||||
0xbabababaU, 0x78787878U, 0x25252525U, 0x2e2e2e2eU,
|
||||
0x1c1c1c1cU, 0xa6a6a6a6U, 0xb4b4b4b4U, 0xc6c6c6c6U,
|
||||
0xe8e8e8e8U, 0xddddddddU, 0x74747474U, 0x1f1f1f1fU,
|
||||
0x4b4b4b4bU, 0xbdbdbdbdU, 0x8b8b8b8bU, 0x8a8a8a8aU,
|
||||
0x70707070U, 0x3e3e3e3eU, 0xb5b5b5b5U, 0x66666666U,
|
||||
0x48484848U, 0x03030303U, 0xf6f6f6f6U, 0x0e0e0e0eU,
|
||||
0x61616161U, 0x35353535U, 0x57575757U, 0xb9b9b9b9U,
|
||||
0x86868686U, 0xc1c1c1c1U, 0x1d1d1d1dU, 0x9e9e9e9eU,
|
||||
0xe1e1e1e1U, 0xf8f8f8f8U, 0x98989898U, 0x11111111U,
|
||||
0x69696969U, 0xd9d9d9d9U, 0x8e8e8e8eU, 0x94949494U,
|
||||
0x9b9b9b9bU, 0x1e1e1e1eU, 0x87878787U, 0xe9e9e9e9U,
|
||||
0xcecececeU, 0x55555555U, 0x28282828U, 0xdfdfdfdfU,
|
||||
0x8c8c8c8cU, 0xa1a1a1a1U, 0x89898989U, 0x0d0d0d0dU,
|
||||
0xbfbfbfbfU, 0xe6e6e6e6U, 0x42424242U, 0x68686868U,
|
||||
0x41414141U, 0x99999999U, 0x2d2d2d2dU, 0x0f0f0f0fU,
|
||||
0xb0b0b0b0U, 0x54545454U, 0xbbbbbbbbU, 0x16161616U,
|
||||
};
|
||||
|
||||
#define TE4_1(v) (Te4[(v) & 0xff] & 0xff000000)
|
||||
#define TE4_2(v) (Te4[(v) & 0xff] & 0x00ff0000)
|
||||
#define TE4_3(v) (Te4[(v) & 0xff] & 0x0000ff00)
|
||||
#define TE4_4(v) (Te4[(v) & 0xff] & 0x000000ff)
|
||||
|
||||
#endif /* SMALL_TE4 */
|
||||
|
||||
|
||||
static const u32 rcon[] = {
|
||||
0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000,
|
||||
0x20000000, 0x40000000, 0x80000000, 0x1B000000, 0x36000000,
|
||||
};
|
||||
|
||||
#define GETU32(pt) \
|
||||
(((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] << 8) ^ \
|
||||
((u32)(pt)[3]))
|
||||
#define PUTU32(ct, st) \
|
||||
{ (ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); \
|
||||
(ct)[2] = (u8)((st) >> 8); (ct)[3] = (u8)(st); }
|
||||
|
||||
|
||||
/* Expand the cipher key into the encryption key schedule. */
|
||||
void ieee80211_aes_key_setup_encrypt(u32 rk[/*44*/], const u8 key[])
|
||||
{
|
||||
int i;
|
||||
u32 temp;
|
||||
|
||||
rk[0] = GETU32(key );
|
||||
rk[1] = GETU32(key + 4);
|
||||
rk[2] = GETU32(key + 8);
|
||||
rk[3] = GETU32(key + 12);
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
temp = rk[3];
|
||||
rk[4] = rk[0] ^ TE4_1(temp >> 16) ^ TE4_2(temp >> 8) ^
|
||||
TE4_3(temp) ^ TE4_4(temp >> 24) ^ rcon[i];
|
||||
rk[5] = rk[1] ^ rk[4];
|
||||
rk[6] = rk[2] ^ rk[5];
|
||||
rk[7] = rk[3] ^ rk[6];
|
||||
rk += 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ieee80211_aes_encrypt(const u32 rk[/*44*/], const u8 pt[16], u8 ct[16])
|
||||
{
|
||||
const int Nr = 10;
|
||||
u32 s0, s1, s2, s3, t0, t1, t2, t3;
|
||||
|
||||
/* Map byte array block to cipher state and add initial round key */
|
||||
s0 = GETU32(pt ) ^ rk[0];
|
||||
s1 = GETU32(pt + 4) ^ rk[1];
|
||||
s2 = GETU32(pt + 8) ^ rk[2];
|
||||
s3 = GETU32(pt + 12) ^ rk[3];
|
||||
|
||||
#define ROUND(r,d,s,i) \
|
||||
d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[i]; \
|
||||
d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[i + 1]; \
|
||||
d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[i + 2]; \
|
||||
d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[i + 3]
|
||||
ROUND(1,t,s,4);
|
||||
ROUND(2,s,t,8);
|
||||
ROUND(3,t,s,12);
|
||||
ROUND(4,s,t,16);
|
||||
ROUND(5,t,s,20);
|
||||
ROUND(6,s,t,24);
|
||||
ROUND(7,t,s,28);
|
||||
ROUND(8,s,t,32);
|
||||
ROUND(9,t,s,36);
|
||||
#undef ROUND
|
||||
|
||||
rk += Nr << 2;
|
||||
|
||||
/* Apply the last round and map cipher state to byte array block */
|
||||
s0 = TE4_1(t0 >> 24) ^ TE4_2(t1 >> 16) ^ TE4_3(t2 >> 8) ^ TE4_4(t3) ^
|
||||
rk[0];
|
||||
PUTU32(ct, s0);
|
||||
s0 = TE4_1(t1 >> 24) ^ TE4_2(t2 >> 16) ^ TE4_3(t3 >> 8) ^ TE4_4(t0) ^
|
||||
rk[1];
|
||||
PUTU32(ct + 4, s0);
|
||||
s0 = TE4_1(t2 >> 24) ^ TE4_2(t3 >> 16) ^ TE4_3(t0 >> 8) ^ TE4_4(t1) ^
|
||||
rk[2];
|
||||
PUTU32(ct + 8, s0);
|
||||
s0 = TE4_1(t3 >> 24) ^ TE4_2(t0 >> 16) ^ TE4_3(t1 >> 8) ^ TE4_4(t2) ^
|
||||
rk[3];
|
||||
PUTU32(ct + 12, s0);
|
||||
}
|
||||
|
||||
/* --- end of code that is based on public domain AES implementation --- */
|
@ -1,119 +0,0 @@
|
||||
/*
|
||||
* Copyright 2003-2004, Instant802 Networks, Inc.
|
||||
* Copyright 2005, Devicescape Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/netdevice.h>
|
||||
|
||||
#include <net/ieee80211.h>
|
||||
#include "ieee80211_key.h"
|
||||
#include "aes_ccm.h"
|
||||
|
||||
#include "aes.c"
|
||||
|
||||
static inline void aes_ccm_prepare(u32 *rk, u8 *b_0, u8 *aad, u8 *b,
|
||||
u8 *s_0, u8 *a)
|
||||
{
|
||||
int i;
|
||||
|
||||
ieee80211_aes_encrypt(rk, b_0, b);
|
||||
|
||||
/* Extra Authenticate-only data (always two AES blocks) */
|
||||
for (i = 0; i < AES_BLOCK_LEN; i++)
|
||||
aad[i] ^= b[i];
|
||||
ieee80211_aes_encrypt(rk, aad, b);
|
||||
|
||||
aad += AES_BLOCK_LEN;
|
||||
|
||||
for (i = 0; i < AES_BLOCK_LEN; i++)
|
||||
aad[i] ^= b[i];
|
||||
ieee80211_aes_encrypt(rk, aad, a);
|
||||
|
||||
/* Mask out bits from auth-only-b_0 */
|
||||
b_0[0] &= 0x07;
|
||||
|
||||
/* S_0 is used to encrypt T (= MIC) */
|
||||
b_0[14] = 0;
|
||||
b_0[15] = 0;
|
||||
ieee80211_aes_encrypt(rk, b_0, s_0);
|
||||
}
|
||||
|
||||
|
||||
void ieee80211_aes_ccm_encrypt(u32 *rk, u8 *b_0, u8 *aad, u8 *data,
|
||||
size_t data_len, u8 *cdata, u8 *mic)
|
||||
{
|
||||
int i, j, last_len, num_blocks;
|
||||
u8 *pos, *cpos;
|
||||
u8 b[AES_BLOCK_LEN], s_0[AES_BLOCK_LEN], e[AES_BLOCK_LEN];
|
||||
|
||||
num_blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
|
||||
last_len = data_len % AES_BLOCK_LEN;
|
||||
aes_ccm_prepare(rk, b_0, aad, b, s_0, b);
|
||||
|
||||
/* Process payload blocks */
|
||||
pos = data;
|
||||
cpos = cdata;
|
||||
for (j = 1; j <= num_blocks; j++) {
|
||||
int blen = (j == num_blocks && last_len) ?
|
||||
last_len : AES_BLOCK_LEN;
|
||||
|
||||
/* Authentication followed by encryption */
|
||||
for (i = 0; i < blen; i++)
|
||||
b[i] ^= pos[i];
|
||||
ieee80211_aes_encrypt(rk, b, b);
|
||||
|
||||
b_0[14] = (j >> 8) & 0xff;
|
||||
b_0[15] = j & 0xff;
|
||||
ieee80211_aes_encrypt(rk, b_0, e);
|
||||
for (i = 0; i < blen; i++)
|
||||
*cpos++ = *pos++ ^ e[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < CCMP_MIC_LEN; i++)
|
||||
mic[i] = b[i] ^ s_0[i];
|
||||
}
|
||||
|
||||
|
||||
int ieee80211_aes_ccm_decrypt(u32 *rk, u8 *b_0, u8 *aad, u8 *cdata,
|
||||
size_t data_len, u8 *mic, u8 *data)
|
||||
{
|
||||
int i, j, last_len, num_blocks;
|
||||
u8 *pos, *cpos;
|
||||
u8 b[AES_BLOCK_LEN], s_0[AES_BLOCK_LEN], a[AES_BLOCK_LEN];
|
||||
|
||||
num_blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
|
||||
last_len = data_len % AES_BLOCK_LEN;
|
||||
aes_ccm_prepare(rk, b_0, aad, b, s_0, a);
|
||||
|
||||
/* Process payload blocks */
|
||||
cpos = cdata;
|
||||
pos = data;
|
||||
for (j = 1; j <= num_blocks; j++) {
|
||||
int blen = (j == num_blocks && last_len) ?
|
||||
last_len : AES_BLOCK_LEN;
|
||||
|
||||
/* Decryption followed by authentication */
|
||||
b_0[14] = (j >> 8) & 0xff;
|
||||
b_0[15] = j & 0xff;
|
||||
ieee80211_aes_encrypt(rk, b_0, b);
|
||||
for (i = 0; i < blen; i++) {
|
||||
*pos = *cpos++ ^ b[i];
|
||||
a[i] ^= *pos++;
|
||||
}
|
||||
|
||||
ieee80211_aes_encrypt(rk, a, a);
|
||||
}
|
||||
|
||||
for (i = 0; i < CCMP_MIC_LEN; i++) {
|
||||
if ((mic[i] ^ s_0[i]) != a[i])
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright 2003-2004, Instant802 Networks, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef AES_CCM_H
|
||||
#define AES_CCM_H
|
||||
|
||||
#define AES_BLOCK_LEN 16
|
||||
#define AES_STATE_LEN 44
|
||||
|
||||
void ieee80211_aes_key_setup_encrypt(u32 rk[/*44*/], const u8 key[]);
|
||||
void ieee80211_aes_encrypt(const u32 rk[/*44*/], const u8 pt[16], u8 ct[16]);
|
||||
void ieee80211_aes_ccm_encrypt(u32 rk[/*44*/], u8 *b_0, u8 *aad, u8 *data,
|
||||
size_t data_len, u8 *cdata, u8 *mic);
|
||||
int ieee80211_aes_ccm_decrypt(u32 rk[/*44*/], u8 *b_0, u8 *aad, u8 *cdata,
|
||||
size_t data_len, u8 *mic, u8 *data);
|
||||
|
||||
#endif /* AES_CCM_H */
|
@ -1,103 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005, Devicescape Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* If building without CONFIG_NET_SCHED we need a simple
|
||||
* fifo qdisc to install by default as the sub-qdisc.
|
||||
* This is a simple replacement for sch_fifo.
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <net/ieee80211.h>
|
||||
#include "ieee80211_i.h"
|
||||
#include "wme.h"
|
||||
|
||||
static int pfifo_enqueue(struct sk_buff *skb, struct Qdisc* qd)
|
||||
{
|
||||
struct sk_buff_head *q = qdisc_priv(qd);
|
||||
|
||||
if (skb_queue_len(q) > qd->dev->tx_queue_len) {
|
||||
qd->qstats.drops++;
|
||||
kfree_skb(skb);
|
||||
return NET_XMIT_DROP;
|
||||
}
|
||||
|
||||
skb_queue_tail(q, skb);
|
||||
qd->q.qlen++;
|
||||
qd->bstats.bytes += skb->len;
|
||||
qd->bstats.packets++;
|
||||
|
||||
return NET_XMIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int pfifo_requeue(struct sk_buff *skb, struct Qdisc* qd)
|
||||
{
|
||||
struct sk_buff_head *q = qdisc_priv(qd);
|
||||
|
||||
skb_queue_head(q, skb);
|
||||
qd->q.qlen++;
|
||||
qd->bstats.bytes += skb->len;
|
||||
qd->bstats.packets++;
|
||||
|
||||
return NET_XMIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static struct sk_buff *pfifo_dequeue(struct Qdisc* qd)
|
||||
{
|
||||
struct sk_buff_head *q = qdisc_priv(qd);
|
||||
|
||||
return skb_dequeue(q);
|
||||
}
|
||||
|
||||
|
||||
static int pfifo_init(struct Qdisc* qd, struct rtattr *opt)
|
||||
{
|
||||
struct sk_buff_head *q = qdisc_priv(qd);
|
||||
|
||||
skb_queue_head_init(q);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void pfifo_reset(struct Qdisc* qd)
|
||||
{
|
||||
struct sk_buff_head *q = qdisc_priv(qd);
|
||||
|
||||
skb_queue_purge(q);
|
||||
qd->q.qlen = 0;
|
||||
}
|
||||
|
||||
|
||||
static int pfifo_dump(struct Qdisc *qd, struct sk_buff *skb)
|
||||
{
|
||||
return skb->len;
|
||||
}
|
||||
|
||||
|
||||
struct Qdisc_ops pfifo_qdisc_ops =
|
||||
{
|
||||
.next = NULL,
|
||||
.cl_ops = NULL,
|
||||
.id = "ieee80211_pfifo",
|
||||
.priv_size = sizeof(struct sk_buff_head),
|
||||
|
||||
.enqueue = pfifo_enqueue,
|
||||
.dequeue = pfifo_dequeue,
|
||||
.requeue = pfifo_requeue,
|
||||
.drop = NULL,
|
||||
|
||||
.init = pfifo_init,
|
||||
.reset = pfifo_reset,
|
||||
.destroy = NULL,
|
||||
.change = NULL,
|
||||
|
||||
.dump = pfifo_dump,
|
||||
};
|
||||
|
@ -1,438 +0,0 @@
|
||||
/*
|
||||
* Host AP (software wireless LAN access point) user space daemon for
|
||||
* Host AP kernel driver
|
||||
* Copyright 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
|
||||
* Copyright 2002-2004, Instant802 Networks, Inc.
|
||||
* Copyright 2005, Devicescape Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef HOSTAPD_IOCTL_H
|
||||
#define HOSTAPD_IOCTL_H
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#include "ieee80211_shared.h"
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#define PRISM2_IOCTL_PRISM2_PARAM (SIOCIWFIRSTPRIV + 0)
|
||||
#define PRISM2_IOCTL_GET_PRISM2_PARAM (SIOCIWFIRSTPRIV + 1)
|
||||
#define PRISM2_IOCTL_HOSTAPD (SIOCIWFIRSTPRIV + 3)
|
||||
#define PRISM2_IOCTL_TEST_PARAM (SIOCIWFIRSTPRIV + 4)
|
||||
|
||||
/* PRISM2_IOCTL_PRISM2_PARAM ioctl() subtypes: */
|
||||
enum {
|
||||
PRISM2_PARAM_PTYPE = 1,
|
||||
PRISM2_PARAM_TXRATECTRL = 2,
|
||||
PRISM2_PARAM_BEACON_INT = 3,
|
||||
PRISM2_PARAM_PSEUDO_IBSS = 4,
|
||||
PRISM2_PARAM_ALC = 5,
|
||||
PRISM2_PARAM_TXPOWER = 6,
|
||||
PRISM2_PARAM_DUMP = 7,
|
||||
PRISM2_PARAM_OTHER_AP_POLICY = 8,
|
||||
PRISM2_PARAM_AP_MAX_INACTIVITY = 9,
|
||||
PRISM2_PARAM_AP_BRIDGE_PACKETS = 10,
|
||||
PRISM2_PARAM_DTIM_PERIOD = 11,
|
||||
PRISM2_PARAM_AP_NULLFUNC_ACK = 12,
|
||||
PRISM2_PARAM_MAX_WDS = 13,
|
||||
PRISM2_PARAM_AP_AUTOM_AP_WDS = 14,
|
||||
PRISM2_PARAM_AP_AUTH_ALGS = 15,
|
||||
PRISM2_PARAM_MONITOR_ALLOW_FCSERR = 16,
|
||||
PRISM2_PARAM_HOST_ENCRYPT = 17,
|
||||
PRISM2_PARAM_HOST_DECRYPT = 18,
|
||||
PRISM2_PARAM_BUS_MASTER_THRESHOLD_RX = 19,
|
||||
PRISM2_PARAM_BUS_MASTER_THRESHOLD_TX = 20,
|
||||
PRISM2_PARAM_HOST_ROAMING = 21,
|
||||
PRISM2_PARAM_BCRX_STA_KEY = 22,
|
||||
PRISM2_PARAM_IEEE_802_1X = 23,
|
||||
PRISM2_PARAM_ANTSEL_TX = 24,
|
||||
PRISM2_PARAM_ANTSEL_RX = 25,
|
||||
PRISM2_PARAM_MONITOR_TYPE = 26,
|
||||
PRISM2_PARAM_WDS_TYPE = 27,
|
||||
PRISM2_PARAM_HOSTSCAN = 28,
|
||||
PRISM2_PARAM_AP_SCAN = 29,
|
||||
|
||||
/* Instant802 additions */
|
||||
PRISM2_PARAM_CTS_PROTECT_ERP_FRAMES = 1001,
|
||||
PRISM2_PARAM_DROP_UNENCRYPTED = 1002,
|
||||
PRISM2_PARAM_PREAMBLE = 1003,
|
||||
PRISM2_PARAM_RATE_LIMIT = 1004,
|
||||
PRISM2_PARAM_RATE_LIMIT_BURST = 1005,
|
||||
PRISM2_PARAM_SHORT_SLOT_TIME = 1006,
|
||||
PRISM2_PARAM_TEST_MODE = 1007,
|
||||
PRISM2_PARAM_NEXT_MODE = 1008,
|
||||
PRISM2_PARAM_CLEAR_KEYS = 1009,
|
||||
PRISM2_PARAM_ADM_STATUS = 1010,
|
||||
PRISM2_PARAM_ANTENNA_SEL = 1011,
|
||||
PRISM2_PARAM_CALIB_INT = 1012,
|
||||
PRISM2_PARAM_ANTENNA_MODE = 1013,
|
||||
PRISM2_PARAM_PRIVACY_INVOKED = 1014,
|
||||
PRISM2_PARAM_BROADCAST_SSID = 1015,
|
||||
PRISM2_PARAM_STAT_TIME = 1016,
|
||||
PRISM2_PARAM_STA_ANTENNA_SEL = 1017,
|
||||
PRISM2_PARAM_FORCE_UNICAST_RATE = 1018,
|
||||
PRISM2_PARAM_RATE_CTRL_NUM_UP = 1019,
|
||||
PRISM2_PARAM_RATE_CTRL_NUM_DOWN = 1020,
|
||||
PRISM2_PARAM_MAX_RATECTRL_RATE = 1021,
|
||||
PRISM2_PARAM_TX_POWER_REDUCTION = 1022,
|
||||
PRISM2_PARAM_EAPOL = 1023,
|
||||
PRISM2_PARAM_KEY_TX_RX_THRESHOLD = 1024,
|
||||
PRISM2_PARAM_KEY_INDEX = 1025,
|
||||
PRISM2_PARAM_DEFAULT_WEP_ONLY = 1026,
|
||||
PRISM2_PARAM_WIFI_WME_NOACK_TEST = 1033,
|
||||
PRISM2_PARAM_ALLOW_BROADCAST_ALWAYS = 1034,
|
||||
PRISM2_PARAM_SCAN_FLAGS = 1035,
|
||||
PRISM2_PARAM_HW_MODES = 1036,
|
||||
PRISM2_PARAM_CREATE_IBSS = 1037,
|
||||
PRISM2_PARAM_WMM_ENABLED = 1038,
|
||||
PRISM2_PARAM_MIXED_CELL = 1039,
|
||||
PRISM2_PARAM_KEY_MGMT = 1040,
|
||||
PRISM2_PARAM_RADAR_DETECT = 1043,
|
||||
PRISM2_PARAM_SPECTRUM_MGMT = 1044,
|
||||
/* NOTE: Please try to coordinate with other active development
|
||||
* branches before allocating new param numbers so that each new param
|
||||
* will be unique within all branches and the allocated number will not
|
||||
* need to be changed when merging new features. Existing numbers in
|
||||
* the mainline (or main devel branch) must not be changed when merging
|
||||
* in new features. */
|
||||
};
|
||||
|
||||
/* PRISM2_IOCTL_HOSTAPD ioctl() cmd: */
|
||||
enum {
|
||||
PRISM2_HOSTAPD_FLUSH = 1,
|
||||
PRISM2_HOSTAPD_ADD_STA = 2,
|
||||
PRISM2_HOSTAPD_REMOVE_STA = 3,
|
||||
PRISM2_HOSTAPD_GET_INFO_STA = 4,
|
||||
/* REMOVED: PRISM2_HOSTAPD_RESET_TXEXC_STA = 5, */
|
||||
PRISM2_SET_ENCRYPTION = 6,
|
||||
PRISM2_GET_ENCRYPTION = 7,
|
||||
PRISM2_HOSTAPD_SET_FLAGS_STA = 8,
|
||||
PRISM2_HOSTAPD_GET_RID = 9,
|
||||
PRISM2_HOSTAPD_SET_RID = 10,
|
||||
PRISM2_HOSTAPD_SET_ASSOC_AP_ADDR = 11,
|
||||
PRISM2_HOSTAPD_MLME = 13,
|
||||
|
||||
/* Instant802 additions */
|
||||
PRISM2_HOSTAPD_SET_BEACON = 1001,
|
||||
PRISM2_HOSTAPD_GET_HW_FEATURES = 1002,
|
||||
PRISM2_HOSTAPD_SCAN = 1003,
|
||||
PRISM2_HOSTAPD_WPA_TRIGGER = 1004,
|
||||
PRISM2_HOSTAPD_SET_RATE_SETS = 1005,
|
||||
PRISM2_HOSTAPD_ADD_IF = 1006,
|
||||
PRISM2_HOSTAPD_REMOVE_IF = 1007,
|
||||
PRISM2_HOSTAPD_GET_DOT11COUNTERSTABLE = 1008,
|
||||
PRISM2_HOSTAPD_GET_LOAD_STATS = 1009,
|
||||
PRISM2_HOSTAPD_SET_STA_VLAN = 1010,
|
||||
PRISM2_HOSTAPD_SET_GENERIC_INFO_ELEM = 1011,
|
||||
PRISM2_HOSTAPD_SET_CHANNEL_FLAG = 1012,
|
||||
PRISM2_HOSTAPD_SET_REGULATORY_DOMAIN = 1013,
|
||||
PRISM2_HOSTAPD_SET_TX_QUEUE_PARAMS = 1014,
|
||||
PRISM2_HOSTAPD_SET_BSS = 1015,
|
||||
PRISM2_HOSTAPD_GET_TX_STATS = 1016,
|
||||
PRISM2_HOSTAPD_UPDATE_IF = 1017,
|
||||
PRISM2_HOSTAPD_SCAN_REQ = 1019,
|
||||
PRISM2_STA_GET_STATE = 1020,
|
||||
PRISM2_HOSTAPD_FLUSH_IFS = 1021,
|
||||
PRISM2_HOSTAPD_SET_RADAR_PARAMS = 1023,
|
||||
PRISM2_HOSTAPD_SET_QUIET_PARAMS = 1024,
|
||||
PRISM2_HOSTAPD_GET_TX_POWER = 1025,
|
||||
/* NOTE: Please try to coordinate with other active development
|
||||
* branches before allocating new param numbers so that each new param
|
||||
* will be unique within all branches and the allocated number will not
|
||||
* need to be changed when merging new features. Existing numbers in
|
||||
* the mainline (or main devel branch) must not be changed when merging
|
||||
* in new features. */
|
||||
};
|
||||
|
||||
/* these definitions mirror the ieee80211_i.h
|
||||
* IEEE80211_DISABLED, ... IEEE80211_ASSOCIATED enumeration */
|
||||
enum {
|
||||
PRISM2_PARAM_STA_DISABLED,
|
||||
PRISM2_PARAM_STA_AUTHENTICATE,
|
||||
PRISM2_PARAM_STA_ASSOCIATE,
|
||||
PRISM2_PARAM_STA_ASSOCIATED,
|
||||
};
|
||||
|
||||
#define PRISM2_HOSTAPD_MAX_BUF_SIZE 2048
|
||||
#define HOSTAP_CRYPT_ALG_NAME_LEN 16
|
||||
|
||||
/* Use this to make sure that structure elements are correctly aligned
|
||||
* for access as other types. Most commonly, this affects the placeholder
|
||||
* types used for data at the end of a structure in this union.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
#undef ALIGNED
|
||||
#define ALIGNED __attribute__ ((aligned))
|
||||
#else
|
||||
/* Check if it has been defined elsewhere */
|
||||
#ifndef ALIGNED
|
||||
#error "Must define ALIGNED to generate aligned structure elements"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct prism2_hostapd_param {
|
||||
u32 cmd;
|
||||
u8 sta_addr[ETH_ALEN];
|
||||
u8 pad[2];
|
||||
union {
|
||||
struct {
|
||||
u16 aid;
|
||||
u16 capability;
|
||||
u8 supp_rates[32];
|
||||
/* atheros_super_ag and enc_flags are only used with
|
||||
* IEEE80211_ATHEROS_SUPER_AG
|
||||
*/
|
||||
u8 atheros_super_ag;
|
||||
u8 atheros_xr_mode;
|
||||
u8 wds_flags;
|
||||
#define IEEE80211_STA_DYNAMIC_ENC BIT(0)
|
||||
u8 enc_flags;
|
||||
} add_sta;
|
||||
struct {
|
||||
u32 inactive_msec;
|
||||
u32 rx_packets;
|
||||
u32 tx_packets;
|
||||
u32 rx_bytes;
|
||||
u32 tx_bytes;
|
||||
u32 current_tx_rate; /* in 100 kbps */
|
||||
u32 channel_use;
|
||||
u32 flags;
|
||||
u32 num_ps_buf_frames;
|
||||
u32 tx_retry_failed;
|
||||
u32 tx_retry_count;
|
||||
u32 last_rssi;
|
||||
u32 last_ack_rssi;
|
||||
} get_info_sta;
|
||||
struct {
|
||||
u8 alg[HOSTAP_CRYPT_ALG_NAME_LEN];
|
||||
u32 flags;
|
||||
u32 err;
|
||||
u8 idx;
|
||||
#define HOSTAP_SEQ_COUNTER_SIZE 8
|
||||
u8 seq_counter[HOSTAP_SEQ_COUNTER_SIZE];
|
||||
u16 key_len;
|
||||
u8 key[0] ALIGNED;
|
||||
} crypt;
|
||||
struct {
|
||||
u32 flags_and;
|
||||
u32 flags_or;
|
||||
} set_flags_sta;
|
||||
struct {
|
||||
u16 rid;
|
||||
u16 len;
|
||||
u8 data[0] ALIGNED;
|
||||
} rid;
|
||||
struct {
|
||||
u16 head_len;
|
||||
u16 tail_len;
|
||||
u8 data[0] ALIGNED; /* head_len + tail_len bytes */
|
||||
} beacon;
|
||||
struct {
|
||||
u16 num_modes;
|
||||
u16 flags;
|
||||
u8 data[0] ALIGNED; /* num_modes * feature data */
|
||||
} hw_features;
|
||||
struct {
|
||||
u8 now;
|
||||
s8 our_mode_only;
|
||||
s16 last_rx;
|
||||
u16 channel;
|
||||
s16 interval; /* seconds */
|
||||
s32 listen; /* microseconds */
|
||||
} scan;
|
||||
struct {
|
||||
#define WPA_TRIGGER_FAIL_TX_MIC BIT(0)
|
||||
#define WPA_TRIGGER_FAIL_TX_ICV BIT(1)
|
||||
#define WPA_TRIGGER_FAIL_RX_MIC BIT(2)
|
||||
#define WPA_TRIGGER_FAIL_RX_ICV BIT(3)
|
||||
#define WPA_TRIGGER_TX_REPLAY BIT(4)
|
||||
#define WPA_TRIGGER_TX_REPLAY_FRAG BIT(5)
|
||||
#define WPA_TRIGGER_TX_SKIP_SEQ BIT(6)
|
||||
u32 trigger;
|
||||
} wpa_trigger;
|
||||
struct {
|
||||
u16 mode; /* MODE_* */
|
||||
u16 num_supported_rates;
|
||||
u16 num_basic_rates;
|
||||
u8 data[0] ALIGNED; /* num_supported_rates * u16 +
|
||||
* num_basic_rates * u16 */
|
||||
} set_rate_sets;
|
||||
struct {
|
||||
u8 type; /* WDS, VLAN, etc */
|
||||
u8 name[IFNAMSIZ];
|
||||
u8 data[0] ALIGNED;
|
||||
} if_info;
|
||||
struct dot11_counters {
|
||||
u32 dot11TransmittedFragmentCount;
|
||||
u32 dot11MulticastTransmittedFrameCount;
|
||||
u32 dot11FailedCount;
|
||||
u32 dot11ReceivedFragmentCount;
|
||||
u32 dot11MulticastReceivedFrameCount;
|
||||
u32 dot11FCSErrorCount;
|
||||
u32 dot11TransmittedFrameCount;
|
||||
u32 dot11WEPUndecryptableCount;
|
||||
u32 dot11ACKFailureCount;
|
||||
u32 dot11RTSFailureCount;
|
||||
u32 dot11RTSSuccessCount;
|
||||
} dot11CountersTable;
|
||||
struct {
|
||||
#define LOAD_STATS_CLEAR BIT(1)
|
||||
u32 flags;
|
||||
u32 channel_use;
|
||||
} get_load_stats;
|
||||
struct {
|
||||
char vlan_name[IFNAMSIZ];
|
||||
int vlan_id;
|
||||
} set_sta_vlan;
|
||||
struct {
|
||||
u8 len;
|
||||
u8 data[0] ALIGNED;
|
||||
} set_generic_info_elem;
|
||||
struct {
|
||||
u16 mode; /* MODE_* */
|
||||
u16 chan;
|
||||
u32 flag;
|
||||
u8 power_level; /* regulatory limit in dBm */
|
||||
u8 antenna_max;
|
||||
} set_channel_flag;
|
||||
struct {
|
||||
u32 rd;
|
||||
} set_regulatory_domain;
|
||||
struct {
|
||||
u32 queue;
|
||||
s32 aifs;
|
||||
u32 cw_min;
|
||||
u32 cw_max;
|
||||
u32 burst_time; /* maximum burst time in 0.1 ms, i.e.,
|
||||
* 10 = 1 ms */
|
||||
} tx_queue_params;
|
||||
struct {
|
||||
u32 bss_count;
|
||||
u8 bssid_mask[ETH_ALEN];
|
||||
} set_bss;
|
||||
struct ieee80211_tx_stats {
|
||||
struct {
|
||||
unsigned int len; /* num packets in queue */
|
||||
unsigned int limit; /* queue len (soft) limit
|
||||
*/
|
||||
unsigned int count; /* total num frames sent */
|
||||
} data[4];
|
||||
} get_tx_stats;
|
||||
struct {
|
||||
u8 ssid_len;
|
||||
u8 ssid[0] ALIGNED;
|
||||
} scan_req;
|
||||
struct {
|
||||
u32 state;
|
||||
} sta_get_state;
|
||||
struct {
|
||||
#define MLME_STA_DEAUTH 0
|
||||
#define MLME_STA_DISASSOC 1
|
||||
u16 cmd;
|
||||
u16 reason_code;
|
||||
} mlme;
|
||||
struct {
|
||||
unsigned int value;
|
||||
/* TODO
|
||||
int pulse_width;
|
||||
int num_pulse;
|
||||
int period;
|
||||
*/
|
||||
}radar;
|
||||
struct {
|
||||
unsigned int period;
|
||||
unsigned int offset;
|
||||
unsigned int duration;
|
||||
}quiet;
|
||||
struct {
|
||||
unsigned int tx_power_min;
|
||||
unsigned int tx_power_max;
|
||||
}tx_power;
|
||||
struct {
|
||||
u8 dummy[80]; /* Make sizeof() this struct large enough
|
||||
* with some compiler versions. */
|
||||
} dummy;
|
||||
} u;
|
||||
};
|
||||
|
||||
|
||||
#ifndef IEEE80211_TX_QUEUE_NUMS
|
||||
#define IEEE80211_TX_QUEUE_NUMS
|
||||
/* TODO: these need to be synchronized with ieee80211.h; make a shared header
|
||||
* file that can be included into low-level drivers, 80211.o, and hostapd */
|
||||
/* tx_queue_params - queue */
|
||||
enum {
|
||||
IEEE80211_TX_QUEUE_DATA0 = 0, /* used for EDCA AC_VO data */
|
||||
IEEE80211_TX_QUEUE_DATA1 = 1, /* used for EDCA AC_VI data */
|
||||
IEEE80211_TX_QUEUE_DATA2 = 2, /* used for EDCA AC_BE data */
|
||||
IEEE80211_TX_QUEUE_DATA3 = 3, /* used for EDCA AC_BK data */
|
||||
IEEE80211_TX_QUEUE_DATA4 = 4,
|
||||
IEEE80211_TX_QUEUE_AFTER_BEACON = 6,
|
||||
IEEE80211_TX_QUEUE_BEACON = 7
|
||||
};
|
||||
#endif /* IEEE80211_TX_QUEUE_NUMS */
|
||||
|
||||
|
||||
#define HOSTAP_CRYPT_FLAG_SET_TX_KEY BIT(0)
|
||||
#define HOSTAP_CRYPT_FLAG_PERMANENT BIT(1)
|
||||
|
||||
#define HOSTAP_CRYPT_ERR_UNKNOWN_ALG 2
|
||||
#define HOSTAP_CRYPT_ERR_UNKNOWN_ADDR 3
|
||||
#define HOSTAP_CRYPT_ERR_CRYPT_INIT_FAILED 4
|
||||
#define HOSTAP_CRYPT_ERR_KEY_SET_FAILED 5
|
||||
#define HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED 6
|
||||
#define HOSTAP_CRYPT_ERR_CARD_CONF_FAILED 7
|
||||
|
||||
#define HOSTAP_HW_FLAG_NULLFUNC_OK BIT(0)
|
||||
|
||||
enum {
|
||||
IEEE80211_KEY_MGMT_NONE = 0,
|
||||
IEEE80211_KEY_MGMT_IEEE8021X = 1,
|
||||
IEEE80211_KEY_MGMT_WPA_PSK = 2,
|
||||
IEEE80211_KEY_MGMT_WPA_EAP = 3,
|
||||
};
|
||||
|
||||
|
||||
/* Data structures used for get_hw_features ioctl */
|
||||
struct hostapd_ioctl_hw_modes_hdr {
|
||||
int mode;
|
||||
int num_channels;
|
||||
int num_rates;
|
||||
};
|
||||
|
||||
struct ieee80211_channel_data {
|
||||
short chan; /* channel number (IEEE 802.11) */
|
||||
short freq; /* frequency in MHz */
|
||||
int flag; /* flag for hostapd use (IEEE80211_CHAN_*) */
|
||||
};
|
||||
|
||||
struct ieee80211_rate_data {
|
||||
int rate; /* rate in 100 kbps */
|
||||
int flags; /* IEEE80211_RATE_ flags */
|
||||
};
|
||||
|
||||
|
||||
/* ADD_IF, REMOVE_IF, and UPDATE_IF 'type' argument */
|
||||
enum {
|
||||
HOSTAP_IF_WDS = 1, HOSTAP_IF_VLAN = 2, HOSTAP_IF_BSS = 3,
|
||||
HOSTAP_IF_STA = 4
|
||||
};
|
||||
|
||||
struct hostapd_if_wds {
|
||||
u8 remote_addr[ETH_ALEN];
|
||||
};
|
||||
|
||||
struct hostapd_if_vlan {
|
||||
u8 id;
|
||||
};
|
||||
|
||||
struct hostapd_if_bss {
|
||||
u8 bssid[ETH_ALEN];
|
||||
};
|
||||
|
||||
struct hostapd_if_sta {
|
||||
};
|
||||
|
||||
#endif /* HOSTAPD_IOCTL_H */
|
File diff suppressed because it is too large
Load Diff
@ -1,571 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2005, Instant802 Networks, Inc.
|
||||
* Copyright 2005, Devicescape Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef IEEE80211_I_H
|
||||
#define IEEE80211_I_H
|
||||
|
||||
/* ieee80211.o internal definitions, etc. These are not included into
|
||||
* low-level drivers. */
|
||||
|
||||
#ifndef ETH_P_PAE
|
||||
#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
|
||||
#endif /* ETH_P_PAE */
|
||||
|
||||
#define IEEE80211_MAX_SSID_LEN 32
|
||||
|
||||
struct ieee80211_local;
|
||||
|
||||
#include "ieee80211_key.h"
|
||||
#include "sta_info.h"
|
||||
|
||||
#define BIT(x) (1 << (x))
|
||||
|
||||
#define IEEE80211_ALIGN32_PAD(a) ((4 - ((a) & 3)) & 3)
|
||||
|
||||
|
||||
/* Maximum number of broadcast/multicast frames to buffer when some of the
|
||||
* associated stations are using power saving. */
|
||||
#define AP_MAX_BC_BUFFER 128
|
||||
|
||||
/* Maximum number of frames buffered to all STAs, including multicast frames.
|
||||
* Note: increasing this limit increases the potential memory requirement. Each
|
||||
* frame can be up to about 2 kB long. */
|
||||
#define TOTAL_MAX_TX_BUFFER 512
|
||||
|
||||
|
||||
#define MAC2STR(a) ((a)[0] & 0xff), ((a)[1] & 0xff), ((a)[2] & 0xff), \
|
||||
((a)[3] & 0xff), ((a)[4] & 0xff), ((a)[5] & 0xff)
|
||||
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
|
||||
|
||||
#define MULTICAST_ADDR(a) ((a)[0] & 0x01)
|
||||
|
||||
|
||||
/* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent
|
||||
* reception of at least three fragmented frames. This limit can be increased
|
||||
* by changing this define, at the cost of slower frame reassembly and
|
||||
* increased memory use (about 2 kB of RAM per entry). */
|
||||
#define IEEE80211_FRAGMENT_MAX 4
|
||||
|
||||
struct ieee80211_fragment_entry {
|
||||
unsigned long first_frag_time;
|
||||
unsigned int seq;
|
||||
unsigned int rx_queue;
|
||||
unsigned int last_frag;
|
||||
struct sk_buff *skb;
|
||||
int ccmp; /* Whether fragments were encrypted with CCMP */
|
||||
u8 last_pn[6]; /* PN of the last fragment if CCMP was used */
|
||||
};
|
||||
|
||||
|
||||
struct ieee80211_sta_bss {
|
||||
struct list_head list;
|
||||
struct ieee80211_sta_bss *hnext;
|
||||
atomic_t users;
|
||||
|
||||
u8 bssid[ETH_ALEN];
|
||||
u8 ssid[IEEE80211_MAX_SSID_LEN];
|
||||
size_t ssid_len;
|
||||
u16 capability; /* host byte order */
|
||||
int hw_mode;
|
||||
int channel;
|
||||
int freq;
|
||||
int rssi;
|
||||
u8 *wpa_ie;
|
||||
size_t wpa_ie_len;
|
||||
u8 *rsn_ie;
|
||||
size_t rsn_ie_len;
|
||||
u8 *wmm_ie;
|
||||
size_t wmm_ie_len;
|
||||
#define IEEE80211_MAX_SUPP_RATES 32
|
||||
u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
|
||||
size_t supp_rates_len;
|
||||
int beacon_int;
|
||||
u64 timestamp;
|
||||
|
||||
int probe_resp;
|
||||
unsigned long last_update;
|
||||
|
||||
};
|
||||
|
||||
|
||||
typedef enum {
|
||||
TXRX_CONTINUE, TXRX_DROP, TXRX_QUEUED
|
||||
} ieee80211_txrx_result;
|
||||
|
||||
struct ieee80211_txrx_data {
|
||||
struct sk_buff *skb;
|
||||
struct net_device *dev;
|
||||
struct ieee80211_local *local;
|
||||
struct ieee80211_sub_if_data *sdata;
|
||||
struct sta_info *sta;
|
||||
u16 fc, ethertype;
|
||||
struct ieee80211_key *key;
|
||||
unsigned int fragmented:1; /* whether the MSDU was fragmented */
|
||||
union {
|
||||
struct {
|
||||
struct ieee80211_tx_control *control;
|
||||
int unicast:1;
|
||||
int ps_buffered:1;
|
||||
int short_preamble:1;
|
||||
int probe_last_frag:1;
|
||||
struct ieee80211_rate *rate;
|
||||
/* use this rate (if set) for last fragment; rate can
|
||||
* be set to lower rate for the first fragments, e.g.,
|
||||
* when using CTS protection with IEEE 802.11g. */
|
||||
struct ieee80211_rate *last_frag_rate;
|
||||
int last_frag_rateidx;
|
||||
int mgmt_interface;
|
||||
|
||||
/* Extra fragments (in addition to the first fragment
|
||||
* in skb) */
|
||||
int num_extra_frag;
|
||||
struct sk_buff **extra_frag;
|
||||
} tx;
|
||||
struct {
|
||||
struct ieee80211_rx_status *status;
|
||||
int sent_ps_buffered;
|
||||
int queue;
|
||||
} rx;
|
||||
} u;
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
int wpa_test;
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
};
|
||||
|
||||
struct ieee80211_passive_scan {
|
||||
unsigned int in_scan:1; /* this must be cleared before calling
|
||||
* netif_oper(WAKEUP) */
|
||||
unsigned int our_mode_only:1; /* only scan our physical mode a/b/g/etc
|
||||
*/
|
||||
int interval; /* time in seconds between scans */
|
||||
int time; /* time in microseconds to scan for */
|
||||
int channel; /* channel to be scanned */
|
||||
int tries;
|
||||
|
||||
int mode_idx;
|
||||
int chan_idx;
|
||||
|
||||
int freq;
|
||||
int rx_packets;
|
||||
int rx_beacon;
|
||||
int txrx_count;
|
||||
|
||||
struct timer_list timer;
|
||||
|
||||
struct sk_buff *skb; /* skb to transmit before changing channels,
|
||||
* maybe null for none */
|
||||
struct ieee80211_tx_control tx_control;
|
||||
|
||||
unsigned int num_scans;
|
||||
};
|
||||
|
||||
typedef ieee80211_txrx_result (*ieee80211_tx_handler)
|
||||
(struct ieee80211_txrx_data *tx);
|
||||
|
||||
typedef ieee80211_txrx_result (*ieee80211_rx_handler)
|
||||
(struct ieee80211_txrx_data *rx);
|
||||
|
||||
struct ieee80211_if_norm {
|
||||
u8 *beacon_head, *beacon_tail;
|
||||
int beacon_head_len, beacon_tail_len;
|
||||
|
||||
/* TODO: sta_aid could be replaced by 2008-bit large bitfield of
|
||||
* that could be used in TIM element generation. This would also
|
||||
* make TIM element generation a bit faster. */
|
||||
/* AID mapping to station data. NULL, if AID is free. AID is in the
|
||||
* range 1..2007 and sta_aid[i] corresponds to AID i+1. */
|
||||
struct sta_info *sta_aid[MAX_AID_TABLE_SIZE];
|
||||
int max_aid; /* largest aid currently in use */
|
||||
atomic_t num_sta_ps; /* number of stations in PS mode */
|
||||
struct sk_buff_head ps_bc_buf;
|
||||
int dtim_period, dtim_count;
|
||||
int force_unicast_rateidx; /* forced TX rateidx for unicast frames */
|
||||
int max_ratectrl_rateidx; /* max TX rateidx for rate control */
|
||||
int num_beacons; /* number of TXed beacon frames for this BSS */
|
||||
};
|
||||
|
||||
struct ieee80211_if_wds {
|
||||
u8 remote_addr[ETH_ALEN];
|
||||
struct sta_info *sta;
|
||||
};
|
||||
|
||||
struct ieee80211_if_vlan {
|
||||
u8 id;
|
||||
};
|
||||
|
||||
struct ieee80211_if_sta {
|
||||
enum {
|
||||
IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
|
||||
IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
|
||||
IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED
|
||||
} state;
|
||||
struct timer_list timer;
|
||||
u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
|
||||
u8 ssid[IEEE80211_MAX_SSID_LEN];
|
||||
size_t ssid_len;
|
||||
u16 aid;
|
||||
u16 ap_capab, capab;
|
||||
u8 *extra_ie; /* to be added to the end of AssocReq */
|
||||
size_t extra_ie_len;
|
||||
|
||||
/* The last AssocReq/Resp IEs */
|
||||
u8 *assocreq_ies, *assocresp_ies;
|
||||
size_t assocreq_ies_len, assocresp_ies_len;
|
||||
|
||||
int auth_tries, assoc_tries;
|
||||
|
||||
int ssid_set:1;
|
||||
int bssid_set:1;
|
||||
int prev_bssid_set:1;
|
||||
int authenticated:1;
|
||||
int associated:1;
|
||||
int probereq_poll:1;
|
||||
int use_protection:1;
|
||||
int create_ibss:1;
|
||||
int mixed_cell:1;
|
||||
int wmm_enabled:1;
|
||||
|
||||
int key_mgmt;
|
||||
unsigned long last_probe;
|
||||
|
||||
#define IEEE80211_AUTH_ALG_OPEN BIT(0)
|
||||
#define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
|
||||
#define IEEE80211_AUTH_ALG_LEAP BIT(2)
|
||||
unsigned int auth_algs; /* bitfield of allowed auth algs */
|
||||
int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
|
||||
int auth_transaction;
|
||||
|
||||
unsigned long ibss_join_req;
|
||||
struct sk_buff *probe_resp; /* ProbeResp template for IBSS */
|
||||
u32 supp_rates_bits;
|
||||
|
||||
int wmm_last_param_set;
|
||||
};
|
||||
|
||||
|
||||
#define IEEE80211_SUB_IF_TYPE_NORM 0x00000000
|
||||
#define IEEE80211_SUB_IF_TYPE_MGMT 0x00000001
|
||||
#define IEEE80211_SUB_IF_TYPE_STA 0x00000002
|
||||
#define IEEE80211_SUB_IF_TYPE_WDS 0x5A580211
|
||||
#define IEEE80211_SUB_IF_TYPE_VLAN 0x00080211
|
||||
|
||||
struct ieee80211_sub_if_data {
|
||||
struct list_head list;
|
||||
unsigned int type;
|
||||
|
||||
struct net_device *dev;
|
||||
struct net_device *master;
|
||||
struct ieee80211_local *local;
|
||||
|
||||
struct net_device_stats stats;
|
||||
int drop_unencrypted;
|
||||
int eapol; /* 0 = process EAPOL frames as normal data frames,
|
||||
* 1 = send EAPOL frames through wlan#ap to hostapd
|
||||
* (default) */
|
||||
int ieee802_1x; /* IEEE 802.1X PAE - drop packet to/from unauthorized
|
||||
* port */
|
||||
|
||||
#define NUM_DEFAULT_KEYS 4
|
||||
struct ieee80211_key *keys[NUM_DEFAULT_KEYS];
|
||||
struct ieee80211_key *default_key;
|
||||
|
||||
struct ieee80211_if_norm *bss; /* BSS that this device belongs to */
|
||||
|
||||
union {
|
||||
struct ieee80211_if_norm norm;
|
||||
struct ieee80211_if_wds wds;
|
||||
struct ieee80211_if_vlan vlan;
|
||||
struct ieee80211_if_sta sta;
|
||||
} u;
|
||||
int channel_use;
|
||||
int channel_use_raw;
|
||||
};
|
||||
|
||||
#define IEEE80211_DEV_TO_SUB_IF(dev) ((struct ieee80211_sub_if_data *) \
|
||||
(((long)dev + sizeof(struct net_device) + 3) & ~3))
|
||||
|
||||
|
||||
struct ieee80211_local {
|
||||
struct ieee80211_hw *hw;
|
||||
void *hw_priv;
|
||||
struct net_device *mdev; /* wlan#.11 - "master" 802.11 device */
|
||||
struct net_device *wdev; /* wlan# - default Ethernet (data) devide */
|
||||
struct net_device *apdev; /* wlan#ap - management frames (hostapd) */
|
||||
int open_count;
|
||||
struct ieee80211_conf conf;
|
||||
|
||||
/* Tasklet and skb queue to process calls from IRQ mode. All frames
|
||||
* added to skb_queue will be processed, but frames in
|
||||
* skb_queue_unreliable may be dropped if the total length of these
|
||||
* queues increases over the limit. */
|
||||
#define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
|
||||
struct tasklet_struct tasklet;
|
||||
struct sk_buff_head skb_queue;
|
||||
struct sk_buff_head skb_queue_unreliable;
|
||||
enum {
|
||||
ieee80211_rx_msg = 1,
|
||||
ieee80211_tx_status_msg = 2
|
||||
} ieee80211_msg_enum;
|
||||
|
||||
spinlock_t generic_lock;
|
||||
/* Station data structures */
|
||||
spinlock_t sta_lock; /* mutex for STA data structures */
|
||||
int num_sta; /* number of stations in sta_list */
|
||||
struct list_head sta_list;
|
||||
struct sta_info *sta_hash[STA_HASH_SIZE];
|
||||
struct timer_list sta_cleanup;
|
||||
|
||||
/* Current rate table. This is a pointer to hw->modes structure. */
|
||||
struct ieee80211_rate *curr_rates;
|
||||
int num_curr_rates;
|
||||
|
||||
void *rate_ctrl_priv;
|
||||
struct rate_control_ops *rate_ctrl;
|
||||
|
||||
int next_mode; /* MODE_IEEE80211*
|
||||
* The mode preference for next channel change. This is
|
||||
* used to select .11g vs. .11b channels (or 4.9 GHz vs.
|
||||
* .11a) when the channel number is not unique. */
|
||||
|
||||
/* Supported and basic rate filters for different modes. These are
|
||||
* pointers to -1 terminated lists and rates in 100 kbps units. */
|
||||
int *supp_rates[NUM_IEEE80211_MODES];
|
||||
int *basic_rates[NUM_IEEE80211_MODES];
|
||||
|
||||
int rts_threshold;
|
||||
int cts_protect_erp_frames;
|
||||
int fragmentation_threshold;
|
||||
int short_retry_limit; /* dot11ShortRetryLimit */
|
||||
int long_retry_limit; /* dot11LongRetryLimit */
|
||||
int short_preamble; /* use short preamble with IEEE 802.11b */
|
||||
|
||||
u32 wep_iv;
|
||||
int key_tx_rx_threshold; /* number of times any key can be used in TX
|
||||
* or RX before generating a rekey
|
||||
* notification; 0 = notification disabled. */
|
||||
|
||||
/* Fragment table for host-based reassembly */
|
||||
struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX];
|
||||
unsigned int fragment_next;
|
||||
|
||||
int bridge_packets; /* bridge packets between associated stations and
|
||||
* deliver multicast frames both back to wireless
|
||||
* media and to the local net stack */
|
||||
|
||||
struct ieee80211_passive_scan scan;
|
||||
|
||||
|
||||
ieee80211_rx_handler *rx_handlers;
|
||||
ieee80211_tx_handler *tx_handlers;
|
||||
|
||||
spinlock_t sub_if_lock; /* mutex for STA data structures */
|
||||
struct list_head sub_if_list;
|
||||
struct net_device **bss_devs; /* pointer to IF_TYPE_NORM devices for
|
||||
* quick access to BSS data */
|
||||
int bss_dev_count; /* number of used entries in bss_devs; note: the
|
||||
* total size of bss_devs array is stored in
|
||||
* conf.bss_count */
|
||||
struct net_device **sta_devs; /* pointer to IF_TYPE_STA devices */
|
||||
int sta_dev_count; /* number of used entries in sta_devs */
|
||||
int sta_scanning;
|
||||
int scan_hw_mode_idx;
|
||||
int scan_channel_idx;
|
||||
enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
|
||||
unsigned long last_scan_completed;
|
||||
struct timer_list scan_timer;
|
||||
int scan_oper_channel;
|
||||
int scan_oper_channel_val;
|
||||
int scan_oper_power_level;
|
||||
int scan_oper_freq;
|
||||
int scan_oper_phymode;
|
||||
int scan_oper_antenna_max;
|
||||
u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
|
||||
size_t scan_ssid_len;
|
||||
int scan_skip_11b;
|
||||
struct list_head sta_bss_list;
|
||||
struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
|
||||
spinlock_t sta_bss_lock;
|
||||
#define IEEE80211_SCAN_MATCH_SSID BIT(0)
|
||||
#define IEEE80211_SCAN_WPA_ONLY BIT(1)
|
||||
#define IEEE80211_SCAN_EXTRA_INFO BIT(2)
|
||||
int scan_flags;
|
||||
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
u32 wpa_trigger;
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
/* SNMP counters */
|
||||
/* dot11CountersTable */
|
||||
u32 dot11TransmittedFragmentCount;
|
||||
u32 dot11MulticastTransmittedFrameCount;
|
||||
u32 dot11FailedCount;
|
||||
u32 dot11RetryCount;
|
||||
u32 dot11MultipleRetryCount;
|
||||
u32 dot11FrameDuplicateCount;
|
||||
u32 dot11ReceivedFragmentCount;
|
||||
u32 dot11MulticastReceivedFrameCount;
|
||||
u32 dot11TransmittedFrameCount;
|
||||
u32 dot11WEPUndecryptableCount;
|
||||
|
||||
int tx_led_counter;
|
||||
|
||||
u32 channel_use;
|
||||
u32 channel_use_raw;
|
||||
u32 stat_time;
|
||||
struct timer_list stat_timer;
|
||||
|
||||
u8 bssid[ETH_ALEN]; /* BSSID for STA modes (Adhoc/Managed) */
|
||||
struct timer_list rate_limit_timer;
|
||||
u32 rate_limit;
|
||||
u32 rate_limit_burst;
|
||||
u32 rate_limit_bucket;
|
||||
struct proc_dir_entry *proc, *proc_sta, *proc_iface;
|
||||
|
||||
struct work_struct sta_proc_add;
|
||||
|
||||
enum {
|
||||
STA_ANTENNA_SEL_AUTO = 0,
|
||||
STA_ANTENNA_SEL_SW_CTRL = 1,
|
||||
STA_ANTENNA_SEL_SW_CTRL_DEBUG = 2
|
||||
} sta_antenna_sel;
|
||||
|
||||
int rate_ctrl_num_up, rate_ctrl_num_down;
|
||||
|
||||
#ifdef CONFIG_IEEE80211_DEBUG_COUNTERS
|
||||
/* TX/RX handler statistics */
|
||||
unsigned int tx_handlers_drop;
|
||||
unsigned int tx_handlers_queued;
|
||||
unsigned int tx_handlers_drop_unencrypted;
|
||||
unsigned int tx_handlers_drop_fragment;
|
||||
unsigned int tx_handlers_drop_wep;
|
||||
unsigned int tx_handlers_drop_rate_limit;
|
||||
unsigned int tx_handlers_drop_not_assoc;
|
||||
unsigned int tx_handlers_drop_unauth_port;
|
||||
unsigned int rx_handlers_drop;
|
||||
unsigned int rx_handlers_queued;
|
||||
unsigned int rx_handlers_drop_nullfunc;
|
||||
unsigned int rx_handlers_drop_defrag;
|
||||
unsigned int rx_handlers_drop_short;
|
||||
unsigned int rx_handlers_drop_passive_scan;
|
||||
unsigned int tx_expand_skb_head;
|
||||
unsigned int tx_expand_skb_head_cloned;
|
||||
unsigned int rx_expand_skb_head;
|
||||
unsigned int rx_expand_skb_head2;
|
||||
unsigned int rx_handlers_fragments;
|
||||
unsigned int tx_status_drop;
|
||||
unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES];
|
||||
unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
|
||||
#define I802_DEBUG_INC(c) (c)++
|
||||
#else /* CONFIG_IEEE80211_DEBUG_COUNTERS */
|
||||
#define I802_DEBUG_INC(c) do { } while (0)
|
||||
#endif /* CONFIG_IEEE80211_DEBUG_COUNTERS */
|
||||
|
||||
|
||||
int default_wep_only; /* only default WEP keys are used with this
|
||||
* interface; this is used to decide when hwaccel
|
||||
* can be used with default keys */
|
||||
int total_ps_buffered; /* total number of all buffered unicast and
|
||||
* multicast packets for power saving stations
|
||||
*/
|
||||
int allow_broadcast_always; /* whether to allow TX of broadcast frames
|
||||
* even when there are no associated STAs
|
||||
*/
|
||||
|
||||
int wifi_wme_noack_test;
|
||||
unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
|
||||
|
||||
unsigned int hw_modes; /* bitfield of allowed hardware modes;
|
||||
* (1 << MODE_*) */
|
||||
};
|
||||
|
||||
|
||||
/* ieee80211.c */
|
||||
int ieee80211_hw_config(struct net_device *dev);
|
||||
struct ieee80211_key_conf *
|
||||
ieee80211_key_data2conf(struct ieee80211_local *local,
|
||||
struct ieee80211_key *data);
|
||||
void ieee80211_rx_mgmt(struct net_device *dev, struct sk_buff *skb,
|
||||
struct ieee80211_rx_status *status, u32 msg_type);
|
||||
void ieee80211_prepare_rates(struct net_device *dev);
|
||||
void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx);
|
||||
int ieee80211_if_add_wds(struct net_device *dev,
|
||||
char *name,
|
||||
struct ieee80211_if_wds *wds, int locked);
|
||||
int ieee80211_if_add_vlan(struct net_device *dev, char *name,
|
||||
struct ieee80211_if_vlan *vlan, int locked);
|
||||
int ieee80211_if_add_norm(struct net_device *dev, char *name, u8 *bssid,
|
||||
int locked);
|
||||
|
||||
int ieee80211_if_remove_wds(struct net_device *dev, char *name, int locked);
|
||||
int ieee80211_if_remove_vlan(struct net_device *dev, char *name, int locked);
|
||||
int ieee80211_if_remove_norm(struct net_device *dev, char *name, int locked);
|
||||
int ieee80211_if_flush(struct net_device *dev, int locked);
|
||||
int ieee80211_if_update_wds(struct net_device *dev, char *name,
|
||||
struct ieee80211_if_wds *wds, int locked);
|
||||
|
||||
/* ieee80211_ioctl.c */
|
||||
int ieee80211_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
|
||||
/* Set hw encryption from ieee80211 */
|
||||
int ieee80211_set_hw_encryption(struct net_device *dev,
|
||||
struct sta_info *sta, u8 addr[ETH_ALEN],
|
||||
struct ieee80211_key *key);
|
||||
|
||||
/* ieee80211_scan.c */
|
||||
void ieee80211_init_scan(struct net_device *dev);
|
||||
void ieee80211_stop_scan(struct net_device *dev);
|
||||
|
||||
|
||||
|
||||
/* Least common multiple of the used rates (in 100 kbps). This is used to
|
||||
* calculate rate_inv values for each rate so that only integers are needed. */
|
||||
#define CHAN_UTIL_RATE_LCM 95040
|
||||
/* 1 usec is 1/8 * (95040/10) = 1188 */
|
||||
#define CHAN_UTIL_PER_USEC 1188
|
||||
/* Amount of bits to shift the result right to scale the total utilization
|
||||
* to values that will not wrap around 32-bit integers. */
|
||||
#define CHAN_UTIL_SHIFT 9
|
||||
/* Theoretical maximum of channel utilization counter in 10 ms (stat_time=1):
|
||||
* (CHAN_UTIL_PER_USEC * 10000) >> CHAN_UTIL_SHIFT = 23203. So dividing the
|
||||
* raw value with about 23 should give utilization in 10th of a percentage
|
||||
* (1/1000). However, utilization is only estimated and not all intervals
|
||||
* between frames etc. are calculated. 18 seems to give numbers that are closer
|
||||
* to the real maximum. */
|
||||
#define CHAN_UTIL_PER_10MS 18
|
||||
#define CHAN_UTIL_HDR_LONG (202 * CHAN_UTIL_PER_USEC)
|
||||
#define CHAN_UTIL_HDR_SHORT (40 * CHAN_UTIL_PER_USEC)
|
||||
|
||||
|
||||
|
||||
/* ieee80211.c */
|
||||
int ieee80211_if_add_sta(struct net_device *dev, char *name, int locked);
|
||||
int ieee80211_if_remove_sta(struct net_device *dev, char *name, int locked);
|
||||
/* ieee80211_ioctl.c */
|
||||
int ieee80211_set_compression(struct ieee80211_local *local,
|
||||
struct net_device *dev, struct sta_info *sta);
|
||||
/* ieee80211_sta.c */
|
||||
void ieee80211_sta_timer(unsigned long ptr);
|
||||
void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb,
|
||||
struct ieee80211_rx_status *rx_status);
|
||||
int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len);
|
||||
int ieee80211_sta_get_ssid(struct net_device *dev, char *ssid, size_t *len);
|
||||
int ieee80211_sta_set_bssid(struct net_device *dev, u8 *bssid);
|
||||
int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len);
|
||||
int ieee80211_sta_scan_results(struct net_device *dev, char *buf, size_t len);
|
||||
void ieee80211_sta_rx_scan(struct net_device *dev, struct sk_buff *skb,
|
||||
struct ieee80211_rx_status *rx_status);
|
||||
void ieee80211_rx_bss_list_init(struct net_device *dev);
|
||||
void ieee80211_rx_bss_list_deinit(struct net_device *dev);
|
||||
int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len);
|
||||
struct sta_info * ieee80211_ibss_add_sta(struct net_device *dev,
|
||||
struct sk_buff *skb, u8 *bssid,
|
||||
u8 *addr);
|
||||
int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason);
|
||||
int ieee80211_sta_disassociate(struct net_device *dev, u16 reason);
|
||||
|
||||
|
||||
#endif /* IEEE80211_I_H */
|
File diff suppressed because it is too large
Load Diff
@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2004, Instant802 Networks, Inc.
|
||||
* Copyright 2005, Devicescape Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef IEEE80211_KEY_H
|
||||
#define IEEE80211_KEY_H
|
||||
|
||||
/* ALG_TKIP
|
||||
* struct ieee80211_key::key is encoded as a 256-bit (32 byte) data block:
|
||||
* Temporal Encryption Key (128 bits)
|
||||
* Temporal Authenticator Tx MIC Key (64 bits)
|
||||
* Temporal Authenticator Rx MIC Key (64 bits)
|
||||
*/
|
||||
|
||||
#define WEP_IV_LEN 4
|
||||
#define WEP_ICV_LEN 4
|
||||
|
||||
#define ALG_TKIP_KEY_LEN 32
|
||||
/* Starting offsets for each key */
|
||||
#define ALG_TKIP_TEMP_ENCR_KEY 0
|
||||
#define ALG_TKIP_TEMP_AUTH_TX_MIC_KEY 16
|
||||
#define ALG_TKIP_TEMP_AUTH_RX_MIC_KEY 24
|
||||
#define TKIP_IV_LEN 8
|
||||
#define TKIP_ICV_LEN 4
|
||||
|
||||
#define ALG_CCMP_KEY_LEN 16
|
||||
#define CCMP_HDR_LEN 8
|
||||
#define CCMP_MIC_LEN 8
|
||||
#define CCMP_TK_LEN 16
|
||||
#define CCMP_PN_LEN 6
|
||||
|
||||
#define NUM_RX_DATA_QUEUES 17
|
||||
|
||||
struct ieee80211_key {
|
||||
int hw_key_idx; /* filled and used by low-level driver */
|
||||
ieee80211_key_alg alg;
|
||||
union {
|
||||
struct {
|
||||
/* last used TSC */
|
||||
u32 iv32;
|
||||
u16 iv16;
|
||||
u16 p1k[5];
|
||||
int tx_initialized;
|
||||
|
||||
/* last received RSC */
|
||||
u32 iv32_rx[NUM_RX_DATA_QUEUES];
|
||||
u16 iv16_rx[NUM_RX_DATA_QUEUES];
|
||||
u16 p1k_rx[NUM_RX_DATA_QUEUES][5];
|
||||
int rx_initialized[NUM_RX_DATA_QUEUES];
|
||||
} tkip;
|
||||
struct {
|
||||
u8 tx_pn[6];
|
||||
/* TODO: for WME make this replay counter per AC */
|
||||
u8 rx_pn[NUM_RX_DATA_QUEUES][6];
|
||||
#ifndef AES_STATE_LEN
|
||||
#define AES_STATE_LEN 44
|
||||
#endif
|
||||
u32 aes_state[AES_STATE_LEN];
|
||||
u32 replays; /* dot11RSNAStatsCCMPReplays */
|
||||
} ccmp;
|
||||
} u;
|
||||
int tx_rx_count; /* number of times this key has been used */
|
||||
int keylen;
|
||||
|
||||
/* if the low level driver can provide hardware acceleration it should
|
||||
* clear this flag */
|
||||
int force_sw_encrypt:1;
|
||||
int keyidx:8; /* WEP key index */
|
||||
int default_tx_key:1; /* This key is the new default TX key
|
||||
* (used only for broadcast keys). */
|
||||
|
||||
u8 key[0];
|
||||
};
|
||||
|
||||
#endif /* IEEE80211_KEY_H */
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2004, Instant802 Networks, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#ifdef CONFIG_OAP_LEDS_WLAN
|
||||
extern void leds_wlan_set(int unit, int tx, int state);
|
||||
#endif
|
||||
|
||||
void ieee80211_rx_led(int state, struct net_device *dev) {
|
||||
#ifdef CONFIG_OAP_LEDS_WLAN
|
||||
static unsigned int count = 0;
|
||||
|
||||
if (state == 2) {
|
||||
leds_wlan_set(0, 0, (++count) & 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ieee80211_tx_led(int state, struct net_device *dev) {
|
||||
#ifdef CONFIG_OAP_LEDS_WLAN
|
||||
leds_wlan_set(0, 1, state);
|
||||
#endif
|
||||
}
|
||||
|
@ -1,777 +0,0 @@
|
||||
/*
|
||||
* Copyright 2003-2005, Devicescape Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
|
||||
#include <net/ieee80211.h>
|
||||
#include <net/ieee80211_common.h>
|
||||
#include <net/ieee80211_mgmt.h>
|
||||
#include "ieee80211_i.h"
|
||||
#include "sta_info.h"
|
||||
#include "ieee80211_proc.h"
|
||||
#include "rate_control.h"
|
||||
|
||||
|
||||
static struct proc_dir_entry *ieee80211_proc;
|
||||
|
||||
#define PROC_LIMIT (PAGE_SIZE - 80)
|
||||
|
||||
|
||||
static char * ieee80211_proc_key(char *p, struct ieee80211_key *key,
|
||||
int idx, int def_key)
|
||||
{
|
||||
int i;
|
||||
u8 *tpn, *rpn;
|
||||
|
||||
if (!key)
|
||||
return p;
|
||||
|
||||
p += sprintf(p, "key[%d]%s len=%d sw_encrypt=%d idx=%d hwidx=%d "
|
||||
"tx_rx_count=%d",
|
||||
idx, def_key ? "*" : "", key->keylen,
|
||||
key->force_sw_encrypt, key->keyidx, key->hw_key_idx,
|
||||
key->tx_rx_count);
|
||||
switch (key->alg) {
|
||||
case ALG_WEP:
|
||||
p += sprintf(p, " alg=WEP");
|
||||
break;
|
||||
case ALG_TKIP:
|
||||
p += sprintf(p, " alg=TKIP iv(tx)=%08x %04x",
|
||||
key->u.tkip.iv32, key->u.tkip.iv16);
|
||||
for (i = 0; i < NUM_RX_DATA_QUEUES; i++) {
|
||||
if (key->u.tkip.iv32_rx[i] == 0 &&
|
||||
key->u.tkip.iv16_rx[i] == 0)
|
||||
continue;
|
||||
p += sprintf(p, " iv(rx %d)=%08x %04x", i,
|
||||
key->u.tkip.iv32_rx[i],
|
||||
key->u.tkip.iv16_rx[i]);
|
||||
}
|
||||
break;
|
||||
case ALG_CCMP:
|
||||
tpn = key->u.ccmp.tx_pn;
|
||||
p += sprintf(p, " alg=CCMP PN(tx)=%02x%02x%02x%02x%02x%02x",
|
||||
tpn[0], tpn[1], tpn[2], tpn[3], tpn[4], tpn[5]);
|
||||
for (i = 0; i < NUM_RX_DATA_QUEUES; i++) {
|
||||
rpn = key->u.ccmp.rx_pn[i];
|
||||
if (memcmp(rpn, "\x00\x00\x00\x00\x00\x00", 6) == 0)
|
||||
continue;
|
||||
p += sprintf(p, " PN(rx %d)=%02x%02x%02x%02x%02x%02x",
|
||||
i, rpn[0], rpn[1], rpn[2], rpn[3], rpn[4],
|
||||
rpn[5]);
|
||||
}
|
||||
p += sprintf(p, " replays=%u", key->u.ccmp.replays);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
p += sprintf(p, " key=");
|
||||
for (i = 0; i < key->keylen; i++)
|
||||
p += sprintf(p, "%02x", key->key[i]);
|
||||
p += sprintf(p, "\n");
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
static char * ieee80211_proc_sub_if_norm(char *p,
|
||||
struct ieee80211_if_norm *norm)
|
||||
{
|
||||
p += sprintf(p, "type=norm\n");
|
||||
if (norm->beacon_head)
|
||||
p += sprintf(p, "beacon_head_len=%d\n", norm->beacon_head_len);
|
||||
if (norm->beacon_tail)
|
||||
p += sprintf(p, "beacon_tail_len=%d\n", norm->beacon_tail_len);
|
||||
p += sprintf(p,
|
||||
"max_aid=%d\n"
|
||||
"num_sta_ps=%d\n"
|
||||
"num_buffered_multicast=%u\n"
|
||||
"dtim_period=%d\n"
|
||||
"dtim_count=%d\n"
|
||||
"num_beacons=%d\n"
|
||||
"force_unicast_rateidx=%d\n"
|
||||
"max_ratectrl_rateidx=%d\n",
|
||||
norm->max_aid, atomic_read(&norm->num_sta_ps),
|
||||
skb_queue_len(&norm->ps_bc_buf),
|
||||
norm->dtim_period, norm->dtim_count, norm->num_beacons,
|
||||
norm->force_unicast_rateidx, norm->max_ratectrl_rateidx);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
static char * ieee80211_proc_sub_if_sta(char *p,
|
||||
struct ieee80211_if_sta *ifsta)
|
||||
{
|
||||
p += sprintf(p, "type=sta\n");
|
||||
p += sprintf(p,
|
||||
"state=%d\n"
|
||||
"bssid=" MACSTR "\n"
|
||||
"prev_bssid=" MACSTR "\n"
|
||||
"ssid_len=%zd\n"
|
||||
"aid=%d\n"
|
||||
"ap_capab=0x%x\n"
|
||||
"capab=0x%x\n"
|
||||
"extra_ie_len=%zd\n"
|
||||
"auth_tries=%d\n"
|
||||
"assoc_tries=%d\n"
|
||||
"flags=%s%s%s%s%s%s%s\n"
|
||||
"auth_algs=0x%x\n"
|
||||
"auth_alg=%d\n"
|
||||
"auth_transaction=%d\n",
|
||||
ifsta->state,
|
||||
MAC2STR(ifsta->bssid),
|
||||
MAC2STR(ifsta->prev_bssid),
|
||||
ifsta->ssid_len,
|
||||
ifsta->aid,
|
||||
ifsta->ap_capab,
|
||||
ifsta->capab,
|
||||
ifsta->extra_ie_len,
|
||||
ifsta->auth_tries,
|
||||
ifsta->assoc_tries,
|
||||
ifsta->ssid_set ? "[SSID]" : "",
|
||||
ifsta->bssid_set ? "[BSSID]" : "",
|
||||
ifsta->prev_bssid_set ? "[prev BSSID" : "",
|
||||
ifsta->authenticated ? "[AUTH]" : "",
|
||||
ifsta->associated ? "[ASSOC]" : "",
|
||||
ifsta->probereq_poll ? "[PROBEREQ POLL]" : "",
|
||||
ifsta->use_protection ? "[CTS prot]" : "",
|
||||
ifsta->auth_algs,
|
||||
ifsta->auth_alg,
|
||||
ifsta->auth_transaction);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
static char * ieee80211_proc_sub_if(char *p,
|
||||
struct ieee80211_sub_if_data *sdata)
|
||||
{
|
||||
if (sdata == NULL)
|
||||
return p;
|
||||
|
||||
if (sdata->bss)
|
||||
p += sprintf(p, "bss=%p\n", sdata->bss);
|
||||
|
||||
switch (sdata->type) {
|
||||
case IEEE80211_SUB_IF_TYPE_NORM:
|
||||
p = ieee80211_proc_sub_if_norm(p, &sdata->u.norm);
|
||||
break;
|
||||
case IEEE80211_SUB_IF_TYPE_WDS:
|
||||
p += sprintf(p, "type=wds\n");
|
||||
p += sprintf(p, "wds.peer=" MACSTR "\n",
|
||||
MAC2STR(sdata->u.wds.remote_addr));
|
||||
break;
|
||||
case IEEE80211_SUB_IF_TYPE_VLAN:
|
||||
p += sprintf(p, "type=vlan\n");
|
||||
p += sprintf(p, "vlan.id=%d\n", sdata->u.vlan.id);
|
||||
break;
|
||||
case IEEE80211_SUB_IF_TYPE_STA:
|
||||
p = ieee80211_proc_sub_if_sta(p, &sdata->u.sta);
|
||||
break;
|
||||
}
|
||||
p += sprintf(p, "channel_use=%d\n", sdata->channel_use);
|
||||
p += sprintf(p, "drop_unencrypted=%d\n", sdata->drop_unencrypted);
|
||||
p += sprintf(p, "eapol=%d\n", sdata->eapol);
|
||||
p += sprintf(p, "ieee802_1x=%d\n", sdata->ieee802_1x);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
static int ieee80211_proc_iface_read(char *page, char **start, off_t off,
|
||||
int count, int *eof, void *data)
|
||||
{
|
||||
char *p = page;
|
||||
struct net_device *dev = (struct net_device *) data;
|
||||
struct ieee80211_sub_if_data *sdata;
|
||||
int i;
|
||||
|
||||
if (off != 0) {
|
||||
*eof = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
|
||||
if (!sdata)
|
||||
return -1;
|
||||
|
||||
p = ieee80211_proc_sub_if(p, sdata);
|
||||
|
||||
for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
|
||||
if (sdata->keys[i] == NULL)
|
||||
continue;
|
||||
|
||||
p = ieee80211_proc_key(p, sdata->keys[i], i,
|
||||
sdata->keys[i] == sdata->default_key);
|
||||
}
|
||||
|
||||
return (p - page);
|
||||
}
|
||||
|
||||
|
||||
static int ieee80211_proc_sta_read(char *page, char **start, off_t off,
|
||||
int count, int *eof, void *data)
|
||||
{
|
||||
char *p = page;
|
||||
struct sta_info *sta = (struct sta_info *) data;
|
||||
struct ieee80211_local *local;
|
||||
int inactive, i;
|
||||
|
||||
if (off != 0) {
|
||||
*eof = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!sta || !sta->dev)
|
||||
return -1;
|
||||
|
||||
p += sprintf(p, "users=%d\n", atomic_read(&sta->users));
|
||||
p += sprintf(p, "aid=%d\n", sta->aid);
|
||||
p += sprintf(p, "flags=0x%x %s%s%s%s%s%s%s%s%s%s\n", sta->flags,
|
||||
sta->flags & WLAN_STA_AUTH ? "[AUTH]" : "",
|
||||
sta->flags & WLAN_STA_ASSOC ? "[ASSOC]" : "",
|
||||
sta->flags & WLAN_STA_PS ? "[PS]" : "",
|
||||
sta->flags & WLAN_STA_TIM ? "[TIM]" : "",
|
||||
sta->flags & WLAN_STA_PERM ? "[PERM]" : "",
|
||||
sta->flags & WLAN_STA_AUTHORIZED ? "[AUTHORIZED]" : "",
|
||||
sta->flags & WLAN_STA_SHORT_PREAMBLE ?
|
||||
"[SHORT PREAMBLE]" : "",
|
||||
sta->flags & WLAN_STA_WME ? "[WME]" : "",
|
||||
sta->flags & WLAN_STA_WDS ? "[WDS]" : "",
|
||||
sta->flags & WLAN_STA_XR ? "[XR]" : "");
|
||||
p += sprintf(p, "key_idx_compression=%d\n",
|
||||
sta->key_idx_compression);
|
||||
p += sprintf(p, "dev=%s\n", sta->dev->name);
|
||||
if (sta->vlan_id > 0)
|
||||
p += sprintf(p, "vlan_id=%d\n", sta->vlan_id);
|
||||
p += sprintf(p, "rx_packets=%lu\ntx_packets=%lu\nrx_bytes=%lu\n"
|
||||
"tx_bytes=%lu\nrx_duplicates=%lu\nrx_fragments=%lu\n"
|
||||
"rx_dropped=%lu\ntx_fragments=%lu\ntx_filtered=%lu\n",
|
||||
sta->rx_packets, sta->tx_packets,
|
||||
sta->rx_bytes, sta->tx_bytes,
|
||||
sta->num_duplicates, sta->rx_fragments, sta->rx_dropped,
|
||||
sta->tx_fragments, sta->tx_filtered_count);
|
||||
p = ieee80211_proc_key(p, sta->key, 0, 1);
|
||||
|
||||
local = (struct ieee80211_local *) sta->dev->priv;
|
||||
if (sta->txrate >= 0 && sta->txrate < local->num_curr_rates) {
|
||||
p += sprintf(p, "txrate=%d\n",
|
||||
local->curr_rates[sta->txrate].rate);
|
||||
}
|
||||
if (sta->last_txrate >= 0 &&
|
||||
sta->last_txrate < local->num_curr_rates) {
|
||||
p += sprintf(p, "last_txrate=%d\n",
|
||||
local->curr_rates[sta->last_txrate].rate);
|
||||
}
|
||||
p += sprintf(p, "num_ps_buf_frames=%u\n",
|
||||
skb_queue_len(&sta->ps_tx_buf));
|
||||
p += sprintf(p, "tx_retry_failed=%lu\n", sta->tx_retry_failed);
|
||||
p += sprintf(p, "tx_retry_count=%lu\n", sta->tx_retry_count);
|
||||
p += sprintf(p, "last_rssi=%d\n", sta->last_rssi);
|
||||
p += sprintf(p, "last_ack_rssi=%d %d %d\n",
|
||||
sta->last_ack_rssi[0], sta->last_ack_rssi[1],
|
||||
sta->last_ack_rssi[2]);
|
||||
if (sta->last_ack)
|
||||
p += sprintf(p, "last_ack_ms=%d\n",
|
||||
jiffies_to_msecs(jiffies - sta->last_ack));
|
||||
inactive = jiffies - sta->last_rx;
|
||||
p += sprintf(p, "inactive_msec=%d\n", jiffies_to_msecs(inactive));
|
||||
p += sprintf(p, "channel_use=%d\n", sta->channel_use);
|
||||
p += sprintf(p, "wep_weak_iv_count=%d\n", sta->wep_weak_iv_count);
|
||||
#ifdef CONFIG_IEEE80211_DEBUG_COUNTERS
|
||||
p += sprintf(p, "wme_rx_queue=");
|
||||
for (i = 0; i < NUM_RX_DATA_QUEUES; i++)
|
||||
p += sprintf(p, "%u ", sta->wme_rx_queue[i]);
|
||||
p += sprintf(p, "\n");
|
||||
|
||||
p += sprintf(p, "wme_tx_queue=");
|
||||
for (i = 0; i < NUM_RX_DATA_QUEUES; i++)
|
||||
p += sprintf(p, "%u ", sta->wme_tx_queue[i]);
|
||||
p += sprintf(p, "\n");
|
||||
#endif /* CONFIG_IEEE80211_DEBUG_COUNTERS */
|
||||
p += sprintf(p, "last_seq_ctrl=");
|
||||
for (i = 0; i < NUM_RX_DATA_QUEUES; i++) {
|
||||
p += sprintf(p, "%x ", sta->last_seq_ctrl[i]);
|
||||
}
|
||||
p += sprintf(p, "\n");
|
||||
|
||||
p += rate_control_status_sta(local, sta, p);
|
||||
|
||||
return (p - page);
|
||||
}
|
||||
|
||||
|
||||
static int ieee80211_proc_counters_read(char *page, char **start, off_t off,
|
||||
int count, int *eof, void *data)
|
||||
{
|
||||
char *p = page;
|
||||
struct ieee80211_local *local = (struct ieee80211_local *) data;
|
||||
struct ieee80211_low_level_stats stats;
|
||||
|
||||
if (off != 0) {
|
||||
*eof = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
p += sprintf(p,
|
||||
"TransmittedFragmentCount=%u\n"
|
||||
"MulticastTransmittedFrameCount=%u\n"
|
||||
"FailedCount=%u\n"
|
||||
"RetryCount=%u\n"
|
||||
"MultipleRetryCount=%d\n"
|
||||
"FrameDuplicateCount=%d\n"
|
||||
"ReceivedFragmentCount=%u\n"
|
||||
"MulticastReceivedFrameCount=%u\n"
|
||||
"TransmittedFrameCount=%u\n"
|
||||
"WEPUndecryptableCount=%u\n",
|
||||
local->dot11TransmittedFragmentCount,
|
||||
local->dot11MulticastTransmittedFrameCount,
|
||||
local->dot11FailedCount,
|
||||
local->dot11RetryCount,
|
||||
local->dot11MultipleRetryCount,
|
||||
local->dot11FrameDuplicateCount,
|
||||
local->dot11ReceivedFragmentCount,
|
||||
local->dot11MulticastReceivedFrameCount,
|
||||
local->dot11TransmittedFrameCount,
|
||||
local->dot11WEPUndecryptableCount);
|
||||
|
||||
memset(&stats, 0, sizeof(stats));
|
||||
if (local->hw->get_stats &&
|
||||
local->hw->get_stats(local->mdev, &stats) == 0) {
|
||||
p += sprintf(p,
|
||||
"ACKFailureCount=%u\n"
|
||||
"RTSFailureCount=%u\n"
|
||||
"FCSErrorCount=%u\n"
|
||||
"RTSSuccessCount=%u\n",
|
||||
stats.dot11ACKFailureCount,
|
||||
stats.dot11RTSFailureCount,
|
||||
stats.dot11FCSErrorCount,
|
||||
stats.dot11RTSSuccessCount);
|
||||
}
|
||||
|
||||
return (p - page);
|
||||
}
|
||||
|
||||
|
||||
static int ieee80211_proc_debug_read(char *page, char **start, off_t off,
|
||||
int count, int *eof, void *data)
|
||||
{
|
||||
char *p = page;
|
||||
struct ieee80211_local *local = (struct ieee80211_local *) data;
|
||||
int i;
|
||||
|
||||
if (off != 0) {
|
||||
*eof = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IEEE80211_DEBUG_COUNTERS
|
||||
p += sprintf(p,
|
||||
"tx_handlers_drop=%u\n"
|
||||
"tx_handlers_queued=%u\n"
|
||||
"tx_handlers_drop_unencrypted=%u\n"
|
||||
"tx_handlers_drop_fragment=%u\n"
|
||||
"tx_handlers_drop_wep=%u\n"
|
||||
"tx_handlers_drop_rate_limit=%u\n"
|
||||
"tx_handlers_drop_not_assoc=%u\n"
|
||||
"tx_handlers_drop_unauth_port=%u\n"
|
||||
"rx_handlers_drop=%u\n"
|
||||
"rx_handlers_queued=%u\n"
|
||||
"rx_handlers_drop_nullfunc=%u\n"
|
||||
"rx_handlers_drop_defrag=%u\n"
|
||||
"rx_handlers_drop_short=%u\n"
|
||||
"rx_handlers_drop_passive_scan=%u\n"
|
||||
"tx_expand_skb_head=%u\n"
|
||||
"tx_expand_skb_head_cloned=%u\n"
|
||||
"rx_expand_skb_head=%u\n"
|
||||
"rx_expand_skb_head2=%u\n"
|
||||
"rx_handlers_fragments=%u\n"
|
||||
"tx_status_drop=%u\n",
|
||||
local->tx_handlers_drop,
|
||||
local->tx_handlers_queued,
|
||||
local->tx_handlers_drop_unencrypted,
|
||||
local->tx_handlers_drop_fragment,
|
||||
local->tx_handlers_drop_wep,
|
||||
local->tx_handlers_drop_rate_limit,
|
||||
local->tx_handlers_drop_not_assoc,
|
||||
local->tx_handlers_drop_unauth_port,
|
||||
local->rx_handlers_drop,
|
||||
local->rx_handlers_queued,
|
||||
local->rx_handlers_drop_nullfunc,
|
||||
local->rx_handlers_drop_defrag,
|
||||
local->rx_handlers_drop_short,
|
||||
local->rx_handlers_drop_passive_scan,
|
||||
local->tx_expand_skb_head,
|
||||
local->tx_expand_skb_head_cloned,
|
||||
local->rx_expand_skb_head,
|
||||
local->rx_expand_skb_head2,
|
||||
local->rx_handlers_fragments,
|
||||
local->tx_status_drop);
|
||||
{
|
||||
int i;
|
||||
p += sprintf(p, "wme_rx_queue=");
|
||||
for (i = 0; i < NUM_RX_DATA_QUEUES; i++)
|
||||
p += sprintf(p, " %u", local->wme_rx_queue[i]);
|
||||
p += sprintf(p, "\n");
|
||||
|
||||
p += sprintf(p, "wme_tx_queue=");
|
||||
for (i = 0; i < NUM_RX_DATA_QUEUES; i++)
|
||||
p += sprintf(p, " %u", local->wme_tx_queue[i]);
|
||||
p += sprintf(p, "\n");
|
||||
}
|
||||
#endif /* CONFIG_IEEE80211_DEBUG_COUNTERS */
|
||||
|
||||
p += sprintf(p, "num_scans=%u\n", local->scan.num_scans);
|
||||
|
||||
p += sprintf(p,
|
||||
"conf.bss_count=%d\n"
|
||||
"bss_dev_count=%u\n",
|
||||
local->conf.bss_count, local->bss_dev_count);
|
||||
for (i = 0; i < local->conf.bss_count; i++) {
|
||||
p += sprintf(p, "bss_dev[%d]=%p (%s)\n",
|
||||
i, local->bss_devs[i],
|
||||
(i < local->bss_dev_count && local->bss_devs[i]) ?
|
||||
local->bss_devs[i]->name : "N/A");
|
||||
}
|
||||
|
||||
return (p - page);
|
||||
}
|
||||
|
||||
|
||||
static const char * ieee80211_mode_str_short(int mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case MODE_IEEE80211A:
|
||||
return "802.11a";
|
||||
case MODE_IEEE80211B:
|
||||
return "802.11b";
|
||||
case MODE_IEEE80211G:
|
||||
return "802.11g";
|
||||
case MODE_ATHEROS_TURBO:
|
||||
return "AtherosTurbo";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static const char * ieee80211_mode_str(int mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case MODE_IEEE80211A:
|
||||
return "IEEE 802.11a";
|
||||
case MODE_IEEE80211B:
|
||||
return "IEEE 802.11b";
|
||||
case MODE_IEEE80211G:
|
||||
return "IEEE 802.11g";
|
||||
case MODE_ATHEROS_TURBO:
|
||||
return "Atheros Turbo (5 GHz)";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int ieee80211_proc_info_read(char *page, char **start, off_t off,
|
||||
int count, int *eof, void *data)
|
||||
{
|
||||
char *p = page;
|
||||
struct ieee80211_local *local = (struct ieee80211_local *) data;
|
||||
int m;
|
||||
struct ieee80211_hw_modes *mode;
|
||||
|
||||
if (off != 0) {
|
||||
*eof = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
p += sprintf(p, "hw_name=%s\n", local->hw->name);
|
||||
p += sprintf(p, "modes=");
|
||||
for (m = 0; m < local->hw->num_modes; m++) {
|
||||
mode = &local->hw->modes[m];
|
||||
p += sprintf(p, "[%s]", ieee80211_mode_str_short(mode->mode));
|
||||
}
|
||||
p += sprintf(p, "\n");
|
||||
if (local->rate_ctrl && local->rate_ctrl_priv)
|
||||
p+= sprintf(p, "rate_ctrl_alg=%s\n", local->rate_ctrl->name);
|
||||
return (p - page);
|
||||
}
|
||||
|
||||
|
||||
static int ieee80211_proc_config_read(char *page, char **start, off_t off,
|
||||
int count, int *eof, void *data)
|
||||
{
|
||||
char *p = page;
|
||||
struct ieee80211_local *local = (struct ieee80211_local *) data;
|
||||
|
||||
if (off != 0) {
|
||||
*eof = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
p += sprintf(p,
|
||||
"low_level_driver=%s\n"
|
||||
"channel=%d\n"
|
||||
"freq=%d\n"
|
||||
"mode=%s\n"
|
||||
"802.11h=%d\n"
|
||||
"wep_iv=0x%06x\n"
|
||||
"antenna_sel=%d\n"
|
||||
"calib_int=%d\n"
|
||||
"tx_power_reduction=%d.%d dBm\n"
|
||||
"bridge_packets=%d\n"
|
||||
"key_tx_rx_threshold=%d\n"
|
||||
"rts_threshold=%d\n"
|
||||
"fragmentation_threshold=%d\n"
|
||||
"short_retry_limit=%d\n"
|
||||
"long_retry_limit=%d\n"
|
||||
"total_ps_buffered=%d\n",
|
||||
local->hw->name ? local->hw->name : "N/A",
|
||||
local->conf.channel,
|
||||
local->conf.freq,
|
||||
ieee80211_mode_str(local->conf.phymode),
|
||||
local->conf.radar_detect,
|
||||
local->wep_iv & 0xffffff,
|
||||
local->conf.antenna_sel,
|
||||
local->conf.calib_int,
|
||||
local->conf.tx_power_reduction / 10,
|
||||
local->conf.tx_power_reduction % 10,
|
||||
local->bridge_packets,
|
||||
local->key_tx_rx_threshold,
|
||||
local->rts_threshold,
|
||||
local->fragmentation_threshold,
|
||||
local->short_retry_limit,
|
||||
local->long_retry_limit,
|
||||
local->total_ps_buffered);
|
||||
|
||||
return (p - page);
|
||||
}
|
||||
|
||||
|
||||
static int ieee80211_proc_channels_read(char *page, char **start, off_t off,
|
||||
int count, int *eof, void *data)
|
||||
{
|
||||
char *p = page;
|
||||
struct ieee80211_local *local = (struct ieee80211_local *) data;
|
||||
int m, c;
|
||||
struct ieee80211_hw_modes *mode;
|
||||
struct ieee80211_channel *chan;
|
||||
|
||||
if (off != 0) {
|
||||
*eof = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
p += sprintf(p, "MODE CHAN FREQ TXPOWER ANTMAX FLAGS\n");
|
||||
for (m = 0; m < local->hw->num_modes; m++) {
|
||||
mode = &local->hw->modes[m];
|
||||
for (c = 0; c < mode->num_channels; c++) {
|
||||
chan = &mode->channels[c];
|
||||
p += sprintf(p, "%d %d %d %d %d %s%s%s\n",
|
||||
mode->mode, chan->chan, chan->freq,
|
||||
chan->power_level, chan->antenna_max,
|
||||
chan->flag & IEEE80211_CHAN_W_SCAN ?
|
||||
"[W_SCAN]" : "",
|
||||
chan->flag & IEEE80211_CHAN_W_ACTIVE_SCAN
|
||||
? "[W_ACTIVE_SCAN]" : "",
|
||||
chan->flag & IEEE80211_CHAN_W_IBSS ?
|
||||
"[W_IBSS]" : "");
|
||||
}
|
||||
}
|
||||
return (p - page);
|
||||
}
|
||||
|
||||
|
||||
static int ieee80211_proc_rates_read(char *page, char **start, off_t off,
|
||||
int count, int *eof, void *data)
|
||||
{
|
||||
char *p = page;
|
||||
struct ieee80211_local *local = (struct ieee80211_local *) data;
|
||||
int r;
|
||||
struct ieee80211_rate *rate;
|
||||
|
||||
if (off != 0) {
|
||||
*eof = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
p += sprintf(p, "RATE VAL VAL2 MIN_RSSI_ACK MIN_RSSI_ACK_DELTA "
|
||||
"FLAGS\n");
|
||||
for (r = 0; r < local->num_curr_rates; r++) {
|
||||
rate = &local->curr_rates[r];
|
||||
p += sprintf(p, "%d %d %d %d %d 0x%x %s%s%s%s%s%s%s%s\n",
|
||||
rate->rate, rate->val, rate->val2,
|
||||
rate->min_rssi_ack, rate->min_rssi_ack_delta,
|
||||
rate->flags,
|
||||
rate->flags & IEEE80211_RATE_ERP ? "[ERP]" : "",
|
||||
rate->flags & IEEE80211_RATE_BASIC ?
|
||||
"[BASIC]" : "",
|
||||
rate->flags & IEEE80211_RATE_PREAMBLE2 ?
|
||||
"[PREAMBLE2]" : "",
|
||||
rate->flags & IEEE80211_RATE_SUPPORTED ?
|
||||
"[SUPPORTED]" : "",
|
||||
rate->flags & IEEE80211_RATE_OFDM ? "[OFDM]" : "",
|
||||
rate->flags & IEEE80211_RATE_CCK ? "[CCK]" : "",
|
||||
rate->flags & IEEE80211_RATE_TURBO ?
|
||||
"[TURBO]" : "",
|
||||
rate->flags & IEEE80211_RATE_MANDATORY ?
|
||||
"[MANDATORY]" : "");
|
||||
}
|
||||
return (p - page);
|
||||
}
|
||||
|
||||
|
||||
static int ieee80211_proc_multicast_read(char *page, char **start, off_t off,
|
||||
int count, int *eof, void *data)
|
||||
{
|
||||
char *p = page;
|
||||
struct ieee80211_local *local = (struct ieee80211_local *) data;
|
||||
|
||||
if (off != 0) {
|
||||
*eof = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return rate_control_status_global(local, p);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ieee80211_proc_init_sta(struct ieee80211_local *local,
|
||||
struct sta_info *sta)
|
||||
{
|
||||
char buf[30];
|
||||
struct proc_dir_entry *entry;
|
||||
|
||||
sprintf(buf, MACSTR, MAC2STR(sta->addr));
|
||||
|
||||
if (!local->proc_sta)
|
||||
return;
|
||||
|
||||
entry = create_proc_read_entry(buf, 0, local->proc_sta,
|
||||
ieee80211_proc_sta_read, sta);
|
||||
if (entry) {
|
||||
entry->mode &= ~(S_IRWXG | S_IRWXO);
|
||||
sta->proc_entry_added = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ieee80211_proc_deinit_sta(struct ieee80211_local *local,
|
||||
struct sta_info *sta)
|
||||
{
|
||||
char buf[30];
|
||||
sprintf(buf, MACSTR, MAC2STR(sta->addr));
|
||||
if (local->proc_sta) {
|
||||
remove_proc_entry(buf, local->proc_sta);
|
||||
sta->proc_entry_added = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ieee80211_proc_init_virtual(struct net_device *dev)
|
||||
{
|
||||
struct proc_dir_entry *entry;
|
||||
struct ieee80211_local *local = (struct ieee80211_local *) dev->priv;
|
||||
|
||||
if (!local->proc_iface)
|
||||
return;
|
||||
|
||||
entry = create_proc_read_entry(dev->name, 0, local->proc_iface,
|
||||
ieee80211_proc_iface_read, dev);
|
||||
if (entry)
|
||||
entry->mode &= ~(S_IRWXG | S_IRWXO);
|
||||
}
|
||||
|
||||
|
||||
void ieee80211_proc_deinit_virtual(struct net_device *dev)
|
||||
{
|
||||
struct ieee80211_local *local = (struct ieee80211_local *) dev->priv;
|
||||
|
||||
if (local->proc_iface)
|
||||
remove_proc_entry(dev->name, local->proc_iface);
|
||||
}
|
||||
|
||||
|
||||
void ieee80211_proc_init_interface(struct ieee80211_local *local)
|
||||
{
|
||||
if (!ieee80211_proc)
|
||||
return;
|
||||
|
||||
local->proc = proc_mkdir(local->wdev->name, ieee80211_proc);
|
||||
if (!local->proc)
|
||||
return;
|
||||
|
||||
local->proc_sta = proc_mkdir("sta", local->proc);
|
||||
local->proc_iface = proc_mkdir("iface", local->proc);
|
||||
create_proc_read_entry("counters", 0, local->proc,
|
||||
ieee80211_proc_counters_read, local);
|
||||
create_proc_read_entry("config", 0, local->proc,
|
||||
ieee80211_proc_config_read, local);
|
||||
create_proc_read_entry("channels", 0, local->proc,
|
||||
ieee80211_proc_channels_read, local);
|
||||
create_proc_read_entry("rates", 0, local->proc,
|
||||
ieee80211_proc_rates_read, local);
|
||||
create_proc_read_entry("multicast", 0, local->proc,
|
||||
ieee80211_proc_multicast_read, local);
|
||||
create_proc_read_entry("debug", 0, local->proc,
|
||||
ieee80211_proc_debug_read, local);
|
||||
create_proc_read_entry("info", 0, local->proc,
|
||||
ieee80211_proc_info_read, local);
|
||||
ieee80211_proc_init_virtual(local->wdev);
|
||||
}
|
||||
|
||||
|
||||
void ieee80211_proc_deinit_interface(struct ieee80211_local *local)
|
||||
{
|
||||
if (!local->proc)
|
||||
return;
|
||||
|
||||
ieee80211_proc_deinit_virtual(local->wdev);
|
||||
remove_proc_entry("iface", local->proc);
|
||||
remove_proc_entry("sta", local->proc);
|
||||
remove_proc_entry("counters", local->proc);
|
||||
remove_proc_entry("debug", local->proc);
|
||||
remove_proc_entry("config", local->proc);
|
||||
remove_proc_entry("channels", local->proc);
|
||||
remove_proc_entry("rates", local->proc);
|
||||
remove_proc_entry("multicast", local->proc);
|
||||
remove_proc_entry("info", local->proc);
|
||||
local->proc = NULL;
|
||||
remove_proc_entry(local->wdev->name, ieee80211_proc);
|
||||
}
|
||||
|
||||
|
||||
void ieee80211_proc_init(void)
|
||||
{
|
||||
if (proc_net == NULL) {
|
||||
ieee80211_proc = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
ieee80211_proc = proc_mkdir("ieee80211", proc_net);
|
||||
if (!ieee80211_proc)
|
||||
printk(KERN_WARNING "Failed to mkdir /proc/net/ieee80211\n");
|
||||
}
|
||||
|
||||
|
||||
void ieee80211_proc_deinit(void)
|
||||
{
|
||||
if (!ieee80211_proc)
|
||||
return;
|
||||
|
||||
ieee80211_proc = NULL;
|
||||
remove_proc_entry("ieee80211", proc_net);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PROC_FS */
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright 2003-2004, Instant802 Networks, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef IEEE80211_PROC_H
|
||||
#define IEEE80211_PROC_H
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
|
||||
void ieee80211_proc_init_sta(struct ieee80211_local *local,
|
||||
struct sta_info *sta);
|
||||
void ieee80211_proc_deinit_sta(struct ieee80211_local *local,
|
||||
struct sta_info *sta);
|
||||
void ieee80211_proc_init_virtual(struct net_device *dev);
|
||||
void ieee80211_proc_deinit_virtual(struct net_device *dev);
|
||||
void ieee80211_proc_init_interface(struct ieee80211_local *local);
|
||||
void ieee80211_proc_deinit_interface(struct ieee80211_local *local);
|
||||
void ieee80211_proc_init(void);
|
||||
void ieee80211_proc_deinit(void);
|
||||
|
||||
#else /* CONFIG_PROC_FS */
|
||||
|
||||
static inline void ieee80211_proc_init_sta(struct ieee80211_local *local,
|
||||
struct sta_info *sta) {}
|
||||
static inline void ieee80211_proc_deinit_sta(struct ieee80211_local *local,
|
||||
struct sta_info *sta) {}
|
||||
static inline void ieee80211_proc_init_virtual(struct net_device *dev) {}
|
||||
static inline void ieee80211_proc_deinit_virtual(struct net_device *dev) {}
|
||||
static inline void
|
||||
ieee80211_proc_init_interface(struct ieee80211_local *local) {}
|
||||
static inline void
|
||||
ieee80211_proc_deinit_interface(struct ieee80211_local *local) {}
|
||||
static inline void ieee80211_proc_init(void) {}
|
||||
static inline void ieee80211_proc_deinit(void) {}
|
||||
#endif /* CONFIG_PROC_FS */
|
||||
|
||||
#endif /* IEEE80211_PROC_H */
|
@ -1,352 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2004, Instant802 Networks, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
#include <net/ieee80211.h>
|
||||
#include "ieee80211_i.h"
|
||||
#include "rate_control.h"
|
||||
|
||||
|
||||
/* Maximum number of seconds to wait for the traffic load to get below
|
||||
* threshold before forcing a passive scan. */
|
||||
#define MAX_SCAN_WAIT 60
|
||||
/* Threshold (pkts/sec TX or RX) for delaying passive scan */
|
||||
#define SCAN_TXRX_THRESHOLD 75
|
||||
|
||||
static void get_channel_params(struct ieee80211_local *local, int channel,
|
||||
struct ieee80211_hw_modes **mode,
|
||||
struct ieee80211_channel **chan)
|
||||
{
|
||||
int m;
|
||||
|
||||
for (m = 0; m < local->hw->num_modes; m++) {
|
||||
*mode = &local->hw->modes[m];
|
||||
if ((*mode)->mode == local->conf.phymode)
|
||||
break;
|
||||
}
|
||||
local->scan.mode_idx = m;
|
||||
local->scan.chan_idx = 0;
|
||||
do {
|
||||
*chan = &(*mode)->channels[local->scan.chan_idx];
|
||||
if ((*chan)->chan == channel) {
|
||||
return;
|
||||
}
|
||||
local->scan.chan_idx++;
|
||||
} while (local->scan.chan_idx < (*mode)->num_channels);
|
||||
*chan = NULL;
|
||||
}
|
||||
|
||||
|
||||
static void next_chan_same_mode(struct ieee80211_local *local,
|
||||
struct ieee80211_hw_modes **mode,
|
||||
struct ieee80211_channel **chan)
|
||||
{
|
||||
int m, prev;
|
||||
|
||||
for (m = 0; m < local->hw->num_modes; m++) {
|
||||
*mode = &local->hw->modes[m];
|
||||
if ((*mode)->mode == local->conf.phymode)
|
||||
break;
|
||||
}
|
||||
local->scan.mode_idx = m;
|
||||
|
||||
/* Select next channel - scan only channels marked with W_SCAN flag */
|
||||
prev = local->scan.chan_idx;
|
||||
do {
|
||||
local->scan.chan_idx++;
|
||||
if (local->scan.chan_idx >= (*mode)->num_channels)
|
||||
local->scan.chan_idx = 0;
|
||||
*chan = &(*mode)->channels[local->scan.chan_idx];
|
||||
if ((*chan)->flag & IEEE80211_CHAN_W_SCAN)
|
||||
break;
|
||||
} while (local->scan.chan_idx != prev);
|
||||
}
|
||||
|
||||
|
||||
static void next_chan_all_modes(struct ieee80211_local *local,
|
||||
struct ieee80211_hw_modes **mode,
|
||||
struct ieee80211_channel **chan)
|
||||
{
|
||||
int prev, prev_m;
|
||||
|
||||
if (local->scan.mode_idx >= local->hw->num_modes) {
|
||||
local->scan.mode_idx = 0;
|
||||
local->scan.chan_idx = 0;
|
||||
}
|
||||
|
||||
/* Select next channel - scan only channels marked with W_SCAN flag */
|
||||
prev = local->scan.chan_idx;
|
||||
prev_m = local->scan.mode_idx;
|
||||
do {
|
||||
*mode = &local->hw->modes[local->scan.mode_idx];
|
||||
local->scan.chan_idx++;
|
||||
if (local->scan.chan_idx >= (*mode)->num_channels) {
|
||||
local->scan.chan_idx = 0;
|
||||
local->scan.mode_idx++;
|
||||
if (local->scan.mode_idx >= local->hw->num_modes)
|
||||
local->scan.mode_idx = 0;
|
||||
*mode = &local->hw->modes[local->scan.mode_idx];
|
||||
}
|
||||
*chan = &(*mode)->channels[local->scan.chan_idx];
|
||||
if ((*chan)->flag & IEEE80211_CHAN_W_SCAN)
|
||||
break;
|
||||
} while (local->scan.chan_idx != prev ||
|
||||
local->scan.mode_idx != prev_m);
|
||||
}
|
||||
|
||||
|
||||
static void ieee80211_scan_start(struct net_device *dev,
|
||||
struct ieee80211_scan_conf *conf)
|
||||
{
|
||||
struct ieee80211_local *local = dev->priv;
|
||||
int old_mode_idx = local->scan.mode_idx;
|
||||
int old_chan_idx = local->scan.chan_idx;
|
||||
struct ieee80211_hw_modes *mode = NULL;
|
||||
struct ieee80211_channel *chan = NULL;
|
||||
int ret;
|
||||
|
||||
if (local->hw->passive_scan == 0) {
|
||||
printk(KERN_DEBUG "%s: Scan handler called, yet the hardware "
|
||||
"does not support passive scanning. Disabled.\n",
|
||||
dev->name);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((local->scan.tries < MAX_SCAN_WAIT &&
|
||||
local->scan.txrx_count > SCAN_TXRX_THRESHOLD)) {
|
||||
local->scan.tries++;
|
||||
/* Count TX/RX packets during one second interval and allow
|
||||
* scan to start only if the number of packets is below the
|
||||
* threshold. */
|
||||
local->scan.txrx_count = 0;
|
||||
local->scan.timer.expires = jiffies + HZ;
|
||||
add_timer(&local->scan.timer);
|
||||
return;
|
||||
}
|
||||
|
||||
if (local->scan.skb == NULL) {
|
||||
printk(KERN_DEBUG "%s: Scan start called even though scan.skb "
|
||||
"is not set\n", dev->name);
|
||||
}
|
||||
|
||||
if (local->scan.our_mode_only) {
|
||||
if (local->scan.channel > 0) {
|
||||
get_channel_params(local, local->scan.channel, &mode,
|
||||
&chan);
|
||||
} else
|
||||
next_chan_same_mode(local, &mode, &chan);
|
||||
}
|
||||
else
|
||||
next_chan_all_modes(local, &mode, &chan);
|
||||
|
||||
conf->scan_channel = chan->chan;
|
||||
conf->scan_freq = chan->freq;
|
||||
conf->scan_channel_val = chan->val;
|
||||
conf->scan_phymode = mode->mode;
|
||||
conf->scan_power_level = chan->power_level;
|
||||
conf->scan_antenna_max = chan->antenna_max;
|
||||
conf->scan_time = 2 * local->hw->channel_change_time +
|
||||
local->scan.time; /* 10ms scan time+hardware changes */
|
||||
conf->skb = local->scan.skb ?
|
||||
skb_clone(local->scan.skb, GFP_ATOMIC) : NULL;
|
||||
conf->tx_control = &local->scan.tx_control;
|
||||
#if 0
|
||||
printk(KERN_DEBUG "%s: Doing scan on mode: %d freq: %d chan: %d "
|
||||
"for %d ms\n",
|
||||
dev->name, conf->scan_phymode, conf->scan_freq,
|
||||
conf->scan_channel, conf->scan_time);
|
||||
#endif
|
||||
local->scan.rx_packets = 0;
|
||||
local->scan.rx_beacon = 0;
|
||||
local->scan.freq = chan->freq;
|
||||
local->scan.in_scan = 1;
|
||||
|
||||
ieee80211_netif_oper(dev, NETIF_STOP);
|
||||
|
||||
ret = local->hw->passive_scan(dev, IEEE80211_SCAN_START, conf);
|
||||
|
||||
if (ret == 0) {
|
||||
long usec = local->hw->channel_change_time +
|
||||
local->scan.time;
|
||||
usec += 1000000L / HZ - 1;
|
||||
usec /= 1000000L / HZ;
|
||||
local->scan.timer.expires = jiffies + usec;
|
||||
} else {
|
||||
local->scan.in_scan = 0;
|
||||
if (conf->skb)
|
||||
dev_kfree_skb(conf->skb);
|
||||
ieee80211_netif_oper(dev, NETIF_WAKE);
|
||||
if (ret == -EAGAIN) {
|
||||
local->scan.timer.expires = jiffies +
|
||||
(local->scan.interval * HZ / 100);
|
||||
local->scan.mode_idx = old_mode_idx;
|
||||
local->scan.chan_idx = old_chan_idx;
|
||||
} else {
|
||||
printk(KERN_DEBUG "%s: Got unknown error from "
|
||||
"passive_scan %d\n", dev->name, ret);
|
||||
local->scan.timer.expires = jiffies +
|
||||
(local->scan.interval * HZ);
|
||||
}
|
||||
local->scan.in_scan = 0;
|
||||
}
|
||||
|
||||
add_timer(&local->scan.timer);
|
||||
}
|
||||
|
||||
|
||||
static void ieee80211_scan_stop(struct net_device *dev,
|
||||
struct ieee80211_scan_conf *conf)
|
||||
{
|
||||
struct ieee80211_local *local = dev->priv;
|
||||
struct ieee80211_hw_modes *mode;
|
||||
struct ieee80211_channel *chan;
|
||||
int wait;
|
||||
|
||||
if (local->hw->passive_scan == NULL)
|
||||
return;
|
||||
|
||||
if (local->scan.mode_idx >= local->hw->num_modes) {
|
||||
local->scan.mode_idx = 0;
|
||||
local->scan.chan_idx = 0;
|
||||
}
|
||||
|
||||
mode = &local->hw->modes[local->scan.mode_idx];
|
||||
|
||||
if (local->scan.chan_idx >= mode->num_channels) {
|
||||
local->scan.chan_idx = 0;
|
||||
}
|
||||
|
||||
chan = &mode->channels[local->scan.chan_idx];
|
||||
|
||||
local->hw->passive_scan(dev, IEEE80211_SCAN_END, conf);
|
||||
|
||||
#ifdef CONFIG_IEEE80211_VERBOSE_DEBUG
|
||||
printk(KERN_DEBUG "%s: Did scan on mode: %d freq: %d chan: %d "
|
||||
"GOT: %d Beacon: %d (%d)\n",
|
||||
dev->name,
|
||||
mode->mode, chan->freq, chan->chan,
|
||||
local->scan.rx_packets, local->scan.rx_beacon,
|
||||
local->scan.tries);
|
||||
#endif /* CONFIG_IEEE80211_VERBOSE_DEBUG */
|
||||
local->scan.num_scans++;
|
||||
|
||||
local->scan.in_scan = 0;
|
||||
ieee80211_netif_oper(dev, NETIF_WAKE);
|
||||
|
||||
local->scan.tries = 0;
|
||||
/* Use random interval of scan.interval .. 2 * scan.interval */
|
||||
wait = (local->scan.interval * HZ * ((net_random() & 127) + 128)) /
|
||||
128;
|
||||
local->scan.timer.expires = jiffies + wait;
|
||||
|
||||
add_timer(&local->scan.timer);
|
||||
}
|
||||
|
||||
|
||||
static void ieee80211_scan_handler(unsigned long uldev)
|
||||
{
|
||||
struct net_device *dev = (struct net_device *) uldev;
|
||||
struct ieee80211_local *local = dev->priv;
|
||||
struct ieee80211_scan_conf conf;
|
||||
|
||||
if (local->scan.interval == 0 && !local->scan.in_scan) {
|
||||
/* Passive scanning is disabled - keep the timer always
|
||||
* running to make code cleaner. */
|
||||
local->scan.timer.expires = jiffies + 10 * HZ;
|
||||
add_timer(&local->scan.timer);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&conf, 0, sizeof(struct ieee80211_scan_conf));
|
||||
conf.running_freq = local->conf.freq;
|
||||
conf.running_channel = local->conf.channel;
|
||||
conf.running_phymode = local->conf.phymode;
|
||||
conf.running_channel_val = local->conf.channel_val;
|
||||
conf.running_power_level = local->conf.power_level;
|
||||
conf.running_antenna_max = local->conf.antenna_max;
|
||||
|
||||
if (local->scan.in_scan == 0)
|
||||
ieee80211_scan_start(dev, &conf);
|
||||
else
|
||||
ieee80211_scan_stop(dev, &conf);
|
||||
}
|
||||
|
||||
|
||||
void ieee80211_init_scan(struct net_device *dev)
|
||||
{
|
||||
struct ieee80211_local *local = dev->priv;
|
||||
struct ieee80211_hdr hdr;
|
||||
u16 fc;
|
||||
int len = 10;
|
||||
struct rate_control_extra extra;
|
||||
|
||||
/* Only initialize passive scanning if the hardware supports it */
|
||||
if (!local->hw->passive_scan) {
|
||||
local->scan.skb = NULL;
|
||||
memset(&local->scan.tx_control, 0,
|
||||
sizeof(local->scan.tx_control));
|
||||
printk(KERN_DEBUG "%s: Does not support passive scan, "
|
||||
"disabled\n", dev->name);
|
||||
return;
|
||||
}
|
||||
|
||||
local->scan.interval = 0;
|
||||
local->scan.our_mode_only = 1;
|
||||
local->scan.time = 10000;
|
||||
local->scan.timer.function = ieee80211_scan_handler;
|
||||
local->scan.timer.data = (unsigned long) dev;
|
||||
local->scan.timer.expires = jiffies + local->scan.interval * HZ;
|
||||
add_timer(&local->scan.timer);
|
||||
|
||||
/* Create a CTS from for broadcasting before
|
||||
* the low level changes channels */
|
||||
local->scan.skb = alloc_skb(len, GFP_KERNEL);
|
||||
if (local->scan.skb == NULL) {
|
||||
printk(KERN_WARNING "%s: Failed to allocate CTS packet for "
|
||||
"passive scan\n", dev->name);
|
||||
return;
|
||||
}
|
||||
|
||||
fc = (WLAN_FC_TYPE_CTRL << 2) | (WLAN_FC_STYPE_CTS << 4);
|
||||
hdr.frame_control = cpu_to_le16(fc);
|
||||
hdr.duration_id =
|
||||
cpu_to_le16(2 * local->hw->channel_change_time +
|
||||
local->scan.time);
|
||||
memcpy(hdr.addr1, dev->dev_addr, ETH_ALEN); /* DA */
|
||||
hdr.seq_ctrl = 0;
|
||||
|
||||
memcpy(skb_put(local->scan.skb, len), &hdr, len);
|
||||
|
||||
memset(&local->scan.tx_control, 0, sizeof(local->scan.tx_control));
|
||||
local->scan.tx_control.key_idx = HW_KEY_IDX_INVALID;
|
||||
local->scan.tx_control.do_not_encrypt = 1;
|
||||
memset(&extra, 0, sizeof(extra));
|
||||
extra.endidx = local->num_curr_rates;
|
||||
local->scan.tx_control.tx_rate =
|
||||
rate_control_get_rate(dev, local->scan.skb, &extra)->val;
|
||||
local->scan.tx_control.no_ack = 1;
|
||||
}
|
||||
|
||||
|
||||
void ieee80211_stop_scan(struct net_device *dev)
|
||||
{
|
||||
struct ieee80211_local *local = dev->priv;
|
||||
|
||||
if (local->hw->passive_scan != 0) {
|
||||
del_timer_sync(&local->scan.timer);
|
||||
dev_kfree_skb(local->scan.skb);
|
||||
local->scan.skb = NULL;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,872 +0,0 @@
|
||||
/*
|
||||
* Low-level hardware driver -- IEEE 802.11 driver (80211.o) interface
|
||||
* Copyright 2002-2005, Devicescape Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef IEEE80211_H
|
||||
#define IEEE80211_H
|
||||
|
||||
#include "ieee80211_shared.h"
|
||||
|
||||
/* Note! Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsave() can be
|
||||
* called in hardware interrupt context. The low-level driver must not call any
|
||||
* other functions in hardware interrupt context. If there is a need for such
|
||||
* call, the low-level driver should first ACK the interrupt and perform the
|
||||
* IEEE 802.11 code call after this, e.g., from a scheduled tasklet (in
|
||||
* software interrupt context).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Frame format used when passing frame between low-level hardware drivers
|
||||
* and IEEE 802.11 driver the same as used in the wireless media, i.e.,
|
||||
* buffers start with IEEE 802.11 header and include the same octets that
|
||||
* are sent over air.
|
||||
*
|
||||
* If hardware uses IEEE 802.3 headers (and perform 802.3 <-> 802.11
|
||||
* conversion in firmware), upper layer 802.11 code needs to be changed to
|
||||
* support this.
|
||||
*
|
||||
* If the receive frame format is not the same as the real frame sent
|
||||
* on the wireless media (e.g., due to padding etc.), upper layer 802.11 code
|
||||
* could be updated to provide support for such format assuming this would
|
||||
* optimize the performance, e.g., by removing need to re-allocation and
|
||||
* copying of the data.
|
||||
*/
|
||||
|
||||
/* Interface version (used for compatibility verification) */
|
||||
#define IEEE80211_VERSION 2
|
||||
|
||||
|
||||
/* Channel information structure. Low-level driver is expected to fill in chan,
|
||||
* freq, and val fields. Other fields will be filled in by 80211.o based on
|
||||
* hostapd information and low-level driver does not need to use them. The
|
||||
* limits for each channel will be provided in 'struct ieee80211_conf' when
|
||||
* configuring the low-level driver with hw->config callback. */
|
||||
struct ieee80211_channel {
|
||||
short chan; /* channel number (IEEE 802.11) */
|
||||
short freq; /* frequency in MHz */
|
||||
int val; /* hw specific value for the channel */
|
||||
int flag; /* flag for hostapd use (IEEE80211_CHAN_*) */
|
||||
unsigned char power_level;
|
||||
unsigned char antenna_max;
|
||||
};
|
||||
|
||||
struct ieee80211_rate {
|
||||
int rate; /* rate in 100 kbps */
|
||||
int val; /* hw specific value for the rate */
|
||||
int flags; /* IEEE80211_RATE_ flags */
|
||||
int val2; /* hw specific value for the rate when using short preamble
|
||||
* (only when IEEE80211_RATE_PREAMBLE2 flag is set, i.e., for
|
||||
* 2, 5.5, and 11 Mbps) */
|
||||
signed char min_rssi_ack;
|
||||
unsigned char min_rssi_ack_delta;
|
||||
|
||||
/* following fields are set by 80211.o and need not be filled by the
|
||||
* low-level driver */
|
||||
int rate_inv; /* inverse of the rate (LCM(all rates) / rate) for
|
||||
* optimizing channel utilization estimates */
|
||||
};
|
||||
|
||||
struct ieee80211_hw_modes {
|
||||
int mode;
|
||||
int num_channels;
|
||||
struct ieee80211_channel *channels;
|
||||
int num_rates;
|
||||
struct ieee80211_rate *rates;
|
||||
int xr_end; /* only used with Atheros XR */
|
||||
};
|
||||
|
||||
struct ieee80211_tx_queue_params {
|
||||
int aifs; /* 0 .. 255; -1 = use default */
|
||||
int cw_min; /* 2^n-1: 1, 3, 7, .. , 1023; 0 = use default */
|
||||
int cw_max; /* 2^n-1: 1, 3, 7, .. , 1023; 0 = use default */
|
||||
int burst_time; /* maximum burst time in 0.1 ms (i.e., 10 = 1 ms);
|
||||
* 0 = disabled */
|
||||
};
|
||||
|
||||
#define NUM_TX_DATA_QUEUES 6
|
||||
|
||||
struct ieee80211_tx_queue_stats_data {
|
||||
unsigned int len; /* num packets in queue */
|
||||
unsigned int limit; /* queue len (soft) limit */
|
||||
unsigned int count; /* total num frames sent */
|
||||
};
|
||||
|
||||
struct ieee80211_tx_queue_stats {
|
||||
struct ieee80211_tx_queue_stats_data data[NUM_TX_DATA_QUEUES];
|
||||
};
|
||||
|
||||
#ifndef IEEE80211_TX_QUEUE_NUMS
|
||||
#define IEEE80211_TX_QUEUE_NUMS
|
||||
/* TODO: these need to be synchronized with hostapd_ioctl.h; make a shared
|
||||
* header file that can be included into low-level drivers, 80211.o, and
|
||||
* hostapd */
|
||||
enum {
|
||||
IEEE80211_TX_QUEUE_DATA0 = 0,
|
||||
IEEE80211_TX_QUEUE_DATA1 = 1,
|
||||
IEEE80211_TX_QUEUE_DATA2 = 2,
|
||||
IEEE80211_TX_QUEUE_DATA3 = 3,
|
||||
IEEE80211_TX_QUEUE_DATA4 = 4,
|
||||
IEEE80211_TX_QUEUE_SVP = 5,
|
||||
IEEE80211_TX_QUEUE_AFTER_BEACON = 6,
|
||||
IEEE80211_TX_QUEUE_BEACON = 7
|
||||
};
|
||||
#endif /* IEEE80211_TX_QUEUE_NUMS */
|
||||
|
||||
|
||||
struct ieee80211_low_level_stats {
|
||||
unsigned int dot11ACKFailureCount;
|
||||
unsigned int dot11RTSFailureCount;
|
||||
unsigned int dot11FCSErrorCount;
|
||||
unsigned int dot11RTSSuccessCount;
|
||||
};
|
||||
|
||||
/* Transmit control fields. This data structure is passed to low-level driver
|
||||
* with each TX frame. The low-level driver is responsible of configuring
|
||||
* hardware to use given values (depending on what is supported). */
|
||||
#define HW_KEY_IDX_INVALID -1
|
||||
|
||||
struct ieee80211_tx_control {
|
||||
enum { PKT_NORMAL = 0, PKT_PROBE_RESP } pkt_type;
|
||||
int tx_rate; /* Transmit rate, given as the hw specific value for the
|
||||
* rate (from struct ieee80211_rate) */
|
||||
int rts_cts_rate; /* Transmit rate for RTS/CTS frame, given as the hw
|
||||
* specific value for the rate (from
|
||||
* struct ieee80211_rate) */
|
||||
/* 1 = only first attempt, 2 = one retry, .. */
|
||||
unsigned int retry_limit:8;
|
||||
/* duration field for RTS/CTS frame */
|
||||
unsigned int rts_cts_duration:16;
|
||||
/* TODO: change these bit flags to use one unsigned int variable and
|
||||
* defines with BIT(n). These are copied to TX status structure and
|
||||
* this will make the code faster and smaller. */
|
||||
unsigned int req_tx_status:1; /* request TX status callback for this
|
||||
* frame */
|
||||
unsigned int do_not_encrypt:1; /* send this frame without encryption;
|
||||
* e.g., for EAPOL frames */
|
||||
unsigned int use_rts_cts:1; /* Use RTS-CTS before sending frame. */
|
||||
unsigned int use_cts_protect:1; /* Use CTS protection for the frame
|
||||
* (e.g., for combined 802.11g /
|
||||
* 802.11b networks) */
|
||||
unsigned int no_ack:1; /* Tell the low level not to wait for an ack */
|
||||
unsigned int rate_ctrl_probe:1;
|
||||
unsigned int clear_dst_mask:1;
|
||||
unsigned int requeue:1;
|
||||
/* following three flags are only used with Atheros Super A/G */
|
||||
unsigned int compress:1;
|
||||
unsigned int turbo_prime_notify:1; /* notify HostaAPd after frame
|
||||
* transmission */
|
||||
unsigned int fast_frame:1;
|
||||
|
||||
unsigned int atheros_xr:1; /* only used with Atheros XR */
|
||||
|
||||
unsigned int power_level:8; /* per-packet transmit power level, in dBm
|
||||
*/
|
||||
unsigned int antenna_sel:4; /* 0 = default/diversity,
|
||||
* 1 = Ant0, 2 = Ant1 */
|
||||
int key_idx:8; /* -1 = do not encrypt, >= 0 keyidx from hw->set_key()
|
||||
*/
|
||||
int icv_len:8; /* Length of the ICV/MIC field in octets */
|
||||
int iv_len:8; /* Length of the IV field in octets */
|
||||
unsigned int queue:4; /* hardware queue to use for this frame;
|
||||
* 0 = highest, hw->queues-1 = lowest */
|
||||
unsigned int sw_retry_attempt:4; /* no. of times hw has tried to
|
||||
* transmit frame (not incl. hw retries) */
|
||||
|
||||
#if 0
|
||||
int rateidx; /* internal 80211.o rateidx, to be copied to tx_status */
|
||||
int alt_retry_rate; /* retry rate for the last retries, given as the
|
||||
* hw specific value for the rate (from
|
||||
* struct ieee80211_rate). To be used to limit
|
||||
* packet dropping when probing higher rates, if hw
|
||||
* supports multiple retry rates. -1 = not used */
|
||||
#endif
|
||||
};
|
||||
|
||||
#define IEEE80211_CB_MAGIC 0xAAB80211
|
||||
|
||||
struct ieee80211_tx_packet_data {
|
||||
unsigned int magic;
|
||||
struct ieee80211_tx_control control;
|
||||
unsigned long jiffies;
|
||||
struct ieee80211_sub_if_data *sdata;
|
||||
};
|
||||
|
||||
#define RX_FLAG_MMIC_ERROR 0x1
|
||||
#define RX_FLAG_DECRYPTED 0x2
|
||||
#define RX_FLAG_XR_DOUBLE_CHIRP 0x4
|
||||
|
||||
/* Receive status. The low-level driver should provide this information
|
||||
* (the subset supported by hardware) to the 802.11 code with each received
|
||||
* frame.
|
||||
* Current implementation copies this into skb->cb, so it must be less than
|
||||
* 48 bytes. */
|
||||
struct ieee80211_rx_status {
|
||||
#if 0
|
||||
u64 hosttime;
|
||||
u64 mactime;
|
||||
#endif
|
||||
int freq; /* receive frequency in Mhz */
|
||||
int channel;
|
||||
int phymode;
|
||||
int ssi;
|
||||
int antenna;
|
||||
int rate;
|
||||
int flag;
|
||||
};
|
||||
|
||||
/* Transmit status. The low-level driver should provide this information
|
||||
* (the subset supported by hardware) to the 802.11 code for each transmit
|
||||
* frame. */
|
||||
struct ieee80211_tx_status {
|
||||
/* flags copied from struct ieee80211_tx_control) */
|
||||
unsigned int req_tx_status:1; /* whether TX status was explicitly
|
||||
* requested */
|
||||
unsigned int rate_ctrl_probe:1; /* whether this was a probe packet from
|
||||
* rate control */
|
||||
unsigned int tx_filtered:1;
|
||||
|
||||
/* following three fields are only used with Atheros Super A/G */
|
||||
unsigned int turbo_prime_notify:1; /* notify HostAPd - CTS for Turbo
|
||||
* Prime is sent */
|
||||
int queue_length; /* information about TX queue */
|
||||
int queue_number;
|
||||
|
||||
int ack; /* whether the TX frame was ACKed */
|
||||
int ack_signal; /* measured signal strength of the ACK frame */
|
||||
int excessive_retries;
|
||||
int retry_count;
|
||||
int rateidx; /* internal 80211.o rateidx, to be copied to tx_status */
|
||||
};
|
||||
|
||||
|
||||
struct ieee80211_conf {
|
||||
int channel; /* IEEE 802.11 channel number */
|
||||
int freq; /* MHz */
|
||||
int channel_val; /* hw specific value for the channel */
|
||||
|
||||
int mode; /* IW_MODE_ */
|
||||
|
||||
int phymode; /* MODE_IEEE80211A, .. */
|
||||
unsigned int regulatory_domain;
|
||||
int adm_status;
|
||||
|
||||
int beacon_int;
|
||||
|
||||
/* Bitfields, grouped together */
|
||||
|
||||
int sw_encrypt:1;
|
||||
int sw_decrypt:1;
|
||||
int short_slot_time:1; /* use IEEE 802.11g Short Slot Time */
|
||||
int ssid_hidden:1; /* do not broadcast the ssid */
|
||||
|
||||
/* these fields are used by low level drivers for hardware
|
||||
* that generate beacons independently */
|
||||
u8 *ssid;
|
||||
size_t ssid_len;
|
||||
u8 *generic_elem;
|
||||
size_t generic_elem_len;
|
||||
|
||||
u8 power_level; /* transmit power limit for current
|
||||
* regulatory domain; in dBm */
|
||||
u8 antenna_max; /* maximum antenna gain */
|
||||
short tx_power_reduction; /* in 0.1 dBm */
|
||||
|
||||
int antenna_sel; /* default antenna conf:
|
||||
* 0 = default/diversity,
|
||||
* 1 = Ant0,
|
||||
* 2 = Ant1 */
|
||||
|
||||
int calib_int; /* hw/radio calibration interval in
|
||||
* seconds */
|
||||
int antenna_def;
|
||||
int antenna_mode;
|
||||
|
||||
u8 bssid_mask[ETH_ALEN]; /* ff:ff:ff:ff:ff:ff = 1 BSSID */
|
||||
int bss_count;
|
||||
|
||||
int atheros_super_ag_compression;
|
||||
int atheros_super_ag_fast_frame;
|
||||
int atheros_super_ag_burst;
|
||||
int atheros_super_ag_wme_ele;
|
||||
int atheros_super_ag_turbo_g;
|
||||
int atheros_super_ag_turbo_prime;
|
||||
|
||||
int atheros_xr;
|
||||
|
||||
u8 client_bssid[ETH_ALEN];
|
||||
|
||||
/* Following five fields are used for IEEE 802.11H */
|
||||
unsigned int radar_detect;
|
||||
unsigned int spect_mgmt;
|
||||
unsigned int quiet_duration; /* duration of quiet period */
|
||||
unsigned int quiet_offset; /* how far into the beacon is the quiet
|
||||
* period */
|
||||
unsigned int quiet_period;
|
||||
};
|
||||
|
||||
|
||||
typedef enum { ALG_NONE, ALG_WEP, ALG_TKIP, ALG_CCMP, ALG_NULL }
|
||||
ieee80211_key_alg;
|
||||
|
||||
|
||||
struct ieee80211_key_conf {
|
||||
|
||||
int hw_key_idx; /* filled + used by low-level driver */
|
||||
ieee80211_key_alg alg;
|
||||
int keylen;
|
||||
|
||||
int force_sw_encrypt:1; /* to be cleared by low-level driver */
|
||||
int keyidx:8; /* WEP key index */
|
||||
int default_tx_key:1; /* This key is the new default TX key
|
||||
* (used only for broadcast keys). */
|
||||
int default_wep_only:1; /* static WEP is the only configured security
|
||||
* policy; this allows some low-level drivers
|
||||
* to determine when hwaccel can be used */
|
||||
u8 key[0];
|
||||
};
|
||||
|
||||
#define IEEE80211_SCAN_START 1
|
||||
#define IEEE80211_SCAN_END 2
|
||||
|
||||
struct ieee80211_scan_conf {
|
||||
int scan_channel; /* IEEE 802.11 channel number to do passive scan
|
||||
* on */
|
||||
int scan_freq; /* new freq in MHz to switch to for passive scan
|
||||
*/
|
||||
int scan_channel_val; /* hw specific value for the channel */
|
||||
int scan_phymode; /* MODE_IEEE80211A, .. */
|
||||
unsigned char scan_power_level;
|
||||
unsigned char scan_antenna_max;
|
||||
|
||||
|
||||
int running_channel; /* IEEE 802.11 channel number we operate on
|
||||
* normally */
|
||||
int running_freq; /* freq in MHz we're operating on normally */
|
||||
int running_channel_val; /* hw specific value for the channel */
|
||||
int running_phymode;
|
||||
unsigned char running_power_level;
|
||||
unsigned char running_antenna_max;
|
||||
|
||||
int scan_time; /* time a scan will take in us */
|
||||
int tries;
|
||||
|
||||
struct sk_buff *skb; /* skb to transmit before changing channels, maybe
|
||||
* NULL for none */
|
||||
struct ieee80211_tx_control *tx_control;
|
||||
|
||||
};
|
||||
|
||||
#ifndef IW_MODE_ADHOC
|
||||
#define IW_MODE_ADHOC 1
|
||||
#endif
|
||||
|
||||
#ifndef IW_MODE_INFRA
|
||||
#define IW_MODE_INFRA 2
|
||||
#endif
|
||||
|
||||
#ifndef IW_MODE_MASTER
|
||||
#define IW_MODE_MASTER 3
|
||||
#endif
|
||||
|
||||
#ifndef IW_MODE_MONITOR
|
||||
#define IW_MODE_MONITOR 6
|
||||
#endif
|
||||
|
||||
#define IEEE80211_SEQ_COUNTER_RX 0
|
||||
#define IEEE80211_SEQ_COUNTER_TX 1
|
||||
|
||||
typedef enum {
|
||||
SET_KEY, DISABLE_KEY, REMOVE_ALL_KEYS,
|
||||
ENABLE_COMPRESSION, DISABLE_COMPRESSION
|
||||
} set_key_cmd;
|
||||
|
||||
/* Configuration block used by the low-level driver to tell 802.11 code about
|
||||
* supported hardware features and to pass function pointers for callback
|
||||
* functions. */
|
||||
struct ieee80211_hw {
|
||||
int version; /* IEEE80211_VERSION */
|
||||
|
||||
/* Driver name */
|
||||
char *name;
|
||||
|
||||
/* TODO: frame_type 802.11/802.3, sw_encryption requirements */
|
||||
|
||||
/* Some wireless LAN chipsets generate beacons in the hardware/firmware
|
||||
* and others rely on host generated beacons. This option is used to
|
||||
* configure upper layer IEEE 802.11 module to generate beacons. The
|
||||
* low-level driver can use ieee80211_beacon_get() to fetch next
|
||||
* beacon frame. */
|
||||
int host_gen_beacon:1;
|
||||
|
||||
|
||||
/* Some devices handle decryption internally and do not
|
||||
* indicate whether the frame was encrypted (unencrypted frames
|
||||
* will be dropped by the hardware, unless specifically allowed
|
||||
* through) */
|
||||
int device_hides_wep:1;
|
||||
|
||||
/* Whether RX frames passed to ieee80211_rx() include FCS in the end
|
||||
*/
|
||||
int rx_includes_fcs:1;
|
||||
|
||||
/* Some wireless LAN chipsets buffer broadcast/multicast frames for
|
||||
* power saving stations in the hardware/firmware and others rely on
|
||||
* the host system for such buffering. This option is used to
|
||||
* configure upper layer IEEE 802.11 to buffer broadcast/multicast
|
||||
* frames when there are power saving stations so that low-level driver
|
||||
* can fetch them with ieee80211_get_buffered_bc(). */
|
||||
int host_broadcast_ps_buffering:1;
|
||||
|
||||
int wep_include_iv:1;
|
||||
int data_nullfunc_ack:1; /* will data nullfunc frames get proper
|
||||
* TX status callback */
|
||||
|
||||
/* Force sw version of encryption for TKIP packets if WMM is enabled.
|
||||
*/
|
||||
int no_tkip_wmm_hwaccel:1;
|
||||
|
||||
/* 1 if the payload needs to be padded at even boundaries after the
|
||||
* header */
|
||||
unsigned int extra_hdr_room:1;
|
||||
|
||||
/* Some devices handle Michael MIC internally and do not include MIC in
|
||||
* the received packets given to 80211.o. device_strips_mic must be set
|
||||
* for such devices. ISWEP bit is still expected to be set in the IEEE
|
||||
* 802.11 header with this option unlike with device_hides_wep option.
|
||||
*/
|
||||
unsigned int device_strips_mic:1;
|
||||
|
||||
/* 1 = low-level driver supports skb fraglist (NETIF_F_FRAGLIST), i.e.,
|
||||
* more than one skb per frame */
|
||||
unsigned int fraglist;
|
||||
|
||||
/* This is the time in us to change channels
|
||||
*/
|
||||
int channel_change_time;
|
||||
|
||||
int num_modes;
|
||||
struct ieee80211_hw_modes *modes;
|
||||
|
||||
/* Handler that 802.11 module calls for each transmitted frame.
|
||||
* skb contains the buffer starting from the IEEE 802.11 header.
|
||||
* The low-level driver should send the frame out based on
|
||||
* configuration in the TX control data. */
|
||||
int (*tx)(struct net_device *dev, struct sk_buff *skb,
|
||||
struct ieee80211_tx_control *control);
|
||||
|
||||
/* Handler for performing hardware reset. */
|
||||
int (*reset)(struct net_device *dev);
|
||||
|
||||
/* Handler that is called when any netdevice attached to the hardware
|
||||
* device is set UP for the first time. This can be used, e.g., to
|
||||
* enable interrupts and beacon sending. */
|
||||
int (*open)(struct net_device *dev);
|
||||
|
||||
/* Handler that is called when the last netdevice attached to the
|
||||
* hardware device is set DOWN. This can be used, e.g., to disable
|
||||
* interrupts and beacon sending. */
|
||||
int (*stop)(struct net_device *dev);
|
||||
|
||||
/* Handler for configuration requests. IEEE 802.11 code calls this
|
||||
* function to change hardware configuration, e.g., channel. */
|
||||
int (*config)(struct net_device *dev, struct ieee80211_conf *conf);
|
||||
|
||||
/* Set TIM bit handler. If the hardware/firmware takes care of beacon
|
||||
* generation, IEEE 802.11 code uses this function to tell the
|
||||
* low-level to set (or clear if set==0) TIM bit for the given aid. If
|
||||
* host system is used to generate beacons, this handler is not used
|
||||
* and low-level driver should set it to NULL. */
|
||||
int (*set_tim)(struct net_device *dev, int aid, int set);
|
||||
|
||||
/* Set encryption key. IEEE 802.11 module calls this function to set
|
||||
* encryption keys. addr is ff:ff:ff:ff:ff:ff for default keys and
|
||||
* station hwaddr for individual keys. aid of the station is given
|
||||
* to help low-level driver in selecting which key->hw_key_idx to use
|
||||
* for this key. TX control data will use the hw_key_idx selected by
|
||||
* the low-level driver. */
|
||||
int (*set_key)(struct net_device *dev, set_key_cmd cmd, u8 *addr,
|
||||
struct ieee80211_key_conf *key, int aid);
|
||||
|
||||
/* Set TX key index for default/broadcast keys. This is needed in cases
|
||||
* where wlan card is doing full WEP/TKIP encapsulation (wep_include_iv
|
||||
* is not set), in other cases, this function pointer can be set to
|
||||
* NULL since 80211.o takes care of selecting the key index for each
|
||||
* TX frame. */
|
||||
int (*set_key_idx)(struct net_device *dev, int idx);
|
||||
|
||||
/* Enable/disable IEEE 802.1X. This item requests wlan card to pass
|
||||
* unencrypted EAPOL-Key frames even when encryption is configured.
|
||||
* If the wlan card does not require such a configuration, this
|
||||
* function pointer can be set to NULL. 80211.o */
|
||||
int (*set_ieee8021x)(struct net_device *dev, int use_ieee8021x);
|
||||
|
||||
/* Set port authorization state (IEEE 802.1X PAE) to be authorized
|
||||
* (authorized=1) or unauthorized (authorized=0). This function can be
|
||||
* used if the wlan hardware or low-level driver implements PAE.
|
||||
* 80211.o module will anyway filter frames based on authorization
|
||||
* state, so this function pointer can be NULL if low-level driver does
|
||||
* not require event notification about port state changes. */
|
||||
int (*set_port_auth)(struct net_device *dev, u8 *addr, int authorized);
|
||||
|
||||
/* Ask the hardware to do a passive scan on a new channel. The hardware
|
||||
* will do what ever is required to nicely leave the current channel
|
||||
* including transmit any CTS packets, etc. */
|
||||
int (*passive_scan)(struct net_device *dev, int state,
|
||||
struct ieee80211_scan_conf *conf);
|
||||
|
||||
/* return low-level statistics */
|
||||
int (*get_stats)(struct net_device *dev,
|
||||
struct ieee80211_low_level_stats *stats);
|
||||
|
||||
/* Enable/disable test modes; mode = IEEE80211_TEST_* */
|
||||
int (*test_mode)(struct net_device *dev, int mode);
|
||||
|
||||
/* Configuration of test parameters */
|
||||
int (*test_param)(struct net_device *dev, int param, int value);
|
||||
|
||||
/* Change MAC address. addr is pointer to struct sockaddr. */
|
||||
int (*set_mac_address)(struct net_device *dev, void *addr);
|
||||
|
||||
/* For devices that generate their own beacons and probe response
|
||||
* or association responses this updates the state of privacy_invoked
|
||||
* returns 0 for success or an error number */
|
||||
|
||||
int (*set_privacy_invoked)(struct net_device *dev,
|
||||
int privacy_invoked);
|
||||
|
||||
/* For devices that have internal sequence counters, allow 802.11
|
||||
* code to access the current value of a counter */
|
||||
int (*get_sequence_counter)(struct net_device *dev,
|
||||
u8* addr, u8 keyidx, u8 txrx,
|
||||
u32* iv32, u16* iv16);
|
||||
|
||||
/* Configuration of RTS threshold (if device needs it) */
|
||||
int (*set_rts_threshold)(struct net_device *dev, u32 value);
|
||||
|
||||
/* Configuration of fragmentation threshold (if device needs it) */
|
||||
int (*set_frag_threshold)(struct net_device *dev, u32 value);
|
||||
|
||||
/* Configuration of retry limits (if device needs it) */
|
||||
int (*set_retry_limit)(struct net_device *dev, u32 short_retry,
|
||||
u32 long_retr);
|
||||
|
||||
/* Number of STAs in STA table notification (NULL = disabled) */
|
||||
void (*sta_table_notification)(struct net_device *dev, int num_sta);
|
||||
|
||||
/* Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
|
||||
* bursting) for a hardware TX queue.
|
||||
* queue = IEEE80211_TX_QUEUE_*. */
|
||||
int (*conf_tx)(struct net_device *dev, int queue,
|
||||
const struct ieee80211_tx_queue_params *params);
|
||||
|
||||
/* Get statistics of the current TX queue status. This is used to get
|
||||
* number of currently queued packets (queue length), maximum queue
|
||||
* size (limit), and total number of packets sent using each TX queue
|
||||
* (count). This information is used for WMM to find out which TX
|
||||
* queues have room for more packets and by hostapd to provide
|
||||
* statistics about the current queueing state to external programs. */
|
||||
int (*get_tx_stats)(struct net_device *dev,
|
||||
struct ieee80211_tx_queue_stats *stats);
|
||||
|
||||
/* Number of available hardware TX queues for data packets.
|
||||
* WMM requires at least four queues. */
|
||||
int queues;
|
||||
|
||||
/* Get the current TSF timer value from firmware/hardware. Currently,
|
||||
* this is only used for IBSS mode debugging and, as such, is not a
|
||||
* required function. */
|
||||
u64 (*get_tsf)(struct net_device *dev);
|
||||
|
||||
/* Reset the TSF timer and allow firmware/hardware to synchronize with
|
||||
* other STAs in the IBSS. This is only used in IBSS mode. This
|
||||
* function is optional if the firmware/hardware takes full care of
|
||||
* TSF synchronization. */
|
||||
void (*reset_tsf)(struct net_device *dev);
|
||||
|
||||
/* Setup beacon data for IBSS beacons. Unlike access point (Master),
|
||||
* IBSS uses a fixed beacon frame which is configured using this
|
||||
* function. This handler is required only for IBSS mode. */
|
||||
int (*beacon_update)(struct net_device *dev, struct sk_buff *skb,
|
||||
struct ieee80211_tx_control *control);
|
||||
|
||||
/* Determine whether the last IBSS beacon was sent by us. This is
|
||||
* needed only for IBSS mode and the result of this function is used to
|
||||
* determine whether to reply to Probe Requests. */
|
||||
int (*tx_last_beacon)(struct net_device *dev);
|
||||
|
||||
/* Optional handler for XR-in-use notification. */
|
||||
int (*atheros_xr_in_use)(struct net_device *dev, int in_use);
|
||||
};
|
||||
|
||||
/* Allocate a new hardware device. This must be called once for each
|
||||
* hardware device. The returned pointer must be used to refer to this
|
||||
* device when calling other functions. 802.11 code allocates a private data
|
||||
* area for the low-level driver. The size of this area is given as
|
||||
* priv_data_len. ieee80211_dev_hw_data() is used to get a pointer to the
|
||||
* private data area.
|
||||
*
|
||||
* Note: in this version of the interface the returned pointer is struct
|
||||
* net_device *. This may change in the future and low-level driver should
|
||||
* not refer the device data directly to remain compatible with the future
|
||||
* versions of the interface. */
|
||||
struct net_device *ieee80211_alloc_hw(size_t priv_data_len,
|
||||
void (*setup)(struct net_device *));
|
||||
|
||||
/* Register hardware device to the IEEE 802.11 code and kernel. Low-level
|
||||
* drivers must call this function before using any other IEEE 802.11
|
||||
* function. */
|
||||
int ieee80211_register_hw(struct net_device *dev, struct ieee80211_hw *hw);
|
||||
|
||||
/* This function is allowed to update hardware configuration (e.g., list of
|
||||
* supported operation modes and rates). */
|
||||
int ieee80211_update_hw(struct net_device *dev, struct ieee80211_hw *hw);
|
||||
|
||||
/* Unregister a hardware device. This function instructs 802.11 code to free
|
||||
* allocated resources and unregister netdevices from the kernel. */
|
||||
void ieee80211_unregister_hw(struct net_device *dev);
|
||||
|
||||
/* Free allocated net_device including private data of a driver. */
|
||||
void ieee80211_free_hw(struct net_device *dev);
|
||||
|
||||
/* Receive frame callback function. The low-level driver uses this function to
|
||||
* send received frames to the IEEE 802.11 code. Receive buffer (skb) must
|
||||
* start with IEEE 802.11 header. */
|
||||
void ieee80211_rx(struct net_device *dev, struct sk_buff *skb,
|
||||
struct ieee80211_rx_status *status);
|
||||
void ieee80211_rx_irqsafe(struct net_device *dev, struct sk_buff *skb,
|
||||
struct ieee80211_rx_status *status);
|
||||
|
||||
/* Transmit status callback function. The low-level driver must call this
|
||||
* function to report transmit status for all the TX frames that had
|
||||
* req_tx_status set in the transmit control fields. In addition, this should
|
||||
* be called at least for all unicast frames to provide information for TX rate
|
||||
* control algorithm. In order to maintain all statistics, this function is
|
||||
* recommended to be called after each frame, including multicast/broadcast, is
|
||||
* sent. */
|
||||
void ieee80211_tx_status(struct net_device *dev, struct sk_buff *skb,
|
||||
struct ieee80211_tx_status *status);
|
||||
void ieee80211_tx_status_irqsafe(struct net_device *dev, struct sk_buff *skb,
|
||||
struct ieee80211_tx_status *status);
|
||||
|
||||
/* Beacon generation function. If the beacon frames are generated by the host
|
||||
* system (i.e., not in hardware/firmware), the low-level driver uses this
|
||||
* function to receive the next beacon frame from the 802.11 code. The
|
||||
* low-level is responsible for calling this function before beacon data is
|
||||
* needed (e.g., based on hardware interrupt). Returned skb is used only once
|
||||
* and low-level driver is responsible of freeing it. */
|
||||
struct sk_buff * ieee80211_beacon_get(struct net_device *dev, int bss_idx,
|
||||
struct ieee80211_tx_control *control);
|
||||
|
||||
/* Function for accessing buffered broadcast and multicast frames. If
|
||||
* hardware/firmware does not implement buffering of broadcast/multicast
|
||||
* frames when power saving is used, 802.11 code buffers them in the host
|
||||
* memory. The low-level driver uses this function to fetch next buffered
|
||||
* frame. In most cases, this is used when generating beacon frame. This
|
||||
* function returns a pointer to the next buffered skb or NULL if no more
|
||||
* buffered frames are available.
|
||||
*
|
||||
* Note: buffered frames are returned only after DTIM beacon frame was
|
||||
* generated with ieee80211_beacon_get() and the low-level driver must thus
|
||||
* call ieee80211_beacon_get() first. ieee80211_get_buffered_bc() returns
|
||||
* NULL if the previous generated beacon was not DTIM, so the low-level driver
|
||||
* does not need to check for DTIM beacons separately and should be able to
|
||||
* use common code for all beacons. */
|
||||
struct sk_buff *
|
||||
ieee80211_get_buffered_bc(struct net_device *dev, int bss_idx,
|
||||
struct ieee80211_tx_control *control);
|
||||
|
||||
/* Low level drivers that have their own MLME and MAC indicate
|
||||
* the aid for an associating station with this call */
|
||||
int ieee80211_set_aid_for_sta(struct net_device *dev, u8 *peer_address,
|
||||
u16 aid);
|
||||
|
||||
|
||||
/* Given an sk_buff with a raw 802.11 header at the data pointer this function
|
||||
* returns the 802.11 header length in bytes (not including encryption
|
||||
* headers). If the data in the sk_buff is too short to contain a valid 802.11
|
||||
* header the function returns 0.
|
||||
*/
|
||||
int ieee80211_get_hdrlen_from_skb(struct sk_buff *skb);
|
||||
|
||||
/* Like ieee80211_get_hdrlen_from_skb() but takes a FC in CPU order. */
|
||||
int ieee80211_get_hdrlen(u16 fc);
|
||||
|
||||
/* Function for net interface operation. IEEE 802.11 may use multiple kernel
|
||||
* netdevices for each hardware device. The low-level driver does not "see"
|
||||
* these interfaces, so it should use this function to perform netif
|
||||
* operations on all interface. */
|
||||
typedef enum {
|
||||
NETIF_ATTACH, NETIF_DETACH, NETIF_START, NETIF_STOP, NETIF_WAKE,
|
||||
NETIF_IS_STOPPED, NETIF_UPDATE_TX_START
|
||||
} Netif_Oper;
|
||||
int ieee80211_netif_oper(struct net_device *dev, Netif_Oper op);
|
||||
|
||||
|
||||
/*
|
||||
* Function to get hardware configuration information
|
||||
* by the low level driver should it need it.
|
||||
*/
|
||||
struct ieee80211_conf *
|
||||
ieee80211_get_hw_conf(struct net_device *dev);
|
||||
|
||||
|
||||
/* Return a pointer to the low-level private data area for the given device. */
|
||||
void * ieee80211_dev_hw_data(struct net_device *dev);
|
||||
/* Return a pointer to network statistics data area for the given device. */
|
||||
void * ieee80211_dev_stats(struct net_device *dev);
|
||||
|
||||
/* Function to indicate Radar Detection. The low level driver must call this
|
||||
* function to indicate the presence of radar in the current channel.
|
||||
* Additionally the radar type also could be sent */
|
||||
int ieee80211_radar_status(struct net_device *dev, int channel, int radar,
|
||||
int radar_type);
|
||||
|
||||
/* Test modes */
|
||||
enum {
|
||||
IEEE80211_TEST_DISABLE = 0 /* terminate testing */,
|
||||
IEEE80211_TEST_UNMASK_CHANNELS = 1 /* allow all channels to be used */,
|
||||
IEEE80211_TEST_CONTINUOUS_TX = 2,
|
||||
};
|
||||
|
||||
/* Test parameters */
|
||||
enum {
|
||||
/* TX power in hardware specific raw value */
|
||||
IEEE80211_TEST_PARAM_TX_POWER_RAW = 0,
|
||||
/* TX rate in hardware specific raw value */
|
||||
IEEE80211_TEST_PARAM_TX_RATE_RAW = 1,
|
||||
/* Continuous TX pattern (32-bit) */
|
||||
IEEE80211_TEST_PARAM_TX_PATTERN = 2,
|
||||
/* TX power in 0.1 dBm, 100 = 10 dBm */
|
||||
IEEE80211_TEST_PARAM_TX_POWER = 3,
|
||||
/* TX rate in 100 kbps, 540 = 54 Mbps */
|
||||
IEEE80211_TEST_PARAM_TX_RATE = 4,
|
||||
IEEE80211_TEST_PARAM_TX_ANT_SEL_RAW = 5,
|
||||
};
|
||||
|
||||
/* ieee80211_tx_led called with state == 1 when the first frame is queued
|
||||
* with state == 0 when the last frame is transmitted and tx queue is empty
|
||||
*/
|
||||
void ieee80211_tx_led(int state, struct net_device *dev);
|
||||
/* ieee80211_rx_led is called each time frame is received, state is not used
|
||||
* (== 2)
|
||||
*/
|
||||
void ieee80211_rx_led(int state, struct net_device *dev);
|
||||
|
||||
|
||||
/* IEEE 802.11 defines */
|
||||
|
||||
#define FCS_LEN 4
|
||||
|
||||
#define WLAN_FC_PVER 0x0003
|
||||
#define WLAN_FC_TODS 0x0100
|
||||
#define WLAN_FC_FROMDS 0x0200
|
||||
#define WLAN_FC_MOREFRAG 0x0400
|
||||
#define WLAN_FC_RETRY 0x0800
|
||||
#define WLAN_FC_PWRMGT 0x1000
|
||||
#define WLAN_FC_MOREDATA 0x2000
|
||||
#define WLAN_FC_ISWEP 0x4000
|
||||
#define WLAN_FC_ORDER 0x8000
|
||||
|
||||
#define WLAN_FC_GET_TYPE(fc) (((fc) & 0x000c) >> 2)
|
||||
#define WLAN_FC_GET_STYPE(fc) (((fc) & 0x00f0) >> 4)
|
||||
|
||||
#define WLAN_GET_SEQ_FRAG(seq) ((seq) & 0x000f)
|
||||
#define WLAN_GET_SEQ_SEQ(seq) ((seq) >> 4)
|
||||
|
||||
#define WLAN_FC_DATA_PRESENT(fc) (((fc) & 0x4c) == 0x08)
|
||||
|
||||
#define WLAN_FC_TYPE_MGMT 0
|
||||
#define WLAN_FC_TYPE_CTRL 1
|
||||
#define WLAN_FC_TYPE_DATA 2
|
||||
|
||||
/* management */
|
||||
#define WLAN_FC_STYPE_ASSOC_REQ 0
|
||||
#define WLAN_FC_STYPE_ASSOC_RESP 1
|
||||
#define WLAN_FC_STYPE_REASSOC_REQ 2
|
||||
#define WLAN_FC_STYPE_REASSOC_RESP 3
|
||||
#define WLAN_FC_STYPE_PROBE_REQ 4
|
||||
#define WLAN_FC_STYPE_PROBE_RESP 5
|
||||
#define WLAN_FC_STYPE_BEACON 8
|
||||
#define WLAN_FC_STYPE_ATIM 9
|
||||
#define WLAN_FC_STYPE_DISASSOC 10
|
||||
#define WLAN_FC_STYPE_AUTH 11
|
||||
#define WLAN_FC_STYPE_DEAUTH 12
|
||||
#define WLAN_FC_STYPE_ACTION 13
|
||||
|
||||
/* control */
|
||||
#define WLAN_FC_STYPE_PSPOLL 10
|
||||
#define WLAN_FC_STYPE_RTS 11
|
||||
#define WLAN_FC_STYPE_CTS 12
|
||||
#define WLAN_FC_STYPE_ACK 13
|
||||
#define WLAN_FC_STYPE_CFEND 14
|
||||
#define WLAN_FC_STYPE_CFENDACK 15
|
||||
|
||||
/* data */
|
||||
#define WLAN_FC_STYPE_DATA 0
|
||||
#define WLAN_FC_STYPE_DATA_CFACK 1
|
||||
#define WLAN_FC_STYPE_DATA_CFPOLL 2
|
||||
#define WLAN_FC_STYPE_DATA_CFACKPOLL 3
|
||||
#define WLAN_FC_STYPE_NULLFUNC 4
|
||||
#define WLAN_FC_STYPE_CFACK 5
|
||||
#define WLAN_FC_STYPE_CFPOLL 6
|
||||
#define WLAN_FC_STYPE_CFACKPOLL 7
|
||||
#define WLAN_FC_STYPE_QOS_DATA 8
|
||||
#define WLAN_FC_STYPE_QOS_DATA_CFACK 9
|
||||
#define WLAN_FC_STYPE_QOS_DATA_CFPOLL 10
|
||||
#define WLAN_FC_STYPE_QOS_DATA_CFACKPOLL 11
|
||||
#define WLAN_FC_STYPE_QOS_NULLFUNC 12
|
||||
#define WLAN_FC_STYPE_QOS_CFACK 13
|
||||
#define WLAN_FC_STYPE_QOS_CFPOLL 14
|
||||
#define WLAN_FC_STYPE_QOS_CFACKPOLL 15
|
||||
|
||||
|
||||
#define IEEE80211_MAX_FRAG_THRESHOLD 2346
|
||||
#define IEEE80211_MAX_RTS_THRESHOLD 2347
|
||||
|
||||
struct ieee80211_hdr {
|
||||
u16 frame_control;
|
||||
u16 duration_id;
|
||||
u8 addr1[6];
|
||||
u8 addr2[6];
|
||||
u8 addr3[6];
|
||||
u16 seq_ctrl;
|
||||
u8 addr4[6];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* return a pointer to the source address (SA) */
|
||||
static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
|
||||
{
|
||||
u8 *raw = (u8 *) hdr;
|
||||
u8 tofrom = (*(raw+1)) & 3; /* get the TODS and FROMDS bits */
|
||||
|
||||
switch (tofrom) {
|
||||
case 2:
|
||||
return hdr->addr3;
|
||||
case 3:
|
||||
return hdr->addr4;
|
||||
}
|
||||
return hdr->addr2;
|
||||
}
|
||||
|
||||
/* return a pointer to the destination address (DA) */
|
||||
static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
|
||||
{
|
||||
u8 *raw = (u8 *) hdr;
|
||||
u8 to_ds = (*(raw+1)) & 1; /* get the TODS bit */
|
||||
|
||||
if (to_ds)
|
||||
return hdr->addr3;
|
||||
return hdr->addr1;
|
||||
}
|
||||
|
||||
static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr)
|
||||
{
|
||||
return (le16_to_cpu(hdr->frame_control) & WLAN_FC_MOREFRAG) != 0;
|
||||
}
|
||||
|
||||
#endif /* IEEE80211_H */
|
@ -1,96 +0,0 @@
|
||||
/*
|
||||
* IEEE 802.11 driver (80211.o) -- hostapd interface
|
||||
* Copyright 2002-2004, Instant802 Networks, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef IEEE80211_COMMON_H
|
||||
#define IEEE80211_COMMON_H
|
||||
|
||||
/*
|
||||
* This is common header information with user space. It is used on all
|
||||
* frames sent to wlan#ap interface.
|
||||
*/
|
||||
|
||||
#define IEEE80211_FI_VERSION 0x80211001
|
||||
|
||||
struct ieee80211_frame_info {
|
||||
u32 version;
|
||||
u32 length;
|
||||
u64 mactime;
|
||||
u64 hosttime;
|
||||
u32 phytype;
|
||||
u32 channel;
|
||||
u32 datarate;
|
||||
u32 antenna;
|
||||
u32 priority;
|
||||
u32 ssi_type;
|
||||
u32 ssi_signal;
|
||||
u32 ssi_noise;
|
||||
u32 preamble;
|
||||
u32 encoding;
|
||||
|
||||
/* Note: this structure is otherwise identical to capture format used
|
||||
* in linux-wlan-ng, but this additional field is used to provide meta
|
||||
* data about the frame to hostapd. This was the easiest method for
|
||||
* providing this information, but this might change in the future. */
|
||||
u32 msg_type;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
enum ieee80211_msg_type {
|
||||
ieee80211_msg_normal = 0,
|
||||
ieee80211_msg_tx_callback_ack = 1,
|
||||
ieee80211_msg_tx_callback_fail = 2,
|
||||
ieee80211_msg_passive_scan = 3,
|
||||
ieee80211_msg_wep_frame_unknown_key = 4,
|
||||
ieee80211_msg_michael_mic_failure = 5,
|
||||
ieee80211_msg_monitor = 6,
|
||||
ieee80211_msg_sta_not_assoc = 7,
|
||||
ieee80211_msg_set_aid_for_sta = 8 /* used by Intersil MVC driver */,
|
||||
ieee80211_msg_key_threshold_notification = 9,
|
||||
ieee80211_msg_radar = 11,
|
||||
};
|
||||
|
||||
struct ieee80211_msg_set_aid_for_sta {
|
||||
char sta_address[ETH_ALEN];
|
||||
u16 aid;
|
||||
};
|
||||
|
||||
struct ieee80211_msg_key_notification {
|
||||
int tx_rx_count;
|
||||
char ifname[IFNAMSIZ];
|
||||
u8 addr[ETH_ALEN]; /* ff:ff:ff:ff:ff:ff for broadcast keys */
|
||||
};
|
||||
|
||||
|
||||
enum ieee80211_phytype {
|
||||
ieee80211_phytype_fhss_dot11_97 = 1,
|
||||
ieee80211_phytype_dsss_dot11_97 = 2,
|
||||
ieee80211_phytype_irbaseband = 3,
|
||||
ieee80211_phytype_dsss_dot11_b = 4,
|
||||
ieee80211_phytype_pbcc_dot11_b = 5,
|
||||
ieee80211_phytype_ofdm_dot11_g = 6,
|
||||
ieee80211_phytype_pbcc_dot11_g = 7,
|
||||
ieee80211_phytype_ofdm_dot11_a = 8,
|
||||
ieee80211_phytype_dsss_dot11_turbog = 255,
|
||||
ieee80211_phytype_dsss_dot11_turbo = 256,
|
||||
};
|
||||
|
||||
enum ieee80211_ssi_type {
|
||||
ieee80211_ssi_none = 0,
|
||||
ieee80211_ssi_norm = 1, /* normalized, 0-1000 */
|
||||
ieee80211_ssi_dbm = 2,
|
||||
ieee80211_ssi_raw = 3, /* raw SSI */
|
||||
};
|
||||
|
||||
struct ieee80211_radar_info {
|
||||
int channel;
|
||||
int radar;
|
||||
int radar_type;
|
||||
};
|
||||
|
||||
#endif /* IEEE80211_COMMON_H */
|
@ -1,196 +0,0 @@
|
||||
/*
|
||||
* IEEE 802.11 -- shared defines for 80211.o and hostapd
|
||||
* Copyright 2002, Jouni Malinen <jkmaline@cc.hut.fi>
|
||||
* Copyright 2002-2004, Instant802 Networks, Inc.
|
||||
* Copyright 2005, Devicescape Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef IEEE802_11_MGMT_H
|
||||
#define IEEE802_11_MGMT_H
|
||||
|
||||
|
||||
struct ieee80211_mgmt {
|
||||
u16 frame_control;
|
||||
u16 duration;
|
||||
u8 da[6];
|
||||
u8 sa[6];
|
||||
u8 bssid[6];
|
||||
u16 seq_ctrl;
|
||||
union {
|
||||
struct {
|
||||
u16 auth_alg;
|
||||
u16 auth_transaction;
|
||||
u16 status_code;
|
||||
/* possibly followed by Challenge text */
|
||||
u8 variable[0];
|
||||
} __attribute__ ((packed)) auth;
|
||||
struct {
|
||||
u16 reason_code;
|
||||
} __attribute__ ((packed)) deauth;
|
||||
struct {
|
||||
u16 capab_info;
|
||||
u16 listen_interval;
|
||||
/* followed by SSID and Supported rates */
|
||||
u8 variable[0];
|
||||
} __attribute__ ((packed)) assoc_req;
|
||||
struct {
|
||||
u16 capab_info;
|
||||
u16 status_code;
|
||||
u16 aid;
|
||||
/* followed by Supported rates */
|
||||
u8 variable[0];
|
||||
} __attribute__ ((packed)) assoc_resp, reassoc_resp;
|
||||
struct {
|
||||
u16 capab_info;
|
||||
u16 listen_interval;
|
||||
u8 current_ap[6];
|
||||
/* followed by SSID and Supported rates */
|
||||
u8 variable[0];
|
||||
} __attribute__ ((packed)) reassoc_req;
|
||||
struct {
|
||||
u16 reason_code;
|
||||
} __attribute__ ((packed)) disassoc;
|
||||
struct {
|
||||
u8 timestamp[8];
|
||||
u16 beacon_int;
|
||||
u16 capab_info;
|
||||
/* followed by some of SSID, Supported rates,
|
||||
* FH Params, DS Params, CF Params, IBSS Params, TIM */
|
||||
u8 variable[0];
|
||||
} __attribute__ ((packed)) beacon;
|
||||
struct {
|
||||
/* only variable items: SSID, Supported rates */
|
||||
u8 variable[0];
|
||||
} __attribute__ ((packed)) probe_req;
|
||||
struct {
|
||||
u8 timestamp[8];
|
||||
u16 beacon_int;
|
||||
u16 capab_info;
|
||||
/* followed by some of SSID, Supported rates,
|
||||
* FH Params, DS Params, CF Params, IBSS Params */
|
||||
u8 variable[0];
|
||||
} __attribute__ ((packed)) probe_resp;
|
||||
struct {
|
||||
u8 category;
|
||||
union {
|
||||
struct {
|
||||
u8 action_code;
|
||||
u8 dialog_token;
|
||||
u8 status_code;
|
||||
u8 variable[0];
|
||||
} __attribute__ ((packed)) wme_action;
|
||||
struct{
|
||||
u8 action_code;
|
||||
u8 element_id;
|
||||
u8 length;
|
||||
u8 switch_mode;
|
||||
u8 new_chan;
|
||||
u8 switch_count;
|
||||
} __attribute__((packed)) chan_switch;
|
||||
} u;
|
||||
} __attribute__ ((packed)) action;
|
||||
} u;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/* Authentication algorithms */
|
||||
#define WLAN_AUTH_OPEN 0
|
||||
#define WLAN_AUTH_SHARED_KEY 1
|
||||
#define WLAN_AUTH_LEAP 128
|
||||
|
||||
#define WLAN_AUTH_CHALLENGE_LEN 128
|
||||
|
||||
#define WLAN_CAPABILITY_ESS BIT(0)
|
||||
#define WLAN_CAPABILITY_IBSS BIT(1)
|
||||
#define WLAN_CAPABILITY_CF_POLLABLE BIT(2)
|
||||
#define WLAN_CAPABILITY_CF_POLL_REQUEST BIT(3)
|
||||
#define WLAN_CAPABILITY_PRIVACY BIT(4)
|
||||
#define WLAN_CAPABILITY_SHORT_PREAMBLE BIT(5)
|
||||
#define WLAN_CAPABILITY_PBCC BIT(6)
|
||||
#define WLAN_CAPABILITY_CHANNEL_AGILITY BIT(7)
|
||||
/* 802.11h */
|
||||
#define WLAN_CAPABILITY_SPECTRUM_MGMT BIT(8)
|
||||
#define WLAN_CAPABILITY_SHORT_SLOT_TIME BIT(10)
|
||||
#define WLAN_CAPABILITY_DSSS_OFDM BIT(13)
|
||||
|
||||
/* Status codes */
|
||||
#define WLAN_STATUS_SUCCESS 0
|
||||
#define WLAN_STATUS_UNSPECIFIED_FAILURE 1
|
||||
#define WLAN_STATUS_CAPS_UNSUPPORTED 10
|
||||
#define WLAN_STATUS_REASSOC_NO_ASSOC 11
|
||||
#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
|
||||
#define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
|
||||
#define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
|
||||
#define WLAN_STATUS_CHALLENGE_FAIL 15
|
||||
#define WLAN_STATUS_AUTH_TIMEOUT 16
|
||||
#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
|
||||
#define WLAN_STATUS_ASSOC_DENIED_RATES 18
|
||||
/* 802.11b */
|
||||
#define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
|
||||
#define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
|
||||
#define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
|
||||
/* 802.11h */
|
||||
#define WLAN_STATUS_SPEC_MGMT_REQUIRED 22
|
||||
#define WLAN_STATUS_PWR_CAPABILITY_NOT_VALID 23
|
||||
#define WLAN_STATUS_SUPPORTED_CHANNEL_NOT_VALID 24
|
||||
/* 802.11g */
|
||||
#define WLAN_STATUS_ASSOC_DENOED_NO_SHORT_SLOT_TIME 25
|
||||
#define WLAN_STATUS_ASSOC_DENOED_NO_ER_PBCC 26
|
||||
#define WLAN_STATUS_ASSOC_DENOED_NO_DSSS_OFDM 27
|
||||
|
||||
|
||||
/* Reason codes */
|
||||
#define WLAN_REASON_UNSPECIFIED 1
|
||||
#define WLAN_REASON_PREV_AUTH_NOT_VALID 2
|
||||
#define WLAN_REASON_DEAUTH_LEAVING 3
|
||||
#define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
|
||||
#define WLAN_REASON_DISASSOC_AP_BUSY 5
|
||||
#define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
|
||||
#define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
|
||||
#define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
|
||||
#define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
|
||||
/* 802.11h */
|
||||
#define WLAN_REASON_PWR_CAPABILITY_NOT_VALID 10
|
||||
#define WLAN_REASON_SUPPORTED_CHANNEL_NOT_VALID 11
|
||||
|
||||
#define WLAN_REASON_MIC_FAILURE 14
|
||||
|
||||
|
||||
/* Information Element IDs */
|
||||
#define WLAN_EID_SSID 0
|
||||
#define WLAN_EID_SUPP_RATES 1
|
||||
#define WLAN_EID_FH_PARAMS 2
|
||||
#define WLAN_EID_DS_PARAMS 3
|
||||
#define WLAN_EID_CF_PARAMS 4
|
||||
#define WLAN_EID_TIM 5
|
||||
#define WLAN_EID_IBSS_PARAMS 6
|
||||
#define WLAN_EID_COUNTRY 7
|
||||
#define WLAN_EID_CHALLENGE 16
|
||||
/* EIDs defined as part fo 11h - starts */
|
||||
#define WLAN_EID_PWR_CONSTRAINT 32
|
||||
#define WLAN_EID_PWR_CAPABILITY 33
|
||||
#define WLAN_EID_TPC_REQUEST 34
|
||||
#define WLAN_EID_TPC_REPORT 35
|
||||
#define WLAN_EID_SUPPORTED_CHANNELS 36
|
||||
#define WLAN_EID_CHANNEL_SWITCH 37
|
||||
#define WLAN_EID_MEASURE_REQUEST 38
|
||||
#define WLAN_EID_MEASURE_REPORT 39
|
||||
#define WLAN_EID_QUITE 40
|
||||
#define WLAN_EID_IBSS_DFS 41
|
||||
/* EIDs defined as part fo 11h - ends */
|
||||
#define WLAN_EID_ERP_INFO 42
|
||||
#define WLAN_EID_RSN 48
|
||||
#define WLAN_EID_EXT_SUPP_RATES 50
|
||||
#define WLAN_EID_WPA 221
|
||||
#define WLAN_EID_GENERIC 221
|
||||
#define WLAN_EID_VENDOR_SPECIFIC 221
|
||||
|
||||
|
||||
|
||||
#define ATHEROS_INFO_USEXR BIT(3)
|
||||
|
||||
#endif /* IEEE802_11_MGMT_H */
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* IEEE 802.11 -- shared defines for low-level drivers, 80211.o, and hostapd
|
||||
* Copyright 2002-2004, Instant802 Networks, Inc.
|
||||
* Copyright 2005, Devicescape Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef IEEE80211_SHARED_H
|
||||
#define IEEE80211_SHARED_H
|
||||
|
||||
/* 802.11g is backwards-compatible with 802.11b, so a wlan card can
|
||||
* actually be both in 11b and 11g modes at the same time. */
|
||||
enum {
|
||||
MODE_IEEE80211A = 0 /* IEEE 802.11a */,
|
||||
MODE_IEEE80211B = 1 /* IEEE 802.11b only */,
|
||||
MODE_ATHEROS_TURBO = 2 /* Atheros Turbo mode (2x.11a at 5 GHz) */,
|
||||
MODE_IEEE80211G = 3 /* IEEE 802.11g (and 802.11b compatibility) */,
|
||||
MODE_ATHEROS_TURBOG = 4 /* Atheros Turbo mode (2x.11g at 2.4 GHz) */,
|
||||
MODE_ATHEROS_PRIME = 5 /* Atheros Dynamic Turbo mode */,
|
||||
MODE_ATHEROS_PRIMEG = 6 /* Atheros Dynamic Turbo mode G */,
|
||||
MODE_ATHEROS_XR = 7 /* Atheros XR mode */,
|
||||
NUM_IEEE80211_MODES = 8
|
||||
};
|
||||
|
||||
#define IEEE80211_CHAN_W_SCAN 0x00000001
|
||||
#define IEEE80211_CHAN_W_ACTIVE_SCAN 0x00000002
|
||||
#define IEEE80211_CHAN_W_IBSS 0x00000004
|
||||
|
||||
/* Low-level driver should set PREAMBLE2, OFDM, CCK, and TURBO flags.
|
||||
* BASIC, SUPPORTED, ERP, and MANDATORY flags are set in 80211.o based on the
|
||||
* configuration. */
|
||||
#define IEEE80211_RATE_ERP 0x00000001
|
||||
#define IEEE80211_RATE_BASIC 0x00000002
|
||||
#define IEEE80211_RATE_PREAMBLE2 0x00000004
|
||||
#define IEEE80211_RATE_SUPPORTED 0x00000010
|
||||
#define IEEE80211_RATE_OFDM 0x00000020
|
||||
#define IEEE80211_RATE_CCK 0x00000040
|
||||
#define IEEE80211_RATE_TURBO 0x00000080
|
||||
#define IEEE80211_RATE_MANDATORY 0x00000100
|
||||
#define IEEE80211_RATE_XR 0x00000200
|
||||
|
||||
#define IEEE80211_RATE_CCK_2 (IEEE80211_RATE_CCK | IEEE80211_RATE_PREAMBLE2)
|
||||
#define IEEE80211_RATE_MODULATION(f) \
|
||||
(f & (IEEE80211_RATE_CCK | IEEE80211_RATE_OFDM))
|
||||
|
||||
|
||||
#endif /* IEEE80211_SHARED_H */
|
@ -1,104 +0,0 @@
|
||||
/*
|
||||
* Michael MIC implementation - optimized for TKIP MIC operations
|
||||
* Copyright 2002-2003, Instant802 Networks, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#include "michael.h"
|
||||
|
||||
static inline u32 rotr(u32 val, int bits)
|
||||
{
|
||||
return (val >> bits) | (val << (32 - bits));
|
||||
}
|
||||
|
||||
|
||||
static inline u32 rotl(u32 val, int bits)
|
||||
{
|
||||
return (val << bits) | (val >> (32 - bits));
|
||||
}
|
||||
|
||||
|
||||
static inline u32 xswap(u32 val)
|
||||
{
|
||||
return ((val & 0xff00ff00) >> 8) | ((val & 0x00ff00ff) << 8);
|
||||
}
|
||||
|
||||
|
||||
#define michael_block(l, r) \
|
||||
do { \
|
||||
r ^= rotl(l, 17); \
|
||||
l += r; \
|
||||
r ^= xswap(l); \
|
||||
l += r; \
|
||||
r ^= rotl(l, 3); \
|
||||
l += r; \
|
||||
r ^= rotr(l, 2); \
|
||||
l += r; \
|
||||
} while (0)
|
||||
|
||||
|
||||
static inline u32 michael_get32(u8 *data)
|
||||
{
|
||||
return data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
|
||||
}
|
||||
|
||||
|
||||
static inline void michael_put32(u32 val, u8 *data)
|
||||
{
|
||||
data[0] = val & 0xff;
|
||||
data[1] = (val >> 8) & 0xff;
|
||||
data[2] = (val >> 16) & 0xff;
|
||||
data[3] = (val >> 24) & 0xff;
|
||||
}
|
||||
|
||||
|
||||
void michael_mic(u8 *key, u8 *da, u8 *sa, u8 priority,
|
||||
u8 *data, size_t data_len, u8 *mic)
|
||||
{
|
||||
u32 l, r, val;
|
||||
size_t block, blocks, left;
|
||||
|
||||
l = michael_get32(key);
|
||||
r = michael_get32(key + 4);
|
||||
|
||||
/* A pseudo header (DA, SA, Priority, 0, 0, 0) is used in Michael MIC
|
||||
* calculation, but it is _not_ transmitted */
|
||||
l ^= michael_get32(da);
|
||||
michael_block(l, r);
|
||||
l ^= da[4] | (da[5] << 8) | (sa[0] << 16) | (sa[1] << 24);
|
||||
michael_block(l, r);
|
||||
l ^= michael_get32(&sa[2]);
|
||||
michael_block(l, r);
|
||||
l ^= priority;
|
||||
michael_block(l, r);
|
||||
|
||||
/* Real data */
|
||||
blocks = data_len / 4;
|
||||
left = data_len % 4;
|
||||
|
||||
for (block = 0; block < blocks; block++) {
|
||||
l ^= michael_get32(&data[block * 4]);
|
||||
michael_block(l, r);
|
||||
}
|
||||
|
||||
/* Partial block of 0..3 bytes and padding: 0x5a + 4..7 zeros to make
|
||||
* total length a multiple of 4. */
|
||||
val = 0x5a;
|
||||
while (left > 0) {
|
||||
val <<= 8;
|
||||
left--;
|
||||
val |= data[blocks * 4 + left];
|
||||
}
|
||||
l ^= val;
|
||||
michael_block(l, r);
|
||||
/* last block is zero, so l ^ 0 = l */
|
||||
michael_block(l, r);
|
||||
|
||||
michael_put32(l, mic);
|
||||
michael_put32(r, mic + 4);
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Michael MIC implementation - optimized for TKIP MIC operations
|
||||
* Copyright 2002-2003, Instant802 Networks, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef MICHAEL_H
|
||||
#define MICHAEL_H
|
||||
|
||||
#define MICHAEL_MIC_LEN 8
|
||||
|
||||
void michael_mic(u8 *key, u8 *da, u8 *sa, u8 priority,
|
||||
u8 *data, size_t data_len, u8 *mic);
|
||||
|
||||
#endif /* MICHAEL_H */
|
@ -1,381 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2005, Instant802 Networks, Inc.
|
||||
* Copyright 2005, Devicescape Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/compiler.h>
|
||||
|
||||
#include <net/ieee80211.h>
|
||||
#include "ieee80211_i.h"
|
||||
#include "rate_control.h"
|
||||
|
||||
|
||||
/* This is a minimal implementation of TX rate controlling that can be used
|
||||
* as the default when no improved mechanisms are available. */
|
||||
|
||||
|
||||
#define RATE_CONTROL_EMERG_DEC 2
|
||||
#define RATE_CONTROL_INTERVAL (HZ / 20)
|
||||
#define RATE_CONTROL_MIN_TX 10
|
||||
|
||||
|
||||
static void rate_control_rate_inc(struct ieee80211_local *local,
|
||||
struct sta_info *sta)
|
||||
{
|
||||
struct ieee80211_sub_if_data *sdata;
|
||||
int i = sta->txrate;
|
||||
int maxrate;
|
||||
|
||||
sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
|
||||
if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) {
|
||||
/* forced unicast rate - do not change STA rate */
|
||||
return;
|
||||
}
|
||||
|
||||
maxrate = sdata->bss ? sdata->bss->max_ratectrl_rateidx : -1;
|
||||
|
||||
if (i > local->num_curr_rates)
|
||||
i = local->num_curr_rates - 2;
|
||||
|
||||
while (i + 1 < local->num_curr_rates) {
|
||||
i++;
|
||||
if (sta->supp_rates & BIT(i) &&
|
||||
local->curr_rates[i].flags & IEEE80211_RATE_SUPPORTED &&
|
||||
(maxrate < 0 || i <= maxrate)) {
|
||||
sta->txrate = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void rate_control_rate_dec(struct ieee80211_local *local,
|
||||
struct sta_info *sta)
|
||||
{
|
||||
struct ieee80211_sub_if_data *sdata;
|
||||
int i = sta->txrate;
|
||||
|
||||
sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
|
||||
if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) {
|
||||
/* forced unicast rate - do not change STA rate */
|
||||
return;
|
||||
}
|
||||
|
||||
if (i > local->num_curr_rates)
|
||||
i = local->num_curr_rates;
|
||||
|
||||
while (i > 0) {
|
||||
i--;
|
||||
if (sta->supp_rates & BIT(i) &&
|
||||
local->curr_rates[i].flags & IEEE80211_RATE_SUPPORTED) {
|
||||
sta->txrate = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static struct ieee80211_rate *
|
||||
rate_control_lowest_rate(struct ieee80211_local *local)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < local->num_curr_rates; i++) {
|
||||
struct ieee80211_rate *rate = &local->curr_rates[i];
|
||||
|
||||
if (rate->flags & IEEE80211_RATE_SUPPORTED
|
||||
)
|
||||
return rate;
|
||||
}
|
||||
|
||||
printk(KERN_DEBUG "rate_control_lowest_rate - no supported rates "
|
||||
"found\n");
|
||||
return &local->curr_rates[0];
|
||||
}
|
||||
|
||||
|
||||
struct global_rate_control {
|
||||
int dummy;
|
||||
};
|
||||
|
||||
struct sta_rate_control {
|
||||
unsigned long last_rate_change;
|
||||
u32 tx_num_failures;
|
||||
u32 tx_num_xmit;
|
||||
|
||||
unsigned long avg_rate_update;
|
||||
u32 tx_avg_rate_sum;
|
||||
u32 tx_avg_rate_num;
|
||||
};
|
||||
|
||||
|
||||
static void rate_control_simple_tx_status(struct net_device *dev,
|
||||
struct sk_buff *skb,
|
||||
struct ieee80211_tx_status *status)
|
||||
{
|
||||
struct ieee80211_local *local = dev->priv;
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
struct sta_info *sta;
|
||||
struct sta_rate_control *srctrl;
|
||||
|
||||
sta = sta_info_get(local, hdr->addr1);
|
||||
|
||||
if (!sta)
|
||||
return;
|
||||
|
||||
srctrl = sta->rate_ctrl_priv;
|
||||
srctrl->tx_num_xmit++;
|
||||
if (status->excessive_retries) {
|
||||
sta->antenna_sel = sta->antenna_sel == 1 ? 2 : 1;
|
||||
if (local->sta_antenna_sel == STA_ANTENNA_SEL_SW_CTRL_DEBUG) {
|
||||
printk(KERN_DEBUG "%s: " MACSTR " TX antenna --> %d "
|
||||
"(@%lu)\n",
|
||||
dev->name, MAC2STR(hdr->addr1),
|
||||
sta->antenna_sel, jiffies);
|
||||
}
|
||||
srctrl->tx_num_failures++;
|
||||
sta->tx_retry_failed++;
|
||||
sta->tx_num_consecutive_failures++;
|
||||
sta->tx_num_mpdu_fail++;
|
||||
} else {
|
||||
sta->last_ack_rssi[0] = sta->last_ack_rssi[1];
|
||||
sta->last_ack_rssi[1] = sta->last_ack_rssi[2];
|
||||
sta->last_ack_rssi[2] = status->ack_signal;
|
||||
sta->tx_num_consecutive_failures = 0;
|
||||
sta->tx_num_mpdu_ok++;
|
||||
}
|
||||
sta->tx_retry_count += status->retry_count;
|
||||
sta->tx_num_mpdu_fail += status->retry_count;
|
||||
|
||||
if (time_after(jiffies,
|
||||
srctrl->last_rate_change + RATE_CONTROL_INTERVAL) &&
|
||||
srctrl->tx_num_xmit > RATE_CONTROL_MIN_TX) {
|
||||
u32 per_failed;
|
||||
srctrl->last_rate_change = jiffies;
|
||||
|
||||
per_failed = (100 * sta->tx_num_mpdu_fail) /
|
||||
(sta->tx_num_mpdu_fail + sta->tx_num_mpdu_ok);
|
||||
/* TODO: calculate average per_failed to make adjusting
|
||||
* parameters easier */
|
||||
#if 0
|
||||
if (net_ratelimit()) {
|
||||
printk(KERN_DEBUG "MPDU fail=%d ok=%d per_failed=%d\n",
|
||||
sta->tx_num_mpdu_fail, sta->tx_num_mpdu_ok,
|
||||
per_failed);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (per_failed > local->rate_ctrl_num_down) {
|
||||
rate_control_rate_dec(local, sta);
|
||||
} else if (per_failed < local->rate_ctrl_num_up) {
|
||||
rate_control_rate_inc(local, sta);
|
||||
}
|
||||
srctrl->tx_avg_rate_sum += local->curr_rates[sta->txrate].rate;
|
||||
srctrl->tx_avg_rate_num++;
|
||||
srctrl->tx_num_failures = 0;
|
||||
srctrl->tx_num_xmit = 0;
|
||||
} else if (sta->tx_num_consecutive_failures >=
|
||||
RATE_CONTROL_EMERG_DEC) {
|
||||
rate_control_rate_dec(local, sta);
|
||||
}
|
||||
|
||||
if (srctrl->avg_rate_update + 60 * HZ < jiffies) {
|
||||
srctrl->avg_rate_update = jiffies;
|
||||
if (srctrl->tx_avg_rate_num > 0) {
|
||||
#ifdef CONFIG_IEEE80211_VERBOSE_DEBUG
|
||||
printk(KERN_DEBUG "%s: STA " MACSTR " Average rate: "
|
||||
"%d (%d/%d)\n",
|
||||
dev->name, MAC2STR(sta->addr),
|
||||
srctrl->tx_avg_rate_sum /
|
||||
srctrl->tx_avg_rate_num,
|
||||
srctrl->tx_avg_rate_sum,
|
||||
srctrl->tx_avg_rate_num);
|
||||
#endif /* CONFIG_IEEE80211_VERBOSE_DEBUG */
|
||||
srctrl->tx_avg_rate_sum = 0;
|
||||
srctrl->tx_avg_rate_num = 0;
|
||||
}
|
||||
}
|
||||
|
||||
sta_info_release(local, sta);
|
||||
}
|
||||
|
||||
|
||||
static struct ieee80211_rate *
|
||||
rate_control_simple_get_rate(struct net_device *dev, struct sk_buff *skb,
|
||||
struct rate_control_extra *extra)
|
||||
{
|
||||
struct ieee80211_local *local = dev->priv;
|
||||
struct ieee80211_sub_if_data *sdata;
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
struct sta_info *sta;
|
||||
int rateidx, nonerp_idx;
|
||||
u16 fc;
|
||||
|
||||
memset(extra, 0, sizeof(*extra));
|
||||
|
||||
fc = le16_to_cpu(hdr->frame_control);
|
||||
if (WLAN_FC_GET_TYPE(fc) != WLAN_FC_TYPE_DATA ||
|
||||
(hdr->addr1[0] & 0x01)) {
|
||||
/* Send management frames and broadcast/multicast data using
|
||||
* lowest rate. */
|
||||
/* TODO: this could probably be improved.. */
|
||||
return rate_control_lowest_rate(local);
|
||||
}
|
||||
|
||||
sta = sta_info_get(local, hdr->addr1);
|
||||
|
||||
if (!sta)
|
||||
return rate_control_lowest_rate(local);
|
||||
|
||||
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
|
||||
if (sdata->bss && sdata->bss->force_unicast_rateidx > -1)
|
||||
sta->txrate = sdata->bss->force_unicast_rateidx;
|
||||
|
||||
rateidx = sta->txrate;
|
||||
|
||||
if (rateidx >= local->num_curr_rates)
|
||||
rateidx = local->num_curr_rates - 1;
|
||||
|
||||
sta->last_txrate = rateidx;
|
||||
nonerp_idx = rateidx;
|
||||
while (nonerp_idx > 0 &&
|
||||
((local->curr_rates[nonerp_idx].flags & IEEE80211_RATE_ERP) ||
|
||||
!(local->curr_rates[nonerp_idx].flags &
|
||||
IEEE80211_RATE_SUPPORTED) ||
|
||||
!(sta->supp_rates & BIT(nonerp_idx))))
|
||||
nonerp_idx--;
|
||||
extra->nonerp_idx = nonerp_idx;
|
||||
extra->nonerp = &local->curr_rates[extra->nonerp_idx];
|
||||
|
||||
sta_info_release(local, sta);
|
||||
|
||||
return &local->curr_rates[rateidx];
|
||||
}
|
||||
|
||||
|
||||
static void rate_control_simple_rate_init(struct ieee80211_local *local,
|
||||
struct sta_info *sta)
|
||||
{
|
||||
int i;
|
||||
sta->txrate = 0;
|
||||
/* TODO: what is a good starting rate for STA? About middle? Maybe not
|
||||
* the lowest or the highest rate.. Could consider using RSSI from
|
||||
* previous packets? Need to have IEEE 802.1X auth succeed immediately
|
||||
* after assoc.. */
|
||||
for (i = 0; i < local->num_curr_rates; i++) {
|
||||
if ((sta->supp_rates & BIT(i)) &&
|
||||
(local->curr_rates[i].flags & IEEE80211_RATE_SUPPORTED))
|
||||
sta->txrate = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void * rate_control_simple_alloc(struct ieee80211_local *local)
|
||||
{
|
||||
struct global_rate_control *rctrl;
|
||||
|
||||
rctrl = kmalloc(sizeof(*rctrl), GFP_ATOMIC);
|
||||
if (rctrl == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
memset(rctrl, 0, sizeof(*rctrl));
|
||||
return rctrl;
|
||||
}
|
||||
|
||||
|
||||
static void rate_control_simple_free(void *priv)
|
||||
{
|
||||
struct global_rate_control *rctrl = priv;
|
||||
kfree(rctrl);
|
||||
}
|
||||
|
||||
|
||||
static void rate_control_simple_clear(void *priv)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static void * rate_control_simple_alloc_sta(void)
|
||||
{
|
||||
struct sta_rate_control *rctrl;
|
||||
|
||||
rctrl = kmalloc(sizeof(*rctrl), GFP_ATOMIC);
|
||||
if (rctrl == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
memset(rctrl, 0, sizeof(*rctrl));
|
||||
return rctrl;
|
||||
}
|
||||
|
||||
|
||||
static void rate_control_simple_free_sta(void *priv)
|
||||
{
|
||||
struct sta_rate_control *rctrl = priv;
|
||||
kfree(rctrl);
|
||||
}
|
||||
|
||||
|
||||
static int rate_control_simple_status_sta(struct ieee80211_local *local,
|
||||
struct sta_info *sta, char *buf)
|
||||
{
|
||||
char *p = buf;
|
||||
struct sta_rate_control *srctrl = sta->rate_ctrl_priv;
|
||||
|
||||
p += sprintf(p, "tx_avg_rate_sum=%d\n", srctrl->tx_avg_rate_sum);
|
||||
p += sprintf(p, "tx_avg_rate_num=%d\n", srctrl->tx_avg_rate_num);
|
||||
if (srctrl->tx_avg_rate_num)
|
||||
p += sprintf(p, "tx_avg_rate_avg=%d\n",
|
||||
srctrl->tx_avg_rate_sum /
|
||||
srctrl->tx_avg_rate_num);
|
||||
return p - buf;
|
||||
}
|
||||
|
||||
|
||||
static int rate_control_simple_status_global(struct ieee80211_local *local,
|
||||
char *buf)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static struct rate_control_ops rate_control_simple = {
|
||||
.name = "simple",
|
||||
.tx_status = rate_control_simple_tx_status,
|
||||
.get_rate = rate_control_simple_get_rate,
|
||||
.rate_init = rate_control_simple_rate_init,
|
||||
.clear = rate_control_simple_clear,
|
||||
.status_sta = rate_control_simple_status_sta,
|
||||
.status_global = rate_control_simple_status_global,
|
||||
.alloc = rate_control_simple_alloc,
|
||||
.free = rate_control_simple_free,
|
||||
.alloc_sta = rate_control_simple_alloc_sta,
|
||||
.free_sta = rate_control_simple_free_sta,
|
||||
};
|
||||
|
||||
|
||||
int __init rate_control_simple_init(void)
|
||||
{
|
||||
return ieee80211_rate_control_register(&rate_control_simple);
|
||||
}
|
||||
|
||||
|
||||
static void __exit rate_control_simple_exit(void)
|
||||
{
|
||||
ieee80211_rate_control_unregister(&rate_control_simple);
|
||||
}
|
||||
|
||||
|
||||
module_init(rate_control_simple_init);
|
||||
module_exit(rate_control_simple_exit);
|
@ -1,128 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2005, Instant802 Networks, Inc.
|
||||
* Copyright 2005, Devicescape Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef RATE_CONTROL
|
||||
#define RATE_CONTROL
|
||||
|
||||
#define RATE_CONTROL_NUM_DOWN 20
|
||||
#define RATE_CONTROL_NUM_UP 15
|
||||
|
||||
|
||||
struct rate_control_extra {
|
||||
/* values from rate_control_get_rate() to the caller: */
|
||||
struct ieee80211_rate *probe; /* probe with this rate, or NULL for no
|
||||
* probing */
|
||||
int startidx, endidx, rateidx;
|
||||
struct ieee80211_rate *nonerp;
|
||||
int nonerp_idx;
|
||||
|
||||
/* parameters from the caller to rate_control_get_rate(): */
|
||||
int mgmt_data; /* this is data frame that is used for management
|
||||
* (e.g., IEEE 802.1X EAPOL) */
|
||||
u16 ethertype;
|
||||
};
|
||||
|
||||
|
||||
struct rate_control_ops {
|
||||
const char *name;
|
||||
void (*tx_status)(struct net_device *dev, struct sk_buff *skb,
|
||||
struct ieee80211_tx_status *status);
|
||||
struct ieee80211_rate *
|
||||
(*get_rate)(struct net_device *dev, struct sk_buff *skb,
|
||||
struct rate_control_extra *extra);
|
||||
void (*rate_init)(struct ieee80211_local *local, struct sta_info *sta);
|
||||
void (*clear)(void *priv);
|
||||
int (*status_sta)(struct ieee80211_local *local,
|
||||
struct sta_info *sta, char *buf);
|
||||
int (*status_global)(struct ieee80211_local *local, char *buf);
|
||||
|
||||
void * (*alloc)(struct ieee80211_local *local);
|
||||
void (*free)(void *priv);
|
||||
void * (*alloc_sta)(void);
|
||||
void (*free_sta)(void *priv);
|
||||
};
|
||||
|
||||
|
||||
int ieee80211_rate_control_register(struct rate_control_ops *ops);
|
||||
void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
|
||||
|
||||
|
||||
static inline void rate_control_tx_status(struct net_device *dev,
|
||||
struct sk_buff *skb,
|
||||
struct ieee80211_tx_status *status)
|
||||
{
|
||||
struct ieee80211_local *local = dev->priv;
|
||||
local->rate_ctrl->tx_status(dev, skb, status);
|
||||
}
|
||||
|
||||
|
||||
static inline struct ieee80211_rate *
|
||||
rate_control_get_rate(struct net_device *dev, struct sk_buff *skb,
|
||||
struct rate_control_extra *extra)
|
||||
{
|
||||
struct ieee80211_local *local = dev->priv;
|
||||
return local->rate_ctrl->get_rate(dev, skb, extra);
|
||||
}
|
||||
|
||||
|
||||
static inline void rate_control_rate_init(struct ieee80211_local *local,
|
||||
struct sta_info *sta)
|
||||
{
|
||||
local->rate_ctrl->rate_init(local, sta);
|
||||
}
|
||||
|
||||
|
||||
static inline void rate_control_clear(struct ieee80211_local *local)
|
||||
{
|
||||
local->rate_ctrl->clear(local->rate_ctrl_priv);
|
||||
}
|
||||
|
||||
|
||||
static inline int rate_control_status_sta(struct ieee80211_local *local,
|
||||
struct sta_info *sta, char *buf)
|
||||
{
|
||||
return local->rate_ctrl->status_sta(local, sta, buf);
|
||||
}
|
||||
|
||||
|
||||
static inline int rate_control_status_global(struct ieee80211_local *local,
|
||||
char *buf)
|
||||
{
|
||||
return local->rate_ctrl->status_global(local, buf);
|
||||
}
|
||||
|
||||
|
||||
static inline void * rate_control_alloc(struct ieee80211_local *local)
|
||||
{
|
||||
return local->rate_ctrl->alloc(local);
|
||||
}
|
||||
|
||||
|
||||
static inline void rate_control_free(struct ieee80211_local *local)
|
||||
{
|
||||
if (local->rate_ctrl == NULL || local->rate_ctrl_priv == NULL)
|
||||
return;
|
||||
local->rate_ctrl->free(local->rate_ctrl_priv);
|
||||
local->rate_ctrl_priv = NULL;
|
||||
}
|
||||
|
||||
|
||||
static inline void * rate_control_alloc_sta(struct ieee80211_local *local)
|
||||
{
|
||||
return local->rate_ctrl->alloc_sta();
|
||||
}
|
||||
|
||||
|
||||
static inline void rate_control_free_sta(struct ieee80211_local *local,
|
||||
void *priv)
|
||||
{
|
||||
local->rate_ctrl->free_sta(priv);
|
||||
}
|
||||
|
||||
#endif /* RATE_CONTROL */
|
@ -1,417 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2005, Instant802 Networks, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/if_arp.h>
|
||||
|
||||
#include <net/ieee80211.h>
|
||||
#include "ieee80211_i.h"
|
||||
#include "ieee80211_proc.h"
|
||||
#include "rate_control.h"
|
||||
|
||||
|
||||
/* Caller must hold local->sta_lock */
|
||||
static void sta_info_hash_add(struct ieee80211_local *local,
|
||||
struct sta_info *sta)
|
||||
{
|
||||
sta->hnext = local->sta_hash[STA_HASH(sta->addr)];
|
||||
local->sta_hash[STA_HASH(sta->addr)] = sta;
|
||||
}
|
||||
|
||||
|
||||
/* Caller must hold local->sta_lock */
|
||||
static void sta_info_hash_del(struct ieee80211_local *local,
|
||||
struct sta_info *sta)
|
||||
{
|
||||
struct sta_info *s;
|
||||
|
||||
s = local->sta_hash[STA_HASH(sta->addr)];
|
||||
if (s == NULL)
|
||||
return;
|
||||
if (memcmp(s->addr, sta->addr, ETH_ALEN) == 0) {
|
||||
local->sta_hash[STA_HASH(sta->addr)] = s->hnext;
|
||||
return;
|
||||
}
|
||||
|
||||
while (s->hnext != NULL &&
|
||||
memcmp(s->hnext->addr, sta->addr, ETH_ALEN) != 0)
|
||||
s = s->hnext;
|
||||
if (s->hnext != NULL)
|
||||
s->hnext = s->hnext->hnext;
|
||||
else
|
||||
printk(KERN_ERR "%s: could not remove STA " MACSTR " from "
|
||||
"hash table\n", local->mdev->name, MAC2STR(sta->addr));
|
||||
}
|
||||
|
||||
|
||||
struct sta_info * sta_info_get(struct ieee80211_local *local, u8 *addr)
|
||||
{
|
||||
struct sta_info *sta;
|
||||
|
||||
spin_lock_bh(&local->sta_lock);
|
||||
sta = local->sta_hash[STA_HASH(addr)];
|
||||
while (sta) {
|
||||
if (memcmp(sta->addr, addr, ETH_ALEN) == 0) {
|
||||
atomic_inc(&sta->users);
|
||||
break;
|
||||
}
|
||||
sta = sta->hnext;
|
||||
}
|
||||
spin_unlock_bh(&local->sta_lock);
|
||||
|
||||
return sta;
|
||||
}
|
||||
|
||||
|
||||
int sta_info_min_txrate_get(struct ieee80211_local *local)
|
||||
{
|
||||
struct sta_info *sta;
|
||||
int min_txrate = 9999999;
|
||||
int i;
|
||||
|
||||
spin_lock_bh(&local->sta_lock);
|
||||
for (i = 0; i < STA_HASH_SIZE; i++) {
|
||||
sta = local->sta_hash[i];
|
||||
while (sta) {
|
||||
if (sta->txrate < min_txrate)
|
||||
min_txrate = sta->txrate;
|
||||
sta = sta->hnext;
|
||||
}
|
||||
}
|
||||
spin_unlock_bh(&local->sta_lock);
|
||||
if (min_txrate == 9999999)
|
||||
min_txrate = 0;
|
||||
|
||||
return min_txrate;
|
||||
}
|
||||
|
||||
|
||||
void sta_info_release(struct ieee80211_local *local, struct sta_info *sta)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
|
||||
if (!atomic_dec_and_test(&sta->users))
|
||||
return;
|
||||
|
||||
/* free sta structure; it has already been removed from
|
||||
* hash table etc. external structures. Make sure that all
|
||||
* buffered frames are release (one might have been added
|
||||
* after sta_info_free() was called). */
|
||||
while ((skb = skb_dequeue(&sta->ps_tx_buf)) != NULL) {
|
||||
local->total_ps_buffered--;
|
||||
dev_kfree_skb_any(skb);
|
||||
}
|
||||
while ((skb = skb_dequeue(&sta->tx_filtered)) != NULL) {
|
||||
dev_kfree_skb_any(skb);
|
||||
}
|
||||
rate_control_free_sta(local, sta->rate_ctrl_priv);
|
||||
kfree(sta);
|
||||
}
|
||||
|
||||
|
||||
struct sta_info * sta_info_add(struct ieee80211_local *local,
|
||||
struct net_device *dev, u8 *addr)
|
||||
{
|
||||
struct sta_info *sta;
|
||||
|
||||
sta = kmalloc(sizeof(*sta), GFP_ATOMIC);
|
||||
if (!sta)
|
||||
return NULL;
|
||||
|
||||
memset(sta, 0, sizeof(*sta));
|
||||
|
||||
sta->rate_ctrl_priv = rate_control_alloc_sta(local);
|
||||
if (sta->rate_ctrl_priv == NULL) {
|
||||
kfree(sta);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(sta->addr, addr, ETH_ALEN);
|
||||
sta->dev = dev;
|
||||
skb_queue_head_init(&sta->ps_tx_buf);
|
||||
skb_queue_head_init(&sta->tx_filtered);
|
||||
atomic_inc(&sta->users); /* sta in hashlist etc, decremented by
|
||||
* sta_info_free() */
|
||||
atomic_inc(&sta->users); /* sta used by caller, decremented by
|
||||
* sta_info_release() */
|
||||
spin_lock_bh(&local->sta_lock);
|
||||
list_add(&sta->list, &local->sta_list);
|
||||
local->num_sta++;
|
||||
sta_info_hash_add(local, sta);
|
||||
spin_unlock_bh(&local->sta_lock);
|
||||
if (local->hw->sta_table_notification)
|
||||
local->hw->sta_table_notification(local->mdev, local->num_sta);
|
||||
sta->key_idx_compression = HW_KEY_IDX_INVALID;
|
||||
|
||||
#ifdef CONFIG_IEEE80211_VERBOSE_DEBUG
|
||||
printk(KERN_DEBUG "%s: Added STA " MACSTR "\n",
|
||||
dev->name, MAC2STR(addr));
|
||||
#endif /* CONFIG_IEEE80211_VERBOSE_DEBUG */
|
||||
|
||||
if (!in_interrupt()) {
|
||||
ieee80211_proc_init_sta(local, sta);
|
||||
} else {
|
||||
/* procfs entry adding might sleep, so schedule process context
|
||||
* task for adding proc entry for STAs that do not yet have
|
||||
* one. */
|
||||
schedule_work(&local->sta_proc_add);
|
||||
}
|
||||
|
||||
return sta;
|
||||
}
|
||||
|
||||
|
||||
void sta_info_free(struct ieee80211_local *local, struct sta_info *sta,
|
||||
int locked)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
struct ieee80211_sub_if_data *sdata;
|
||||
|
||||
if (!locked)
|
||||
spin_lock_bh(&local->sta_lock);
|
||||
sta_info_hash_del(local, sta);
|
||||
list_del(&sta->list);
|
||||
sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
|
||||
if (sta->flags & WLAN_STA_PS) {
|
||||
sta->flags &= ~WLAN_STA_PS;
|
||||
if (sdata->bss)
|
||||
atomic_dec(&sdata->bss->num_sta_ps);
|
||||
}
|
||||
local->num_sta--;
|
||||
sta_info_remove_aid_ptr(sta);
|
||||
if (!locked)
|
||||
spin_unlock_bh(&local->sta_lock);
|
||||
if (local->hw->sta_table_notification)
|
||||
local->hw->sta_table_notification(local->mdev, local->num_sta);
|
||||
|
||||
while ((skb = skb_dequeue(&sta->ps_tx_buf)) != NULL) {
|
||||
local->total_ps_buffered--;
|
||||
dev_kfree_skb_any(skb);
|
||||
}
|
||||
while ((skb = skb_dequeue(&sta->tx_filtered)) != NULL) {
|
||||
dev_kfree_skb_any(skb);
|
||||
}
|
||||
|
||||
if (sta->key) {
|
||||
if (local->hw->set_key) {
|
||||
struct ieee80211_key_conf *key;
|
||||
key = ieee80211_key_data2conf(local, sta->key);
|
||||
if (key) {
|
||||
local->hw->set_key(local->mdev, DISABLE_KEY,
|
||||
sta->addr, key, sta->aid);
|
||||
kfree(key);
|
||||
}
|
||||
}
|
||||
kfree(sta->key);
|
||||
sta->key = NULL;
|
||||
} else if (sta->key_idx_compression != HW_KEY_IDX_INVALID) {
|
||||
struct ieee80211_key_conf conf;
|
||||
memset(&conf, 0, sizeof(conf));
|
||||
conf.hw_key_idx = sta->key_idx_compression;
|
||||
conf.alg = ALG_NULL;
|
||||
conf.force_sw_encrypt = 1;
|
||||
local->hw->set_key(local->mdev, DISABLE_KEY, sta->addr, &conf,
|
||||
sta->aid);
|
||||
sta->key_idx_compression = HW_KEY_IDX_INVALID;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IEEE80211_VERBOSE_DEBUG
|
||||
printk(KERN_DEBUG "%s: Removed STA " MACSTR "\n",
|
||||
local->mdev->name, MAC2STR(sta->addr));
|
||||
#endif /* CONFIG_IEEE80211_VERBOSE_DEBUG */
|
||||
|
||||
ieee80211_proc_deinit_sta(local, sta);
|
||||
|
||||
if (atomic_read(&sta->users) != 1) {
|
||||
/* This is OK, but printed for debugging. The station structure
|
||||
* will be removed when the other user of the data calls
|
||||
* sta_info_release(). */
|
||||
printk(KERN_DEBUG "%s: STA " MACSTR " users count %d when "
|
||||
"removing it\n", local->mdev->name, MAC2STR(sta->addr),
|
||||
atomic_read(&sta->users));
|
||||
}
|
||||
|
||||
sta_info_release(local, sta);
|
||||
}
|
||||
|
||||
|
||||
static inline int sta_info_buffer_expired(struct sk_buff *skb)
|
||||
{
|
||||
struct ieee80211_tx_packet_data *pkt_data;
|
||||
if (!skb)
|
||||
return 0;
|
||||
|
||||
/* TODO: this could be improved by passing STA listen interval into
|
||||
* the kernel driver and expiring frames after 2 x listen_interval x
|
||||
* beacon interval */
|
||||
|
||||
pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
|
||||
|
||||
if (pkt_data->magic != IEEE80211_CB_MAGIC)
|
||||
return 1;
|
||||
|
||||
return time_after(jiffies, pkt_data->jiffies + STA_TX_BUFFER_EXPIRE);
|
||||
}
|
||||
|
||||
|
||||
static void sta_info_cleanup_expire_buffered(struct ieee80211_local *local,
|
||||
struct sta_info *sta)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct sk_buff *skb;
|
||||
|
||||
if (skb_queue_empty(&sta->ps_tx_buf))
|
||||
return;
|
||||
|
||||
for (;;) {
|
||||
spin_lock_irqsave(&sta->ps_tx_buf.lock, flags);
|
||||
skb = skb_peek(&sta->ps_tx_buf);
|
||||
if (sta_info_buffer_expired(skb))
|
||||
skb = __skb_dequeue(&sta->ps_tx_buf);
|
||||
else
|
||||
skb = NULL;
|
||||
spin_unlock_irqrestore(&sta->ps_tx_buf.lock, flags);
|
||||
|
||||
if (skb) {
|
||||
local->total_ps_buffered--;
|
||||
printk(KERN_DEBUG "Buffered frame expired (STA "
|
||||
MACSTR ")\n", MAC2STR(sta->addr));
|
||||
dev_kfree_skb(skb);
|
||||
} else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void sta_info_cleanup(unsigned long data)
|
||||
{
|
||||
struct ieee80211_local *local = (struct ieee80211_local *) data;
|
||||
struct list_head *ptr;
|
||||
|
||||
spin_lock_bh(&local->sta_lock);
|
||||
ptr = local->sta_list.next;
|
||||
while (ptr && ptr != &local->sta_list) {
|
||||
struct sta_info *sta = (struct sta_info *) ptr;
|
||||
atomic_inc(&sta->users);
|
||||
sta_info_cleanup_expire_buffered(local, sta);
|
||||
sta_info_release(local, sta);
|
||||
ptr = ptr->next;
|
||||
}
|
||||
spin_unlock_bh(&local->sta_lock);
|
||||
|
||||
local->sta_cleanup.expires = jiffies + STA_INFO_CLEANUP_INTERVAL;
|
||||
add_timer(&local->sta_cleanup);
|
||||
}
|
||||
|
||||
|
||||
static void sta_info_proc_add_task(void *data)
|
||||
{
|
||||
struct ieee80211_local *local = data;
|
||||
struct list_head *ptr;
|
||||
struct sta_info *sta;
|
||||
int max_adds = 100;
|
||||
|
||||
while (max_adds > 0) {
|
||||
sta = NULL;
|
||||
spin_lock_bh(&local->sta_lock);
|
||||
list_for_each(ptr, &local->sta_list) {
|
||||
sta = list_entry(ptr, struct sta_info, list);
|
||||
if (!sta->proc_entry_added) {
|
||||
atomic_inc(&sta->users);
|
||||
break;
|
||||
}
|
||||
sta = NULL;
|
||||
}
|
||||
spin_unlock_bh(&local->sta_lock);
|
||||
|
||||
if (!sta)
|
||||
break;
|
||||
|
||||
ieee80211_proc_init_sta(local, sta);
|
||||
atomic_dec(&sta->users);
|
||||
|
||||
max_adds--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void sta_info_init(struct ieee80211_local *local)
|
||||
{
|
||||
spin_lock_init(&local->sta_lock);
|
||||
INIT_LIST_HEAD(&local->sta_list);
|
||||
|
||||
init_timer(&local->sta_cleanup);
|
||||
local->sta_cleanup.expires = jiffies + STA_INFO_CLEANUP_INTERVAL;
|
||||
local->sta_cleanup.data = (unsigned long) local;
|
||||
local->sta_cleanup.function = sta_info_cleanup;
|
||||
|
||||
INIT_WORK(&local->sta_proc_add, sta_info_proc_add_task, local);
|
||||
}
|
||||
|
||||
void sta_info_start(struct ieee80211_local *local)
|
||||
{
|
||||
add_timer(&local->sta_cleanup);
|
||||
}
|
||||
|
||||
void sta_info_stop(struct ieee80211_local *local)
|
||||
{
|
||||
struct list_head *ptr;
|
||||
|
||||
del_timer(&local->sta_cleanup);
|
||||
|
||||
ptr = local->sta_list.next;
|
||||
while (ptr && ptr != &local->sta_list) {
|
||||
struct sta_info *sta = (struct sta_info *) ptr;
|
||||
ptr = ptr->next;
|
||||
sta_info_free(local, sta, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void sta_info_remove_aid_ptr(struct sta_info *sta)
|
||||
{
|
||||
struct ieee80211_sub_if_data *sdata;
|
||||
|
||||
sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
|
||||
if (sta->aid <= 0 || !sdata->bss)
|
||||
return;
|
||||
|
||||
sdata->bss->sta_aid[sta->aid - 1] = NULL;
|
||||
if (sta->aid == sdata->bss->max_aid) {
|
||||
while (sdata->bss->max_aid > 0 &&
|
||||
sdata->bss->sta_aid[sdata->bss->max_aid - 1] == NULL)
|
||||
sdata->bss->max_aid--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* sta_info_flush - flush matching STA entries from the STA table
|
||||
* @local: local interface data
|
||||
* @dev: matching rule for the net device (sta->dev) or %NULL to match all STAs
|
||||
*/
|
||||
void sta_info_flush(struct ieee80211_local *local, struct net_device *dev)
|
||||
{
|
||||
struct list_head *ptr, *n;
|
||||
|
||||
spin_lock_bh(&local->sta_lock);
|
||||
|
||||
list_for_each_safe(ptr, n, &local->sta_list) {
|
||||
struct sta_info *sta = list_entry(ptr, struct sta_info, list);
|
||||
if (dev == NULL || dev == sta->dev)
|
||||
sta_info_free(local, sta, 1);
|
||||
}
|
||||
spin_unlock_bh(&local->sta_lock);
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2005, Devicescape Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef STA_INFO_H
|
||||
#define STA_INFO_H
|
||||
|
||||
/* Stations flags (struct sta_info::flags) */
|
||||
#define WLAN_STA_AUTH BIT(0)
|
||||
#define WLAN_STA_ASSOC BIT(1)
|
||||
#define WLAN_STA_PS BIT(2)
|
||||
#define WLAN_STA_TIM BIT(3) /* TIM bit is on for PS stations */
|
||||
#define WLAN_STA_PERM BIT(4) /* permanent; do not remove entry on expiration */
|
||||
#define WLAN_STA_AUTHORIZED BIT(5) /* If 802.1X is used, this flag is
|
||||
* controlling whether STA is authorized to
|
||||
* send and receive non-IEEE 802.1X frames
|
||||
*/
|
||||
#define WLAN_STA_SHORT_PREAMBLE BIT(7)
|
||||
#define WLAN_STA_WME BIT(9)
|
||||
#define WLAN_STA_XR BIT(26)
|
||||
#define WLAN_STA_WDS BIT(27)
|
||||
|
||||
|
||||
struct sta_info {
|
||||
struct list_head list;
|
||||
struct sta_info *hnext; /* next entry in hash table list */
|
||||
atomic_t users; /* number of users (do not remove if > 0) */
|
||||
|
||||
u8 addr[ETH_ALEN];
|
||||
u16 aid; /* STA's unique AID (1..2007), 0 = not yet assigned */
|
||||
u32 flags; /* WLAN_STA_ */
|
||||
|
||||
struct sk_buff_head ps_tx_buf; /* buffer of TX frames for station in
|
||||
* power saving state */
|
||||
int pspoll; /* whether STA has send a PS Poll frame */
|
||||
struct sk_buff_head tx_filtered; /* buffer of TX frames that were
|
||||
* already given to low-level driver,
|
||||
* but were filtered */
|
||||
int clear_dst_mask;
|
||||
|
||||
unsigned long rx_packets, tx_packets; /* number of RX/TX MSDUs */
|
||||
unsigned long rx_bytes, tx_bytes;
|
||||
unsigned long tx_retry_failed, tx_retry_count;
|
||||
unsigned long tx_filtered_count;
|
||||
|
||||
unsigned int wep_weak_iv_count; /* number of RX frames with weak IV */
|
||||
|
||||
unsigned long last_rx;
|
||||
u32 supp_rates; /* bitmap of supported rates in local->curr_rates */
|
||||
int txrate; /* index in local->curr_rates */
|
||||
int last_txrate; /* last rate used to send a frame to this STA */
|
||||
int last_nonerp_idx;
|
||||
|
||||
struct net_device *dev; /* which net device is this station associated
|
||||
* to */
|
||||
|
||||
struct ieee80211_key *key;
|
||||
|
||||
u32 tx_num_consecutive_failures;
|
||||
u32 tx_num_mpdu_ok;
|
||||
u32 tx_num_mpdu_fail;
|
||||
|
||||
void *rate_ctrl_priv;
|
||||
|
||||
/* last received seq/frag number from this STA (per RX queue) */
|
||||
u16 last_seq_ctrl[NUM_RX_DATA_QUEUES];
|
||||
unsigned long num_duplicates; /* number of duplicate frames received
|
||||
* from this STA */
|
||||
unsigned long tx_fragments; /* number of transmitted MPDUs */
|
||||
unsigned long rx_fragments; /* number of received MPDUs */
|
||||
unsigned long rx_dropped; /* number of dropped MPDUs from this STA */
|
||||
|
||||
int last_rssi; /* RSSI of last received frame from this STA */
|
||||
int last_ack_rssi[3]; /* RSSI of last received ACKs from this STA */
|
||||
unsigned long last_ack;
|
||||
int channel_use;
|
||||
int channel_use_raw;
|
||||
|
||||
int antenna_sel;
|
||||
|
||||
|
||||
int key_idx_compression; /* key table index for compression and TX
|
||||
* filtering; used only if sta->key is not
|
||||
* set */
|
||||
|
||||
int proc_entry_added:1;
|
||||
int assoc_ap:1; /* whether this is an AP that we are associated with
|
||||
* as a client */
|
||||
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
u32 wpa_trigger;
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
|
||||
#ifdef CONFIG_IEEE80211_DEBUG_COUNTERS
|
||||
unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES];
|
||||
unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
|
||||
#endif /* CONFIG_IEEE80211_DEBUG_COUNTERS */
|
||||
|
||||
int vlan_id;
|
||||
};
|
||||
|
||||
|
||||
/* Maximum number of concurrently registered stations */
|
||||
#define MAX_STA_COUNT 2007
|
||||
|
||||
/* Maximum number of AIDs to use for STAs; must be 2007 or lower
|
||||
* (IEEE 802.11 beacon format limitation) */
|
||||
#define MAX_AID_TABLE_SIZE 2007
|
||||
|
||||
#define STA_HASH_SIZE 256
|
||||
#define STA_HASH(sta) (sta[5])
|
||||
|
||||
|
||||
/* Maximum number of frames to buffer per power saving station */
|
||||
#define STA_MAX_TX_BUFFER 128
|
||||
|
||||
/* Buffered frame expiry time */
|
||||
#define STA_TX_BUFFER_EXPIRE (10 * HZ)
|
||||
|
||||
/* How often station data is cleaned up (e.g., expiration of buffered frames)
|
||||
*/
|
||||
#define STA_INFO_CLEANUP_INTERVAL (10 * HZ)
|
||||
|
||||
|
||||
struct sta_info * sta_info_get(struct ieee80211_local *local, u8 *addr);
|
||||
int sta_info_min_txrate_get(struct ieee80211_local *local);
|
||||
void sta_info_release(struct ieee80211_local *local, struct sta_info *sta);
|
||||
struct sta_info * sta_info_add(struct ieee80211_local *local,
|
||||
struct net_device *dev, u8 *addr);
|
||||
void sta_info_free(struct ieee80211_local *local, struct sta_info *sta,
|
||||
int locked);
|
||||
void sta_info_init(struct ieee80211_local *local);
|
||||
void sta_info_start(struct ieee80211_local *local);
|
||||
void sta_info_stop(struct ieee80211_local *local);
|
||||
void sta_info_remove_aid_ptr(struct sta_info *sta);
|
||||
void sta_info_flush(struct ieee80211_local *local, struct net_device *dev);
|
||||
|
||||
#endif /* STA_INFO_H */
|
@ -1,341 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2004, Instant802 Networks, Inc.
|
||||
* Copyright 2005, Devicescape Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_TKIP_DEBUG
|
||||
#include <linux/config.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/skbuff.h>
|
||||
#endif /* CONFIG_TKIP_DEBUG */
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/netdevice.h>
|
||||
|
||||
#include <net/ieee80211.h>
|
||||
#include "ieee80211_key.h"
|
||||
#ifdef CONFIG_TKIP_DEBUG
|
||||
#include "ieee80211_i.h"
|
||||
#endif /* CONFIG_TKIP_DEBUG */
|
||||
#include "tkip.h"
|
||||
|
||||
/* Dummy prototypes for structures used in wep.h, but not really needed for
|
||||
* TKIP. */
|
||||
struct ieee80211_local;
|
||||
struct sk_buff;
|
||||
#include "wep.h"
|
||||
|
||||
|
||||
/* TKIP key mixing functions */
|
||||
|
||||
|
||||
#define PHASE1_LOOP_COUNT 8
|
||||
|
||||
|
||||
/* 2-byte by 2-byte subset of the full AES S-box table; second part of this
|
||||
* table is identical to first part but byte-swapped */
|
||||
static const u16 tkip_sbox[256] =
|
||||
{
|
||||
0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154,
|
||||
0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A,
|
||||
0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B,
|
||||
0x41EC, 0xB367, 0x5FFD, 0x45EA, 0x23BF, 0x53F7, 0xE496, 0x9B5B,
|
||||
0x75C2, 0xE11C, 0x3DAE, 0x4C6A, 0x6C5A, 0x7E41, 0xF502, 0x834F,
|
||||
0x685C, 0x51F4, 0xD134, 0xF908, 0xE293, 0xAB73, 0x6253, 0x2A3F,
|
||||
0x080C, 0x9552, 0x4665, 0x9D5E, 0x3028, 0x37A1, 0x0A0F, 0x2FB5,
|
||||
0x0E09, 0x2436, 0x1B9B, 0xDF3D, 0xCD26, 0x4E69, 0x7FCD, 0xEA9F,
|
||||
0x121B, 0x1D9E, 0x5874, 0x342E, 0x362D, 0xDCB2, 0xB4EE, 0x5BFB,
|
||||
0xA4F6, 0x764D, 0xB761, 0x7DCE, 0x527B, 0xDD3E, 0x5E71, 0x1397,
|
||||
0xA6F5, 0xB968, 0x0000, 0xC12C, 0x4060, 0xE31F, 0x79C8, 0xB6ED,
|
||||
0xD4BE, 0x8D46, 0x67D9, 0x724B, 0x94DE, 0x98D4, 0xB0E8, 0x854A,
|
||||
0xBB6B, 0xC52A, 0x4FE5, 0xED16, 0x86C5, 0x9AD7, 0x6655, 0x1194,
|
||||
0x8ACF, 0xE910, 0x0406, 0xFE81, 0xA0F0, 0x7844, 0x25BA, 0x4BE3,
|
||||
0xA2F3, 0x5DFE, 0x80C0, 0x058A, 0x3FAD, 0x21BC, 0x7048, 0xF104,
|
||||
0x63DF, 0x77C1, 0xAF75, 0x4263, 0x2030, 0xE51A, 0xFD0E, 0xBF6D,
|
||||
0x814C, 0x1814, 0x2635, 0xC32F, 0xBEE1, 0x35A2, 0x88CC, 0x2E39,
|
||||
0x9357, 0x55F2, 0xFC82, 0x7A47, 0xC8AC, 0xBAE7, 0x322B, 0xE695,
|
||||
0xC0A0, 0x1998, 0x9ED1, 0xA37F, 0x4466, 0x547E, 0x3BAB, 0x0B83,
|
||||
0x8CCA, 0xC729, 0x6BD3, 0x283C, 0xA779, 0xBCE2, 0x161D, 0xAD76,
|
||||
0xDB3B, 0x6456, 0x744E, 0x141E, 0x92DB, 0x0C0A, 0x486C, 0xB8E4,
|
||||
0x9F5D, 0xBD6E, 0x43EF, 0xC4A6, 0x39A8, 0x31A4, 0xD337, 0xF28B,
|
||||
0xD532, 0x8B43, 0x6E59, 0xDAB7, 0x018C, 0xB164, 0x9CD2, 0x49E0,
|
||||
0xD8B4, 0xACFA, 0xF307, 0xCF25, 0xCAAF, 0xF48E, 0x47E9, 0x1018,
|
||||
0x6FD5, 0xF088, 0x4A6F, 0x5C72, 0x3824, 0x57F1, 0x73C7, 0x9751,
|
||||
0xCB23, 0xA17C, 0xE89C, 0x3E21, 0x96DD, 0x61DC, 0x0D86, 0x0F85,
|
||||
0xE090, 0x7C42, 0x71C4, 0xCCAA, 0x90D8, 0x0605, 0xF701, 0x1C12,
|
||||
0xC2A3, 0x6A5F, 0xAEF9, 0x69D0, 0x1791, 0x9958, 0x3A27, 0x27B9,
|
||||
0xD938, 0xEB13, 0x2BB3, 0x2233, 0xD2BB, 0xA970, 0x0789, 0x33A7,
|
||||
0x2DB6, 0x3C22, 0x1592, 0xC920, 0x8749, 0xAAFF, 0x5078, 0xA57A,
|
||||
0x038F, 0x59F8, 0x0980, 0x1A17, 0x65DA, 0xD731, 0x84C6, 0xD0B8,
|
||||
0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A,
|
||||
};
|
||||
|
||||
|
||||
static inline u16 Mk16(u8 x, u8 y)
|
||||
{
|
||||
return ((u16) x << 8) | (u16) y;
|
||||
}
|
||||
|
||||
|
||||
static inline u8 Hi8(u16 v)
|
||||
{
|
||||
return v >> 8;
|
||||
}
|
||||
|
||||
|
||||
static inline u8 Lo8(u16 v)
|
||||
{
|
||||
return v & 0xff;
|
||||
}
|
||||
|
||||
|
||||
static inline u16 Hi16(u32 v)
|
||||
{
|
||||
return v >> 16;
|
||||
}
|
||||
|
||||
|
||||
static inline u16 Lo16(u32 v)
|
||||
{
|
||||
return v & 0xffff;
|
||||
}
|
||||
|
||||
|
||||
static inline u16 RotR1(u16 v)
|
||||
{
|
||||
return (v >> 1) | ((v & 0x0001) << 15);
|
||||
}
|
||||
|
||||
|
||||
static inline u16 tkip_S(u16 val)
|
||||
{
|
||||
u16 a = tkip_sbox[Hi8(val)];
|
||||
|
||||
return tkip_sbox[Lo8(val)] ^ Hi8(a) ^ (Lo8(a) << 8);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* P1K := Phase1(TA, TK, TSC)
|
||||
* TA = transmitter address (48 bits)
|
||||
* TK = dot11DefaultKeyValue or dot11KeyMappingValue (128 bits)
|
||||
* TSC = TKIP sequence counter (48 bits, only 32 msb bits used)
|
||||
* P1K: 80 bits
|
||||
*/
|
||||
static void tkip_mixing_phase1(const u8 *ta, const u8 *tk, u32 tsc_IV32,
|
||||
u16 *p1k)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
p1k[0] = Lo16(tsc_IV32);
|
||||
p1k[1] = Hi16(tsc_IV32);
|
||||
p1k[2] = Mk16(ta[1], ta[0]);
|
||||
p1k[3] = Mk16(ta[3], ta[2]);
|
||||
p1k[4] = Mk16(ta[5], ta[4]);
|
||||
|
||||
for (i = 0; i < PHASE1_LOOP_COUNT; i++) {
|
||||
j = 2 * (i & 1);
|
||||
p1k[0] += tkip_S(p1k[4] ^ Mk16(tk[ 1 + j], tk[ 0 + j]));
|
||||
p1k[1] += tkip_S(p1k[0] ^ Mk16(tk[ 5 + j], tk[ 4 + j]));
|
||||
p1k[2] += tkip_S(p1k[1] ^ Mk16(tk[ 9 + j], tk[ 8 + j]));
|
||||
p1k[3] += tkip_S(p1k[2] ^ Mk16(tk[13 + j], tk[12 + j]));
|
||||
p1k[4] += tkip_S(p1k[3] ^ Mk16(tk[ 1 + j], tk[ 0 + j])) + i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void tkip_mixing_phase2(const u16 *p1k, const u8 *tk, u16 tsc_IV16,
|
||||
u8 *rc4key)
|
||||
{
|
||||
u16 ppk[6];
|
||||
int i;
|
||||
|
||||
ppk[0] = p1k[0];
|
||||
ppk[1] = p1k[1];
|
||||
ppk[2] = p1k[2];
|
||||
ppk[3] = p1k[3];
|
||||
ppk[4] = p1k[4];
|
||||
ppk[5] = p1k[4] + tsc_IV16;
|
||||
|
||||
ppk[0] += tkip_S(ppk[5] ^ Mk16(tk[ 1], tk[ 0]));
|
||||
ppk[1] += tkip_S(ppk[0] ^ Mk16(tk[ 3], tk[ 2]));
|
||||
ppk[2] += tkip_S(ppk[1] ^ Mk16(tk[ 5], tk[ 4]));
|
||||
ppk[3] += tkip_S(ppk[2] ^ Mk16(tk[ 7], tk[ 6]));
|
||||
ppk[4] += tkip_S(ppk[3] ^ Mk16(tk[ 9], tk[ 8]));
|
||||
ppk[5] += tkip_S(ppk[4] ^ Mk16(tk[11], tk[10]));
|
||||
ppk[0] += RotR1(ppk[5] ^ Mk16(tk[13], tk[12]));
|
||||
ppk[1] += RotR1(ppk[0] ^ Mk16(tk[15], tk[14]));
|
||||
ppk[2] += RotR1(ppk[1]);
|
||||
ppk[3] += RotR1(ppk[2]);
|
||||
ppk[4] += RotR1(ppk[3]);
|
||||
ppk[5] += RotR1(ppk[4]);
|
||||
|
||||
rc4key[0] = Hi8(tsc_IV16);
|
||||
rc4key[1] = (Hi8(tsc_IV16) | 0x20) & 0x7f;
|
||||
rc4key[2] = Lo8(tsc_IV16);
|
||||
rc4key[3] = Lo8((ppk[5] ^ Mk16(tk[1], tk[0])) >> 1);
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
rc4key[4 + 2 * i] = Lo8(ppk[i]);
|
||||
rc4key[5 + 2 * i] = Hi8(ppk[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Add TKIP IV and Ext. IV at @pos. @iv0, @iv1, and @iv2 are the first octets
|
||||
* of the IV. Returns pointer to the octet following IVs (i.e., beginning of
|
||||
* the packet payload). */
|
||||
u8 * ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key,
|
||||
u8 iv0, u8 iv1, u8 iv2)
|
||||
{
|
||||
*pos++ = iv0;
|
||||
*pos++ = iv1;
|
||||
*pos++ = iv2;
|
||||
*pos++ = (key->keyidx << 6) | (1 << 5) /* Ext IV */;
|
||||
*pos++ = key->u.tkip.iv32 & 0xff;
|
||||
*pos++ = (key->u.tkip.iv32 >> 8) & 0xff;
|
||||
*pos++ = (key->u.tkip.iv32 >> 16) & 0xff;
|
||||
*pos++ = (key->u.tkip.iv32 >> 24) & 0xff;
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
/* Encrypt packet payload with TKIP using @key. @pos is a pointer to the
|
||||
* beginning of the buffer containing payload. This payload must include
|
||||
* headroom of eight octets for IV and Ext. IV and taildroom of four octets
|
||||
* for ICV. @payload_len is the length of payload (_not_ including extra
|
||||
* headroom and tailroom). @ta is the transmitter addresses. */
|
||||
void ieee80211_tkip_encrypt_data(struct ieee80211_key *key, u8 *pos,
|
||||
size_t payload_len, u8 *ta)
|
||||
{
|
||||
u8 rc4key[16];
|
||||
|
||||
/* Calculate per-packet key */
|
||||
if (key->u.tkip.iv16 == 0 || !key->u.tkip.tx_initialized) {
|
||||
/* IV16 wrapped around - perform TKIP phase 1 */
|
||||
tkip_mixing_phase1(ta, &key->key[ALG_TKIP_TEMP_ENCR_KEY],
|
||||
key->u.tkip.iv32, key->u.tkip.p1k);
|
||||
key->u.tkip.tx_initialized = 1;
|
||||
}
|
||||
|
||||
tkip_mixing_phase2(key->u.tkip.p1k, &key->key[ALG_TKIP_TEMP_ENCR_KEY],
|
||||
key->u.tkip.iv16, rc4key);
|
||||
|
||||
pos = ieee80211_tkip_add_iv(pos, key, rc4key[0], rc4key[1], rc4key[2]);
|
||||
ieee80211_wep_encrypt_data(rc4key, 16, pos, payload_len);
|
||||
}
|
||||
|
||||
|
||||
/* Decrypt packet payload with TKIP using @key. @pos is a pointer to the
|
||||
* beginning of the buffer containing IEEE 802.11 header payload, i.e.,
|
||||
* including IV, Ext. IV, real data, Michael MIC, ICV. @payload_len is the
|
||||
* length of payload, including IV, Ext. IV, MIC, ICV. */
|
||||
int ieee80211_tkip_decrypt_data(struct ieee80211_key *key, u8 *payload,
|
||||
size_t payload_len, u8 *ta, int only_iv,
|
||||
int queue)
|
||||
{
|
||||
u32 iv32;
|
||||
u32 iv16;
|
||||
u8 rc4key[16], keyid, *pos = payload;
|
||||
int res;
|
||||
|
||||
if (payload_len < 12)
|
||||
return -1;
|
||||
|
||||
iv16 = (pos[0] << 8) | pos[2];
|
||||
keyid = pos[3];
|
||||
iv32 = pos[4] | (pos[5] << 8) | (pos[6] << 16) | (pos[7] << 24);
|
||||
pos += 8;
|
||||
#ifdef CONFIG_TKIP_DEBUG
|
||||
{
|
||||
int i;
|
||||
printk(KERN_DEBUG "TKIP decrypt: data(len=%zd)", payload_len);
|
||||
for (i = 0; i < payload_len; i++)
|
||||
printk(" %02x", payload[i]);
|
||||
printk("\n");
|
||||
printk(KERN_DEBUG "TKIP decrypt: iv16=%04x iv32=%08x\n",
|
||||
iv16, iv32);
|
||||
}
|
||||
#endif /* CONFIG_TKIP_DEBUG */
|
||||
|
||||
if (!(keyid & (1 << 5)))
|
||||
return TKIP_DECRYPT_NO_EXT_IV;
|
||||
|
||||
if ((keyid >> 6) != key->keyidx)
|
||||
return TKIP_DECRYPT_INVALID_KEYIDX;
|
||||
|
||||
if (key->u.tkip.rx_initialized[queue] &&
|
||||
(iv32 < key->u.tkip.iv32_rx[queue] ||
|
||||
(iv32 == key->u.tkip.iv32_rx[queue] &&
|
||||
iv16 <= key->u.tkip.iv16_rx[queue]))) {
|
||||
#ifdef CONFIG_TKIP_DEBUG
|
||||
printk(KERN_DEBUG "TKIP replay detected for RX frame from "
|
||||
MACSTR " (RX IV (%04x,%02x) <= prev. IV (%04x,%02x)\n",
|
||||
MAC2STR(ta),
|
||||
iv32, iv16, key->u.tkip.iv32_rx[queue],
|
||||
key->u.tkip.iv16_rx[queue]);
|
||||
#endif /* CONFIG_TKIP_DEBUG */
|
||||
return TKIP_DECRYPT_REPLAY;
|
||||
}
|
||||
|
||||
if (only_iv) {
|
||||
res = TKIP_DECRYPT_OK;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!key->u.tkip.rx_initialized[queue] ||
|
||||
key->u.tkip.iv32_rx[queue] != iv32) {
|
||||
key->u.tkip.rx_initialized[queue] = 1;
|
||||
/* IV16 wrapped around - perform TKIP phase 1 */
|
||||
tkip_mixing_phase1(ta, &key->key[ALG_TKIP_TEMP_ENCR_KEY],
|
||||
iv32, key->u.tkip.p1k_rx[queue]);
|
||||
#ifdef CONFIG_TKIP_DEBUG
|
||||
{
|
||||
int i;
|
||||
printk(KERN_DEBUG "TKIP decrypt: Phase1 TA=" MACSTR
|
||||
" TK=", MAC2STR(ta));
|
||||
for (i = 0; i < 16; i++)
|
||||
printk("%02x ",
|
||||
key->key[ALG_TKIP_TEMP_ENCR_KEY + i]);
|
||||
printk("\n");
|
||||
printk(KERN_DEBUG "TKIP decrypt: P1K=");
|
||||
for (i = 0; i < 5; i++)
|
||||
printk("%04x ", key->u.tkip.p1k_rx[queue][i]);
|
||||
printk("\n");
|
||||
}
|
||||
#endif /* CONFIG_TKIP_DEBUG */
|
||||
}
|
||||
|
||||
tkip_mixing_phase2(key->u.tkip.p1k_rx[queue],
|
||||
&key->key[ALG_TKIP_TEMP_ENCR_KEY],
|
||||
iv16, rc4key);
|
||||
#ifdef CONFIG_TKIP_DEBUG
|
||||
{
|
||||
int i;
|
||||
printk(KERN_DEBUG "TKIP decrypt: Phase2 rc4key=");
|
||||
for (i = 0; i < 16; i++)
|
||||
printk("%02x ", rc4key[i]);
|
||||
printk("\n");
|
||||
}
|
||||
#endif /* CONFIG_TKIP_DEBUG */
|
||||
|
||||
res = ieee80211_wep_decrypt_data(rc4key, 16, pos, payload_len - 12);
|
||||
done:
|
||||
if (res == TKIP_DECRYPT_OK) {
|
||||
/* FIX: these should be updated only after Michael MIC has been
|
||||
* verified */
|
||||
/* Record previously received IV */
|
||||
key->u.tkip.iv32_rx[queue] = iv32;
|
||||
key->u.tkip.iv16_rx[queue] = iv16;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2004, Instant802 Networks, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef TKIP_H
|
||||
#define TKIP_H
|
||||
|
||||
u8 * ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key,
|
||||
u8 iv0, u8 iv1, u8 iv2);
|
||||
void ieee80211_tkip_encrypt_data(struct ieee80211_key *key, u8 *pos,
|
||||
size_t payload_len, u8 *ta);
|
||||
enum {
|
||||
TKIP_DECRYPT_OK = 0,
|
||||
TKIP_DECRYPT_NO_EXT_IV = -1,
|
||||
TKIP_DECRYPT_INVALID_KEYIDX = -2,
|
||||
TKIP_DECRYPT_REPLAY = -3,
|
||||
};
|
||||
int ieee80211_tkip_decrypt_data(struct ieee80211_key *key, u8 *payload,
|
||||
size_t payload_len, u8 *ta, int only_iv,
|
||||
int queue);
|
||||
|
||||
#endif /* TKIP_H */
|
@ -1,423 +0,0 @@
|
||||
/*
|
||||
* Software WEP encryption implementation
|
||||
* Copyright 2002, Jouni Malinen <jkmaline@cc.hut.fi>
|
||||
* Copyright 2003, Instant802 Networks, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/random.h>
|
||||
#include <linux/compiler.h>
|
||||
|
||||
#include <net/ieee80211.h>
|
||||
#include "ieee80211_i.h"
|
||||
#include "wep.h"
|
||||
|
||||
|
||||
static const __u32 crc32_table[256] = {
|
||||
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
|
||||
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
|
||||
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
|
||||
0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
|
||||
0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
|
||||
0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
|
||||
0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
|
||||
0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
|
||||
0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
|
||||
0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
|
||||
0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
|
||||
0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
|
||||
0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
|
||||
0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
|
||||
0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
|
||||
0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
|
||||
0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
|
||||
0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
|
||||
0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
|
||||
0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
|
||||
0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
|
||||
0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
|
||||
0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
|
||||
0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
|
||||
0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
|
||||
0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
|
||||
0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
|
||||
0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
|
||||
0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
|
||||
0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
|
||||
0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
|
||||
0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
|
||||
0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
|
||||
0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
|
||||
0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
|
||||
0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
|
||||
0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
|
||||
0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
|
||||
0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
|
||||
0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
|
||||
0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
|
||||
0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
|
||||
0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
|
||||
0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
|
||||
0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
|
||||
0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
|
||||
0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
|
||||
0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
|
||||
0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
|
||||
0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
|
||||
0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
|
||||
0x2d02ef8dL
|
||||
};
|
||||
|
||||
|
||||
void ieee80211_wep_init(struct ieee80211_local *local)
|
||||
{
|
||||
/* start WEP IV from a random value */
|
||||
get_random_bytes(&local->wep_iv, WEP_IV_LEN);
|
||||
}
|
||||
|
||||
|
||||
static inline int ieee80211_wep_weak_iv(u32 iv, int keylen)
|
||||
{
|
||||
/* Fluhrer, Mantin, and Shamir have reported weaknesses in the
|
||||
* key scheduling algorithm of RC4. At least IVs (KeyByte + 3,
|
||||
* 0xff, N) can be used to speedup attacks, so avoid using them. */
|
||||
if ((iv & 0xff00) == 0xff00) {
|
||||
u8 B = (iv >> 16) & 0xff;
|
||||
if (B >= 3 && B < 3 + keylen)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void ieee80211_wep_get_iv(struct ieee80211_local *local,
|
||||
struct ieee80211_key *key, u8 *iv)
|
||||
{
|
||||
local->wep_iv++;
|
||||
if (ieee80211_wep_weak_iv(local->wep_iv, key->keylen))
|
||||
local->wep_iv += 0x0100;
|
||||
|
||||
if (iv == NULL)
|
||||
return;
|
||||
|
||||
*iv++ = (local->wep_iv >> 16) & 0xff;
|
||||
*iv++ = (local->wep_iv >> 8) & 0xff;
|
||||
*iv++ = local->wep_iv & 0xff;
|
||||
*iv++ = key->keyidx << 6;
|
||||
}
|
||||
|
||||
|
||||
u8 * ieee80211_wep_add_iv(struct ieee80211_local *local,
|
||||
struct sk_buff *skb,
|
||||
struct ieee80211_key *key)
|
||||
{
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
u16 fc;
|
||||
int hdrlen;
|
||||
u8 *newhdr;
|
||||
|
||||
fc = le16_to_cpu(hdr->frame_control);
|
||||
fc |= WLAN_FC_ISWEP;
|
||||
hdr->frame_control = cpu_to_le16(fc);
|
||||
|
||||
if ((skb_headroom(skb) < WEP_IV_LEN ||
|
||||
skb_tailroom(skb) < WEP_ICV_LEN)) {
|
||||
I802_DEBUG_INC(local->tx_expand_skb_head);
|
||||
if (unlikely(pskb_expand_head(skb, WEP_IV_LEN, WEP_ICV_LEN,
|
||||
GFP_ATOMIC)))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hdrlen = ieee80211_get_hdrlen(fc);
|
||||
newhdr = skb_push(skb, WEP_IV_LEN);
|
||||
memmove(newhdr, newhdr + WEP_IV_LEN, hdrlen);
|
||||
ieee80211_wep_get_iv(local, key, newhdr + hdrlen);
|
||||
return newhdr + hdrlen;
|
||||
}
|
||||
|
||||
|
||||
void ieee80211_wep_remove_iv(struct ieee80211_local *local,
|
||||
struct sk_buff *skb,
|
||||
struct ieee80211_key *key)
|
||||
{
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
u16 fc;
|
||||
int hdrlen;
|
||||
|
||||
fc = le16_to_cpu(hdr->frame_control);
|
||||
hdrlen = ieee80211_get_hdrlen(fc);
|
||||
memmove(skb->data + WEP_IV_LEN, skb->data, hdrlen);
|
||||
skb_pull(skb, WEP_IV_LEN);
|
||||
}
|
||||
|
||||
|
||||
/* Perform WEP encryption using given key. data buffer must have tailroom
|
||||
* for 4-byte ICV. data_len must not include this ICV. Note: this function
|
||||
* does _not_ add IV. data = RC4(data | CRC32(data)) */
|
||||
void ieee80211_wep_encrypt_data(u8 *rc4key, size_t klen, u8 *data,
|
||||
size_t data_len)
|
||||
{
|
||||
u32 i, j, k, crc;
|
||||
u8 S[256];
|
||||
u8 kpos, *pos;
|
||||
#define S_SWAP(a,b) do { u8 t = S[a]; S[a] = S[b]; S[b] = t; } while(0)
|
||||
|
||||
/* Setup RC4 state */
|
||||
for (i = 0; i < 256; i++)
|
||||
S[i] = i;
|
||||
j = 0;
|
||||
kpos = 0;
|
||||
for (i = 0; i < 256; i++) {
|
||||
j = (j + S[i] + rc4key[kpos]) & 0xff;
|
||||
kpos++;
|
||||
if (kpos >= klen)
|
||||
kpos = 0;
|
||||
S_SWAP(i, j);
|
||||
}
|
||||
|
||||
/* Compute CRC32 over unencrypted data and apply RC4 to data */
|
||||
pos = data;
|
||||
crc = ~0;
|
||||
i = j = 0;
|
||||
for (k = 0; k < data_len; k++) {
|
||||
crc = crc32_table[(crc ^ *pos) & 0xff] ^ (crc >> 8);
|
||||
i = (i + 1) & 0xff;
|
||||
j = (j + S[i]) & 0xff;
|
||||
S_SWAP(i, j);
|
||||
*pos++ ^= S[(S[i] + S[j]) & 0xff];
|
||||
}
|
||||
crc = ~crc;
|
||||
|
||||
/* Append little-endian CRC32 and encrypt it to produce ICV */
|
||||
pos[0] = crc;
|
||||
pos[1] = crc >> 8;
|
||||
pos[2] = crc >> 16;
|
||||
pos[3] = crc >> 24;
|
||||
for (k = 0; k < 4; k++) {
|
||||
i = (i + 1) & 0xff;
|
||||
j = (j + S[i]) & 0xff;
|
||||
S_SWAP(i, j);
|
||||
*pos++ ^= S[(S[i] + S[j]) & 0xff];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Perform WEP encryption on given skb. 4 bytes of extra space (IV) in the
|
||||
* beginning of the buffer 4 bytes of extra space (ICV) in the end of the
|
||||
* buffer will be added. Both IV and ICV will be transmitted, so the
|
||||
* payload length increases with 8 bytes.
|
||||
*
|
||||
* WEP frame payload: IV + TX key idx, RC4(data), ICV = RC4(CRC32(data))
|
||||
*/
|
||||
int ieee80211_wep_encrypt(struct ieee80211_local *local, struct sk_buff *skb,
|
||||
struct ieee80211_key *key)
|
||||
{
|
||||
u32 klen;
|
||||
u8 *rc4key, *iv;
|
||||
size_t len;
|
||||
|
||||
if (key == NULL || key->alg != ALG_WEP)
|
||||
return -1;
|
||||
|
||||
klen = 3 + key->keylen;
|
||||
rc4key = kmalloc(klen, GFP_ATOMIC);
|
||||
if (rc4key == NULL)
|
||||
return -1;
|
||||
|
||||
iv = ieee80211_wep_add_iv(local, skb, key);
|
||||
if (iv == NULL) {
|
||||
kfree(rc4key);
|
||||
return -1;
|
||||
}
|
||||
|
||||
len = skb->len - (iv + WEP_IV_LEN - skb->data);
|
||||
|
||||
/* Prepend 24-bit IV to RC4 key */
|
||||
memcpy(rc4key, iv, 3);
|
||||
|
||||
/* Copy rest of the WEP key (the secret part) */
|
||||
memcpy(rc4key + 3, key->key, key->keylen);
|
||||
|
||||
/* Add room for ICV */
|
||||
skb_put(skb, WEP_ICV_LEN);
|
||||
|
||||
ieee80211_wep_encrypt_data(rc4key, klen, iv + WEP_IV_LEN, len);
|
||||
|
||||
kfree(rc4key);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Perform WEP decryption using given key. data buffer includes encrypted
|
||||
* payload, including 4-byte ICV, but _not_ IV. data_len must not include ICV.
|
||||
* Return 0 on success and -1 on ICV mismatch. */
|
||||
int ieee80211_wep_decrypt_data(u8 *rc4key, size_t klen, u8 *data,
|
||||
size_t data_len)
|
||||
{
|
||||
u32 i, j, k, crc;
|
||||
u8 S[256];
|
||||
u8 kpos, *pos, crcbuf[WEP_ICV_LEN], *cpos;
|
||||
|
||||
/* Setup RC4 state */
|
||||
for (i = 0; i < 256; i++)
|
||||
S[i] = i;
|
||||
j = 0;
|
||||
kpos = 0;
|
||||
for (i = 0; i < 256; i++) {
|
||||
j = (j + S[i] + rc4key[kpos]) & 0xff;
|
||||
kpos++;
|
||||
if (kpos >= klen)
|
||||
kpos = 0;
|
||||
S_SWAP(i, j);
|
||||
}
|
||||
|
||||
/* Apply RC4 to data and compute CRC32 over decrypted data */
|
||||
pos = data;
|
||||
crc = ~0;
|
||||
i = j = 0;
|
||||
for (k = 0; k < data_len; k++) {
|
||||
i = (i + 1) & 0xff;
|
||||
j = (j + S[i]) & 0xff;
|
||||
S_SWAP(i, j);
|
||||
*pos ^= S[(S[i] + S[j]) & 0xff];
|
||||
crc = crc32_table[(crc ^ *pos++) & 0xff] ^ (crc >> 8);
|
||||
}
|
||||
crc = ~crc;
|
||||
|
||||
/* Decrypt little-endian CRC32 and verify that it matches with the
|
||||
* received ICV */
|
||||
cpos = crcbuf;
|
||||
crcbuf[0] = crc;
|
||||
crcbuf[1] = crc >> 8;
|
||||
crcbuf[2] = crc >> 16;
|
||||
crcbuf[3] = crc >> 24;
|
||||
for (k = 0; k < WEP_ICV_LEN; k++) {
|
||||
i = (i + 1) & 0xff;
|
||||
j = (j + S[i]) & 0xff;
|
||||
S_SWAP(i, j);
|
||||
if (*cpos++ != (*pos++ ^ S[(S[i] + S[j]) & 0xff])) {
|
||||
/* ICV mismatch */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Perform WEP decryption on given skb. Buffer includes whole WEP part of
|
||||
* the frame: IV (4 bytes), encrypted payload (including SNAP header),
|
||||
* ICV (4 bytes). skb->len includes both IV and ICV.
|
||||
*
|
||||
* Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
|
||||
* failure. If frame is OK, IV and ICV will be removed, i.e., decrypted payload
|
||||
* is moved to the beginning of the skb and skb length will be reduced.
|
||||
*/
|
||||
int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb,
|
||||
struct ieee80211_key *key)
|
||||
{
|
||||
u32 klen;
|
||||
u8 *rc4key;
|
||||
u8 keyidx;
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
u16 fc;
|
||||
int hdrlen;
|
||||
size_t len;
|
||||
int ret = 0;
|
||||
|
||||
fc = le16_to_cpu(hdr->frame_control);
|
||||
if (!(fc & WLAN_FC_ISWEP))
|
||||
return -1;
|
||||
|
||||
hdrlen = ieee80211_get_hdrlen(fc);
|
||||
|
||||
if (skb->len < 8 + hdrlen)
|
||||
return -1;
|
||||
|
||||
len = skb->len - hdrlen - 8;
|
||||
|
||||
keyidx = skb->data[hdrlen + 3] >> 6;
|
||||
|
||||
if (key == NULL || keyidx != key->keyidx || key->alg != ALG_WEP)
|
||||
return -1;
|
||||
|
||||
klen = 3 + key->keylen;
|
||||
|
||||
rc4key = kmalloc(klen, GFP_ATOMIC);
|
||||
if (rc4key == NULL)
|
||||
return -1;
|
||||
|
||||
/* Prepend 24-bit IV to RC4 key */
|
||||
memcpy(rc4key, skb->data + hdrlen, 3);
|
||||
|
||||
/* Copy rest of the WEP key (the secret part) */
|
||||
memcpy(rc4key + 3, key->key, key->keylen);
|
||||
|
||||
if (ieee80211_wep_decrypt_data(rc4key, klen,
|
||||
skb->data + hdrlen + WEP_IV_LEN,
|
||||
len)) {
|
||||
printk(KERN_DEBUG "WEP decrypt failed (ICV)\n");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
kfree(rc4key);
|
||||
|
||||
/* Trim ICV */
|
||||
skb_trim(skb, skb->len - WEP_ICV_LEN);
|
||||
|
||||
/* Remove IV */
|
||||
memmove(skb->data + WEP_IV_LEN, skb->data, hdrlen);
|
||||
skb_pull(skb, WEP_IV_LEN);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int ieee80211_wep_get_keyidx(struct sk_buff *skb)
|
||||
{
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
u16 fc;
|
||||
int hdrlen;
|
||||
|
||||
fc = le16_to_cpu(hdr->frame_control);
|
||||
if (!(fc & WLAN_FC_ISWEP))
|
||||
return -1;
|
||||
|
||||
hdrlen = ieee80211_get_hdrlen(fc);
|
||||
|
||||
if (skb->len < 8 + hdrlen)
|
||||
return -1;
|
||||
|
||||
return skb->data[hdrlen + 3] >> 6;
|
||||
}
|
||||
|
||||
|
||||
u8 * ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key)
|
||||
{
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
u16 fc;
|
||||
int hdrlen;
|
||||
u8 *ivpos;
|
||||
u32 iv;
|
||||
|
||||
fc = le16_to_cpu(hdr->frame_control);
|
||||
if (!(fc & WLAN_FC_ISWEP))
|
||||
return NULL;
|
||||
|
||||
hdrlen = ieee80211_get_hdrlen(fc);
|
||||
ivpos = skb->data + hdrlen;
|
||||
iv = (ivpos[0] << 16) | (ivpos[1] << 8) | ivpos[2];
|
||||
|
||||
if (ieee80211_wep_weak_iv(iv, key->keylen))
|
||||
return ivpos;
|
||||
|
||||
return NULL;
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Software WEP encryption implementation
|
||||
* Copyright 2002, Jouni Malinen <jkmaline@cc.hut.fi>
|
||||
* Copyright 2003, Instant802 Networks, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef WEP_H
|
||||
#define WEP_H
|
||||
|
||||
void ieee80211_wep_init(struct ieee80211_local *local);
|
||||
void ieee80211_wep_get_iv(struct ieee80211_local *local,
|
||||
struct ieee80211_key *key, u8 *iv);
|
||||
u8 * ieee80211_wep_add_iv(struct ieee80211_local *local,
|
||||
struct sk_buff *skb,
|
||||
struct ieee80211_key *key);
|
||||
void ieee80211_wep_remove_iv(struct ieee80211_local *local,
|
||||
struct sk_buff *skb,
|
||||
struct ieee80211_key *key);
|
||||
void ieee80211_wep_encrypt_data(u8 *rc4key, size_t klen, u8 *data,
|
||||
size_t data_len);
|
||||
int ieee80211_wep_decrypt_data(u8 *rc4key, size_t klen, u8 *data,
|
||||
size_t data_len);
|
||||
int ieee80211_wep_encrypt(struct ieee80211_local *local, struct sk_buff *skb,
|
||||
struct ieee80211_key *key);
|
||||
int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb,
|
||||
struct ieee80211_key *key);
|
||||
int ieee80211_wep_get_keyidx(struct sk_buff *skb);
|
||||
u8 * ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key);
|
||||
|
||||
#endif /* WEP_H */
|
@ -1,700 +0,0 @@
|
||||
/*
|
||||
* Copyright 2004, Instant802 Networks, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/module.h>
|
||||
#include <net/ip.h>
|
||||
|
||||
#include <net/ieee80211.h>
|
||||
#include "ieee80211_i.h"
|
||||
#include "wme.h"
|
||||
|
||||
#define CHILD_QDISC_OPS pfifo_qdisc_ops
|
||||
|
||||
static inline int WLAN_FC_IS_QOS_DATA(u16 fc)
|
||||
{
|
||||
return (fc & 0x8C) == 0x88;
|
||||
}
|
||||
|
||||
|
||||
ieee80211_txrx_result
|
||||
ieee80211_rx_h_parse_qos(struct ieee80211_txrx_data *rx)
|
||||
{
|
||||
u8 *data = rx->skb->data;
|
||||
int tid;
|
||||
|
||||
/* does the frame have a qos control field? */
|
||||
if (WLAN_FC_IS_QOS_DATA(rx->fc)) {
|
||||
u8 *qc = data + ieee80211_get_hdrlen(rx->fc) - QOS_CONTROL_LEN;
|
||||
/* frame has qos control */
|
||||
tid = qc[0] & QOS_CONTROL_TID_MASK;
|
||||
} else {
|
||||
if (unlikely(WLAN_FC_GET_TYPE(rx->fc) == WLAN_FC_TYPE_MGMT)) {
|
||||
/* Separate TID for management frames */
|
||||
tid = NUM_RX_DATA_QUEUES - 1;
|
||||
} else {
|
||||
/* no qos control present */
|
||||
tid = 0; /* 802.1d - Best Effort */
|
||||
}
|
||||
}
|
||||
#ifdef CONFIG_IEEE80211_DEBUG_COUNTERS
|
||||
I802_DEBUG_INC(rx->local->wme_rx_queue[tid]);
|
||||
if (rx->sta) {
|
||||
I802_DEBUG_INC(rx->sta->wme_rx_queue[tid]);
|
||||
}
|
||||
#endif /* CONFIG_IEEE80211_DEBUG_COUNTERS */
|
||||
|
||||
rx->u.rx.queue = tid;
|
||||
/* Set skb->priority to 1d tag if highest order bit of TID is not set.
|
||||
* For now, set skb->priority to 0 for other cases. */
|
||||
rx->skb->priority = (tid > 7) ? 0 : tid;
|
||||
|
||||
return TXRX_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
ieee80211_txrx_result
|
||||
ieee80211_rx_h_remove_qos_control(struct ieee80211_txrx_data *rx)
|
||||
{
|
||||
u16 fc = rx->fc;
|
||||
u8 *data = rx->skb->data;
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) data;
|
||||
|
||||
if (!WLAN_FC_IS_QOS_DATA(fc))
|
||||
return TXRX_CONTINUE;
|
||||
|
||||
/* remove the qos control field, update frame type and meta-data */
|
||||
memmove(data + 2, data, ieee80211_get_hdrlen(fc) - 2);
|
||||
hdr = (struct ieee80211_hdr *) skb_pull(rx->skb, 2);
|
||||
/* change frame type to non QOS */
|
||||
rx->fc = fc &= ~(WLAN_FC_STYPE_QOS_DATA << 4);
|
||||
hdr->frame_control = cpu_to_le16(fc);
|
||||
|
||||
return TXRX_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
/* maximum number of hardware queues we support. */
|
||||
#define TC_80211_MAX_QUEUES 8
|
||||
|
||||
struct ieee80211_sched_data
|
||||
{
|
||||
struct tcf_proto *filter_list;
|
||||
struct Qdisc *queues[TC_80211_MAX_QUEUES];
|
||||
struct sk_buff_head requeued[TC_80211_MAX_QUEUES];
|
||||
};
|
||||
|
||||
|
||||
/* given a data frame determine the 802.1p/1d tag to use */
|
||||
static inline unsigned classify_1d(struct sk_buff *skb, struct Qdisc *qd)
|
||||
{
|
||||
struct iphdr *ip;
|
||||
int dscp;
|
||||
int offset;
|
||||
|
||||
#ifdef CONFIG_NET_SCHED
|
||||
struct ieee80211_sched_data *q = qdisc_priv(qd);
|
||||
struct tcf_result res = { -1, 0 };
|
||||
|
||||
/* if there is a user set filter list, call out to that */
|
||||
if (q->filter_list) {
|
||||
tc_classify(skb, q->filter_list, &res);
|
||||
if (res.class != -1)
|
||||
return res.class;
|
||||
}
|
||||
#endif /* CONFIG_NET_SCHED */
|
||||
|
||||
/* skb->priority values from 256->263 are magic values to
|
||||
* directly indicate a specific 802.1d priority.
|
||||
* This is used to allow 802.1d priority to be passed directly in
|
||||
* from VLAN tags, etc. */
|
||||
if (skb->priority >= 256 && skb->priority <= 263)
|
||||
return skb->priority - 256;
|
||||
|
||||
/* check there is a valid IP header present */
|
||||
offset = ieee80211_get_hdrlen_from_skb(skb) + 8 /* LLC + proto */;
|
||||
if (skb->protocol != __constant_htons(ETH_P_IP) ||
|
||||
skb->len < offset + sizeof(*ip))
|
||||
return 0;
|
||||
|
||||
ip = (struct iphdr *) (skb->data + offset);
|
||||
|
||||
dscp = ip->tos & 0xfc;
|
||||
switch (dscp) {
|
||||
case 0x20:
|
||||
return 2;
|
||||
case 0x40:
|
||||
return 1;
|
||||
case 0x60:
|
||||
return 3;
|
||||
case 0x80:
|
||||
return 4;
|
||||
case 0xa0:
|
||||
return 5;
|
||||
case 0xc0:
|
||||
return 6;
|
||||
case 0xe0:
|
||||
return 7;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static inline int wme_downgrade_ac(struct sk_buff *skb)
|
||||
{
|
||||
switch (skb->priority) {
|
||||
case 6:
|
||||
case 7:
|
||||
skb->priority = 5; /* VO -> VI */
|
||||
return 0;
|
||||
case 4:
|
||||
case 5:
|
||||
skb->priority = 3; /* VI -> BE */
|
||||
return 0;
|
||||
case 0:
|
||||
case 3:
|
||||
skb->priority = 2; /* BE -> BK */
|
||||
return 0;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* positive return value indicates which queue to use
|
||||
* negative return value indicates to drop the frame */
|
||||
static inline int classify80211(struct sk_buff *skb, struct Qdisc *qd)
|
||||
{
|
||||
struct ieee80211_local *local = qd->dev->priv;
|
||||
struct ieee80211_tx_packet_data *pkt_data =
|
||||
(struct ieee80211_tx_packet_data *) skb->cb;
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
unsigned short fc = le16_to_cpu(hdr->frame_control);
|
||||
int qos;
|
||||
const int ieee802_1d_to_ac[8] = { 2, 3, 3, 2, 1, 1, 0, 0 };
|
||||
|
||||
if (unlikely(pkt_data->magic != IEEE80211_CB_MAGIC))
|
||||
return -1;
|
||||
|
||||
/* see if frame is data or non data frame */
|
||||
if (unlikely(WLAN_FC_GET_TYPE(fc) != WLAN_FC_TYPE_DATA)) {
|
||||
/* management frames go on AC_VO queue, but are sent
|
||||
* without QoS control fields */
|
||||
return IEEE80211_TX_QUEUE_DATA0;
|
||||
}
|
||||
|
||||
if (unlikely(pkt_data->sdata->type == IEEE80211_SUB_IF_TYPE_MGMT)) {
|
||||
/* Data frames from hostapd (mainly, EAPOL) use AC_VO
|
||||
* and they will include QoS control fields if
|
||||
* the target STA is using WME. */
|
||||
skb->priority = 7;
|
||||
return ieee802_1d_to_ac[skb->priority];
|
||||
}
|
||||
|
||||
|
||||
/* is this a QoS frame? */
|
||||
qos = fc & (WLAN_FC_STYPE_QOS_DATA << 4);
|
||||
|
||||
|
||||
if (!qos) {
|
||||
skb->priority = 0; /* required for correct WPA/11i MIC */
|
||||
return ieee802_1d_to_ac[skb->priority];
|
||||
}
|
||||
|
||||
/* use the data classifier to determine what 802.1d tag the
|
||||
* data frame has */
|
||||
skb->priority = classify_1d(skb, qd);
|
||||
|
||||
|
||||
/* incase we are a client verify acm is not set for this ac */
|
||||
for (; unlikely(local->wmm_acm & BIT(skb->priority)); )
|
||||
{
|
||||
if (wme_downgrade_ac(skb)) {
|
||||
/* No AC with lower priority has acm=0,
|
||||
* drop packet. */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* look up which queue to use for frames with this 1d tag */
|
||||
return ieee802_1d_to_ac[skb->priority];
|
||||
}
|
||||
|
||||
|
||||
static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
|
||||
{
|
||||
struct ieee80211_local *local = qd->dev->priv;
|
||||
struct ieee80211_sched_data *q = qdisc_priv(qd);
|
||||
struct ieee80211_tx_packet_data *pkt_data =
|
||||
(struct ieee80211_tx_packet_data *) skb->cb;
|
||||
struct ieee80211_tx_control *control = &pkt_data->control;
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
unsigned short fc = le16_to_cpu(hdr->frame_control);
|
||||
struct Qdisc *qdisc;
|
||||
int err, queue;
|
||||
|
||||
if (control->requeue) {
|
||||
skb_queue_tail(&q->requeued[control->queue], skb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
queue = classify80211(skb, qd);
|
||||
|
||||
/* now we know the 1d priority, fill in the QoS header if there is one */
|
||||
if (WLAN_FC_IS_QOS_DATA(fc)) {
|
||||
struct qos_control *qc = (struct qos_control *) (skb->data + ieee80211_get_hdrlen(fc) - 2);
|
||||
u8 *p = (u8 *) qc;
|
||||
*p++ = 0; /* do this due to gcc's lack of optimization on bitfield ops */
|
||||
*p = 0;
|
||||
qc->tag1d = skb->priority;
|
||||
if (local->wifi_wme_noack_test)
|
||||
qc->ack_policy = 1;
|
||||
}
|
||||
|
||||
if (unlikely(queue >= local->hw->queues)) {
|
||||
#if 0
|
||||
if (net_ratelimit()) {
|
||||
printk(KERN_DEBUG "%s - queue=%d (hw does not "
|
||||
"support) -> %d\n",
|
||||
__func__, queue, local->hw->queues - 1);
|
||||
}
|
||||
#endif
|
||||
queue = local->hw->queues - 1;
|
||||
}
|
||||
|
||||
if (unlikely(queue < 0)) {
|
||||
kfree_skb(skb);
|
||||
err = NET_XMIT_DROP;
|
||||
} else {
|
||||
control->queue = (unsigned int) queue;
|
||||
qdisc = q->queues[queue];
|
||||
err = qdisc->enqueue(skb, qdisc);
|
||||
if (err == NET_XMIT_SUCCESS) {
|
||||
qd->q.qlen++;
|
||||
qd->bstats.bytes += skb->len;
|
||||
qd->bstats.packets++;
|
||||
return NET_XMIT_SUCCESS;
|
||||
}
|
||||
}
|
||||
qd->qstats.drops++;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
/* TODO: clean up the cases where master_hard_start_xmit
|
||||
* returns non 0 - it shouldn't ever do that. Once done we
|
||||
* can remove this function */
|
||||
static int wme_qdiscop_requeue(struct sk_buff *skb, struct Qdisc* qd)
|
||||
{
|
||||
struct ieee80211_sched_data *q = qdisc_priv(qd);
|
||||
struct ieee80211_tx_packet_data *pkt_data =
|
||||
(struct ieee80211_tx_packet_data *) skb->cb;
|
||||
struct Qdisc *qdisc;
|
||||
int err;
|
||||
|
||||
/* we recorded which queue to use earlier! */
|
||||
qdisc = q->queues[pkt_data->control.queue];
|
||||
|
||||
if ((err = qdisc->ops->requeue(skb, qdisc)) == 0) {
|
||||
qd->q.qlen++;
|
||||
return 0;
|
||||
}
|
||||
qd->qstats.drops++;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
static struct sk_buff *wme_qdiscop_dequeue(struct Qdisc* qd)
|
||||
{
|
||||
struct ieee80211_sched_data *q = qdisc_priv(qd);
|
||||
struct net_device *dev = qd->dev;
|
||||
struct ieee80211_local *local = dev->priv;
|
||||
struct ieee80211_hw *hw = local->hw;
|
||||
struct ieee80211_tx_queue_stats stats;
|
||||
struct sk_buff *skb;
|
||||
struct Qdisc *qdisc;
|
||||
int queue;
|
||||
|
||||
/* find which hardware queues have space in them */
|
||||
hw->get_tx_stats(dev, &stats);
|
||||
|
||||
/* check all the h/w queues in numeric/priority order */
|
||||
for (queue = 0; queue < hw->queues; queue++) {
|
||||
/* see if there is room in this hardware queue */
|
||||
if (stats.data[queue].len >= stats.data[queue].limit)
|
||||
continue;
|
||||
|
||||
/* there is space - try and get a frame */
|
||||
skb = skb_dequeue(&q->requeued[queue]);
|
||||
if (skb)
|
||||
return skb;
|
||||
|
||||
qdisc = q->queues[queue];
|
||||
skb = qdisc->dequeue(qdisc);
|
||||
if (skb) {
|
||||
qd->q.qlen--;
|
||||
return skb;
|
||||
}
|
||||
}
|
||||
/* returning a NULL here when all the h/w queues are full means we
|
||||
* never need to call netif_stop_queue in the driver */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static void wme_qdiscop_reset(struct Qdisc* qd)
|
||||
{
|
||||
struct ieee80211_sched_data *q = qdisc_priv(qd);
|
||||
struct ieee80211_local *local = qd->dev->priv;
|
||||
struct ieee80211_hw *hw = local->hw;
|
||||
int queue;
|
||||
|
||||
/* QUESTION: should we have some hardware flush functionality here? */
|
||||
|
||||
for (queue = 0; queue < hw->queues; queue++) {
|
||||
skb_queue_purge(&q->requeued[queue]);
|
||||
qdisc_reset(q->queues[queue]);
|
||||
}
|
||||
qd->q.qlen = 0;
|
||||
}
|
||||
|
||||
|
||||
static void wme_qdiscop_destroy(struct Qdisc* qd)
|
||||
{
|
||||
struct ieee80211_sched_data *q = qdisc_priv(qd);
|
||||
struct ieee80211_local *local = qd->dev->priv;
|
||||
struct ieee80211_hw *hw = local->hw;
|
||||
struct tcf_proto *tp;
|
||||
int queue;
|
||||
|
||||
while ((tp = q->filter_list) != NULL) {
|
||||
q->filter_list = tp->next;
|
||||
tp->ops->destroy(tp);
|
||||
}
|
||||
|
||||
for (queue=0; queue < hw->queues; queue++) {
|
||||
skb_queue_purge(&q->requeued[queue]);
|
||||
qdisc_destroy(q->queues[queue]);
|
||||
q->queues[queue] = &noop_qdisc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* called whenever parameters are updated on existing qdisc */
|
||||
static int wme_qdiscop_tune(struct Qdisc *qd, struct rtattr *opt)
|
||||
{
|
||||
/* struct ieee80211_sched_data *q = qdisc_priv(qd);
|
||||
*/
|
||||
/* check our options block is the right size */
|
||||
/* copy any options to our local structure */
|
||||
/* Ignore options block for now - always use static mapping
|
||||
struct tc_ieee80211_qopt *qopt = RTA_DATA(opt);
|
||||
|
||||
if (opt->rta_len < RTA_LENGTH(sizeof(*qopt)))
|
||||
return -EINVAL;
|
||||
memcpy(q->tag2queue, qopt->tag2queue, sizeof(qopt->tag2queue));
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* called during initial creation of qdisc on device */
|
||||
static int wme_qdiscop_init(struct Qdisc *qd, struct rtattr *opt)
|
||||
{
|
||||
struct ieee80211_sched_data *q = qdisc_priv(qd);
|
||||
struct net_device *dev = qd->dev;
|
||||
struct ieee80211_local *local = dev->priv;
|
||||
int queues = local->hw->queues;
|
||||
int err = 0, i;
|
||||
|
||||
/* check this device is an ieee80211 master type device */
|
||||
if (dev->type != ARPHRD_IEEE80211)
|
||||
return -EINVAL;
|
||||
|
||||
/* check that there is no qdisc currently attached to device
|
||||
* this ensures that we will be the root qdisc. (I can't find a better
|
||||
* way to test this explicitly) */
|
||||
if (dev->qdisc_sleeping != &noop_qdisc)
|
||||
return -EINVAL;
|
||||
|
||||
if (qd->flags & TCQ_F_INGRESS)
|
||||
return -EINVAL;
|
||||
|
||||
/* if options were passed in, set them */
|
||||
if (opt) {
|
||||
err = wme_qdiscop_tune(qd, opt);
|
||||
}
|
||||
|
||||
/* create child queues */
|
||||
for (i = 0; i < queues; i++) {
|
||||
skb_queue_head_init(&q->requeued[i]);
|
||||
q->queues[i] = qdisc_create_dflt(qd->dev, &CHILD_QDISC_OPS);
|
||||
if (q->queues[i] == 0) {
|
||||
q->queues[i] = &noop_qdisc;
|
||||
printk(KERN_ERR "%s child qdisc %i creation failed", dev->name, i);
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int wme_qdiscop_dump(struct Qdisc *qd, struct sk_buff *skb)
|
||||
{
|
||||
/* struct ieee80211_sched_data *q = qdisc_priv(qd);
|
||||
unsigned char *p = skb->tail;
|
||||
struct tc_ieee80211_qopt opt;
|
||||
|
||||
memcpy(&opt.tag2queue, q->tag2queue, TC_80211_MAX_TAG + 1);
|
||||
RTA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
|
||||
*/ return skb->len;
|
||||
/*
|
||||
rtattr_failure:
|
||||
skb_trim(skb, p - skb->data);*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static int wme_classop_graft(struct Qdisc *qd, unsigned long arg,
|
||||
struct Qdisc *new, struct Qdisc **old)
|
||||
{
|
||||
struct ieee80211_sched_data *q = qdisc_priv(qd);
|
||||
struct ieee80211_local *local = qd->dev->priv;
|
||||
struct ieee80211_hw *hw = local->hw;
|
||||
unsigned long queue = arg - 1;
|
||||
|
||||
if (queue >= hw->queues)
|
||||
return -EINVAL;
|
||||
|
||||
if (new == NULL)
|
||||
new = &noop_qdisc;
|
||||
|
||||
sch_tree_lock(qd);
|
||||
*old = q->queues[queue];
|
||||
q->queues[queue] = new;
|
||||
qdisc_reset(*old);
|
||||
sch_tree_unlock(qd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static struct Qdisc *
|
||||
wme_classop_leaf(struct Qdisc *qd, unsigned long arg)
|
||||
{
|
||||
struct ieee80211_sched_data *q = qdisc_priv(qd);
|
||||
struct ieee80211_local *local = qd->dev->priv;
|
||||
struct ieee80211_hw *hw = local->hw;
|
||||
unsigned long queue = arg - 1;
|
||||
|
||||
if (queue >= hw->queues)
|
||||
return NULL;
|
||||
|
||||
return q->queues[queue];
|
||||
}
|
||||
|
||||
|
||||
static unsigned long wme_classop_get(struct Qdisc *qd, u32 classid)
|
||||
{
|
||||
struct ieee80211_local *local = qd->dev->priv;
|
||||
struct ieee80211_hw *hw = local->hw;
|
||||
unsigned long queue = TC_H_MIN(classid);
|
||||
|
||||
if (queue - 1 >= hw->queues)
|
||||
return 0;
|
||||
|
||||
return queue;
|
||||
}
|
||||
|
||||
|
||||
static unsigned long wme_classop_bind(struct Qdisc *qd, unsigned long parent,
|
||||
u32 classid)
|
||||
{
|
||||
return wme_classop_get(qd, classid);
|
||||
}
|
||||
|
||||
|
||||
static void wme_classop_put(struct Qdisc *q, unsigned long cl)
|
||||
{
|
||||
/* printk(KERN_DEBUG "entering %s\n", __func__); */
|
||||
}
|
||||
|
||||
|
||||
static int wme_classop_change(struct Qdisc *qd, u32 handle, u32 parent,
|
||||
struct rtattr **tca, unsigned long *arg)
|
||||
{
|
||||
unsigned long cl = *arg;
|
||||
struct ieee80211_local *local = qd->dev->priv;
|
||||
struct ieee80211_hw *hw = local->hw;
|
||||
/* printk(KERN_DEBUG "entering %s\n", __func__); */
|
||||
|
||||
if (cl - 1 > hw->queues)
|
||||
return -ENOENT;
|
||||
|
||||
/* TODO: put code to program hardware queue parameters here,
|
||||
* to allow programming from tc command line */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* we don't support deleting hardware queues
|
||||
* when we add WMM-SA support - TSPECs may be deleted here */
|
||||
static int wme_classop_delete(struct Qdisc *qd, unsigned long cl)
|
||||
{
|
||||
struct ieee80211_local *local = qd->dev->priv;
|
||||
struct ieee80211_hw *hw = local->hw;
|
||||
/* printk(KERN_DEBUG "entering %s\n", __func__); */
|
||||
|
||||
if (cl - 1 > hw->queues)
|
||||
return -ENOENT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int wme_classop_dump_class(struct Qdisc *qd, unsigned long cl,
|
||||
struct sk_buff *skb, struct tcmsg *tcm)
|
||||
{
|
||||
struct ieee80211_sched_data *q = qdisc_priv(qd);
|
||||
struct ieee80211_local *local = qd->dev->priv;
|
||||
struct ieee80211_hw *hw = local->hw;
|
||||
/* printk(KERN_DEBUG "entering %s\n", __func__); */
|
||||
|
||||
if (cl - 1 > hw->queues)
|
||||
return -ENOENT;
|
||||
tcm->tcm_handle = TC_H_MIN(cl);
|
||||
tcm->tcm_parent = qd->handle;
|
||||
tcm->tcm_info = q->queues[cl-1]->handle; /* do we need this? */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void wme_classop_walk(struct Qdisc *qd, struct qdisc_walker *arg)
|
||||
{
|
||||
struct ieee80211_local *local = qd->dev->priv;
|
||||
struct ieee80211_hw *hw = local->hw;
|
||||
int queue;
|
||||
/* printk(KERN_DEBUG "entering %s\n", __func__); */
|
||||
|
||||
if (arg->stop)
|
||||
return;
|
||||
|
||||
for (queue = 0; queue < hw->queues; queue++) {
|
||||
if (arg->count < arg->skip) {
|
||||
arg->count++;
|
||||
continue;
|
||||
}
|
||||
/* we should return classids for our internal queues here
|
||||
* as well as the external ones */
|
||||
if (arg->fn(qd, queue+1, arg) < 0) {
|
||||
arg->stop = 1;
|
||||
break;
|
||||
}
|
||||
arg->count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static struct tcf_proto ** wme_classop_find_tcf(struct Qdisc *qd,
|
||||
unsigned long cl)
|
||||
{
|
||||
struct ieee80211_sched_data *q = qdisc_priv(qd);
|
||||
/* printk("entering %s\n", __func__); */
|
||||
|
||||
if (cl)
|
||||
return NULL;
|
||||
|
||||
return &q->filter_list;
|
||||
}
|
||||
|
||||
|
||||
/* this qdisc is classful (i.e. has classes, some of which may have leaf qdiscs attached)
|
||||
* - these are the operations on the classes */
|
||||
static struct Qdisc_class_ops class_ops =
|
||||
{
|
||||
.graft = wme_classop_graft,
|
||||
.leaf = wme_classop_leaf,
|
||||
|
||||
.get = wme_classop_get,
|
||||
.put = wme_classop_put,
|
||||
.change = wme_classop_change,
|
||||
.delete = wme_classop_delete,
|
||||
.walk = wme_classop_walk,
|
||||
|
||||
.tcf_chain = wme_classop_find_tcf,
|
||||
.bind_tcf = wme_classop_bind,
|
||||
.unbind_tcf = wme_classop_put,
|
||||
|
||||
.dump = wme_classop_dump_class,
|
||||
};
|
||||
|
||||
|
||||
/* queueing discipline operations */
|
||||
static struct Qdisc_ops wme_qdisc_ops =
|
||||
{
|
||||
.next = NULL,
|
||||
.cl_ops = &class_ops,
|
||||
.id = "ieee80211",
|
||||
.priv_size = sizeof(struct ieee80211_sched_data),
|
||||
|
||||
.enqueue = wme_qdiscop_enqueue,
|
||||
.dequeue = wme_qdiscop_dequeue,
|
||||
.requeue = wme_qdiscop_requeue,
|
||||
.drop = NULL, /* drop not needed since we are always the root qdisc */
|
||||
|
||||
.init = wme_qdiscop_init,
|
||||
.reset = wme_qdiscop_reset,
|
||||
.destroy = wme_qdiscop_destroy,
|
||||
.change = wme_qdiscop_tune,
|
||||
|
||||
.dump = wme_qdiscop_dump,
|
||||
};
|
||||
|
||||
|
||||
void ieee80211_install_qdisc(struct net_device *dev)
|
||||
{
|
||||
struct Qdisc *qdisc;
|
||||
|
||||
qdisc = qdisc_create_dflt(dev, &wme_qdisc_ops);
|
||||
if (qdisc == NULL) {
|
||||
printk(KERN_ERR "%s: qdisc installation failed\n", dev->name);
|
||||
return;
|
||||
}
|
||||
|
||||
/* same handle as would be allocated by qdisc_alloc_handle() */
|
||||
qdisc->handle = 0x80010000;
|
||||
|
||||
write_lock(&qdisc_tree_lock);
|
||||
list_add_tail(&qdisc->list, &dev->qdisc_list);
|
||||
dev->qdisc_sleeping = qdisc;
|
||||
write_unlock(&qdisc_tree_lock);
|
||||
}
|
||||
|
||||
|
||||
int ieee80211_wme_register(void)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
#ifdef CONFIG_NET_SCHED
|
||||
err = register_qdisc(&wme_qdisc_ops);
|
||||
#endif
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
void ieee80211_wme_unregister(void)
|
||||
{
|
||||
#ifdef CONFIG_NET_SCHED
|
||||
unregister_qdisc(&wme_qdisc_ops);
|
||||
#endif
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* IEEE 802.11 driver (80211.o) - QoS datatypes
|
||||
* Copyright 2004, Instant802 Networks, Inc.
|
||||
* Copyright 2005, Devicescape Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
#include <net/pkt_sched.h>
|
||||
|
||||
#define QOS_CONTROL_LEN 2
|
||||
|
||||
#define QOS_CONTROL_ACK_POLICY_NORMAL 0
|
||||
#define QOS_CONTROL_ACK_POLICY_NOACK 1
|
||||
|
||||
#define QOS_CONTROL_TID_MASK 0x0f
|
||||
#define QOS_CONTROL_ACK_POLICY_SHIFT 5
|
||||
|
||||
/* This bit field structure should not be used; it can cause compiler to
|
||||
* generate unaligned accesses and inefficient code. */
|
||||
struct qos_control {
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
u8 tag1d:3, /* bits 0-2 */
|
||||
reserved1:1,
|
||||
eosp:1,
|
||||
ack_policy:2,
|
||||
reserved2:1;
|
||||
#elif defined (__BIG_ENDIAN_BITFIELD)
|
||||
u8 reserved2:1,
|
||||
ack_policy:2,
|
||||
eosp:1,
|
||||
reserved1:1,
|
||||
tag1d:3; /* bits 0-2 */
|
||||
#else
|
||||
#error "Please fix <asm/byteorder.h>"
|
||||
#endif
|
||||
u8 reserved;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
ieee80211_txrx_result
|
||||
ieee80211_rx_h_parse_qos(struct ieee80211_txrx_data *rx);
|
||||
|
||||
ieee80211_txrx_result
|
||||
ieee80211_rx_h_remove_qos_control(struct ieee80211_txrx_data *rx);
|
||||
|
||||
void ieee80211_install_qdisc(struct net_device *dev);
|
||||
|
||||
int ieee80211_wme_register(void);
|
||||
void ieee80211_wme_unregister(void);
|
||||
|
@ -1,825 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2004, Instant802 Networks, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/wireless.h>
|
||||
#include <net/iw_handler.h>
|
||||
|
||||
#include <net/ieee80211.h>
|
||||
#include <net/ieee80211_common.h>
|
||||
#include "ieee80211_i.h"
|
||||
#include "michael.h"
|
||||
#include "tkip.h"
|
||||
#include "aes_ccm.h"
|
||||
#include "wpa.h"
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
#include "hostapd_ioctl.h"
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
|
||||
|
||||
#define MICHAEL_MIC_HWACCEL
|
||||
|
||||
|
||||
int ieee80211_get_hdr_info(const struct sk_buff *skb, u8 **sa, u8 **da,
|
||||
u8 *qos_tid, u8 **data, size_t *data_len)
|
||||
{
|
||||
struct ieee80211_hdr *hdr;
|
||||
size_t hdrlen;
|
||||
u16 fc;
|
||||
int a4_included;
|
||||
u8 *pos;
|
||||
|
||||
hdr = (struct ieee80211_hdr *) skb->data;
|
||||
fc = le16_to_cpu(hdr->frame_control);
|
||||
|
||||
hdrlen = 24;
|
||||
if ((fc & (WLAN_FC_FROMDS | WLAN_FC_TODS)) ==
|
||||
(WLAN_FC_FROMDS | WLAN_FC_TODS)) {
|
||||
hdrlen += ETH_ALEN;
|
||||
*sa = hdr->addr4;
|
||||
*da = hdr->addr3;
|
||||
} else if (fc & WLAN_FC_FROMDS) {
|
||||
*sa = hdr->addr3;
|
||||
*da = hdr->addr1;
|
||||
} else if (fc & WLAN_FC_TODS) {
|
||||
*sa = hdr->addr2;
|
||||
*da = hdr->addr3;
|
||||
} else {
|
||||
*sa = hdr->addr2;
|
||||
*da = hdr->addr1;
|
||||
}
|
||||
|
||||
if (fc & 0x80)
|
||||
hdrlen += 2;
|
||||
|
||||
*data = skb->data + hdrlen;
|
||||
*data_len = skb->len - hdrlen;
|
||||
|
||||
a4_included = (fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) ==
|
||||
(WLAN_FC_TODS | WLAN_FC_FROMDS);
|
||||
if (WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA &&
|
||||
WLAN_FC_GET_STYPE(fc) & 0x08) {
|
||||
pos = (u8 *) &hdr->addr4;
|
||||
if (a4_included)
|
||||
pos += 6;
|
||||
*qos_tid = pos[0] & 0x0f;
|
||||
*qos_tid |= 0x80; /* qos_included flag */
|
||||
} else
|
||||
*qos_tid = 0;
|
||||
|
||||
return skb->len < hdrlen ? -1 : 0;
|
||||
}
|
||||
|
||||
|
||||
ieee80211_txrx_result
|
||||
ieee80211_tx_h_michael_mic_add(struct ieee80211_txrx_data *tx)
|
||||
{
|
||||
u8 *data, *sa, *da, *key, *mic, qos_tid;
|
||||
size_t data_len;
|
||||
u16 fc;
|
||||
struct sk_buff *skb = tx->skb;
|
||||
int authenticator;
|
||||
#if defined(CONFIG_HOSTAPD_WPA_TESTING) || defined(MICHAEL_MIC_HWACCEL)
|
||||
int wpa_test = 0;
|
||||
#endif
|
||||
|
||||
fc = tx->fc;
|
||||
|
||||
if (!tx->key || tx->key->alg != ALG_TKIP || skb->len < 24 ||
|
||||
!WLAN_FC_DATA_PRESENT(fc))
|
||||
return TXRX_CONTINUE;
|
||||
|
||||
if (ieee80211_get_hdr_info(skb, &sa, &da, &qos_tid, &data, &data_len))
|
||||
return TXRX_DROP;
|
||||
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
if ((tx->sta && tx->sta->wpa_trigger & WPA_TRIGGER_FAIL_TX_MIC) ||
|
||||
(!tx->u.tx.unicast &&
|
||||
tx->local->wpa_trigger & WPA_TRIGGER_FAIL_TX_MIC)) {
|
||||
wpa_test = 1;
|
||||
}
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
|
||||
#ifdef MICHAEL_MIC_HWACCEL
|
||||
if (!tx->key->force_sw_encrypt && !tx->local->conf.sw_decrypt &&
|
||||
!tx->fragmented && !wpa_test) {
|
||||
/* hwaccel - with no need for preallocated room for Michael MIC
|
||||
*/
|
||||
return TXRX_CONTINUE;
|
||||
}
|
||||
#endif /* MICHAEL_MIC_HWACCEL */
|
||||
|
||||
if (skb_tailroom(skb) < MICHAEL_MIC_LEN) {
|
||||
I802_DEBUG_INC(tx->local->tx_expand_skb_head);
|
||||
if (unlikely(pskb_expand_head(skb, TKIP_IV_LEN,
|
||||
MICHAEL_MIC_LEN + TKIP_ICV_LEN,
|
||||
GFP_ATOMIC))) {
|
||||
printk(KERN_DEBUG "%s: failed to allocate more memory "
|
||||
"for Michael MIC\n", tx->dev->name);
|
||||
return TXRX_DROP;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
authenticator = fc & WLAN_FC_FROMDS; /* FIX */
|
||||
#else
|
||||
authenticator = 1;
|
||||
#endif
|
||||
key = &tx->key->key[authenticator ? ALG_TKIP_TEMP_AUTH_TX_MIC_KEY :
|
||||
ALG_TKIP_TEMP_AUTH_RX_MIC_KEY];
|
||||
mic = skb_put(skb, MICHAEL_MIC_LEN);
|
||||
michael_mic(key, da, sa, qos_tid & 0x0f, data, data_len, mic);
|
||||
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
if (tx->sta && tx->sta->wpa_trigger & WPA_TRIGGER_FAIL_TX_MIC) {
|
||||
printk(KERN_INFO "%s: WPA testing - corrupting TX Michael MIC "
|
||||
"for STA " MACSTR "\n",
|
||||
tx->dev->name, MAC2STR(tx->sta->addr));
|
||||
tx->u.tx.control->key_idx = HW_KEY_IDX_INVALID;
|
||||
tx->sta->wpa_trigger &= ~WPA_TRIGGER_FAIL_TX_MIC;
|
||||
tx->wpa_test = 1;
|
||||
mic[0]++;
|
||||
} else if (!tx->u.tx.unicast &&
|
||||
tx->local->wpa_trigger & WPA_TRIGGER_FAIL_TX_MIC) {
|
||||
printk(KERN_INFO "%s: WPA testing - corrupting TX Michael MIC "
|
||||
"for Group Key\n", tx->dev->name);
|
||||
tx->u.tx.control->key_idx = HW_KEY_IDX_INVALID;
|
||||
tx->local->wpa_trigger &= ~WPA_TRIGGER_FAIL_TX_MIC;
|
||||
tx->wpa_test = 1;
|
||||
mic[0]++;
|
||||
}
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
|
||||
return TXRX_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
ieee80211_txrx_result
|
||||
ieee80211_rx_h_michael_mic_verify(struct ieee80211_txrx_data *rx)
|
||||
{
|
||||
u8 *data, *sa, *da, *key = NULL, qos_tid;
|
||||
size_t data_len;
|
||||
u16 fc;
|
||||
u8 mic[MICHAEL_MIC_LEN];
|
||||
struct sk_buff *skb = rx->skb;
|
||||
int authenticator = 1, wpa_test = 0;
|
||||
|
||||
fc = rx->fc;
|
||||
|
||||
/* If device handles decryption totally, skip this check */
|
||||
if (rx->local->hw->device_hides_wep ||
|
||||
rx->local->hw->device_strips_mic)
|
||||
return TXRX_CONTINUE;
|
||||
|
||||
if (!rx->key || rx->key->alg != ALG_TKIP ||
|
||||
!(rx->fc & WLAN_FC_ISWEP) || !WLAN_FC_DATA_PRESENT(fc))
|
||||
return TXRX_CONTINUE;
|
||||
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
if (rx->sta && rx->sta->wpa_trigger & WPA_TRIGGER_FAIL_RX_MIC) {
|
||||
wpa_test = 1;
|
||||
}
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
|
||||
#ifdef MICHAEL_MIC_HWACCEL
|
||||
if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
|
||||
!rx->key->force_sw_encrypt && !rx->local->conf.sw_decrypt) {
|
||||
if (rx->local->hw->wep_include_iv) {
|
||||
if (skb->len < MICHAEL_MIC_LEN)
|
||||
return TXRX_DROP;
|
||||
}
|
||||
/* Need to verify Michael MIC sometimes in software even when
|
||||
* hwaccel is used. Atheros ar5212: fragmented frames and QoS
|
||||
* frames. */
|
||||
if (!rx->fragmented && !wpa_test)
|
||||
goto remove_mic;
|
||||
}
|
||||
#endif /* MICHAEL_MIC_HWACCEL */
|
||||
|
||||
if (ieee80211_get_hdr_info(skb, &sa, &da, &qos_tid, &data, &data_len)
|
||||
|| data_len < MICHAEL_MIC_LEN)
|
||||
return TXRX_DROP;
|
||||
|
||||
data_len -= MICHAEL_MIC_LEN;
|
||||
|
||||
#if 0
|
||||
authenticator = fc & WLAN_FC_TODS; /* FIX */
|
||||
#else
|
||||
authenticator = 1;
|
||||
#endif
|
||||
key = &rx->key->key[authenticator ? ALG_TKIP_TEMP_AUTH_RX_MIC_KEY :
|
||||
ALG_TKIP_TEMP_AUTH_TX_MIC_KEY];
|
||||
michael_mic(key, da, sa, qos_tid & 0x0f, data, data_len, mic);
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
if (rx->sta && rx->sta->wpa_trigger & WPA_TRIGGER_FAIL_RX_MIC) {
|
||||
printk(KERN_INFO "%s: WPA testing - corrupting RX Michael MIC "
|
||||
"for STA " MACSTR "\n",
|
||||
rx->dev->name, MAC2STR(rx->sta->addr));
|
||||
rx->sta->wpa_trigger &= ~WPA_TRIGGER_FAIL_RX_MIC;
|
||||
mic[0]++;
|
||||
}
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
if (memcmp(mic, data + data_len, MICHAEL_MIC_LEN) != 0 || wpa_test) {
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
int i;
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
printk(KERN_DEBUG "%s: invalid Michael MIC in data frame from "
|
||||
MACSTR "\n", rx->dev->name, MAC2STR(sa));
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
printk(KERN_DEBUG " received");
|
||||
for (i = 0; i < MICHAEL_MIC_LEN; i++)
|
||||
printk(" %02x", data[data_len + i]);
|
||||
printk(" expected");
|
||||
for (i = 0; i < MICHAEL_MIC_LEN; i++)
|
||||
printk(" %02x", mic[i]);
|
||||
printk("\n");
|
||||
printk(KERN_DEBUG " SA=" MACSTR " DA=" MACSTR " key",
|
||||
MAC2STR(sa), MAC2STR(da));
|
||||
for (i = 0; i < 8; i++)
|
||||
printk(" %02x", key[i]);
|
||||
printk(" (%d)\n", authenticator);
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
|
||||
do {
|
||||
struct ieee80211_hdr *hdr;
|
||||
union iwreq_data wrqu;
|
||||
char *buf = kmalloc(128, GFP_ATOMIC);
|
||||
if (buf == NULL)
|
||||
break;
|
||||
|
||||
/* TODO: needed parameters: count, key type, TSC */
|
||||
hdr = (struct ieee80211_hdr *) skb->data;
|
||||
sprintf(buf, "MLME-MICHAELMICFAILURE.indication("
|
||||
"keyid=%d %scast addr=" MACSTR ")",
|
||||
rx->key->keyidx,
|
||||
hdr->addr1[0] & 0x01 ? "broad" : "uni",
|
||||
MAC2STR(hdr->addr2));
|
||||
memset(&wrqu, 0, sizeof(wrqu));
|
||||
wrqu.data.length = strlen(buf);
|
||||
wireless_send_event(rx->dev, IWEVCUSTOM, &wrqu, buf);
|
||||
kfree(buf);
|
||||
} while (0);
|
||||
|
||||
ieee80211_rx_mgmt(rx->dev, rx->skb, rx->u.rx.status,
|
||||
ieee80211_msg_michael_mic_failure);
|
||||
|
||||
return TXRX_QUEUED;
|
||||
}
|
||||
|
||||
#ifdef MICHAEL_MIC_HWACCEL
|
||||
remove_mic:
|
||||
#endif /* MICHAEL_MIC_HWACCEL */
|
||||
/* remove Michael MIC from payload */
|
||||
skb_trim(skb, skb->len - MICHAEL_MIC_LEN);
|
||||
|
||||
return TXRX_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
static int tkip_encrypt_skb(struct ieee80211_txrx_data *tx,
|
||||
struct sk_buff *skb, int test)
|
||||
{
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
struct ieee80211_key *key = tx->key;
|
||||
int hdrlen, len, tailneed;
|
||||
u16 fc;
|
||||
u8 *pos;
|
||||
|
||||
fc = le16_to_cpu(hdr->frame_control);
|
||||
hdrlen = ieee80211_get_hdrlen(fc);
|
||||
len = skb->len - hdrlen;
|
||||
|
||||
tailneed = (!tx->key->force_sw_encrypt && !tx->local->conf.sw_decrypt)
|
||||
? 0 : TKIP_ICV_LEN;
|
||||
if ((skb_headroom(skb) < TKIP_IV_LEN ||
|
||||
skb_tailroom(skb) < tailneed)) {
|
||||
I802_DEBUG_INC(tx->local->tx_expand_skb_head);
|
||||
if (unlikely(pskb_expand_head(skb, TKIP_IV_LEN, tailneed,
|
||||
GFP_ATOMIC)))
|
||||
return -1;
|
||||
}
|
||||
|
||||
pos = skb_push(skb, TKIP_IV_LEN);
|
||||
memmove(pos, pos + TKIP_IV_LEN, hdrlen);
|
||||
pos += hdrlen;
|
||||
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
if (test & WPA_TRIGGER_TX_REPLAY)
|
||||
goto skip_iv_inc;
|
||||
iv_inc:
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
|
||||
/* Increase IV for the frame */
|
||||
key->u.tkip.iv16++;
|
||||
if (key->u.tkip.iv16 == 0)
|
||||
key->u.tkip.iv32++;
|
||||
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
if (test & WPA_TRIGGER_TX_SKIP_SEQ) {
|
||||
test = 0;
|
||||
goto iv_inc;
|
||||
}
|
||||
skip_iv_inc:
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
|
||||
if (!tx->key->force_sw_encrypt && !tx->local->conf.sw_decrypt
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
&& !tx->wpa_test
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
) {
|
||||
/* hwaccel - with preallocated room for IV */
|
||||
|
||||
ieee80211_tkip_add_iv(pos, key,
|
||||
(u8) (key->u.tkip.iv16 >> 8),
|
||||
(u8) (((key->u.tkip.iv16 >> 8) | 0x20) &
|
||||
0x7f),
|
||||
(u8) key->u.tkip.iv16);
|
||||
|
||||
tx->u.tx.control->key_idx = tx->key->hw_key_idx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Add room for ICV */
|
||||
skb_put(skb, TKIP_ICV_LEN);
|
||||
|
||||
hdr = (struct ieee80211_hdr *) skb->data;
|
||||
ieee80211_tkip_encrypt_data(key, pos, len, hdr->addr2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ieee80211_txrx_result
|
||||
ieee80211_tx_h_tkip_encrypt(struct ieee80211_txrx_data *tx)
|
||||
{
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data;
|
||||
u16 fc;
|
||||
struct ieee80211_key *key = tx->key;
|
||||
struct sk_buff *skb = tx->skb;
|
||||
int wpa_test = 0, test = 0;
|
||||
|
||||
fc = le16_to_cpu(hdr->frame_control);
|
||||
|
||||
if (!key || key->alg != ALG_TKIP || !WLAN_FC_DATA_PRESENT(fc))
|
||||
return TXRX_CONTINUE;
|
||||
|
||||
tx->u.tx.control->icv_len = TKIP_ICV_LEN;
|
||||
tx->u.tx.control->iv_len = TKIP_IV_LEN;
|
||||
ieee80211_tx_set_iswep(tx);
|
||||
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
if ((tx->sta && tx->sta->wpa_trigger & WPA_TRIGGER_FAIL_TX_ICV) ||
|
||||
(!tx->u.tx.unicast &&
|
||||
tx->local->wpa_trigger & WPA_TRIGGER_FAIL_TX_ICV)) {
|
||||
wpa_test = 1;
|
||||
}
|
||||
|
||||
if (tx->sta) {
|
||||
test = tx->sta->wpa_trigger;
|
||||
tx->sta->wpa_trigger &=
|
||||
~(WPA_TRIGGER_TX_REPLAY | WPA_TRIGGER_TX_REPLAY_FRAG |
|
||||
WPA_TRIGGER_TX_SKIP_SEQ);
|
||||
} else {
|
||||
test = tx->local->wpa_trigger;
|
||||
tx->local->wpa_trigger &=
|
||||
~(WPA_TRIGGER_TX_REPLAY | WPA_TRIGGER_TX_REPLAY_FRAG |
|
||||
WPA_TRIGGER_TX_SKIP_SEQ);
|
||||
}
|
||||
if (test &
|
||||
(WPA_TRIGGER_TX_REPLAY | WPA_TRIGGER_TX_REPLAY_FRAG |
|
||||
WPA_TRIGGER_TX_SKIP_SEQ)) {
|
||||
printk(KERN_INFO "%s: WPA testing - TKIP TX packet number "
|
||||
"%s%s%s%s\n", tx->dev->name,
|
||||
tx->sta ? "[UNICAST]" : "[MULTICAST]",
|
||||
test & WPA_TRIGGER_TX_REPLAY ? "[REPLAY]" : "",
|
||||
test & WPA_TRIGGER_TX_REPLAY_FRAG ?
|
||||
"[REPLAY FRAG]" : "",
|
||||
test & WPA_TRIGGER_TX_SKIP_SEQ ? "[SKIP SEQ]" : "");
|
||||
}
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
|
||||
if (!tx->key->force_sw_encrypt && !tx->local->conf.sw_decrypt &&
|
||||
!tx->local->hw->wep_include_iv && !wpa_test) {
|
||||
/* hwaccel - with no need for preallocated room for IV/ICV */
|
||||
tx->u.tx.control->key_idx = tx->key->hw_key_idx;
|
||||
return TXRX_CONTINUE;
|
||||
}
|
||||
|
||||
if (tkip_encrypt_skb(tx, skb, test) < 0)
|
||||
return TXRX_DROP;
|
||||
|
||||
if (tx->u.tx.extra_frag) {
|
||||
int i;
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
if (test & WPA_TRIGGER_TX_REPLAY_FRAG)
|
||||
test |= WPA_TRIGGER_TX_REPLAY;
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
for (i = 0; i < tx->u.tx.num_extra_frag; i++) {
|
||||
if (tkip_encrypt_skb(tx, tx->u.tx.extra_frag[i], test)
|
||||
< 0)
|
||||
return TXRX_DROP;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
if (tx->sta && tx->sta->wpa_trigger & WPA_TRIGGER_FAIL_TX_ICV) {
|
||||
printk(KERN_INFO "%s: WPA testing - corrupting TX TKIP ICV "
|
||||
"for STA " MACSTR "\n",
|
||||
tx->dev->name, MAC2STR(tx->sta->addr));
|
||||
tx->u.tx.control->key_idx = HW_KEY_IDX_INVALID;
|
||||
tx->sta->wpa_trigger &= ~WPA_TRIGGER_FAIL_TX_ICV;
|
||||
skb->data[skb->len - 1]++;
|
||||
} else if (!tx->u.tx.unicast &&
|
||||
tx->local->wpa_trigger & WPA_TRIGGER_FAIL_TX_ICV) {
|
||||
printk(KERN_INFO "%s: WPA testing - corrupting TX TKIP ICV "
|
||||
"for Group Key\n",
|
||||
tx->dev->name);
|
||||
tx->u.tx.control->key_idx = HW_KEY_IDX_INVALID;
|
||||
tx->local->wpa_trigger &= ~WPA_TRIGGER_FAIL_TX_ICV;
|
||||
skb->data[skb->len - 1]++;
|
||||
}
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
|
||||
return TXRX_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
ieee80211_txrx_result
|
||||
ieee80211_rx_h_tkip_decrypt(struct ieee80211_txrx_data *rx)
|
||||
{
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
|
||||
u16 fc;
|
||||
int hdrlen, res, hwaccel = 0, wpa_test = 0;
|
||||
struct ieee80211_key *key = rx->key;
|
||||
struct sk_buff *skb = rx->skb;
|
||||
|
||||
fc = le16_to_cpu(hdr->frame_control);
|
||||
hdrlen = ieee80211_get_hdrlen(fc);
|
||||
|
||||
if (!rx->key || rx->key->alg != ALG_TKIP ||
|
||||
!(rx->fc & WLAN_FC_ISWEP) ||
|
||||
WLAN_FC_GET_TYPE(rx->fc) != WLAN_FC_TYPE_DATA)
|
||||
return TXRX_CONTINUE;
|
||||
|
||||
if (!rx->sta || skb->len - hdrlen < 12)
|
||||
return TXRX_DROP;
|
||||
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
if (rx->sta && rx->sta->wpa_trigger & WPA_TRIGGER_FAIL_RX_ICV) {
|
||||
printk(KERN_INFO "%s: WPA testing - corrupting RX TKIP ICV "
|
||||
"for STA " MACSTR "\n",
|
||||
rx->dev->name, MAC2STR(rx->sta->addr));
|
||||
rx->sta->wpa_trigger &= ~WPA_TRIGGER_FAIL_RX_ICV;
|
||||
skb->data[skb->len - 1]++;
|
||||
wpa_test = 1;
|
||||
}
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
|
||||
if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
|
||||
!rx->key->force_sw_encrypt && !rx->local->conf.sw_decrypt) {
|
||||
if (!rx->local->hw->wep_include_iv) {
|
||||
/* Hardware takes care of all processing, including
|
||||
* replay protection, so no need to continue here. */
|
||||
return TXRX_CONTINUE;
|
||||
}
|
||||
|
||||
/* let TKIP code verify IV, but skip decryption */
|
||||
hwaccel = 1;
|
||||
}
|
||||
|
||||
res = ieee80211_tkip_decrypt_data(key, skb->data + hdrlen,
|
||||
skb->len - hdrlen, rx->sta->addr,
|
||||
hwaccel, rx->u.rx.queue);
|
||||
if (res != TKIP_DECRYPT_OK || wpa_test) {
|
||||
printk(KERN_DEBUG "%s: TKIP decrypt failed for RX frame from "
|
||||
MACSTR " (res=%d)\n",
|
||||
rx->dev->name, MAC2STR(rx->sta->addr), res);
|
||||
return TXRX_DROP;
|
||||
}
|
||||
|
||||
/* Trim ICV */
|
||||
skb_trim(skb, skb->len - TKIP_ICV_LEN);
|
||||
|
||||
/* Remove IV */
|
||||
memmove(skb->data + TKIP_IV_LEN, skb->data, hdrlen);
|
||||
skb_pull(skb, TKIP_IV_LEN);
|
||||
|
||||
return TXRX_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
|
||||
int encrypted)
|
||||
{
|
||||
u16 fc;
|
||||
int a4_included, qos_included;
|
||||
u8 qos_tid, *fc_pos, *data, *sa, *da;
|
||||
int len_a;
|
||||
size_t data_len;
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
|
||||
fc_pos = (u8 *) &hdr->frame_control;
|
||||
fc = fc_pos[0] ^ (fc_pos[1] << 8);
|
||||
a4_included = (fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) ==
|
||||
(WLAN_FC_TODS | WLAN_FC_FROMDS);
|
||||
|
||||
ieee80211_get_hdr_info(skb, &sa, &da, &qos_tid, &data, &data_len);
|
||||
data_len -= CCMP_HDR_LEN + (encrypted ? CCMP_MIC_LEN : 0);
|
||||
if (qos_tid & 0x80) {
|
||||
qos_included = 1;
|
||||
qos_tid &= 0x0f;
|
||||
} else
|
||||
qos_included = 0;
|
||||
/* First block, b_0 */
|
||||
|
||||
b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
|
||||
/* Nonce: QoS Priority | A2 | PN */
|
||||
b_0[1] = qos_tid;
|
||||
memcpy(&b_0[2], hdr->addr2, 6);
|
||||
memcpy(&b_0[8], pn, CCMP_PN_LEN);
|
||||
/* l(m) */
|
||||
b_0[14] = (data_len >> 8) & 0xff;
|
||||
b_0[15] = data_len & 0xff;
|
||||
|
||||
|
||||
/* AAD (extra authenticate-only data) / masked 802.11 header
|
||||
* FC | A1 | A2 | A3 | SC | [A4] | [QC] */
|
||||
|
||||
len_a = a4_included ? 28 : 22;
|
||||
if (qos_included)
|
||||
len_a += 2;
|
||||
|
||||
aad[0] = 0; /* (len_a >> 8) & 0xff; */
|
||||
aad[1] = len_a & 0xff;
|
||||
/* Mask FC: zero subtype b4 b5 b6 */
|
||||
aad[2] = fc_pos[0] & ~(BIT(4) | BIT(5) | BIT(6));
|
||||
/* Retry, PwrMgt, MoreData; set Protected */
|
||||
aad[3] = (fc_pos[1] & ~(BIT(3) | BIT(4) | BIT(5))) | BIT(6);
|
||||
memcpy(&aad[4], &hdr->addr1, 18);
|
||||
|
||||
/* Mask Seq#, leave Frag# */
|
||||
aad[22] = *((u8 *) &hdr->seq_ctrl) & 0x0f;
|
||||
aad[23] = 0;
|
||||
if (a4_included) {
|
||||
memcpy(&aad[24], hdr->addr4, 6);
|
||||
aad[30] = 0;
|
||||
aad[31] = 0;
|
||||
} else
|
||||
memset(&aad[24], 0, 8);
|
||||
if (qos_included) {
|
||||
u8 *dpos = &aad[a4_included ? 30 : 24];
|
||||
|
||||
/* Mask QoS Control field */
|
||||
dpos[0] = qos_tid;
|
||||
dpos[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static inline void ccmp_pn2hdr(u8 *hdr, u8 *pn, int key_id)
|
||||
{
|
||||
hdr[0] = pn[5];
|
||||
hdr[1] = pn[4];
|
||||
hdr[2] = 0;
|
||||
hdr[3] = 0x20 | (key_id << 6);
|
||||
hdr[4] = pn[3];
|
||||
hdr[5] = pn[2];
|
||||
hdr[6] = pn[1];
|
||||
hdr[7] = pn[0];
|
||||
}
|
||||
|
||||
|
||||
static inline int ccmp_hdr2pn(u8 *pn, u8 *hdr)
|
||||
{
|
||||
pn[0] = hdr[7];
|
||||
pn[1] = hdr[6];
|
||||
pn[2] = hdr[5];
|
||||
pn[3] = hdr[4];
|
||||
pn[4] = hdr[1];
|
||||
pn[5] = hdr[0];
|
||||
return (hdr[3] >> 6) & 0x03;
|
||||
}
|
||||
|
||||
|
||||
static int ccmp_encrypt_skb(struct ieee80211_txrx_data *tx,
|
||||
struct sk_buff *skb, int test)
|
||||
{
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
struct ieee80211_key *key = tx->key;
|
||||
int hdrlen, len, tailneed;
|
||||
u16 fc;
|
||||
u8 *pos, *pn;
|
||||
u8 b_0[AES_BLOCK_LEN], aad[2 * AES_BLOCK_LEN];
|
||||
int i;
|
||||
|
||||
fc = le16_to_cpu(hdr->frame_control);
|
||||
hdrlen = ieee80211_get_hdrlen(fc);
|
||||
len = skb->len - hdrlen;
|
||||
|
||||
tailneed = (!tx->key->force_sw_encrypt && !tx->local->conf.sw_decrypt)
|
||||
? 0 : CCMP_MIC_LEN;
|
||||
|
||||
if ((skb_headroom(skb) < CCMP_HDR_LEN ||
|
||||
skb_tailroom(skb) < tailneed)) {
|
||||
I802_DEBUG_INC(tx->local->tx_expand_skb_head);
|
||||
if (unlikely(pskb_expand_head(skb, CCMP_HDR_LEN, tailneed,
|
||||
GFP_ATOMIC)))
|
||||
return -1;
|
||||
}
|
||||
|
||||
pos = skb_push(skb, CCMP_HDR_LEN);
|
||||
memmove(pos, pos + CCMP_HDR_LEN, hdrlen);
|
||||
hdr = (struct ieee80211_hdr *) pos;
|
||||
pos += hdrlen;
|
||||
|
||||
/* PN = PN + 1 */
|
||||
pn = key->u.ccmp.tx_pn;
|
||||
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
if (test & WPA_TRIGGER_TX_REPLAY)
|
||||
goto skip_pn_inc;
|
||||
pn_inc:
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
|
||||
for (i = CCMP_PN_LEN - 1; i >= 0; i--) {
|
||||
pn[i]++;
|
||||
if (pn[i])
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
if (test & WPA_TRIGGER_TX_SKIP_SEQ) {
|
||||
test = 0;
|
||||
goto pn_inc;
|
||||
}
|
||||
skip_pn_inc:
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
|
||||
ccmp_pn2hdr(pos, pn, key->keyidx);
|
||||
|
||||
if (!tx->key->force_sw_encrypt && !tx->local->conf.sw_decrypt) {
|
||||
/* hwaccel - with preallocated room for CCMP header */
|
||||
tx->u.tx.control->key_idx = tx->key->hw_key_idx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
pos += CCMP_HDR_LEN;
|
||||
ccmp_special_blocks(skb, pn, b_0, aad, 0);
|
||||
ieee80211_aes_ccm_encrypt(key->u.ccmp.aes_state, b_0, aad, pos, len,
|
||||
pos, skb_put(skb, CCMP_MIC_LEN));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ieee80211_txrx_result
|
||||
ieee80211_tx_h_ccmp_encrypt(struct ieee80211_txrx_data *tx)
|
||||
{
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data;
|
||||
struct ieee80211_key *key = tx->key;
|
||||
u16 fc;
|
||||
struct sk_buff *skb = tx->skb;
|
||||
int test = 0;
|
||||
|
||||
fc = le16_to_cpu(hdr->frame_control);
|
||||
|
||||
if (!key || key->alg != ALG_CCMP || !WLAN_FC_DATA_PRESENT(fc))
|
||||
return TXRX_CONTINUE;
|
||||
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
if (tx->sta) {
|
||||
test = tx->sta->wpa_trigger;
|
||||
tx->sta->wpa_trigger = 0;
|
||||
} else {
|
||||
test = tx->local->wpa_trigger;
|
||||
tx->local->wpa_trigger = 0;
|
||||
}
|
||||
if (test &
|
||||
(WPA_TRIGGER_TX_REPLAY | WPA_TRIGGER_TX_REPLAY_FRAG |
|
||||
WPA_TRIGGER_TX_SKIP_SEQ)) {
|
||||
printk(KERN_INFO "%s: WPA testing - CCMP TX packet number "
|
||||
"%s%s%s%s\n", tx->dev->name,
|
||||
tx->sta ? "[UNICAST]" : "[MULTICAST]",
|
||||
test & WPA_TRIGGER_TX_REPLAY ? "[REPLAY]" : "",
|
||||
test & WPA_TRIGGER_TX_REPLAY_FRAG ?
|
||||
"[REPLAY FRAG]" : "",
|
||||
test & WPA_TRIGGER_TX_SKIP_SEQ ? "[SKIP SEQ]" : "");
|
||||
}
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
|
||||
tx->u.tx.control->icv_len = CCMP_MIC_LEN;
|
||||
tx->u.tx.control->iv_len = CCMP_HDR_LEN;
|
||||
ieee80211_tx_set_iswep(tx);
|
||||
|
||||
if (!tx->key->force_sw_encrypt && !tx->local->conf.sw_decrypt &&
|
||||
!tx->local->hw->wep_include_iv) {
|
||||
/* hwaccel - with no need for preallocated room for CCMP "
|
||||
* header or MIC fields */
|
||||
tx->u.tx.control->key_idx = tx->key->hw_key_idx;
|
||||
return TXRX_CONTINUE;
|
||||
}
|
||||
|
||||
if (ccmp_encrypt_skb(tx, skb, test) < 0)
|
||||
return TXRX_DROP;
|
||||
|
||||
if (tx->u.tx.extra_frag) {
|
||||
int i;
|
||||
#ifdef CONFIG_HOSTAPD_WPA_TESTING
|
||||
if (test & WPA_TRIGGER_TX_REPLAY_FRAG)
|
||||
test |= WPA_TRIGGER_TX_REPLAY;
|
||||
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
|
||||
for (i = 0; i < tx->u.tx.num_extra_frag; i++) {
|
||||
if (ccmp_encrypt_skb(tx, tx->u.tx.extra_frag[i], test)
|
||||
< 0)
|
||||
return TXRX_DROP;
|
||||
}
|
||||
}
|
||||
|
||||
return TXRX_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
ieee80211_txrx_result
|
||||
ieee80211_rx_h_ccmp_decrypt(struct ieee80211_txrx_data *rx)
|
||||
{
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
|
||||
u16 fc;
|
||||
int hdrlen;
|
||||
struct ieee80211_key *key = rx->key;
|
||||
struct sk_buff *skb = rx->skb;
|
||||
u8 b_0[AES_BLOCK_LEN], aad[2 * AES_BLOCK_LEN];
|
||||
u8 pn[CCMP_PN_LEN];
|
||||
int data_len;
|
||||
|
||||
fc = le16_to_cpu(hdr->frame_control);
|
||||
hdrlen = ieee80211_get_hdrlen(fc);
|
||||
|
||||
if (!rx->key || rx->key->alg != ALG_CCMP ||
|
||||
!(rx->fc & WLAN_FC_ISWEP) ||
|
||||
WLAN_FC_GET_TYPE(rx->fc) != WLAN_FC_TYPE_DATA)
|
||||
return TXRX_CONTINUE;
|
||||
|
||||
data_len = skb->len - hdrlen - CCMP_HDR_LEN - CCMP_MIC_LEN;
|
||||
if (!rx->sta || data_len < 0)
|
||||
return TXRX_DROP;
|
||||
|
||||
if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
|
||||
!rx->key->force_sw_encrypt && !rx->local->conf.sw_decrypt &&
|
||||
!rx->local->hw->wep_include_iv)
|
||||
return TXRX_CONTINUE;
|
||||
|
||||
(void) ccmp_hdr2pn(pn, skb->data + hdrlen);
|
||||
|
||||
if (memcmp(pn, key->u.ccmp.rx_pn[rx->u.rx.queue], CCMP_PN_LEN) <= 0) {
|
||||
#ifdef CONFIG_IEEE80211_DEBUG
|
||||
u8 *ppn = key->u.ccmp.rx_pn[rx->u.rx.queue];
|
||||
printk(KERN_DEBUG "%s: CCMP replay detected for RX frame from "
|
||||
MACSTR " (RX PN %02x%02x%02x%02x%02x%02x <= prev. PN "
|
||||
"%02x%02x%02x%02x%02x%02x)\n", rx->dev->name,
|
||||
MAC2STR(rx->sta->addr),
|
||||
pn[0], pn[1], pn[2], pn[3], pn[4], pn[5],
|
||||
ppn[0], ppn[1], ppn[2], ppn[3], ppn[4], ppn[5]);
|
||||
#endif /* CONFIG_IEEE80211_DEBUG */
|
||||
key->u.ccmp.replays++;
|
||||
return TXRX_DROP;
|
||||
}
|
||||
|
||||
if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
|
||||
!rx->key->force_sw_encrypt && !rx->local->conf.sw_decrypt) {
|
||||
/* hwaccel has already decrypted frame and verified MIC */
|
||||
} else {
|
||||
ccmp_special_blocks(skb, pn, b_0, aad, 1);
|
||||
|
||||
if (ieee80211_aes_ccm_decrypt(
|
||||
key->u.ccmp.aes_state, b_0, aad,
|
||||
skb->data + hdrlen + CCMP_HDR_LEN, data_len,
|
||||
skb->data + skb->len - CCMP_MIC_LEN,
|
||||
skb->data + hdrlen + CCMP_HDR_LEN)) {
|
||||
printk(KERN_DEBUG "%s: CCMP decrypt failed for RX "
|
||||
"frame from " MACSTR "\n", rx->dev->name,
|
||||
MAC2STR(rx->sta->addr));
|
||||
return TXRX_DROP;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(key->u.ccmp.rx_pn[rx->u.rx.queue], pn, CCMP_PN_LEN);
|
||||
|
||||
/* Remove CCMP header and MIC */
|
||||
skb_trim(skb, skb->len - CCMP_MIC_LEN);
|
||||
memmove(skb->data + CCMP_HDR_LEN, skb->data, hdrlen);
|
||||
skb_pull(skb, CCMP_HDR_LEN);
|
||||
|
||||
return TXRX_CONTINUE;
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2004, Instant802 Networks, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef WPA_H
|
||||
#define WPA_H
|
||||
|
||||
ieee80211_txrx_result
|
||||
ieee80211_tx_h_michael_mic_add(struct ieee80211_txrx_data *tx);
|
||||
ieee80211_txrx_result
|
||||
ieee80211_rx_h_michael_mic_verify(struct ieee80211_txrx_data *rx);
|
||||
|
||||
ieee80211_txrx_result
|
||||
ieee80211_tx_h_tkip_encrypt(struct ieee80211_txrx_data *tx);
|
||||
ieee80211_txrx_result
|
||||
ieee80211_rx_h_tkip_decrypt(struct ieee80211_txrx_data *rx);
|
||||
|
||||
ieee80211_txrx_result
|
||||
ieee80211_tx_h_ccmp_encrypt(struct ieee80211_txrx_data *tx);
|
||||
ieee80211_txrx_result
|
||||
ieee80211_rx_h_ccmp_decrypt(struct ieee80211_txrx_data *rx);
|
||||
|
||||
int ieee80211_get_hdr_info(const struct sk_buff *skb, u8 **sa, u8 **da,
|
||||
u8 *qos_tid, u8 **data, size_t *data_len);
|
||||
|
||||
#endif /* WPA_H */
|
Loading…
Reference in New Issue
Block a user