Added hostapd compilation from sources withing chroot, nano pi m1

This commit is contained in:
Igor Pecovnik 2016-04-16 20:50:12 +02:00
parent 694c3936c8
commit 062c1b86b3
13 changed files with 3498 additions and 9 deletions

View File

@ -0,0 +1,11 @@
# H3 quad core 1Gb SoC Wifi
KERNEL_TARGET="default,next,dev"
LINUXFAMILY=sun8i
BOOTCONFIG=FriendlyARM_NanoPi_M1_defconfig
MODULES="#gpio_sunxi #w1-sunxi #w1-gpio #w1-therm #ap6211"
MODULES_NEXT="brcmfmac"
CPUMIN="240000"
CPUMAX="1200000"
GOVERNOR=interactive
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,default"

View File

@ -0,0 +1,316 @@
# Example hostapd build time configuration
#
# This file lists the configuration options that are used when building the
# hostapd binary. All lines starting with # are ignored. Configuration option
# lines must be commented out complete, if they are not to be included, i.e.,
# just setting VARIABLE=n is not disabling that variable.
#
# This file is included in Makefile, so variables like CFLAGS and LIBS can also
# be modified from here. In most cass, these lines should use += in order not
# to override previous values of the variables.
# Driver interface for Host AP driver
CONFIG_DRIVER_HOSTAP=y
# Driver interface for wired authenticator
#CONFIG_DRIVER_WIRED=y
# Driver interface for drivers using the nl80211 kernel interface
CONFIG_DRIVER_NL80211=y
# driver_nl80211.c requires libnl. If you are compiling it yourself
# you may need to point hostapd to your version of libnl.
#
CFLAGS += -I$/usr/include/libnl3/
LIBS += -L$/usr/include/libnl3/
# Use libnl v2.0 (or 3.0) libraries.
CONFIG_LIBNL20=y
# Use libnl 3.2 libraries (if this is selected, CONFIG_LIBNL20 is ignored)
CONFIG_LIBNL32=y
# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
#CONFIG_DRIVER_BSD=y
#CFLAGS += -I/usr/local/include
#LIBS += -L/usr/local/lib
#LIBS_p += -L/usr/local/lib
#LIBS_c += -L/usr/local/lib
# Driver interface for no driver (e.g., RADIUS server only)
#CONFIG_DRIVER_NONE=y
# IEEE 802.11F/IAPP
CONFIG_IAPP=y
# WPA2/IEEE 802.11i RSN pre-authentication
CONFIG_RSN_PREAUTH=y
# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
CONFIG_PEERKEY=y
# IEEE 802.11w (management frame protection)
CONFIG_IEEE80211W=y
# Integrated EAP server
CONFIG_EAP=y
# EAP Re-authentication Protocol (ERP) in integrated EAP server
CONFIG_ERP=y
# EAP-MD5 for the integrated EAP server
CONFIG_EAP_MD5=y
# EAP-TLS for the integrated EAP server
CONFIG_EAP_TLS=y
# EAP-MSCHAPv2 for the integrated EAP server
CONFIG_EAP_MSCHAPV2=y
# EAP-PEAP for the integrated EAP server
CONFIG_EAP_PEAP=y
# EAP-GTC for the integrated EAP server
CONFIG_EAP_GTC=y
# EAP-TTLS for the integrated EAP server
CONFIG_EAP_TTLS=y
# EAP-SIM for the integrated EAP server
#CONFIG_EAP_SIM=y
# EAP-AKA for the integrated EAP server
#CONFIG_EAP_AKA=y
# EAP-AKA' for the integrated EAP server
# This requires CONFIG_EAP_AKA to be enabled, too.
#CONFIG_EAP_AKA_PRIME=y
# EAP-PAX for the integrated EAP server
#CONFIG_EAP_PAX=y
# EAP-PSK for the integrated EAP server (this is _not_ needed for WPA-PSK)
#CONFIG_EAP_PSK=y
# EAP-pwd for the integrated EAP server (secure authentication with a password)
#CONFIG_EAP_PWD=y
# EAP-SAKE for the integrated EAP server
#CONFIG_EAP_SAKE=y
# EAP-GPSK for the integrated EAP server
#CONFIG_EAP_GPSK=y
# Include support for optional SHA256 cipher suite in EAP-GPSK
#CONFIG_EAP_GPSK_SHA256=y
# EAP-FAST for the integrated EAP server
# Note: If OpenSSL is used as the TLS library, OpenSSL 1.0 or newer is needed
# for EAP-FAST support. Older OpenSSL releases would need to be patched, e.g.,
# with openssl-0.9.8x-tls-extensions.patch, to add the needed functions.
#CONFIG_EAP_FAST=y
# Wi-Fi Protected Setup (WPS)
#CONFIG_WPS=y
# Enable UPnP support for external WPS Registrars
#CONFIG_WPS_UPNP=y
# Enable WPS support with NFC config method
#CONFIG_WPS_NFC=y
# EAP-IKEv2
#CONFIG_EAP_IKEV2=y
# Trusted Network Connect (EAP-TNC)
#CONFIG_EAP_TNC=y
# EAP-EKE for the integrated EAP server
#CONFIG_EAP_EKE=y
# PKCS#12 (PFX) support (used to read private key and certificate file from
# a file that usually has extension .p12 or .pfx)
CONFIG_PKCS12=y
# RADIUS authentication server. This provides access to the integrated EAP
# server from external hosts using RADIUS.
#CONFIG_RADIUS_SERVER=y
# Build IPv6 support for RADIUS operations
CONFIG_IPV6=y
# IEEE Std 802.11r-2008 (Fast BSS Transition)
#CONFIG_IEEE80211R=y
# Use the hostapd's IEEE 802.11 authentication (ACL), but without
# the IEEE 802.11 Management capability (e.g., FreeBSD/net80211)
#CONFIG_DRIVER_RADIUS_ACL=y
# IEEE 802.11n (High Throughput) support
CONFIG_IEEE80211N=y
# Wireless Network Management (IEEE Std 802.11v-2011)
# Note: This is experimental and not complete implementation.
#CONFIG_WNM=y
# IEEE 802.11ac (Very High Throughput) support
CONFIG_IEEE80211AC=y
# Remove debugging code that is printing out debug messages to stdout.
# This can be used to reduce the size of the hostapd considerably if debugging
# code is not needed.
#CONFIG_NO_STDOUT_DEBUG=y
# Add support for writing debug log to a file: -f /tmp/hostapd.log
# Disabled by default.
#CONFIG_DEBUG_FILE=y
# Add support for sending all debug messages (regardless of debug verbosity)
# to the Linux kernel tracing facility. This helps debug the entire stack by
# making it easy to record everything happening from the driver up into the
# same file, e.g., using trace-cmd.
#CONFIG_DEBUG_LINUX_TRACING=y
# Remove support for RADIUS accounting
#CONFIG_NO_ACCOUNTING=y
# Remove support for RADIUS
#CONFIG_NO_RADIUS=y
# Remove support for VLANs
#CONFIG_NO_VLAN=y
# Enable support for fully dynamic VLANs. This enables hostapd to
# automatically create bridge and VLAN interfaces if necessary.
#CONFIG_FULL_DYNAMIC_VLAN=y
# Use netlink-based kernel API for VLAN operations instead of ioctl()
# Note: This requires libnl 3.1 or newer.
#CONFIG_VLAN_NETLINK=y
# Remove support for dumping internal state through control interface commands
# This can be used to reduce binary size at the cost of disabling a debugging
# option.
#CONFIG_NO_DUMP_STATE=y
# Enable tracing code for developer debugging
# This tracks use of memory allocations and other registrations and reports
# incorrect use with a backtrace of call (or allocation) location.
#CONFIG_WPA_TRACE=y
# For BSD, comment out these.
#LIBS += -lexecinfo
#LIBS_p += -lexecinfo
#LIBS_c += -lexecinfo
# Use libbfd to get more details for developer debugging
# This enables use of libbfd to get more detailed symbols for the backtraces
# generated by CONFIG_WPA_TRACE=y.
#CONFIG_WPA_TRACE_BFD=y
# For BSD, comment out these.
#LIBS += -lbfd -liberty -lz
#LIBS_p += -lbfd -liberty -lz
#LIBS_c += -lbfd -liberty -lz
# hostapd depends on strong random number generation being available from the
# operating system. os_get_random() function is used to fetch random data when
# needed, e.g., for key generation. On Linux and BSD systems, this works by
# reading /dev/urandom. It should be noted that the OS entropy pool needs to be
# properly initialized before hostapd is started. This is important especially
# on embedded devices that do not have a hardware random number generator and
# may by default start up with minimal entropy available for random number
# generation.
#
# As a safety net, hostapd is by default trying to internally collect
# additional entropy for generating random data to mix in with the data
# fetched from the OS. This by itself is not considered to be very strong, but
# it may help in cases where the system pool is not initialized properly.
# However, it is very strongly recommended that the system pool is initialized
# with enough entropy either by using hardware assisted random number
# generator or by storing state over device reboots.
#
# hostapd can be configured to maintain its own entropy store over restarts to
# enhance random number generation. This is not perfect, but it is much more
# secure than using the same sequence of random numbers after every reboot.
# This can be enabled with -e<entropy file> command line option. The specified
# file needs to be readable and writable by hostapd.
#
# If the os_get_random() is known to provide strong random data (e.g., on
# Linux/BSD, the board in question is known to have reliable source of random
# data from /dev/urandom), the internal hostapd random pool can be disabled.
# This will save some in binary size and CPU use. However, this should only be
# considered for builds that are known to be used on devices that meet the
# requirements described above.
#CONFIG_NO_RANDOM_POOL=y
# Select TLS implementation
# openssl = OpenSSL (default)
# gnutls = GnuTLS
# internal = Internal TLSv1 implementation (experimental)
# none = Empty template
#CONFIG_TLS=openssl
# TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.1)
# can be enabled to get a stronger construction of messages when block ciphers
# are used.
#CONFIG_TLSV11=y
# TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.2)
# can be enabled to enable use of stronger crypto algorithms.
#CONFIG_TLSV12=y
# If CONFIG_TLS=internal is used, additional library and include paths are
# needed for LibTomMath. Alternatively, an integrated, minimal version of
# LibTomMath can be used. See beginning of libtommath.c for details on benefits
# and drawbacks of this option.
#CONFIG_INTERNAL_LIBTOMMATH=y
#ifndef CONFIG_INTERNAL_LIBTOMMATH
#LTM_PATH=/usr/src/libtommath-0.39
#CFLAGS += -I$(LTM_PATH)
#LIBS += -L$(LTM_PATH)
#LIBS_p += -L$(LTM_PATH)
#endif
# At the cost of about 4 kB of additional binary size, the internal LibTomMath
# can be configured to include faster routines for exptmod, sqr, and div to
# speed up DH and RSA calculation considerably
#CONFIG_INTERNAL_LIBTOMMATH_FAST=y
# Interworking (IEEE 802.11u)
# This can be used to enable functionality to improve interworking with
# external networks.
#CONFIG_INTERWORKING=y
# Hotspot 2.0
#CONFIG_HS20=y
# Enable SQLite database support in hlr_auc_gw, EAP-SIM DB, and eap_user_file
#CONFIG_SQLITE=y
# Testing options
# This can be used to enable some testing options (see also the example
# configuration file) that are really useful only for testing clients that
# connect to this hostapd. These options allow, for example, to drop a
# certain percentage of probe requests or auth/(re)assoc frames.
#
#CONFIG_TESTING_OPTIONS=y
# Automatic Channel Selection
# This will allow hostapd to pick the channel automatically when channel is set
# to "acs_survey" or "0". Eventually, other ACS algorithms can be added in
# similar way.
#
# Automatic selection is currently only done through initialization, later on
# we hope to do background checks to keep us moving to more ideal channels as
# time goes by. ACS is currently only supported through the nl80211 driver and
# your driver must have survey dump capability that is filled by the driver
# during scanning.
#
# You can customize the ACS survey algorithm with the hostapd.conf variable
# acs_num_scans.
#
# Supported ACS drivers:
# * ath9k
# * ath5k
# * ath10k
#
# For more details refer to:
# http://wireless.kernel.org/en/users/Documentation/acs
#
#CONFIG_ACS=y

View File

@ -0,0 +1,209 @@
# Example hostapd build time configuration
#
# This file lists the configuration options that are used when building the
# hostapd binary. All lines starting with # are ignored. Configuration option
# lines must be commented out complete, if they are not to be included, i.e.,
# just setting VARIABLE=n is not disabling that variable.
#
# This file is included in Makefile, so variables like CFLAGS and LIBS can also
# be modified from here. In most cass, these lines should use += in order not
# to override previous values of the variables.
# Driver interface for Host AP driver
#CONFIG_DRIVER_HOSTAP=y
CONFIG_DRIVER_RTW=y
# Driver interface for wired authenticator
#CONFIG_DRIVER_WIRED=y
# Driver interface for madwifi driver
#CONFIG_DRIVER_MADWIFI=y
#CFLAGS += -I../../madwifi # change to the madwifi source directory
# Driver interface for drivers using the nl80211 kernel interface
#CONFIG_DRIVER_NL80211=y
# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
#CONFIG_DRIVER_BSD=y
#CONFIG_SUPPORT_RTW_DRIVER=y
#CFLAGS += -I/usr/local/include
#LIBS += -L/usr/local/lib
#LIBS_p += -L/usr/local/lib
#LIBS_c += -L/usr/local/lib
# Driver interface for no driver (e.g., RADIUS server only)
#CONFIG_DRIVER_NONE=y
# IEEE 802.11F/IAPP
#CONFIG_IAPP=y
# WPA2/IEEE 802.11i RSN pre-authentication
#CONFIG_RSN_PREAUTH=y
# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
#CONFIG_PEERKEY=y
# IEEE 802.11w (management frame protection)
# This version is an experimental implementation based on IEEE 802.11w/D1.0
# draft and is subject to change since the standard has not yet been finalized.
# Driver support is also needed for IEEE 802.11w.
#CONFIG_IEEE80211W=y
# Integrated EAP server
CONFIG_EAP=y
# EAP-MD5 for the integrated EAP server
#CONFIG_EAP_MD5=y
# EAP-TLS for the integrated EAP server
#CONFIG_EAP_TLS=y
# EAP-MSCHAPv2 for the integrated EAP server
#CONFIG_EAP_MSCHAPV2=y
# EAP-PEAP for the integrated EAP server
#CONFIG_EAP_PEAP=y
# EAP-GTC for the integrated EAP server
#CONFIG_EAP_GTC=y
# EAP-TTLS for the integrated EAP server
#CONFIG_EAP_TTLS=y
# EAP-SIM for the integrated EAP server
#CONFIG_EAP_SIM=y
# EAP-AKA for the integrated EAP server
#CONFIG_EAP_AKA=y
# EAP-AKA' for the integrated EAP server
# This requires CONFIG_EAP_AKA to be enabled, too.
#CONFIG_EAP_AKA_PRIME=y
# EAP-PAX for the integrated EAP server
#CONFIG_EAP_PAX=y
# EAP-PSK for the integrated EAP server (this is _not_ needed for WPA-PSK)
#CONFIG_EAP_PSK=y
# EAP-SAKE for the integrated EAP server
#CONFIG_EAP_SAKE=y
# EAP-GPSK for the integrated EAP server
#CONFIG_EAP_GPSK=y
# Include support for optional SHA256 cipher suite in EAP-GPSK
#CONFIG_EAP_GPSK_SHA256=y
# EAP-FAST for the integrated EAP server
# Note: Default OpenSSL package does not include support for all the
# functionality needed for EAP-FAST. If EAP-FAST is enabled with OpenSSL,
# the OpenSSL library must be patched (openssl-0.9.9-session-ticket.patch)
# to add the needed functions.
#CONFIG_EAP_FAST=y
# Wi-Fi Protected Setup (WPS)
CONFIG_WPS=y
# Enable WSC 2.0 support
#CONFIG_WPS2=y
# Enable UPnP support for external WPS Registrars
#CONFIG_WPS_UPNP=y
CONFIG_TLS=internal
CONFIG_INTERNAL_LIBTOMMATH=y
# EAP-IKEv2
#CONFIG_EAP_IKEV2=y
# Trusted Network Connect (EAP-TNC)
#CONFIG_EAP_TNC=y
# PKCS#12 (PFX) support (used to read private key and certificate file from
# a file that usually has extension .p12 or .pfx)
#CONFIG_PKCS12=y
# RADIUS authentication server. This provides access to the integrated EAP
# server from external hosts using RADIUS.
#CONFIG_RADIUS_SERVER=y
# Build IPv6 support for RADIUS operations
#CONFIG_IPV6=y
# IEEE Std 802.11r-2008 (Fast BSS Transition)
#CONFIG_IEEE80211R=y
# Use the hostapd's IEEE 802.11 authentication (ACL), but without
# the IEEE 802.11 Management capability (e.g., madwifi or FreeBSD/net80211)
#CONFIG_DRIVER_RADIUS_ACL=y
# IEEE 802.11n (High Throughput) support
CONFIG_IEEE80211N=y
# Remove debugging code that is printing out debug messages to stdout.
# This can be used to reduce the size of the hostapd considerably if debugging
# code is not needed.
#CONFIG_NO_STDOUT_DEBUG=y
# Add support for writing debug log to a file: -f /tmp/hostapd.log
# Disabled by default.
#CONFIG_DEBUG_FILE=y
# Remove support for RADIUS accounting
#CONFIG_NO_ACCOUNTING=y
# Remove support for RADIUS
#CONFIG_NO_RADIUS=y
# Remove support for VLANs
#CONFIG_NO_VLAN=y
# Enable support for fully dynamic VLANs. This enables hostapd to
# automatically create bridge and VLAN interfaces if necessary.
#CONFIG_FULL_DYNAMIC_VLAN=y
# Remove support for dumping state into a file on SIGUSR1 signal
# This can be used to reduce binary size at the cost of disabling a debugging
# option.
#CONFIG_NO_DUMP_STATE=y
# Enable tracing code for developer debugging
# This tracks use of memory allocations and other registrations and reports
# incorrect use with a backtrace of call (or allocation) location.
#CONFIG_WPA_TRACE=y
# For BSD, comment out these.
#LIBS += -lexecinfo
#LIBS_p += -lexecinfo
#LIBS_c += -lexecinfo
# Use libbfd to get more details for developer debugging
# This enables use of libbfd to get more detailed symbols for the backtraces
# generated by CONFIG_WPA_TRACE=y.
#CONFIG_WPA_TRACE_BFD=y
# For BSD, comment out these.
#LIBS += -lbfd -liberty -lz
#LIBS_p += -lbfd -liberty -lz
#LIBS_c += -lbfd -liberty -lz
# hostapd depends on strong random number generation being available from the
# operating system. os_get_random() function is used to fetch random data when
# needed, e.g., for key generation. On Linux and BSD systems, this works by
# reading /dev/urandom. It should be noted that the OS entropy pool needs to be
# properly initialized before hostapd is started. This is important especially
# on embedded devices that do not have a hardware random number generator and
# may by default start up with minimal entropy available for random number
# generation.
#
# As a safety net, hostapd is by default trying to internally collect
# additional entropy for generating random data to mix in with the data
# fetched from the OS. This by itself is not considered to be very strong, but
# it may help in cases where the system pool is not initialized properly.
# However, it is very strongly recommended that the system pool is initialized
# with enough entropy either by using hardware assisted random number
# generatior or by storing state over device reboots.
#
# If the os_get_random() is known to provide strong ramdom data (e.g., on
# Linux/BSD, the board in question is known to have reliable source of random
# data from /dev/urandom), the internal hostapd random pool can be disabled.
# This will save some in binary size and CPU use. However, this should only be
# considered for builds that are known to be used on devices that meet the
# requirements described above.
#CONFIG_NO_RANDOM_POOL=y

View File

@ -0,0 +1,114 @@
#ifndef _DRIVER_RTL_H_
#define _DRIVER_RTL_H_
#define RTL_IOCTL_HOSTAPD (SIOCIWFIRSTPRIV + 28)
#define IEEE_CRYPT_ALG_NAME_LEN (16)
/* RTL871X_IOCTL_HOSTAPD ioctl() cmd: */
enum {
RTL871X_HOSTAPD_FLUSH = 1,
RTL871X_HOSTAPD_ADD_STA = 2,
RTL871X_HOSTAPD_REMOVE_STA = 3,
RTL871X_HOSTAPD_GET_INFO_STA = 4,
/* REMOVED: PRISM2_HOSTAPD_RESET_TXEXC_STA = 5, */
RTL871X_HOSTAPD_GET_WPAIE_STA = 5,
RTL871X_SET_ENCRYPTION = 6,
RTL871X_GET_ENCRYPTION = 7,
RTL871X_HOSTAPD_SET_FLAGS_STA = 8,
RTL871X_HOSTAPD_GET_RID = 9,
RTL871X_HOSTAPD_SET_RID = 10,
RTL871X_HOSTAPD_SET_ASSOC_AP_ADDR = 11,
RTL871X_HOSTAPD_SET_GENERIC_ELEMENT = 12,
RTL871X_HOSTAPD_MLME = 13,
RTL871X_HOSTAPD_SCAN_REQ = 14,
RTL871X_HOSTAPD_STA_CLEAR_STATS = 15,
RTL871X_HOSTAPD_SET_BEACON = 16,
RTL871X_HOSTAPD_SET_WPS_BEACON = 17,
RTL871X_HOSTAPD_SET_WPS_PROBE_RESP = 18,
RTL871X_HOSTAPD_SET_WPS_ASSOC_RESP = 19,
RTL871X_HOSTAPD_SET_HIDDEN_SSID = 20,
};
typedef struct ieee_param {
u32 cmd;
u8 sta_addr[ETH_ALEN];
union {
struct {
u8 name;
u32 value;
} wpa_param;
struct {
u32 len;
u8 reserved[32];
u8 data[0];
} wpa_ie;
struct{
int command;
int reason_code;
} mlme;
struct {
u8 alg[IEEE_CRYPT_ALG_NAME_LEN];
u8 set_tx;
u32 err;
u8 idx;
u8 seq[8]; /* sequence counter (set: RX, get: TX) */
u16 key_len;
u8 key[0];
} crypt;
struct {
u16 aid;
u16 capability;
int flags;
u8 tx_supp_rates[16];
//struct ieee80211_ht_capability ht_cap;
struct ieee80211_ht_capabilities ht_cap;
} add_sta;
struct {
u8 reserved[2];//for set max_num_sta
u8 buf[0];
} bcn_ie;
} u;
} ieee_param;
#define IEEE80211_CCK_RATE_LEN 4
#define IEEE80211_OFDM_RATE_LEN 8
#define IEEE80211_CCK_RATE_1MB 0x02
#define IEEE80211_CCK_RATE_2MB 0x04
#define IEEE80211_CCK_RATE_5MB 0x0B
#define IEEE80211_CCK_RATE_11MB 0x16
#define IEEE80211_OFDM_RATE_6MB 0x0C
#define IEEE80211_OFDM_RATE_9MB 0x12
#define IEEE80211_OFDM_RATE_12MB 0x18
#define IEEE80211_OFDM_RATE_18MB 0x24
#define IEEE80211_OFDM_RATE_24MB 0x30
#define IEEE80211_OFDM_RATE_36MB 0x48
#define IEEE80211_OFDM_RATE_48MB 0x60
#define IEEE80211_OFDM_RATE_54MB 0x6C
#define IEEE80211_BASIC_RATE_MASK 0x80
#define IEEE80211_CCK_RATE_1MB_MASK (1<<0)
#define IEEE80211_CCK_RATE_2MB_MASK (1<<1)
#define IEEE80211_CCK_RATE_5MB_MASK (1<<2)
#define IEEE80211_CCK_RATE_11MB_MASK (1<<3)
#define IEEE80211_OFDM_RATE_6MB_MASK (1<<4)
#define IEEE80211_OFDM_RATE_9MB_MASK (1<<5)
#define IEEE80211_OFDM_RATE_12MB_MASK (1<<6)
#define IEEE80211_OFDM_RATE_18MB_MASK (1<<7)
#define IEEE80211_OFDM_RATE_24MB_MASK (1<<8)
#define IEEE80211_OFDM_RATE_36MB_MASK (1<<9)
#define IEEE80211_OFDM_RATE_48MB_MASK (1<<10)
#define IEEE80211_OFDM_RATE_54MB_MASK (1<<11)
#define IEEE80211_CCK_RATES_MASK 0x0000000F
#define IEEE80211_OFDM_RATES_MASK 0x00000FF0
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,54 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2771,6 +2771,8 @@ static int hostapd_config_fill(struct ho
}
#endif /* CONFIG_IEEE80211W */
#ifdef CONFIG_IEEE80211N
+ } else if (os_strcmp(buf, "noscan") == 0) {
+ conf->noscan = atoi(pos);
} else if (os_strcmp(buf, "ieee80211n") == 0) {
conf->ieee80211n = atoi(pos);
} else if (os_strcmp(buf, "ht_capab") == 0) {
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -619,6 +619,7 @@ struct hostapd_config {
int ht_op_mode_fixed;
u16 ht_capab;
+ int noscan;
int ieee80211n;
int secondary_channel;
int require_ht;
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -461,7 +461,7 @@ static int ieee80211n_check_40mhz(struct
struct wpa_driver_scan_params params;
int ret;
- if (!iface->conf->secondary_channel)
+ if (!iface->conf->secondary_channel || iface->conf->noscan)
return 0; /* HT40 not used */
hostapd_set_state(iface, HAPD_IFACE_HT_SCAN);
--- a/src/ap/ieee802_11_ht.c
+++ b/src/ap/ieee802_11_ht.c
@@ -221,6 +221,9 @@ void hostapd_2040_coex_action(struct hos
if (!(iface->conf->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET))
return;
+ if (iface->conf->noscan)
+ return;
+
if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie))
return;
@@ -346,6 +349,9 @@ void ht40_intolerant_add(struct hostapd_
if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G)
return;
+ if (iface->conf->noscan)
+ return;
+
wpa_printf(MSG_INFO, "HT: Forty MHz Intolerant is set by STA " MACSTR
" in Association Request", MAC2STR(sta->addr));

View File

@ -0,0 +1,651 @@
diff --git a/hostapd/main.c b/hostapd/main.c
index a9d7da5..2457f95 100644
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -412,7 +412,7 @@ static int hostapd_global_run(struct hapd_interfaces *ifaces, int daemonize,
static void show_version(void)
{
fprintf(stderr,
- "hostapd v" VERSION_STR "\n"
+ "hostapd v" VERSION_STR " for Realtek rtl871xdrv\n"
"User space daemon for IEEE 802.11 AP management,\n"
"IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator\n"
"Copyright (c) 2002-2014, Jouni Malinen <j@w1.fi> "
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 2a4acf2..20d7451 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -810,6 +810,11 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
#ifdef CONFIG_IEEE80211N
tailpos = hostapd_eid_ht_capabilities(hapd, tailpos);
tailpos = hostapd_eid_ht_operation(hapd, tailpos);
+
+ //DRIVER_RTW ADD
+ if(hapd->iconf->ieee80211n)
+ hapd->conf->wmm_enabled = 1;
+
#endif /* CONFIG_IEEE80211N */
tailpos = hostapd_eid_ext_capab(hapd, tailpos);
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index 4e66d1b..620f246 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -712,7 +712,10 @@ static int ieee80211n_check_40mhz(struct hostapd_iface *iface)
iface->num_ht40_scan_tries = 1;
eloop_cancel_timeout(ap_ht40_scan_retry, iface, NULL);
eloop_register_timeout(1, 0, ap_ht40_scan_retry, iface, NULL);
- return 1;
+
+ //DRIVER_RTW Modify
+ //return -1;
+ return 0;//ignore this error
}
if (ret < 0) {
diff --git a/src/drivers/driver_bsd.c b/src/drivers/driver_bsd.c
index ca64d5c..05606f0 100644
--- a/src/drivers/driver_bsd.c
+++ b/src/drivers/driver_bsd.c
@@ -47,6 +47,12 @@
#include "l2_packet/l2_packet.h"
+#ifdef HOSTAPD
+#ifdef CONFIG_SUPPORT_RTW_DRIVER
+#define RTW_BSD_HOSTAPD_SET_BEACON (1100)
+#endif
+#endif
+
struct bsd_driver_data {
struct hostapd_data *hapd; /* back pointer */
@@ -792,6 +798,296 @@ handle_read(void *ctx, const u8 *src_addr, const u8 *buf, size_t len)
drv_event_eapol_rx(drv->hapd, src_addr, buf, len);
}
+#ifdef CONFIG_SUPPORT_RTW_DRIVER
+static int rtw_set_beacon_ops(void *priv, const u8 *head, size_t head_len,
+ const u8 *tail, size_t tail_len, int dtim_period,
+ int beacon_int)
+{
+ int ret=0;
+ u8 *pbuf;
+ size_t sz;
+ struct bsd_driver_data *drv = priv;
+
+ if((head_len<24) ||(!head))
+ return -1;
+
+ sz = head_len+tail_len - 24; // 24 = wlan hdr
+
+ printf("%s, beacon_sz=%d\n", __func__, sz);
+
+ pbuf = os_zalloc(sz);
+ if (pbuf == NULL) {
+ return -ENOMEM;
+ }
+
+ os_memcpy(pbuf, (head+24), (head_len-24));// 24=beacon header len.
+
+ os_memcpy(&pbuf[head_len-24], tail, tail_len);
+
+ ret = set80211var(drv, RTW_BSD_HOSTAPD_SET_BEACON, pbuf, sz);
+
+ os_free(pbuf);
+
+ return ret;
+
+}
+
+static struct hostapd_hw_modes *rtw_get_hw_feature_data_ops(
+ void *priv, u16 *num_modes, u16 *flags)
+{
+
+#define MAX_NUM_CHANNEL (14)
+#define MAX_NUM_CHANNEL_5G (24)
+
+ struct hostapd_hw_modes *modes;
+ size_t i;
+ int k;
+
+ printf("%s\n", __func__);
+
+ *num_modes = 3;
+ *flags = 0;
+
+ modes = os_zalloc(*num_modes * sizeof(struct hostapd_hw_modes));
+ if (modes == NULL)
+ return NULL;
+
+ //.1
+ modes[0].mode = HOSTAPD_MODE_IEEE80211G;
+ modes[0].num_channels = MAX_NUM_CHANNEL;
+ modes[0].num_rates = 12;
+ modes[0].channels =
+ os_zalloc(MAX_NUM_CHANNEL * sizeof(struct hostapd_channel_data));
+ modes[0].rates = os_zalloc(modes[0].num_rates * sizeof(int));
+ if (modes[0].channels == NULL || modes[0].rates == NULL)
+ goto fail;
+ for (i = 0; i < MAX_NUM_CHANNEL; i++) {
+ modes[0].channels[i].chan = i + 1;
+ modes[0].channels[i].freq = 2412 + 5 * i;
+ modes[0].channels[i].flag = 0;
+ if (i >= 13)
+ modes[0].channels[i].flag = HOSTAPD_CHAN_DISABLED;
+ }
+ modes[0].rates[0] = 10;
+ modes[0].rates[1] = 20;
+ modes[0].rates[2] = 55;
+ modes[0].rates[3] = 110;
+ modes[0].rates[4] = 60;
+ modes[0].rates[5] = 90;
+ modes[0].rates[6] = 120;
+ modes[0].rates[7] = 180;
+ modes[0].rates[8] = 240;
+ modes[0].rates[9] = 360;
+ modes[0].rates[10] = 480;
+ modes[0].rates[11] = 540;
+
+
+ //.2
+ modes[1].mode = HOSTAPD_MODE_IEEE80211B;
+ modes[1].num_channels = MAX_NUM_CHANNEL;
+ modes[1].num_rates = 4;
+ modes[1].channels =
+ os_zalloc(MAX_NUM_CHANNEL * sizeof(struct hostapd_channel_data));
+ modes[1].rates = os_zalloc(modes[1].num_rates * sizeof(int));
+ if (modes[1].channels == NULL || modes[1].rates == NULL)
+ goto fail;
+ for (i = 0; i < MAX_NUM_CHANNEL; i++) {
+ modes[1].channels[i].chan = i + 1;
+ modes[1].channels[i].freq = 2412 + 5 * i;
+ modes[1].channels[i].flag = 0;
+ if (i >= 11)
+ modes[1].channels[i].flag = HOSTAPD_CHAN_DISABLED;
+ }
+ modes[1].rates[0] = 10;
+ modes[1].rates[1] = 20;
+ modes[1].rates[2] = 55;
+ modes[1].rates[3] = 110;
+
+
+ //.3
+ modes[2].mode = HOSTAPD_MODE_IEEE80211A;
+#ifdef CONFIG_DRIVER_RTL_DFS
+ modes[2].num_channels = MAX_NUM_CHANNEL_5G;
+#else /* CONFIG_DRIVER_RTL_DFS */
+ modes[2].num_channels = 9;
+#endif /* CONFIG_DRIVER_RTL_DFS */
+
+ modes[2].num_rates = 8;
+ modes[2].channels = os_zalloc(modes[2].num_channels * sizeof(struct hostapd_channel_data));
+ modes[2].rates = os_zalloc(modes[2].num_rates * sizeof(int));
+ if (modes[2].channels == NULL || modes[2].rates == NULL)
+ goto fail;
+
+
+ k = 0;
+ // 5G band1 Channel: 36, 40, 44, 48
+ for (i=0; i < 4; i++) {
+ modes[2].channels[k].chan = 36+(i*4);
+ modes[2].channels[k].freq = 5180+(i*20);
+ modes[2].channels[k].flag = 0;
+ k++;
+ }
+
+#ifdef CONFIG_DRIVER_RTL_DFS
+ // 5G band2 Channel: 52, 56, 60, 64
+ for (i=0; i < 4; i++) {
+ modes[2].channels[k].chan = 52+(i*4);
+ modes[2].channels[k].freq = 5260+(i*20);
+ modes[2].channels[k].flag = 0;
+ k++;
+ }
+
+ // 5G band3 Channel: 100, 104, 108. 112, 116, 120, 124, 128, 132, 136, 140
+ for (i=0; i < 11; i++) {
+ modes[2].channels[k].chan = 100+(i*4);
+ modes[2].channels[k].freq = 5500+(i*20);
+ modes[2].channels[k].flag = 0;
+ k++;
+ }
+#endif /* CONFIG_DRIVER_RTL_DFS */
+
+ // 5G band4 Channel: 149, 153, 157, 161, 165
+ for (i=0; i < 5; i++) {
+ modes[2].channels[k].chan = 149+(i*4);
+ modes[2].channels[k].freq = 5745+(i*20);
+ modes[2].channels[k].flag = 0;
+ k++;
+ }
+
+ modes[2].rates[0] = 60;
+ modes[2].rates[1] = 90;
+ modes[2].rates[2] = 120;
+ modes[2].rates[3] = 180;
+ modes[2].rates[4] = 240;
+ modes[2].rates[5] = 360;
+ modes[2].rates[6] = 480;
+ modes[2].rates[7] = 540;
+
+
+ //
+#if 0
+#define HT_CAP_INFO_LDPC_CODING_CAP ((u16) BIT(0))
+#define HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET ((u16) BIT(1))
+#define HT_CAP_INFO_SMPS_MASK ((u16) (BIT(2) | BIT(3)))
+#define HT_CAP_INFO_SMPS_STATIC ((u16) 0)
+#define HT_CAP_INFO_SMPS_DYNAMIC ((u16) BIT(2))
+#define HT_CAP_INFO_SMPS_DISABLED ((u16) (BIT(2) | BIT(3)))
+#define HT_CAP_INFO_GREEN_FIELD ((u16) BIT(4))
+#define HT_CAP_INFO_SHORT_GI20MHZ ((u16) BIT(5))
+#define HT_CAP_INFO_SHORT_GI40MHZ ((u16) BIT(6))
+#define HT_CAP_INFO_TX_STBC ((u16) BIT(7))
+#define HT_CAP_INFO_RX_STBC_MASK ((u16) (BIT(8) | BIT(9)))
+#define HT_CAP_INFO_RX_STBC_1 ((u16) BIT(8))
+#define HT_CAP_INFO_RX_STBC_12 ((u16) BIT(9))
+#define HT_CAP_INFO_RX_STBC_123 ((u16) (BIT(8) | BIT(9)))
+#define HT_CAP_INFO_DELAYED_BA ((u16) BIT(10))
+#define HT_CAP_INFO_MAX_AMSDU_SIZE ((u16) BIT(11))
+#define HT_CAP_INFO_DSSS_CCK40MHZ ((u16) BIT(12))
+#define HT_CAP_INFO_PSMP_SUPP ((u16) BIT(13))
+#define HT_CAP_INFO_40MHZ_INTOLERANT ((u16) BIT(14))
+#define HT_CAP_INFO_LSIG_TXOP_PROTECT_SUPPORT ((u16) BIT(15))
+#endif
+
+ //HOSTAPD_MODE_IEEE80211G
+ modes[0].ht_capab = HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET|HT_CAP_INFO_SHORT_GI20MHZ|
+ HT_CAP_INFO_SHORT_GI40MHZ|HT_CAP_INFO_MAX_AMSDU_SIZE|HT_CAP_INFO_DSSS_CCK40MHZ;
+
+ modes[0].mcs_set[0]= 0xff;
+ modes[0].mcs_set[1]= 0xff;
+
+ //HOSTAPD_MODE_IEEE80211B
+ modes[1].ht_capab = 0;
+
+ //HOSTAPD_MODE_IEEE80211A
+ modes[2].ht_capab = modes[0].ht_capab;
+
+ modes[2].mcs_set[0]= 0xff;
+ modes[2].mcs_set[1]= 0xff;
+
+ return modes;
+
+fail:
+ if (modes) {
+ for (i = 0; i < *num_modes; i++) {
+ os_free(modes[i].channels);
+ os_free(modes[i].rates);
+ }
+ os_free(modes);
+ }
+
+ return NULL;
+
+}
+
+#if 0
+#define IEEE80211_FC0_TYPE_MASK 0x0c
+#define IEEE80211_FC0_TYPE_SHIFT 2
+#define IEEE80211_FC0_TYPE_MGT 0x00
+#define IEEE80211_FC0_TYPE_CTL 0x04
+#define IEEE80211_FC0_TYPE_DATA 0x08
+#define IEEE80211_FC0_SUBTYPE_MASK 0xf0
+#define IEEE80211_FC0_SUBTYPE_SHIFT 4
+#define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00
+#define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10
+#define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20
+#define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30
+#define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40
+#define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50
+#define IEEE80211_FC0_SUBTYPE_BEACON 0x80
+#define IEEE80211_FC0_SUBTYPE_ATIM 0x90
+#define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0
+#define IEEE80211_FC0_SUBTYPE_AUTH 0xb0
+#define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0
+#define IEEE80211_FC0_SUBTYPE_ACTION 0xd0
+#define IEEE80211_FC0_SUBTYPE_ACTION_NOACK 0xe0
+
+#define IEEE80211_APPIE_WPA (IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_BEACON | \
+ IEEE80211_FC0_SUBTYPE_PROBE_RESP)
+
+#endif
+
+#define RTW_IEEE80211_APPIE_BEACON (IEEE80211_FC0_TYPE_MGT|IEEE80211_FC0_SUBTYPE_BEACON)
+#define RTW_IEEE80211_APPIE_PROBE_RESP (IEEE80211_FC0_TYPE_MGT|IEEE80211_FC0_SUBTYPE_PROBE_RESP)
+#define RTW_IEEE80211_APPIE_ASSOC_RESP (IEEE80211_FC0_TYPE_MGT|IEEE80211_FC0_SUBTYPE_ASSOC_RESP)
+
+
+static int rtw_set_wps_assoc_resp_ie(void *priv, const void *ie, size_t len)
+{
+ return bsd_set80211(priv, IEEE80211_IOC_APPIE, RTW_IEEE80211_APPIE_ASSOC_RESP,
+ ie, len);
+}
+
+static int rtw_set_wps_beacon_ie(void *priv, const void *ie, size_t len)
+{
+ return bsd_set80211(priv, IEEE80211_IOC_APPIE, RTW_IEEE80211_APPIE_BEACON,
+ ie, len);
+}
+
+static int rtw_set_wps_probe_resp_ie(void *priv, const void *ie, size_t len)
+{
+ return bsd_set80211(priv, IEEE80211_IOC_APPIE, RTW_IEEE80211_APPIE_PROBE_RESP,
+ ie, len);
+}
+
+static int rtw_set_ap_wps_ie_ops(void *priv, const struct wpabuf *beacon,
+ const struct wpabuf *proberesp, const struct wpabuf *assocresp)
+{
+ if (rtw_set_wps_assoc_resp_ie(priv, assocresp ? wpabuf_head(assocresp) : NULL,
+ assocresp ? wpabuf_len(assocresp) : 0))
+ return -1;
+
+ if (rtw_set_wps_beacon_ie(priv, beacon ? wpabuf_head(beacon) : NULL,
+ beacon ? wpabuf_len(beacon) : 0))
+ return -1;
+
+ return rtw_set_wps_probe_resp_ie(priv,
+ proberesp ? wpabuf_head(proberesp) : NULL,
+ proberesp ? wpabuf_len(proberesp): 0);
+
+}
+#endif
+
+
static void *
bsd_init(struct hostapd_data *hapd, struct wpa_init_params *params)
{
@@ -844,6 +1140,12 @@ bsd_init(struct hostapd_data *hapd, struct wpa_init_params *params)
goto bad;
}
+#ifdef CONFIG_SUPPORT_RTW_DRIVER
+ /* mark up after init */
+ if (bsd_ctrl_iface(drv, 1) < 0)
+ goto bad;
+#endif
+
return drv;
bad:
if (drv->sock_xmit != NULL)
@@ -1282,6 +1584,15 @@ wpa_driver_bsd_event_receive(int sock, void *ctx, void *sock_ctx)
event.interface_status.ifname);
wpa_supplicant_event(ctx, EVENT_INTERFACE_STATUS, &event);
}
+ else{
+ os_strlcpy(event.interface_status.ifname, drv->ifname,
+ sizeof(event.interface_status.ifname));
+ event.interface_status.ievent = EVENT_INTERFACE_ADDED;
+ wpa_printf(MSG_DEBUG, "RTM_IFINFO: Interface '%s' UP",
+ event.interface_status.ifname);
+ wpa_supplicant_event(ctx, EVENT_INTERFACE_STATUS, &event);
+ }
+
break;
}
}
@@ -1594,7 +1905,52 @@ wpa_driver_bsd_get_capa(void *priv, struct wpa_driver_capa *capa)
}
#endif /* HOSTAPD */
-
+#ifdef CONFIG_SUPPORT_RTW_DRIVER
+const struct wpa_driver_ops wpa_driver_bsd_ops = {
+ .name = "bsd",
+ .desc = "BSD 802.11 support",
+#ifdef HOSTAPD
+ .hapd_init = bsd_init,
+ .hapd_deinit = bsd_deinit,
+ .set_privacy = bsd_set_privacy,//del ?
+ .get_seqnum = bsd_get_seqnum,//del ?
+ .flush = bsd_flush,
+ .read_sta_data = bsd_read_sta_driver_data,//del ?
+ .sta_disassoc = bsd_sta_disassoc,
+ .sta_deauth = bsd_sta_deauth,
+ .get_hw_feature_data = rtw_get_hw_feature_data_ops,//add
+ //.sta_remove = rtl871x_sta_remove_ops,//add
+ .set_beacon = rtw_set_beacon_ops, //add
+ .set_ap_wps_ie = rtw_set_ap_wps_ie_ops,//add
+#else /* HOSTAPD */
+ .init = wpa_driver_bsd_init,
+ .deinit = wpa_driver_bsd_deinit,
+ .get_bssid = wpa_driver_bsd_get_bssid,
+ .get_ssid = wpa_driver_bsd_get_ssid,
+ .set_countermeasures = wpa_driver_bsd_set_countermeasures,
+ .scan2 = wpa_driver_bsd_scan,
+ .get_scan_results2 = wpa_driver_bsd_get_scan_results2,
+ .deauthenticate = wpa_driver_bsd_deauthenticate,
+ .disassociate = wpa_driver_bsd_disassociate,
+ .associate = wpa_driver_bsd_associate,
+ .get_capa = wpa_driver_bsd_get_capa,
+ .set_freq = bsd_set_freq, //only for wpa_supplicant
+ .set_ieee8021x = bsd_set_ieee8021x,//only for wpa_supplicant
+ .hapd_set_ssid = bsd_set_ssid,//only for wpa_supplicant
+ .hapd_get_ssid = bsd_get_ssid,//only for wpa_supplicant
+ .sta_set_flags = bsd_set_sta_authorized, //only for wpa_supplicant
+ .set_generic_elem = bsd_set_opt_ie, //only for wpa_supplicant
+#endif /* HOSTAPD */
+ //.set_freq = bsd_set_freq, //only for wpa_supplicant
+ .set_key = bsd_set_key,
+ //.set_ieee8021x = bsd_set_ieee8021x, //only for wpa_supplicant
+ //.hapd_set_ssid = bsd_set_ssid, //only for wpa_supplicant
+ //.hapd_get_ssid = bsd_get_ssid, //only for wpa_supplicant
+ .hapd_send_eapol = bsd_send_eapol, //only for wpa_supplicant
+ //.sta_set_flags = bsd_set_sta_authorized, //only for wpa_supplicant
+ //.set_generic_elem = bsd_set_opt_ie, //only for wpa_supplicant
+};
+#else
const struct wpa_driver_ops wpa_driver_bsd_ops = {
.name = "bsd",
.desc = "BSD 802.11 support",
@@ -1629,3 +1985,4 @@ const struct wpa_driver_ops wpa_driver_bsd_ops = {
.hapd_send_eapol = bsd_send_eapol,
.set_generic_elem = bsd_set_opt_ie,
};
+#endif
diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c
index e5734bd..80f073d 100644
--- a/src/drivers/driver_wext.c
+++ b/src/drivers/driver_wext.c
@@ -990,6 +990,38 @@ void wpa_driver_wext_scan_timeout(void *eloop_ctx, void *timeout_ctx)
wpa_supplicant_event(timeout_ctx, EVENT_SCAN_RESULTS, NULL);
}
+//added for wps2.0 @20110519
+static int wpa_driver_wext_set_probe_req_ie(struct wpa_driver_wext_data *drv, const u8 *extra_ies,
+ size_t extra_ies_len)
+{
+ unsigned char *pbuf;
+ struct iwreq iwr;
+ int ret = 0;
+
+ pbuf = os_malloc(extra_ies_len);
+ os_memset(pbuf, 0, extra_ies_len);
+
+ os_memset(&iwr, 0, sizeof(iwr));
+ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
+
+ os_memcpy(pbuf, extra_ies, extra_ies_len);
+
+ iwr.u.data.pointer = (caddr_t)pbuf;
+ iwr.u.data.length = extra_ies_len;
+ iwr.u.data.flags = 0x8766;//magic number
+
+ if (ioctl(drv->ioctl_sock, SIOCSIWPRIV, &iwr) < 0) {
+ perror("ioctl[SIOCSIWMLME]");
+ ret = -1;
+ }
+
+ if(pbuf)
+ os_free(pbuf);
+
+ return ret;
+
+}
+
/**
* wpa_driver_wext_scan - Request the driver to initiate scan
@@ -1012,6 +1044,10 @@ int wpa_driver_wext_scan(void *priv, struct wpa_driver_scan_params *params)
return -1;
}
+ //added for wps2.0 @20110519
+ wpa_driver_wext_set_probe_req_ie(drv, params->extra_ies,
+ params->extra_ies_len);
+
os_memset(&iwr, 0, sizeof(iwr));
os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
@@ -2315,6 +2351,28 @@ static const char * wext_get_radio_name(void *priv)
return drv->phyname;
}
+// Aries 20120120, append rssi information at the end of "status" command
+int wext_signal_poll(void *priv, struct wpa_signal_info *signal_info)
+{
+ struct wpa_driver_wext_data *drv = priv;
+ struct iwreq iwr;
+ struct iw_statistics stat;
+ int ret = 0;
+
+ os_memset(&iwr, 0, sizeof(iwr));
+ os_memset(&stat, 0, sizeof(stat));
+ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
+ iwr.u.data.pointer = (caddr_t) &stat;
+ iwr.u.data.length = sizeof(struct iw_statistics);
+ iwr.u.data.flags = 1;
+ if (ioctl(drv->ioctl_sock, SIOCGIWSTATS, &iwr) < 0) {
+ perror("ioctl[SIOCGIWSTATS] fail\n");
+ ret = -1;
+ }
+ signal_info->current_signal = stat.qual.level;
+ signal_info->current_noise = stat.qual.noise;
+ return ret;
+}
const struct wpa_driver_ops wpa_driver_wext_ops = {
.name = "wext",
diff --git a/src/drivers/drivers.c b/src/drivers/drivers.c
index d0e42ec..d413c00 100644
--- a/src/drivers/drivers.c
+++ b/src/drivers/drivers.c
@@ -51,6 +51,9 @@ extern struct wpa_driver_ops wpa_driver_atheros_ops; /* driver_atheros.c */
#ifdef CONFIG_DRIVER_NONE
extern struct wpa_driver_ops wpa_driver_none_ops; /* driver_none.c */
#endif /* CONFIG_DRIVER_NONE */
+#ifdef CONFIG_DRIVER_RTW
+extern struct wpa_driver_ops wpa_driver_rtw_ops; /* driver_rtw.c */
+#endif /* CONFIG_DRIVER_RTW */
struct wpa_driver_ops *wpa_drivers[] =
@@ -94,5 +97,8 @@ struct wpa_driver_ops *wpa_drivers[] =
#ifdef CONFIG_DRIVER_NONE
&wpa_driver_none_ops,
#endif /* CONFIG_DRIVER_NONE */
+#ifdef CONFIG_DRIVER_RTW
+ &wpa_driver_rtw_ops,
+#endif /* CONFIG_DRIVER_RTW */
NULL
};
diff --git a/src/drivers/drivers.mak b/src/drivers/drivers.mak
index 7e175f4..b5881db 100644
--- a/src/drivers/drivers.mak
+++ b/src/drivers/drivers.mak
@@ -58,6 +58,10 @@ DRV_CFLAGS += -DCONFIG_DRIVER_BSD
DRV_OBJS += ../src/drivers/driver_bsd.o
CONFIG_L2_FREEBSD=y
CONFIG_DNET_PCAP=y
+ifdef CONFIG_SUPPORT_RTW_DRIVER
+DRV_CFLAGS += -DCONFIG_SUPPORT_RTW_DRIVER -DCONFIG_DRIVER_RTL_DFS
+NEED_AP_MLME=y
+endif
endif
ifdef CONFIG_DRIVER_OPENBSD
@@ -74,6 +78,17 @@ DRV_OBJS += ../src/drivers/driver_test.o
NEED_AP_MLME=y
endif
+ifdef CONFIG_DRIVER_RTW
+#CFLAGS += -DCONFIG_DRIVER_RTL
+#OBJS += driver_rtl.o
+DRV_AP_CFLAGS += -DCONFIG_DRIVER_RTW -DCONFIG_DRIVER_RTL_DFS
+DRV_AP_OBJS += ../src/drivers/driver_rtw.o
+CONFIG_L2_PACKET=linux
+NEED_NETLINK=y
+NEED_LINUX_IOCTL=y
+NEED_AP_MLME=y
+endif
+
ifdef CONFIG_DRIVER_NONE
DRV_CFLAGS += -DCONFIG_DRIVER_NONE
DRV_OBJS += ../src/drivers/driver_none.o
diff --git a/src/eap_peer/eap_wsc.c b/src/eap_peer/eap_wsc.c
index 23e9823..173e71d 100644
--- a/src/eap_peer/eap_wsc.c
+++ b/src/eap_peer/eap_wsc.c
@@ -566,8 +566,13 @@ send_msg:
r = eap_wsc_build_msg(data, ret, id);
if (data->state == FAIL && ret->methodState == METHOD_DONE) {
/* Use reduced client timeout for WPS to avoid long wait */
+#if 0 /* Aries add, 2012/06/12, extend timeout for AP IOT */
+ if (sm->ClientTimeout > 4)
+ sm->ClientTimeout = 4;
+#else
if (sm->ClientTimeout > 2)
sm->ClientTimeout = 2;
+#endif
}
return r;
}
diff --git a/src/wps/wps.c b/src/wps/wps.c
index 648cfd1..0a74d0c 100644
--- a/src/wps/wps.c
+++ b/src/wps/wps.c
@@ -320,11 +320,15 @@ int wps_is_addr_authorized(const struct wpabuf *msg, const u8 *addr,
if (wps_parse_msg(msg, &attr) < 0)
return 0;
+ return is_selected_pin_registrar(&attr);
+// Marked by Albert 2011/11/17
+// Some APs won't carry the AuthorizedMACs in the probe response.
+// So, skip this check will speed up the process to find the current AP out for WPS handshake.
+/*
if (!attr.version2 && ver1_compat) {
/*
* Version 1.0 AP - AuthorizedMACs not used, so revert back to
* old mechanism of using SelectedRegistrar.
- */
return is_selected_pin_registrar(&attr);
}
@@ -341,6 +345,7 @@ int wps_is_addr_authorized(const struct wpabuf *msg, const u8 *addr,
}
return 0;
+*/
}
diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c
index b917e6b..4738fd5 100644
--- a/src/wps/wps_registrar.c
+++ b/src/wps/wps_registrar.c
@@ -589,9 +589,10 @@ static int wps_build_probe_config_methods(struct wps_registrar *reg,
* These are the methods that the AP supports as an Enrollee for adding
* external Registrars.
*/
- methods = reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON;
- methods &= ~(WPS_CONFIG_VIRT_PUSHBUTTON |
- WPS_CONFIG_PHY_PUSHBUTTON);
+ methods = reg->wps->config_methods;
+ //methods = reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON;
+ //methods &= ~(WPS_CONFIG_VIRT_PUSHBUTTON |
+ // WPS_CONFIG_PHY_PUSHBUTTON);
wpa_printf(MSG_DEBUG, "WPS: * Config Methods (%x)", methods);
wpabuf_put_be16(msg, ATTR_CONFIG_METHODS);
wpabuf_put_be16(msg, 2);

View File

@ -256,6 +256,20 @@ case $BOARD in
DESKTOP_TARGET="jessie,default"
;;
nanopim1)#enabled
#description H3 quad core 512Mb SoC
#build 6wip
LINUXFAMILY="sun8i"
BOOTCONFIG="FriendlyARM_NanoPi_M1_defconfig"
MODULES="#gpio_sunxi #w1-sunxi #w1-gpio #w1-therm #ap6211"
MODULES_NEXT="brcmfmac"
CPUMIN="240000"
CPUMAX="1200000"
GOVERNOR="interactive"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,default"
;;
cubox-i)#enabled
#description Freescale iMx dual/quad core Wifi
#build 6
@ -648,12 +662,12 @@ PACKAGE_LIST_ADDITIONAL="alsa-utils btrfs-tools bluez hddtemp i2c-tools iperf ir
# Release specific packages
case $RELEASE in
wheezy)
PACKAGE_LIST_RELEASE="less makedev kbd libnl-dev acpid acpi-support-base"
PACKAGE_LIST_RELEASE="less makedev kbd libnl-3-dev acpid acpi-support-base libnl-genl-3-dev"
PACKAGE_LIST_EXCLUDE=""
;;
jessie)
PACKAGE_LIST_RELEASE="less makedev kbd thin-provisioning-tools libnl-3-dev libnl-genl-3-dev libpam-systemd \
software-properties-common python-software-properties libnss-myhostname f2fs-tools"
software-properties-common python-software-properties libnss-myhostname f2fs-tools libnl-genl-3-dev"
PACKAGE_LIST_EXCLUDE=""
;;
trusty)

View File

@ -187,8 +187,8 @@ xenial)
esac
# copy hostapd configurations
install -m 755 $SRC/lib/config/hostapd.conf $CACHEDIR/sdcard/etc/hostapd.conf
install -m 755 $SRC/lib/config/hostapd.realtek.conf $CACHEDIR/sdcard/etc/hostapd.conf-rt
install -m 755 $SRC/lib/config/hostapd/hostapd.conf $CACHEDIR/sdcard/etc/hostapd.conf
install -m 755 $SRC/lib/config/hostapd/hostapd.realtek.conf $CACHEDIR/sdcard/etc/hostapd.conf-rt
# console fix due to Debian bug
sed -e 's/CHARMAP=".*"/CHARMAP="'$CONSOLE_CHAR'"/g' -i $CACHEDIR/sdcard/etc/default/console-setup

131
extras/hostapd.sh Normal file
View File

@ -0,0 +1,131 @@
#!/bin/bash
#
# Copyright (c) 2015 Igor Pecovnik, igor.pecovnik@gma**.com
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
# warranty of any kind, whether express or implied.
#
# This file is a part of tool chain https://github.com/igorpecovnik/lib
#
compile_hostapd ()
{
sync
echo "Building hostapd" > $DEST/debug/hostapd-build.log 2>&1
display_alert "Building deb" "hostapd" "info"
local tmpdir="sdcard/tmp/hostap"
if [ -d "$CACHEDIR/$tmpdir" ]; then
cd $CACHEDIR/$tmpdir
git checkout -f -q master >> $DEST/debug/hostapd-build.log 2>&1
git pull -q
display_alert "Updating sources" "hostapd" "info"
else
display_alert "Downloading sources" "hostapd" "info"
git clone -q git://w1.fi/hostap.git $CACHEDIR/$tmpdir >> $DEST/debug/hostapd-build.log 2>&1
fi
pack_to_deb ()
{
cd $CACHEDIR/sdcard/tmp
apt-get -qq -d install hostapd
dpkg-deb -R /var/cache/apt/archives/hostapd* armbian-hostapd${TARGET}"_"${REVISION}_${ARCH}
# set up control file
cat <<END > armbian-hostapd${TARGET}_${REVISION}_${ARCH}/DEBIAN/control
Package: armbian-hostapd$TARGET
Version: $REVISION
Architecture: $ARCH
Maintainer: $MAINTAINER <$MAINTAINERMAIL>
Installed-Size: 1
Section: kernel
Conflicts: hostapd
Priority: optional
Description: Patched hostapd
END
#
cp "$CACHEDIR/$tmpdir/hostapd/hostapd" armbian-hostapd${TARGET}_${REVISION}_${ARCH}/usr/sbin
cp "$CACHEDIR/$tmpdir/hostapd/hostapd-rt" armbian-hostapd${TARGET}_${REVISION}_${ARCH}/usr/sbin
cp "$CACHEDIR/$tmpdir/hostapd/hostapd_cli" armbian-hostapd${TARGET}_${REVISION}_${ARCH}/usr/sbin
cp "$CACHEDIR/$tmpdir/hostapd/hostapd_cli-rt" armbian-hostapd${TARGET}_${REVISION}_${ARCH}/usr/sbin
cd armbian-hostapd${TARGET}_${REVISION}_${ARCH}
find . -type f ! -regex '.*.hg.*' ! -regex '.*?debian-binary.*' ! -regex '.*?DEBIAN.*' -printf '%P ' | xargs md5sum > DEBIAN/md5sums
cd ..
dpkg -b armbian-hostapd${TARGET}_${REVISION}_${ARCH} >/dev/null 2>&1
rm -rf armbian-hostapd${TARGET}_${REVISION}_${ARCH}
}
compiling ()
{
chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/hostap/hostapd; make clean" >> $DEST/debug/hostapd-build.log 2>&1
chroot $CACHEDIR/sdcard /bin/bash -c "cd /tmp/hostap/hostapd; make $CTHREADS" >> $DEST/debug/hostapd-build.log 2>&1
if [ $? -ne 0 ] || [ ! -f $CACHEDIR/$tmpdir/hostapd/hostapd ]; then
display_alert "Not built" "hostapd" "err"
exit 1
fi
}
patching ()
{
# Other usefull patches:
# https://dev.openwrt.org/browser/trunk/package/network/services/hostapd/patches?order=name
cp $SRC/lib/config/hostapd/files/*.* $CACHEDIR/$tmpdir/src/drivers/
# brute force for 40Mhz
if [ "$(patch --dry-run -t -p1 < $SRC/lib/config/hostapd/patch/300-noscan.patch | grep previ)" == "" ]; then
patch --batch -f -p1 < $SRC/lib/config/hostapd/patch/300-noscan.patch >> $DEST/debug/hostapd-build.log 2>&1
fi
# patch for realtek
if [ "$1" == "realtek" ]; then
cp $SRC/lib/config/hostapd/config/config_realtek $CACHEDIR/$tmpdir/hostapd/.config
patch --batch -f -p1 < $SRC/lib/config/hostapd/patch/realtek.patch >> $DEST/debug/hostapd-build.log 2>&1
else
cp $SRC/lib/config/hostapd/config/config_default $CACHEDIR/$tmpdir/hostapd/.config
if [ "$(cat $CACHEDIR/$tmpdir/hostapd/main.c | grep rtl871)" != "" ]; then
patch --batch -t -p1 < $SRC/lib/config/hostapd/patch/realtek.patch >> $DEST/debug/hostapd-build.log 2>&1
fi
fi
}
checkout ()
{
if [ "$1" == "stable" ]; then
cd $CACHEDIR/$tmpdir
git checkout -f -q "hostap_2_5" >> ../build.log 2>&1
else
git checkout -f -q >> ../build.log 2>&1
fi
}
checkout "stable"
local apver=$(cat $CACHEDIR/$tmpdir/src/common/version.h | grep "#define VERSION_STR " | awk '{ print $3 }' | sed 's/\"//g')
display_alert "Compiling" "v$apver" "info"
patching
compiling
mv $CACHEDIR/$tmpdir/hostapd/hostapd $CACHEDIR/$tmpdir/hostapd/hostapd-rt
mv $CACHEDIR/$tmpdir/hostapd/hostapd_cli $CACHEDIR/$tmpdir/hostapd/hostapd_cli-rt
checkout "stable"
patching
compiling
pack_to_deb
display_alert "Installing" "armbian-hostapd${TARGET}_${REVISION}_${ARCH}.deb" "info"
chroot $CACHEDIR/sdcard /bin/bash -c "dpkg -i /tmp/armbian-hostapd${TARGET}_${REVISION}_${ARCH}.deb" >> $DEST/debug/hostapd-build.log 2>&1
mv $CACHEDIR/sdcard/tmp/armbian-hostapd${TARGET}_${REVISION}_${ARCH}.deb $DEST/debs
}
compile_hostapd

View File

@ -86,16 +86,12 @@ create_board_package (){
# armbianmonitor (currently only to toggle boot verbosity and log upload)
install -m 755 $SRC/lib/scripts/armbianmonitor/armbianmonitor $destination/usr/local/bin
# replace hostapd from latest self compiled & patched
mkdir -p $destination/usr/sbin/
tar xfz $SRC/lib/bin/hostapd25-rt.tgz -C $destination/usr/sbin/
tar xfz $SRC/lib/bin/hostapd25.tgz -C $destination/usr/sbin/
# module evbug is loaded automagically at boot time but we don't want that
mkdir -p $destination/etc/modprobe.d/
echo "blacklist evbug" > $destination/etc/modprobe.d/ev-debug-blacklist.conf
# script to install to SATA
mkdir -p $destination/usr/sbin/
cp -R $SRC/lib/scripts/nand-sata-install/usr $destination/
chmod +x $destination/usr/lib/nand-sata-install/nand-sata-install.sh
ln -s ../lib/nand-sata-install/nand-sata-install.sh $destination/usr/sbin/nand-sata-install