2009-03-01 22:10:07 +00:00
|
|
|
/*
|
|
|
|
* WPA Supplicant / privileged helper program
|
|
|
|
* Copyright (c) 2007-2009, Jouni Malinen <j@w1.fi>
|
|
|
|
*
|
Import wpa_supplicant / hostapd 2.0.
2013-01-12 - v2.0
* added AP-STA-DISCONNECTED ctrl_iface event
* improved debug logging (human readable event names, interface name
included in more entries)
* added number of small changes to make it easier for static analyzers
to understand the implementation
* added a workaround for Windows 7 Michael MIC failure reporting and
use of the Secure bit in EAPOL-Key msg 3/4
* fixed number of small bugs (see git logs for more details)
* changed OpenSSL to read full certificate chain from server_cert file
* nl80211: number of updates to use new cfg80211/nl80211 functionality
- replace monitor interface with nl80211 commands
- additional information for driver-based AP SME
* EAP-pwd:
- fix KDF for group 21 and zero-padding
- added support for fragmentation
- increased maximum number of hunting-and-pecking iterations
* avoid excessive Probe Response retries for broadcast Probe Request
frames (only with drivers using hostapd SME/MLME)
* added preliminary support for using TLS v1.2 (CONFIG_TLSV12=y)
* fixed WPS operation stopping on dual concurrent AP
* added wps_rf_bands configuration parameter for overriding RF Bands
value for WPS
* added support for getting per-device PSK from RADIUS Tunnel-Password
* added support for libnl 3.2 and newer
* increased initial group key handshake retransmit timeout to 500 ms
* added a workaround for 4-way handshake to update SNonce even after
having sent EAPOL-Key 3/4 to avoid issues with some supplicant
implementations that can change SNonce for each EAP-Key 2/4
* added a workaround for EAPOL-Key 4/4 using incorrect type value in
WPA2 mode (some deployed stations use WPA type in that message)
* added a WPS workaround for mixed mode AP Settings with Windows 7
* changed WPS AP PIN disabling mechanism to disable the PIN after 10
consecutive failures in addition to using the exponential lockout
period
* added support for WFA Hotspot 2.0
- GAS/ANQP advertisement of network information
- disable_dgaf parameter to disable downstream group-addressed
forwarding
* simplified licensing terms by selecting the BSD license as the only
alternative
* EAP-SIM: fixed re-authentication not to update pseudonym
* EAP-SIM: use Notification round before EAP-Failure
* EAP-AKA: added support for AT_COUNTER_TOO_SMALL
* EAP-AKA: skip AKA/Identity exchange if EAP identity is recognized
* EAP-AKA': fixed identity for MK derivation
* EAP-AKA': updated to RFC 5448 (username prefixes changed); note: this
breaks interoperability with older versions
* EAP-SIM/AKA: allow pseudonym to be used after unknown reauth id
* changed ANonce to be a random number instead of Counter-based
* added support for canceling WPS operations with hostapd_cli wps_cancel
* fixed EAP/WPS to PSK transition on reassociation in cases where
deauthentication is missed
* hlr_auc_gw enhancements:
- a new command line parameter -u can be used to enable updating of
SQN in Milenage file
- use 5 bit IND for SQN updates
- SQLite database can now be used to store Milenage information
* EAP-SIM/AKA DB: added optional use of SQLite database for pseudonyms
and reauth data
* added support for Chargeable-User-Identity (RFC 4372)
* added radius_auth_req_attr and radius_acct_req_attr configuration
parameters to allow adding/overriding of RADIUS attributes in
Access-Request and Accounting-Request packets
* added support for RADIUS dynamic authorization server (RFC 5176)
* added initial support for WNM operations
- BSS max idle period
- WNM-Sleep Mode
* added new WPS NFC ctrl_iface mechanism
- removed obsoleted WPS_OOB command (including support for deprecated
UFD config_method)
* added FT support for drivers that implement MLME internally
* added SA Query support for drivers that implement MLME internally
* removed default ACM=1 from AC_VO and AC_VI
* changed VENDOR-TEST EAP method to use proper private enterprise number
(this will not interoperate with older versions)
* added hostapd.conf parameter vendor_elements to allow arbitrary vendor
specific elements to be added to the Beacon and Probe Response frames
* added support for configuring GCMP cipher for IEEE 802.11ad
* added support for 256-bit AES with internal TLS implementation
* changed EAPOL transmission to use AC_VO if WMM is active
* fixed EAP-TLS/PEAP/TTLS/FAST server to validate TLS Message Length
correctly; invalid messages could have caused the hostapd process to
terminate before this fix [CVE-2012-4445]
* limit number of active wildcard PINs for WPS Registrar to one to avoid
confusing behavior with multiple wildcard PINs
* added a workaround for WPS PBC session overlap detection to avoid
interop issues with deployed station implementations that do not
remove active PBC indication from Probe Request frames properly
* added support for using SQLite for the eap_user database
* added Acct-Session-Id attribute into Access-Request messages
* fixed EAPOL frame transmission to non-QoS STAs with nl80211
(do not send QoS frames if the STA did not negotiate use of QoS for
this association)
2012-05-10 - v1.0
* Add channel selection support in hostapd. See hostapd.conf.
* Add support for IEEE 802.11v Time Advertisement mechanism with UTC
TSF offset. See hostapd.conf for config info.
* Delay STA entry removal until Deauth/Disassoc TX status in AP mode.
This allows the driver to use PS buffering of Deauthentication and
Disassociation frames when the STA is in power save sleep. Only
available with drivers that provide TX status events for Deauth/
Disassoc frames (nl80211).
* Allow PMKSA caching to be disabled on the Authenticator. See
hostap.conf config parameter disable_pmksa_caching.
* atheros: Add support for IEEE 802.11w configuration.
* bsd: Add support for setting HT values in IFM_MMASK.
* Allow client isolation to be configured with ap_isolate. Client
isolation can be used to prevent low-level bridging of frames
between associated stations in the BSS. By default, this bridging
is allowed.
* Allow coexistance of HT BSSes with WEP/TKIP BSSes.
* Add require_ht config parameter, which can be used to configure
hostapd to reject association with any station that does not support
HT PHY.
* Add support for writing debug log to a file using "-f" option. Also
add relog CLI command to re-open the log file.
* Add bridge handling for WDS STA interfaces. By default they are
added to the configured bridge of the AP interface (if present),
but the user can also specify a separate bridge using cli command
wds_bridge.
* hostapd_cli:
- Add wds_bridge command for specifying bridge for WDS STA
interfaces.
- Add relog command for reopening log file.
- Send AP-STA-DISCONNECTED event when an AP disconnects a station
due to inactivity.
- Add wps_config ctrl_interface command for configuring AP. This
command can be used to configure the AP using the internal WPS
registrar. It works in the same way as new AP settings received
from an ER.
- Many WPS/WPS ER commands - see WPS/WPS ER sections for details.
- Add command get version, that returns hostapd version string.
* WNM: Add BSS Transition Management Request for ESS Disassoc Imminent.
Use hostapd_cli ess_disassoc (STA addr) (URL) to send the
notification to the STA.
* Allow AP mode to disconnect STAs based on low ACK condition (when
the data connection is not working properly, e.g., due to the STA
going outside the range of the AP). Disabled by default, enable by
config option disassoc_low_ack.
* Add WPA_IGNORE_CONFIG_ERRORS build option to continue in case of bad
config file.
* WPS:
- Send AP Settings as a wrapped Credential attribute to ctrl_iface
in WPS-NEW-AP-SETTINGS.
- Dispatch more WPS events through hostapd ctrl_iface.
- Add mechanism for indicating non-standard WPS errors.
- Change concurrent radio AP to use only one WPS UPnP instance.
- Add wps_check_pin command for processing PIN from user input.
UIs can use this command to process a PIN entered by a user and to
validate the checksum digit (if present).
- Add hostap_cli get_config command to display current AP config.
- Add new hostapd_cli command, wps_ap_pin, to manage AP PIN at
runtime and support dynamic AP PIN management.
- Disable AP PIN after 10 consecutive failures. Slow down attacks
on failures up to 10.
- Allow AP to start in Enrollee mode without AP PIN for probing,
to be compatible with Windows 7.
- Add Config Error into WPS-FAIL events to provide more info
to the user on how to resolve the issue.
- When controlling multiple interfaces:
- apply WPS commands to all interfaces configured to use WPS
- apply WPS config changes to all interfaces that use WPS
- when an attack is detected on any interface, disable AP PIN on
all interfaces
* WPS ER:
- Show SetSelectedRegistrar events as ctrl_iface events.
- Add special AP Setup Locked mode to allow read only ER.
ap_setup_locked=2 can now be used to enable a special mode where
WPS ER can learn the current AP settings, but cannot change them.
* WPS 2.0: Add support for WPS 2.0 (CONFIG_WPS2)
- Add build option CONFIG_WPS_EXTENSIBILITY_TESTING to enable tool
for testing protocol extensibility.
- Add build option CONFIG_WPS_STRICT to allow disabling of WPS
workarounds.
- Add support for AuthorizedMACs attribute.
* TDLS:
- Allow TDLS use or TDLS channel switching in the BSS to be
prohibited in the BSS, using config params tdls_prohibit and
tdls_prohibit_chan_switch.
* EAP server: Add support for configuring fragment size (see
fragment_size in hostapd.conf).
* wlantest: Add a tool wlantest for IEEE802.11 protocol testing.
wlantest can be used to capture frames from a monitor interface
for realtime capturing or from pcap files for offline analysis.
* Interworking: Support added for 802.11u. Enable in .config with
CONFIG_INTERWORKING. See hostapd.conf for config parameters for
interworking.
* Android: Add build and runtime support for Android hostapd.
* Add a new debug message level for excessive information. Use
-ddd to enable.
* TLS: Add support for tls_disable_time_checks=1 in client mode.
* Internal TLS:
- Add support for TLS v1.1 (RFC 4346). Enable with build parameter
CONFIG_TLSV11.
- Add domainComponent parser for X.509 names
* Reorder some IEs to get closer to IEEE 802.11 standard. Move
WMM into end of Beacon, Probe Resp and (Re)Assoc Resp frames.
Move HT IEs to be later in (Re)Assoc Resp.
* Many bugfixes.
2013-06-25 02:47:41 +00:00
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
2009-03-01 22:10:07 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "includes.h"
|
|
|
|
#ifdef __linux__
|
|
|
|
#include <fcntl.h>
|
|
|
|
#endif /* __linux__ */
|
|
|
|
#include <sys/un.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "eloop.h"
|
Import wpa_supplicant / hostapd 0.7.3.
Changes:
2010-09-07 - v0.7.3
* fixed fallback from failed PMKSA caching into full EAP authentication
[Bug 355]
* fixed issue with early D-Bus signals during initialization
* fixed X.509 name handling in internal TLS
* fixed WPS ER to use corrent Enrollee MAC Address in Credential
* fixed scanning routines ot improve AP selection for WPS
* added WPS workaround for open networks
* fixed WPS Diffie-Hellman derivation to use correct public key length
* fixed wpa_supplicant AP mode operations to ignore Supplicant and
scan result events
* improved SME operations with nl80211
* fixed WPS ER event_id handling in some cases
* fixed some issues with bgscan simple to avoid unnecessary scans
* fixed issue with l2_packet_ndis overlapped writes corrupting stack
[Bug 328]
* updated WinPcap to the latest stable version 4.1.2 in Windows
installer
2010-04-18 - v0.7.2
* nl80211: fixed number of issues with roaming
* avoid unnecessary roaming if multiple APs with similar signal
strength are present in scan results
* add TLS client events and server probing to ease design of
automatic detection of EAP parameters
* add option for server certificate matching (SHA256 hash of the
certificate) instead of trusted CA certificate configuration
* bsd: Cleaned up driver wrapper and added various low-level
configuration options
* wpa_gui-qt4: do not show too frequent WPS AP available events as
tray messages
* TNC: fixed issues with fragmentation
* EAP-TNC: add Flags field into fragment acknowledgement (needed to
interoperate with other implementations; may potentially breaks
compatibility with older wpa_supplicant/hostapd versions)
* wpa_cli: added option for using a separate process to receive event
messages to reduce latency in showing these
(CFLAGS += -DCONFIG_WPA_CLI_FORK=y in .config to enable this)
* maximum BSS table size can now be configured (bss_max_count)
* BSSes to be included in the BSS table can be filtered based on
configured SSIDs to save memory (filter_ssids)
* fix number of issues with IEEE 802.11r/FT; this version is not
backwards compatible with old versions
* nl80211: add support for IEEE 802.11r/FT protocol (both over-the-air
and over-the-DS)
* add freq_list network configuration parameter to allow the AP
selection to filter out entries based on the operating channel
* add signal strength change events for bgscan; this allows more
dynamic changes to background scanning interval based on changes in
the signal strength with the current AP; this improves roaming within
ESS quite a bit, e.g., with bgscan="simple:30:-45:300" in the network
configuration block to request background scans less frequently when
signal strength remains good and to automatically trigger background
scans whenever signal strength drops noticeably
(this is currently only available with nl80211)
* add BSSID and reason code (if available) to disconnect event messages
* wpa_gui-qt4: more complete support for translating the GUI with
linguist and add German translation
* fix DH padding with internal crypto code (mainly, for WPS)
* do not trigger initial scan automatically anymore if there are no
enabled networks
2010-01-16 - v0.7.1
* cleaned up driver wrapper API (struct wpa_driver_ops); the new API
is not fully backwards compatible, so out-of-tree driver wrappers
will need modifications
* cleaned up various module interfaces
* merge hostapd and wpa_supplicant developers' documentation into a
single document
* nl80211: use explicit deauthentication to clear cfg80211 state to
avoid issues when roaming between APs
* dbus: major design changes in the new D-Bus API
(fi.w1.wpa_supplicant1)
* nl80211: added support for IBSS networks
* added internal debugging mechanism with backtrace support and memory
allocation/freeing validation, etc. tests (CONFIG_WPA_TRACE=y)
* added WPS ER unsubscription command to more cleanly unregister from
receiving UPnP events when ER is terminated
* cleaned up AP mode operations to avoid need for virtual driver_ops
wrapper
* added BSS table to maintain more complete scan result information
over multiple scans (that may include only partial results)
* wpa_gui-qt4: update Peers dialog information more dynamically while
the dialog is kept open
* fixed PKCS#12 use with OpenSSL 1.0.0
* driver_wext: Added cfg80211-specific optimization to avoid some
unnecessary scans and to speed up association
2009-11-21 - v0.7.0
* increased wpa_cli ping interval to 5 seconds and made this
configurable with a new command line options (-G<seconds>)
* fixed scan buffer processing with WEXT to handle up to 65535
byte result buffer (previously, limited to 32768 bytes)
* allow multiple driver wrappers to be specified on command line
(e.g., -Dnl80211,wext); the first one that is able to initialize the
interface will be used
* added support for multiple SSIDs per scan request to optimize
scan_ssid=1 operations in ap_scan=1 mode (i.e., search for hidden
SSIDs); this requires driver support and can currently be used only
with nl80211
* added support for WPS USBA out-of-band mechanism with USB Flash
Drives (UFD) (CONFIG_WPS_UFD=y)
* driver_ndis: add PAE group address to the multicast address list to
fix wired IEEE 802.1X authentication
* fixed IEEE 802.11r key derivation function to match with the standard
(note: this breaks interoperability with previous version) [Bug 303]
* added better support for drivers that allow separate authentication
and association commands (e.g., mac80211-based Linux drivers with
nl80211; SME in wpa_supplicant); this allows over-the-air FT protocol
to be used (IEEE 802.11r)
* fixed SHA-256 based key derivation function to match with the
standard when using CCMP (for IEEE 802.11r and IEEE 802.11w)
(note: this breaks interoperability with previous version) [Bug 307]
* use shared driver wrapper files with hostapd
* added AP mode functionality (CONFIG_AP=y) with mode=2 in the network
block; this can be used for open and WPA2-Personal networks
(optionally, with WPS); this links in parts of hostapd functionality
into wpa_supplicant
* wpa_gui-qt4: added new Peers dialog to show information about peers
(other devices, including APs and stations, etc. in the neighborhood)
* added support for WPS External Registrar functionality (configure APs
and enroll new devices); can be used with wpa_gui-qt4 Peers dialog
and wpa_cli commands wps_er_start, wps_er_stop, wps_er_pin,
wps_er_pbc, wps_er_learn
(this can also be used with a new 'none' driver wrapper if no
wireless device or IEEE 802.1X on wired is needed)
* driver_nl80211: multiple updates to provide support for new Linux
nl80211/mac80211 functionality
* updated management frame protection to use IEEE Std 802.11w-2009
* fixed number of small WPS issues and added workarounds to
interoperate with common deployed broken implementations
* added support for NFC out-of-band mechanism with WPS
* driver_ndis: fixed wired IEEE 802.1X authentication with PAE group
address frames
* added preliminary support for IEEE 802.11r RIC processing
* added support for specifying subset of enabled frequencies to scan
(scan_freq option in the network configuration block); this can speed
up scanning process considerably if it is known that only a small
subset of channels is actually used in the network (this is currently
supported only with -Dnl80211)
* added a workaround for race condition between receiving the
association event and the following EAPOL-Key
* added background scan and roaming infrastructure to allow
network-specific optimizations to be used to improve roaming within
an ESS (same SSID)
* added new DBus interface (fi.w1.wpa_supplicant1)
2010-10-29 08:01:21 +00:00
|
|
|
#include "common/version.h"
|
2009-03-01 22:10:07 +00:00
|
|
|
#include "drivers/driver.h"
|
|
|
|
#include "l2_packet/l2_packet.h"
|
Import wpa_supplicant / hostapd 0.7.3.
Changes:
2010-09-07 - v0.7.3
* fixed fallback from failed PMKSA caching into full EAP authentication
[Bug 355]
* fixed issue with early D-Bus signals during initialization
* fixed X.509 name handling in internal TLS
* fixed WPS ER to use corrent Enrollee MAC Address in Credential
* fixed scanning routines ot improve AP selection for WPS
* added WPS workaround for open networks
* fixed WPS Diffie-Hellman derivation to use correct public key length
* fixed wpa_supplicant AP mode operations to ignore Supplicant and
scan result events
* improved SME operations with nl80211
* fixed WPS ER event_id handling in some cases
* fixed some issues with bgscan simple to avoid unnecessary scans
* fixed issue with l2_packet_ndis overlapped writes corrupting stack
[Bug 328]
* updated WinPcap to the latest stable version 4.1.2 in Windows
installer
2010-04-18 - v0.7.2
* nl80211: fixed number of issues with roaming
* avoid unnecessary roaming if multiple APs with similar signal
strength are present in scan results
* add TLS client events and server probing to ease design of
automatic detection of EAP parameters
* add option for server certificate matching (SHA256 hash of the
certificate) instead of trusted CA certificate configuration
* bsd: Cleaned up driver wrapper and added various low-level
configuration options
* wpa_gui-qt4: do not show too frequent WPS AP available events as
tray messages
* TNC: fixed issues with fragmentation
* EAP-TNC: add Flags field into fragment acknowledgement (needed to
interoperate with other implementations; may potentially breaks
compatibility with older wpa_supplicant/hostapd versions)
* wpa_cli: added option for using a separate process to receive event
messages to reduce latency in showing these
(CFLAGS += -DCONFIG_WPA_CLI_FORK=y in .config to enable this)
* maximum BSS table size can now be configured (bss_max_count)
* BSSes to be included in the BSS table can be filtered based on
configured SSIDs to save memory (filter_ssids)
* fix number of issues with IEEE 802.11r/FT; this version is not
backwards compatible with old versions
* nl80211: add support for IEEE 802.11r/FT protocol (both over-the-air
and over-the-DS)
* add freq_list network configuration parameter to allow the AP
selection to filter out entries based on the operating channel
* add signal strength change events for bgscan; this allows more
dynamic changes to background scanning interval based on changes in
the signal strength with the current AP; this improves roaming within
ESS quite a bit, e.g., with bgscan="simple:30:-45:300" in the network
configuration block to request background scans less frequently when
signal strength remains good and to automatically trigger background
scans whenever signal strength drops noticeably
(this is currently only available with nl80211)
* add BSSID and reason code (if available) to disconnect event messages
* wpa_gui-qt4: more complete support for translating the GUI with
linguist and add German translation
* fix DH padding with internal crypto code (mainly, for WPS)
* do not trigger initial scan automatically anymore if there are no
enabled networks
2010-01-16 - v0.7.1
* cleaned up driver wrapper API (struct wpa_driver_ops); the new API
is not fully backwards compatible, so out-of-tree driver wrappers
will need modifications
* cleaned up various module interfaces
* merge hostapd and wpa_supplicant developers' documentation into a
single document
* nl80211: use explicit deauthentication to clear cfg80211 state to
avoid issues when roaming between APs
* dbus: major design changes in the new D-Bus API
(fi.w1.wpa_supplicant1)
* nl80211: added support for IBSS networks
* added internal debugging mechanism with backtrace support and memory
allocation/freeing validation, etc. tests (CONFIG_WPA_TRACE=y)
* added WPS ER unsubscription command to more cleanly unregister from
receiving UPnP events when ER is terminated
* cleaned up AP mode operations to avoid need for virtual driver_ops
wrapper
* added BSS table to maintain more complete scan result information
over multiple scans (that may include only partial results)
* wpa_gui-qt4: update Peers dialog information more dynamically while
the dialog is kept open
* fixed PKCS#12 use with OpenSSL 1.0.0
* driver_wext: Added cfg80211-specific optimization to avoid some
unnecessary scans and to speed up association
2009-11-21 - v0.7.0
* increased wpa_cli ping interval to 5 seconds and made this
configurable with a new command line options (-G<seconds>)
* fixed scan buffer processing with WEXT to handle up to 65535
byte result buffer (previously, limited to 32768 bytes)
* allow multiple driver wrappers to be specified on command line
(e.g., -Dnl80211,wext); the first one that is able to initialize the
interface will be used
* added support for multiple SSIDs per scan request to optimize
scan_ssid=1 operations in ap_scan=1 mode (i.e., search for hidden
SSIDs); this requires driver support and can currently be used only
with nl80211
* added support for WPS USBA out-of-band mechanism with USB Flash
Drives (UFD) (CONFIG_WPS_UFD=y)
* driver_ndis: add PAE group address to the multicast address list to
fix wired IEEE 802.1X authentication
* fixed IEEE 802.11r key derivation function to match with the standard
(note: this breaks interoperability with previous version) [Bug 303]
* added better support for drivers that allow separate authentication
and association commands (e.g., mac80211-based Linux drivers with
nl80211; SME in wpa_supplicant); this allows over-the-air FT protocol
to be used (IEEE 802.11r)
* fixed SHA-256 based key derivation function to match with the
standard when using CCMP (for IEEE 802.11r and IEEE 802.11w)
(note: this breaks interoperability with previous version) [Bug 307]
* use shared driver wrapper files with hostapd
* added AP mode functionality (CONFIG_AP=y) with mode=2 in the network
block; this can be used for open and WPA2-Personal networks
(optionally, with WPS); this links in parts of hostapd functionality
into wpa_supplicant
* wpa_gui-qt4: added new Peers dialog to show information about peers
(other devices, including APs and stations, etc. in the neighborhood)
* added support for WPS External Registrar functionality (configure APs
and enroll new devices); can be used with wpa_gui-qt4 Peers dialog
and wpa_cli commands wps_er_start, wps_er_stop, wps_er_pin,
wps_er_pbc, wps_er_learn
(this can also be used with a new 'none' driver wrapper if no
wireless device or IEEE 802.1X on wired is needed)
* driver_nl80211: multiple updates to provide support for new Linux
nl80211/mac80211 functionality
* updated management frame protection to use IEEE Std 802.11w-2009
* fixed number of small WPS issues and added workarounds to
interoperate with common deployed broken implementations
* added support for NFC out-of-band mechanism with WPS
* driver_ndis: fixed wired IEEE 802.1X authentication with PAE group
address frames
* added preliminary support for IEEE 802.11r RIC processing
* added support for specifying subset of enabled frequencies to scan
(scan_freq option in the network configuration block); this can speed
up scanning process considerably if it is known that only a small
subset of channels is actually used in the network (this is currently
supported only with -Dnl80211)
* added a workaround for race condition between receiving the
association event and the following EAPOL-Key
* added background scan and roaming infrastructure to allow
network-specific optimizations to be used to improve roaming within
an ESS (same SSID)
* added new DBus interface (fi.w1.wpa_supplicant1)
2010-10-29 08:01:21 +00:00
|
|
|
#include "common/privsep_commands.h"
|
|
|
|
#include "common/ieee802_11_defs.h"
|
2009-03-01 22:10:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
struct wpa_priv_interface {
|
|
|
|
struct wpa_priv_interface *next;
|
|
|
|
char *driver_name;
|
|
|
|
char *ifname;
|
|
|
|
char *sock_name;
|
|
|
|
int fd;
|
|
|
|
|
2015-10-14 04:30:17 +00:00
|
|
|
const struct wpa_driver_ops *driver;
|
2009-03-01 22:10:07 +00:00
|
|
|
void *drv_priv;
|
2015-10-14 04:30:17 +00:00
|
|
|
void *drv_global_priv;
|
2009-03-01 22:10:07 +00:00
|
|
|
struct sockaddr_un drv_addr;
|
|
|
|
int wpas_registered;
|
|
|
|
|
|
|
|
/* TODO: add support for multiple l2 connections */
|
|
|
|
struct l2_packet_data *l2;
|
|
|
|
struct sockaddr_un l2_addr;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_cmd_register(struct wpa_priv_interface *iface,
|
|
|
|
struct sockaddr_un *from)
|
|
|
|
{
|
|
|
|
if (iface->drv_priv) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Cleaning up forgotten driver instance");
|
|
|
|
if (iface->driver->deinit)
|
|
|
|
iface->driver->deinit(iface->drv_priv);
|
|
|
|
iface->drv_priv = NULL;
|
2015-10-14 04:30:17 +00:00
|
|
|
if (iface->drv_global_priv) {
|
|
|
|
iface->driver->global_deinit(iface->drv_global_priv);
|
|
|
|
iface->drv_global_priv = NULL;
|
|
|
|
}
|
2009-03-01 22:10:07 +00:00
|
|
|
iface->wpas_registered = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (iface->l2) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Cleaning up forgotten l2_packet "
|
|
|
|
"instance");
|
|
|
|
l2_packet_deinit(iface->l2);
|
|
|
|
iface->l2 = NULL;
|
|
|
|
}
|
|
|
|
|
2015-10-14 04:30:17 +00:00
|
|
|
if (iface->driver->init2) {
|
|
|
|
if (iface->driver->global_init) {
|
|
|
|
iface->drv_global_priv = iface->driver->global_init();
|
|
|
|
if (!iface->drv_global_priv) {
|
|
|
|
wpa_printf(MSG_INFO,
|
|
|
|
"Failed to initialize driver global context");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
iface->drv_global_priv = NULL;
|
|
|
|
}
|
|
|
|
iface->drv_priv = iface->driver->init2(iface, iface->ifname,
|
|
|
|
iface->drv_global_priv);
|
|
|
|
} else if (iface->driver->init) {
|
|
|
|
iface->drv_priv = iface->driver->init(iface, iface->ifname);
|
|
|
|
} else {
|
2009-03-01 22:10:07 +00:00
|
|
|
return;
|
2015-10-14 04:30:17 +00:00
|
|
|
}
|
2009-03-01 22:10:07 +00:00
|
|
|
if (iface->drv_priv == NULL) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Failed to initialize driver wrapper");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "Driver wrapper '%s' initialized for interface "
|
|
|
|
"'%s'", iface->driver_name, iface->ifname);
|
|
|
|
|
|
|
|
os_memcpy(&iface->drv_addr, from, sizeof(iface->drv_addr));
|
|
|
|
iface->wpas_registered = 1;
|
|
|
|
|
|
|
|
if (iface->driver->set_param &&
|
|
|
|
iface->driver->set_param(iface->drv_priv, NULL) < 0) {
|
|
|
|
wpa_printf(MSG_ERROR, "Driver interface rejected param");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_cmd_unregister(struct wpa_priv_interface *iface,
|
|
|
|
struct sockaddr_un *from)
|
|
|
|
{
|
|
|
|
if (iface->drv_priv) {
|
|
|
|
if (iface->driver->deinit)
|
|
|
|
iface->driver->deinit(iface->drv_priv);
|
|
|
|
iface->drv_priv = NULL;
|
2015-10-14 04:30:17 +00:00
|
|
|
if (iface->drv_global_priv) {
|
|
|
|
iface->driver->global_deinit(iface->drv_global_priv);
|
|
|
|
iface->drv_global_priv = NULL;
|
|
|
|
}
|
2009-03-01 22:10:07 +00:00
|
|
|
iface->wpas_registered = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_cmd_scan(struct wpa_priv_interface *iface,
|
|
|
|
char *buf, size_t len)
|
|
|
|
{
|
Import wpa_supplicant / hostapd 0.7.3.
Changes:
2010-09-07 - v0.7.3
* fixed fallback from failed PMKSA caching into full EAP authentication
[Bug 355]
* fixed issue with early D-Bus signals during initialization
* fixed X.509 name handling in internal TLS
* fixed WPS ER to use corrent Enrollee MAC Address in Credential
* fixed scanning routines ot improve AP selection for WPS
* added WPS workaround for open networks
* fixed WPS Diffie-Hellman derivation to use correct public key length
* fixed wpa_supplicant AP mode operations to ignore Supplicant and
scan result events
* improved SME operations with nl80211
* fixed WPS ER event_id handling in some cases
* fixed some issues with bgscan simple to avoid unnecessary scans
* fixed issue with l2_packet_ndis overlapped writes corrupting stack
[Bug 328]
* updated WinPcap to the latest stable version 4.1.2 in Windows
installer
2010-04-18 - v0.7.2
* nl80211: fixed number of issues with roaming
* avoid unnecessary roaming if multiple APs with similar signal
strength are present in scan results
* add TLS client events and server probing to ease design of
automatic detection of EAP parameters
* add option for server certificate matching (SHA256 hash of the
certificate) instead of trusted CA certificate configuration
* bsd: Cleaned up driver wrapper and added various low-level
configuration options
* wpa_gui-qt4: do not show too frequent WPS AP available events as
tray messages
* TNC: fixed issues with fragmentation
* EAP-TNC: add Flags field into fragment acknowledgement (needed to
interoperate with other implementations; may potentially breaks
compatibility with older wpa_supplicant/hostapd versions)
* wpa_cli: added option for using a separate process to receive event
messages to reduce latency in showing these
(CFLAGS += -DCONFIG_WPA_CLI_FORK=y in .config to enable this)
* maximum BSS table size can now be configured (bss_max_count)
* BSSes to be included in the BSS table can be filtered based on
configured SSIDs to save memory (filter_ssids)
* fix number of issues with IEEE 802.11r/FT; this version is not
backwards compatible with old versions
* nl80211: add support for IEEE 802.11r/FT protocol (both over-the-air
and over-the-DS)
* add freq_list network configuration parameter to allow the AP
selection to filter out entries based on the operating channel
* add signal strength change events for bgscan; this allows more
dynamic changes to background scanning interval based on changes in
the signal strength with the current AP; this improves roaming within
ESS quite a bit, e.g., with bgscan="simple:30:-45:300" in the network
configuration block to request background scans less frequently when
signal strength remains good and to automatically trigger background
scans whenever signal strength drops noticeably
(this is currently only available with nl80211)
* add BSSID and reason code (if available) to disconnect event messages
* wpa_gui-qt4: more complete support for translating the GUI with
linguist and add German translation
* fix DH padding with internal crypto code (mainly, for WPS)
* do not trigger initial scan automatically anymore if there are no
enabled networks
2010-01-16 - v0.7.1
* cleaned up driver wrapper API (struct wpa_driver_ops); the new API
is not fully backwards compatible, so out-of-tree driver wrappers
will need modifications
* cleaned up various module interfaces
* merge hostapd and wpa_supplicant developers' documentation into a
single document
* nl80211: use explicit deauthentication to clear cfg80211 state to
avoid issues when roaming between APs
* dbus: major design changes in the new D-Bus API
(fi.w1.wpa_supplicant1)
* nl80211: added support for IBSS networks
* added internal debugging mechanism with backtrace support and memory
allocation/freeing validation, etc. tests (CONFIG_WPA_TRACE=y)
* added WPS ER unsubscription command to more cleanly unregister from
receiving UPnP events when ER is terminated
* cleaned up AP mode operations to avoid need for virtual driver_ops
wrapper
* added BSS table to maintain more complete scan result information
over multiple scans (that may include only partial results)
* wpa_gui-qt4: update Peers dialog information more dynamically while
the dialog is kept open
* fixed PKCS#12 use with OpenSSL 1.0.0
* driver_wext: Added cfg80211-specific optimization to avoid some
unnecessary scans and to speed up association
2009-11-21 - v0.7.0
* increased wpa_cli ping interval to 5 seconds and made this
configurable with a new command line options (-G<seconds>)
* fixed scan buffer processing with WEXT to handle up to 65535
byte result buffer (previously, limited to 32768 bytes)
* allow multiple driver wrappers to be specified on command line
(e.g., -Dnl80211,wext); the first one that is able to initialize the
interface will be used
* added support for multiple SSIDs per scan request to optimize
scan_ssid=1 operations in ap_scan=1 mode (i.e., search for hidden
SSIDs); this requires driver support and can currently be used only
with nl80211
* added support for WPS USBA out-of-band mechanism with USB Flash
Drives (UFD) (CONFIG_WPS_UFD=y)
* driver_ndis: add PAE group address to the multicast address list to
fix wired IEEE 802.1X authentication
* fixed IEEE 802.11r key derivation function to match with the standard
(note: this breaks interoperability with previous version) [Bug 303]
* added better support for drivers that allow separate authentication
and association commands (e.g., mac80211-based Linux drivers with
nl80211; SME in wpa_supplicant); this allows over-the-air FT protocol
to be used (IEEE 802.11r)
* fixed SHA-256 based key derivation function to match with the
standard when using CCMP (for IEEE 802.11r and IEEE 802.11w)
(note: this breaks interoperability with previous version) [Bug 307]
* use shared driver wrapper files with hostapd
* added AP mode functionality (CONFIG_AP=y) with mode=2 in the network
block; this can be used for open and WPA2-Personal networks
(optionally, with WPS); this links in parts of hostapd functionality
into wpa_supplicant
* wpa_gui-qt4: added new Peers dialog to show information about peers
(other devices, including APs and stations, etc. in the neighborhood)
* added support for WPS External Registrar functionality (configure APs
and enroll new devices); can be used with wpa_gui-qt4 Peers dialog
and wpa_cli commands wps_er_start, wps_er_stop, wps_er_pin,
wps_er_pbc, wps_er_learn
(this can also be used with a new 'none' driver wrapper if no
wireless device or IEEE 802.1X on wired is needed)
* driver_nl80211: multiple updates to provide support for new Linux
nl80211/mac80211 functionality
* updated management frame protection to use IEEE Std 802.11w-2009
* fixed number of small WPS issues and added workarounds to
interoperate with common deployed broken implementations
* added support for NFC out-of-band mechanism with WPS
* driver_ndis: fixed wired IEEE 802.1X authentication with PAE group
address frames
* added preliminary support for IEEE 802.11r RIC processing
* added support for specifying subset of enabled frequencies to scan
(scan_freq option in the network configuration block); this can speed
up scanning process considerably if it is known that only a small
subset of channels is actually used in the network (this is currently
supported only with -Dnl80211)
* added a workaround for race condition between receiving the
association event and the following EAPOL-Key
* added background scan and roaming infrastructure to allow
network-specific optimizations to be used to improve roaming within
an ESS (same SSID)
* added new DBus interface (fi.w1.wpa_supplicant1)
2010-10-29 08:01:21 +00:00
|
|
|
struct wpa_driver_scan_params params;
|
|
|
|
|
2009-03-01 22:10:07 +00:00
|
|
|
if (iface->drv_priv == NULL)
|
|
|
|
return;
|
|
|
|
|
Import wpa_supplicant / hostapd 0.7.3.
Changes:
2010-09-07 - v0.7.3
* fixed fallback from failed PMKSA caching into full EAP authentication
[Bug 355]
* fixed issue with early D-Bus signals during initialization
* fixed X.509 name handling in internal TLS
* fixed WPS ER to use corrent Enrollee MAC Address in Credential
* fixed scanning routines ot improve AP selection for WPS
* added WPS workaround for open networks
* fixed WPS Diffie-Hellman derivation to use correct public key length
* fixed wpa_supplicant AP mode operations to ignore Supplicant and
scan result events
* improved SME operations with nl80211
* fixed WPS ER event_id handling in some cases
* fixed some issues with bgscan simple to avoid unnecessary scans
* fixed issue with l2_packet_ndis overlapped writes corrupting stack
[Bug 328]
* updated WinPcap to the latest stable version 4.1.2 in Windows
installer
2010-04-18 - v0.7.2
* nl80211: fixed number of issues with roaming
* avoid unnecessary roaming if multiple APs with similar signal
strength are present in scan results
* add TLS client events and server probing to ease design of
automatic detection of EAP parameters
* add option for server certificate matching (SHA256 hash of the
certificate) instead of trusted CA certificate configuration
* bsd: Cleaned up driver wrapper and added various low-level
configuration options
* wpa_gui-qt4: do not show too frequent WPS AP available events as
tray messages
* TNC: fixed issues with fragmentation
* EAP-TNC: add Flags field into fragment acknowledgement (needed to
interoperate with other implementations; may potentially breaks
compatibility with older wpa_supplicant/hostapd versions)
* wpa_cli: added option for using a separate process to receive event
messages to reduce latency in showing these
(CFLAGS += -DCONFIG_WPA_CLI_FORK=y in .config to enable this)
* maximum BSS table size can now be configured (bss_max_count)
* BSSes to be included in the BSS table can be filtered based on
configured SSIDs to save memory (filter_ssids)
* fix number of issues with IEEE 802.11r/FT; this version is not
backwards compatible with old versions
* nl80211: add support for IEEE 802.11r/FT protocol (both over-the-air
and over-the-DS)
* add freq_list network configuration parameter to allow the AP
selection to filter out entries based on the operating channel
* add signal strength change events for bgscan; this allows more
dynamic changes to background scanning interval based on changes in
the signal strength with the current AP; this improves roaming within
ESS quite a bit, e.g., with bgscan="simple:30:-45:300" in the network
configuration block to request background scans less frequently when
signal strength remains good and to automatically trigger background
scans whenever signal strength drops noticeably
(this is currently only available with nl80211)
* add BSSID and reason code (if available) to disconnect event messages
* wpa_gui-qt4: more complete support for translating the GUI with
linguist and add German translation
* fix DH padding with internal crypto code (mainly, for WPS)
* do not trigger initial scan automatically anymore if there are no
enabled networks
2010-01-16 - v0.7.1
* cleaned up driver wrapper API (struct wpa_driver_ops); the new API
is not fully backwards compatible, so out-of-tree driver wrappers
will need modifications
* cleaned up various module interfaces
* merge hostapd and wpa_supplicant developers' documentation into a
single document
* nl80211: use explicit deauthentication to clear cfg80211 state to
avoid issues when roaming between APs
* dbus: major design changes in the new D-Bus API
(fi.w1.wpa_supplicant1)
* nl80211: added support for IBSS networks
* added internal debugging mechanism with backtrace support and memory
allocation/freeing validation, etc. tests (CONFIG_WPA_TRACE=y)
* added WPS ER unsubscription command to more cleanly unregister from
receiving UPnP events when ER is terminated
* cleaned up AP mode operations to avoid need for virtual driver_ops
wrapper
* added BSS table to maintain more complete scan result information
over multiple scans (that may include only partial results)
* wpa_gui-qt4: update Peers dialog information more dynamically while
the dialog is kept open
* fixed PKCS#12 use with OpenSSL 1.0.0
* driver_wext: Added cfg80211-specific optimization to avoid some
unnecessary scans and to speed up association
2009-11-21 - v0.7.0
* increased wpa_cli ping interval to 5 seconds and made this
configurable with a new command line options (-G<seconds>)
* fixed scan buffer processing with WEXT to handle up to 65535
byte result buffer (previously, limited to 32768 bytes)
* allow multiple driver wrappers to be specified on command line
(e.g., -Dnl80211,wext); the first one that is able to initialize the
interface will be used
* added support for multiple SSIDs per scan request to optimize
scan_ssid=1 operations in ap_scan=1 mode (i.e., search for hidden
SSIDs); this requires driver support and can currently be used only
with nl80211
* added support for WPS USBA out-of-band mechanism with USB Flash
Drives (UFD) (CONFIG_WPS_UFD=y)
* driver_ndis: add PAE group address to the multicast address list to
fix wired IEEE 802.1X authentication
* fixed IEEE 802.11r key derivation function to match with the standard
(note: this breaks interoperability with previous version) [Bug 303]
* added better support for drivers that allow separate authentication
and association commands (e.g., mac80211-based Linux drivers with
nl80211; SME in wpa_supplicant); this allows over-the-air FT protocol
to be used (IEEE 802.11r)
* fixed SHA-256 based key derivation function to match with the
standard when using CCMP (for IEEE 802.11r and IEEE 802.11w)
(note: this breaks interoperability with previous version) [Bug 307]
* use shared driver wrapper files with hostapd
* added AP mode functionality (CONFIG_AP=y) with mode=2 in the network
block; this can be used for open and WPA2-Personal networks
(optionally, with WPS); this links in parts of hostapd functionality
into wpa_supplicant
* wpa_gui-qt4: added new Peers dialog to show information about peers
(other devices, including APs and stations, etc. in the neighborhood)
* added support for WPS External Registrar functionality (configure APs
and enroll new devices); can be used with wpa_gui-qt4 Peers dialog
and wpa_cli commands wps_er_start, wps_er_stop, wps_er_pin,
wps_er_pbc, wps_er_learn
(this can also be used with a new 'none' driver wrapper if no
wireless device or IEEE 802.1X on wired is needed)
* driver_nl80211: multiple updates to provide support for new Linux
nl80211/mac80211 functionality
* updated management frame protection to use IEEE Std 802.11w-2009
* fixed number of small WPS issues and added workarounds to
interoperate with common deployed broken implementations
* added support for NFC out-of-band mechanism with WPS
* driver_ndis: fixed wired IEEE 802.1X authentication with PAE group
address frames
* added preliminary support for IEEE 802.11r RIC processing
* added support for specifying subset of enabled frequencies to scan
(scan_freq option in the network configuration block); this can speed
up scanning process considerably if it is known that only a small
subset of channels is actually used in the network (this is currently
supported only with -Dnl80211)
* added a workaround for race condition between receiving the
association event and the following EAPOL-Key
* added background scan and roaming infrastructure to allow
network-specific optimizations to be used to improve roaming within
an ESS (same SSID)
* added new DBus interface (fi.w1.wpa_supplicant1)
2010-10-29 08:01:21 +00:00
|
|
|
os_memset(¶ms, 0, sizeof(params));
|
|
|
|
if (len) {
|
|
|
|
params.ssids[0].ssid = (u8 *) buf;
|
|
|
|
params.ssids[0].ssid_len = len;
|
|
|
|
params.num_ssids = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (iface->driver->scan2)
|
|
|
|
iface->driver->scan2(iface->drv_priv, ¶ms);
|
2009-03-01 22:10:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_get_scan_results2(struct wpa_priv_interface *iface,
|
|
|
|
struct sockaddr_un *from)
|
|
|
|
{
|
|
|
|
struct wpa_scan_results *res;
|
|
|
|
u8 *buf = NULL, *pos, *end;
|
|
|
|
int val;
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
res = iface->driver->get_scan_results2(iface->drv_priv);
|
|
|
|
if (res == NULL)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
buf = os_malloc(60000);
|
|
|
|
if (buf == NULL)
|
|
|
|
goto fail;
|
|
|
|
pos = buf;
|
|
|
|
end = buf + 60000;
|
|
|
|
val = res->num;
|
|
|
|
os_memcpy(pos, &val, sizeof(int));
|
|
|
|
pos += sizeof(int);
|
|
|
|
|
|
|
|
for (i = 0; i < res->num; i++) {
|
|
|
|
struct wpa_scan_res *r = res->res[i];
|
|
|
|
val = sizeof(*r) + r->ie_len;
|
|
|
|
if (end - pos < (int) sizeof(int) + val)
|
|
|
|
break;
|
|
|
|
os_memcpy(pos, &val, sizeof(int));
|
|
|
|
pos += sizeof(int);
|
|
|
|
os_memcpy(pos, r, val);
|
|
|
|
pos += val;
|
|
|
|
}
|
|
|
|
|
|
|
|
sendto(iface->fd, buf, pos - buf, 0, (struct sockaddr *) from,
|
|
|
|
sizeof(*from));
|
|
|
|
|
|
|
|
os_free(buf);
|
2010-06-13 20:32:04 +00:00
|
|
|
wpa_scan_results_free(res);
|
2009-03-01 22:10:07 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
os_free(buf);
|
2010-06-13 20:32:04 +00:00
|
|
|
wpa_scan_results_free(res);
|
2009-03-01 22:10:07 +00:00
|
|
|
sendto(iface->fd, "", 0, 0, (struct sockaddr *) from, sizeof(*from));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_cmd_get_scan_results(struct wpa_priv_interface *iface,
|
|
|
|
struct sockaddr_un *from)
|
|
|
|
{
|
|
|
|
if (iface->drv_priv == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (iface->driver->get_scan_results2)
|
|
|
|
wpa_priv_get_scan_results2(iface, from);
|
|
|
|
else
|
|
|
|
sendto(iface->fd, "", 0, 0, (struct sockaddr *) from,
|
|
|
|
sizeof(*from));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-10-14 04:30:17 +00:00
|
|
|
static void wpa_priv_cmd_authenticate(struct wpa_priv_interface *iface,
|
|
|
|
void *buf, size_t len)
|
|
|
|
{
|
|
|
|
struct wpa_driver_auth_params params;
|
|
|
|
struct privsep_cmd_authenticate *auth;
|
|
|
|
int res, i;
|
|
|
|
|
|
|
|
if (iface->drv_priv == NULL || iface->driver->authenticate == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (len < sizeof(*auth)) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Invalid authentication request");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auth = buf;
|
|
|
|
if (sizeof(*auth) + auth->ie_len + auth->sae_data_len > len) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Authentication request overflow");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
os_memset(¶ms, 0, sizeof(params));
|
|
|
|
params.freq = auth->freq;
|
|
|
|
params.bssid = auth->bssid;
|
|
|
|
params.ssid = auth->ssid;
|
|
|
|
if (auth->ssid_len > SSID_MAX_LEN)
|
|
|
|
return;
|
|
|
|
params.ssid_len = auth->ssid_len;
|
|
|
|
params.auth_alg = auth->auth_alg;
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
if (auth->wep_key_len[i]) {
|
|
|
|
params.wep_key[i] = auth->wep_key[i];
|
|
|
|
params.wep_key_len[i] = auth->wep_key_len[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
params.wep_tx_keyidx = auth->wep_tx_keyidx;
|
|
|
|
params.local_state_change = auth->local_state_change;
|
|
|
|
params.p2p = auth->p2p;
|
|
|
|
if (auth->ie_len) {
|
|
|
|
params.ie = (u8 *) (auth + 1);
|
|
|
|
params.ie_len = auth->ie_len;
|
|
|
|
}
|
|
|
|
if (auth->sae_data_len) {
|
|
|
|
params.sae_data = ((u8 *) (auth + 1)) + auth->ie_len;
|
|
|
|
params.sae_data_len = auth->sae_data_len;
|
|
|
|
}
|
|
|
|
|
|
|
|
res = iface->driver->authenticate(iface->drv_priv, ¶ms);
|
|
|
|
wpa_printf(MSG_DEBUG, "drv->authenticate: res=%d", res);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-01 22:10:07 +00:00
|
|
|
static void wpa_priv_cmd_associate(struct wpa_priv_interface *iface,
|
|
|
|
void *buf, size_t len)
|
|
|
|
{
|
|
|
|
struct wpa_driver_associate_params params;
|
|
|
|
struct privsep_cmd_associate *assoc;
|
|
|
|
u8 *bssid;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
if (iface->drv_priv == NULL || iface->driver->associate == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (len < sizeof(*assoc)) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Invalid association request");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
assoc = buf;
|
|
|
|
if (sizeof(*assoc) + assoc->wpa_ie_len > len) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Association request overflow");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
os_memset(¶ms, 0, sizeof(params));
|
|
|
|
bssid = assoc->bssid;
|
|
|
|
if (bssid[0] | bssid[1] | bssid[2] | bssid[3] | bssid[4] | bssid[5])
|
|
|
|
params.bssid = bssid;
|
|
|
|
params.ssid = assoc->ssid;
|
2015-10-14 04:30:17 +00:00
|
|
|
if (assoc->ssid_len > SSID_MAX_LEN)
|
2009-03-01 22:10:07 +00:00
|
|
|
return;
|
|
|
|
params.ssid_len = assoc->ssid_len;
|
2015-04-18 05:04:12 +00:00
|
|
|
params.freq.mode = assoc->hwmode;
|
|
|
|
params.freq.freq = assoc->freq;
|
|
|
|
params.freq.channel = assoc->channel;
|
2009-03-01 22:10:07 +00:00
|
|
|
if (assoc->wpa_ie_len) {
|
|
|
|
params.wpa_ie = (u8 *) (assoc + 1);
|
|
|
|
params.wpa_ie_len = assoc->wpa_ie_len;
|
|
|
|
}
|
|
|
|
params.pairwise_suite = assoc->pairwise_suite;
|
|
|
|
params.group_suite = assoc->group_suite;
|
|
|
|
params.key_mgmt_suite = assoc->key_mgmt_suite;
|
|
|
|
params.auth_alg = assoc->auth_alg;
|
|
|
|
params.mode = assoc->mode;
|
|
|
|
|
|
|
|
res = iface->driver->associate(iface->drv_priv, ¶ms);
|
|
|
|
wpa_printf(MSG_DEBUG, "drv->associate: res=%d", res);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_cmd_get_bssid(struct wpa_priv_interface *iface,
|
|
|
|
struct sockaddr_un *from)
|
|
|
|
{
|
|
|
|
u8 bssid[ETH_ALEN];
|
|
|
|
|
|
|
|
if (iface->drv_priv == NULL)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
if (iface->driver->get_bssid == NULL ||
|
|
|
|
iface->driver->get_bssid(iface->drv_priv, bssid) < 0)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
sendto(iface->fd, bssid, ETH_ALEN, 0, (struct sockaddr *) from,
|
|
|
|
sizeof(*from));
|
|
|
|
return;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
sendto(iface->fd, "", 0, 0, (struct sockaddr *) from, sizeof(*from));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_cmd_get_ssid(struct wpa_priv_interface *iface,
|
|
|
|
struct sockaddr_un *from)
|
|
|
|
{
|
2015-10-14 04:30:17 +00:00
|
|
|
u8 ssid[sizeof(int) + SSID_MAX_LEN];
|
2009-03-01 22:10:07 +00:00
|
|
|
int res;
|
|
|
|
|
|
|
|
if (iface->drv_priv == NULL)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
if (iface->driver->get_ssid == NULL)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
res = iface->driver->get_ssid(iface->drv_priv, &ssid[sizeof(int)]);
|
2015-10-14 04:30:17 +00:00
|
|
|
if (res < 0 || res > SSID_MAX_LEN)
|
2009-03-01 22:10:07 +00:00
|
|
|
goto fail;
|
|
|
|
os_memcpy(ssid, &res, sizeof(int));
|
|
|
|
|
|
|
|
sendto(iface->fd, ssid, sizeof(ssid), 0, (struct sockaddr *) from,
|
|
|
|
sizeof(*from));
|
|
|
|
return;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
sendto(iface->fd, "", 0, 0, (struct sockaddr *) from, sizeof(*from));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_cmd_set_key(struct wpa_priv_interface *iface,
|
|
|
|
void *buf, size_t len)
|
|
|
|
{
|
|
|
|
struct privsep_cmd_set_key *params;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
if (iface->drv_priv == NULL || iface->driver->set_key == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (len != sizeof(*params)) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Invalid set_key request");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
params = buf;
|
|
|
|
|
Import wpa_supplicant / hostapd 0.7.3.
Changes:
2010-09-07 - v0.7.3
* fixed fallback from failed PMKSA caching into full EAP authentication
[Bug 355]
* fixed issue with early D-Bus signals during initialization
* fixed X.509 name handling in internal TLS
* fixed WPS ER to use corrent Enrollee MAC Address in Credential
* fixed scanning routines ot improve AP selection for WPS
* added WPS workaround for open networks
* fixed WPS Diffie-Hellman derivation to use correct public key length
* fixed wpa_supplicant AP mode operations to ignore Supplicant and
scan result events
* improved SME operations with nl80211
* fixed WPS ER event_id handling in some cases
* fixed some issues with bgscan simple to avoid unnecessary scans
* fixed issue with l2_packet_ndis overlapped writes corrupting stack
[Bug 328]
* updated WinPcap to the latest stable version 4.1.2 in Windows
installer
2010-04-18 - v0.7.2
* nl80211: fixed number of issues with roaming
* avoid unnecessary roaming if multiple APs with similar signal
strength are present in scan results
* add TLS client events and server probing to ease design of
automatic detection of EAP parameters
* add option for server certificate matching (SHA256 hash of the
certificate) instead of trusted CA certificate configuration
* bsd: Cleaned up driver wrapper and added various low-level
configuration options
* wpa_gui-qt4: do not show too frequent WPS AP available events as
tray messages
* TNC: fixed issues with fragmentation
* EAP-TNC: add Flags field into fragment acknowledgement (needed to
interoperate with other implementations; may potentially breaks
compatibility with older wpa_supplicant/hostapd versions)
* wpa_cli: added option for using a separate process to receive event
messages to reduce latency in showing these
(CFLAGS += -DCONFIG_WPA_CLI_FORK=y in .config to enable this)
* maximum BSS table size can now be configured (bss_max_count)
* BSSes to be included in the BSS table can be filtered based on
configured SSIDs to save memory (filter_ssids)
* fix number of issues with IEEE 802.11r/FT; this version is not
backwards compatible with old versions
* nl80211: add support for IEEE 802.11r/FT protocol (both over-the-air
and over-the-DS)
* add freq_list network configuration parameter to allow the AP
selection to filter out entries based on the operating channel
* add signal strength change events for bgscan; this allows more
dynamic changes to background scanning interval based on changes in
the signal strength with the current AP; this improves roaming within
ESS quite a bit, e.g., with bgscan="simple:30:-45:300" in the network
configuration block to request background scans less frequently when
signal strength remains good and to automatically trigger background
scans whenever signal strength drops noticeably
(this is currently only available with nl80211)
* add BSSID and reason code (if available) to disconnect event messages
* wpa_gui-qt4: more complete support for translating the GUI with
linguist and add German translation
* fix DH padding with internal crypto code (mainly, for WPS)
* do not trigger initial scan automatically anymore if there are no
enabled networks
2010-01-16 - v0.7.1
* cleaned up driver wrapper API (struct wpa_driver_ops); the new API
is not fully backwards compatible, so out-of-tree driver wrappers
will need modifications
* cleaned up various module interfaces
* merge hostapd and wpa_supplicant developers' documentation into a
single document
* nl80211: use explicit deauthentication to clear cfg80211 state to
avoid issues when roaming between APs
* dbus: major design changes in the new D-Bus API
(fi.w1.wpa_supplicant1)
* nl80211: added support for IBSS networks
* added internal debugging mechanism with backtrace support and memory
allocation/freeing validation, etc. tests (CONFIG_WPA_TRACE=y)
* added WPS ER unsubscription command to more cleanly unregister from
receiving UPnP events when ER is terminated
* cleaned up AP mode operations to avoid need for virtual driver_ops
wrapper
* added BSS table to maintain more complete scan result information
over multiple scans (that may include only partial results)
* wpa_gui-qt4: update Peers dialog information more dynamically while
the dialog is kept open
* fixed PKCS#12 use with OpenSSL 1.0.0
* driver_wext: Added cfg80211-specific optimization to avoid some
unnecessary scans and to speed up association
2009-11-21 - v0.7.0
* increased wpa_cli ping interval to 5 seconds and made this
configurable with a new command line options (-G<seconds>)
* fixed scan buffer processing with WEXT to handle up to 65535
byte result buffer (previously, limited to 32768 bytes)
* allow multiple driver wrappers to be specified on command line
(e.g., -Dnl80211,wext); the first one that is able to initialize the
interface will be used
* added support for multiple SSIDs per scan request to optimize
scan_ssid=1 operations in ap_scan=1 mode (i.e., search for hidden
SSIDs); this requires driver support and can currently be used only
with nl80211
* added support for WPS USBA out-of-band mechanism with USB Flash
Drives (UFD) (CONFIG_WPS_UFD=y)
* driver_ndis: add PAE group address to the multicast address list to
fix wired IEEE 802.1X authentication
* fixed IEEE 802.11r key derivation function to match with the standard
(note: this breaks interoperability with previous version) [Bug 303]
* added better support for drivers that allow separate authentication
and association commands (e.g., mac80211-based Linux drivers with
nl80211; SME in wpa_supplicant); this allows over-the-air FT protocol
to be used (IEEE 802.11r)
* fixed SHA-256 based key derivation function to match with the
standard when using CCMP (for IEEE 802.11r and IEEE 802.11w)
(note: this breaks interoperability with previous version) [Bug 307]
* use shared driver wrapper files with hostapd
* added AP mode functionality (CONFIG_AP=y) with mode=2 in the network
block; this can be used for open and WPA2-Personal networks
(optionally, with WPS); this links in parts of hostapd functionality
into wpa_supplicant
* wpa_gui-qt4: added new Peers dialog to show information about peers
(other devices, including APs and stations, etc. in the neighborhood)
* added support for WPS External Registrar functionality (configure APs
and enroll new devices); can be used with wpa_gui-qt4 Peers dialog
and wpa_cli commands wps_er_start, wps_er_stop, wps_er_pin,
wps_er_pbc, wps_er_learn
(this can also be used with a new 'none' driver wrapper if no
wireless device or IEEE 802.1X on wired is needed)
* driver_nl80211: multiple updates to provide support for new Linux
nl80211/mac80211 functionality
* updated management frame protection to use IEEE Std 802.11w-2009
* fixed number of small WPS issues and added workarounds to
interoperate with common deployed broken implementations
* added support for NFC out-of-band mechanism with WPS
* driver_ndis: fixed wired IEEE 802.1X authentication with PAE group
address frames
* added preliminary support for IEEE 802.11r RIC processing
* added support for specifying subset of enabled frequencies to scan
(scan_freq option in the network configuration block); this can speed
up scanning process considerably if it is known that only a small
subset of channels is actually used in the network (this is currently
supported only with -Dnl80211)
* added a workaround for race condition between receiving the
association event and the following EAPOL-Key
* added background scan and roaming infrastructure to allow
network-specific optimizations to be used to improve roaming within
an ESS (same SSID)
* added new DBus interface (fi.w1.wpa_supplicant1)
2010-10-29 08:01:21 +00:00
|
|
|
res = iface->driver->set_key(iface->ifname, iface->drv_priv,
|
|
|
|
params->alg,
|
2009-03-01 22:10:07 +00:00
|
|
|
params->addr, params->key_idx,
|
|
|
|
params->set_tx,
|
|
|
|
params->seq_len ? params->seq : NULL,
|
|
|
|
params->seq_len,
|
|
|
|
params->key_len ? params->key : NULL,
|
|
|
|
params->key_len);
|
|
|
|
wpa_printf(MSG_DEBUG, "drv->set_key: res=%d", res);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_cmd_get_capa(struct wpa_priv_interface *iface,
|
|
|
|
struct sockaddr_un *from)
|
|
|
|
{
|
|
|
|
struct wpa_driver_capa capa;
|
|
|
|
|
|
|
|
if (iface->drv_priv == NULL)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
if (iface->driver->get_capa == NULL ||
|
|
|
|
iface->driver->get_capa(iface->drv_priv, &capa) < 0)
|
|
|
|
goto fail;
|
|
|
|
|
2015-10-14 04:30:17 +00:00
|
|
|
/* For now, no support for passing extended_capa pointers */
|
|
|
|
capa.extended_capa = NULL;
|
|
|
|
capa.extended_capa_mask = NULL;
|
|
|
|
capa.extended_capa_len = 0;
|
2009-03-01 22:10:07 +00:00
|
|
|
sendto(iface->fd, &capa, sizeof(capa), 0, (struct sockaddr *) from,
|
|
|
|
sizeof(*from));
|
|
|
|
return;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
sendto(iface->fd, "", 0, 0, (struct sockaddr *) from, sizeof(*from));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_l2_rx(void *ctx, const u8 *src_addr, const u8 *buf,
|
|
|
|
size_t len)
|
|
|
|
{
|
|
|
|
struct wpa_priv_interface *iface = ctx;
|
|
|
|
struct msghdr msg;
|
|
|
|
struct iovec io[2];
|
|
|
|
|
|
|
|
io[0].iov_base = (u8 *) src_addr;
|
|
|
|
io[0].iov_len = ETH_ALEN;
|
|
|
|
io[1].iov_base = (u8 *) buf;
|
|
|
|
io[1].iov_len = len;
|
|
|
|
|
|
|
|
os_memset(&msg, 0, sizeof(msg));
|
|
|
|
msg.msg_iov = io;
|
|
|
|
msg.msg_iovlen = 2;
|
|
|
|
msg.msg_name = &iface->l2_addr;
|
|
|
|
msg.msg_namelen = sizeof(iface->l2_addr);
|
|
|
|
|
|
|
|
if (sendmsg(iface->fd, &msg, 0) < 0) {
|
2015-04-18 05:04:12 +00:00
|
|
|
wpa_printf(MSG_ERROR, "sendmsg(l2 rx): %s", strerror(errno));
|
2009-03-01 22:10:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_cmd_l2_register(struct wpa_priv_interface *iface,
|
|
|
|
struct sockaddr_un *from,
|
|
|
|
void *buf, size_t len)
|
|
|
|
{
|
|
|
|
int *reg_cmd = buf;
|
|
|
|
u8 own_addr[ETH_ALEN];
|
|
|
|
int res;
|
|
|
|
u16 proto;
|
|
|
|
|
|
|
|
if (len != 2 * sizeof(int)) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Invalid l2_register length %lu",
|
|
|
|
(unsigned long) len);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
proto = reg_cmd[0];
|
2015-10-14 04:30:17 +00:00
|
|
|
if (proto != ETH_P_EAPOL && proto != ETH_P_RSN_PREAUTH &&
|
|
|
|
proto != ETH_P_80211_ENCAP) {
|
2009-03-01 22:10:07 +00:00
|
|
|
wpa_printf(MSG_DEBUG, "Refused l2_packet connection for "
|
|
|
|
"ethertype 0x%x", proto);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (iface->l2) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Cleaning up forgotten l2_packet "
|
|
|
|
"instance");
|
|
|
|
l2_packet_deinit(iface->l2);
|
|
|
|
iface->l2 = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
os_memcpy(&iface->l2_addr, from, sizeof(iface->l2_addr));
|
|
|
|
|
|
|
|
iface->l2 = l2_packet_init(iface->ifname, NULL, proto,
|
|
|
|
wpa_priv_l2_rx, iface, reg_cmd[1]);
|
|
|
|
if (iface->l2 == NULL) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Failed to initialize l2_packet "
|
|
|
|
"instance for protocol %d", proto);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (l2_packet_get_own_addr(iface->l2, own_addr) < 0) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Failed to get own address from "
|
|
|
|
"l2_packet");
|
|
|
|
l2_packet_deinit(iface->l2);
|
|
|
|
iface->l2 = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
res = sendto(iface->fd, own_addr, ETH_ALEN, 0,
|
|
|
|
(struct sockaddr *) from, sizeof(*from));
|
|
|
|
wpa_printf(MSG_DEBUG, "L2 registration: res=%d", res);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_cmd_l2_unregister(struct wpa_priv_interface *iface,
|
|
|
|
struct sockaddr_un *from)
|
|
|
|
{
|
|
|
|
if (iface->l2) {
|
|
|
|
l2_packet_deinit(iface->l2);
|
|
|
|
iface->l2 = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_cmd_l2_notify_auth_start(struct wpa_priv_interface *iface,
|
|
|
|
struct sockaddr_un *from)
|
|
|
|
{
|
|
|
|
if (iface->l2)
|
|
|
|
l2_packet_notify_auth_start(iface->l2);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_cmd_l2_send(struct wpa_priv_interface *iface,
|
|
|
|
struct sockaddr_un *from,
|
|
|
|
void *buf, size_t len)
|
|
|
|
{
|
|
|
|
u8 *dst_addr;
|
|
|
|
u16 proto;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
if (iface->l2 == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (len < ETH_ALEN + 2) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Too short L2 send packet (len=%lu)",
|
|
|
|
(unsigned long) len);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dst_addr = buf;
|
|
|
|
os_memcpy(&proto, buf + ETH_ALEN, 2);
|
|
|
|
|
|
|
|
if (proto != ETH_P_EAPOL && proto != ETH_P_RSN_PREAUTH) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Refused l2_packet send for ethertype "
|
|
|
|
"0x%x", proto);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
res = l2_packet_send(iface->l2, dst_addr, proto, buf + ETH_ALEN + 2,
|
|
|
|
len - ETH_ALEN - 2);
|
|
|
|
wpa_printf(MSG_DEBUG, "L2 send: res=%d", res);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_cmd_set_country(struct wpa_priv_interface *iface,
|
|
|
|
char *buf)
|
|
|
|
{
|
|
|
|
if (iface->drv_priv == NULL || iface->driver->set_country == NULL ||
|
|
|
|
*buf == '\0')
|
|
|
|
return;
|
|
|
|
|
|
|
|
iface->driver->set_country(iface->drv_priv, buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_receive(int sock, void *eloop_ctx, void *sock_ctx)
|
|
|
|
{
|
|
|
|
struct wpa_priv_interface *iface = eloop_ctx;
|
|
|
|
char buf[2000], *pos;
|
|
|
|
void *cmd_buf;
|
|
|
|
size_t cmd_len;
|
|
|
|
int res, cmd;
|
|
|
|
struct sockaddr_un from;
|
|
|
|
socklen_t fromlen = sizeof(from);
|
|
|
|
|
|
|
|
res = recvfrom(sock, buf, sizeof(buf), 0, (struct sockaddr *) &from,
|
|
|
|
&fromlen);
|
|
|
|
if (res < 0) {
|
2015-04-18 05:04:12 +00:00
|
|
|
wpa_printf(MSG_ERROR, "recvfrom: %s", strerror(errno));
|
2009-03-01 22:10:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (res < (int) sizeof(int)) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Too short command (len=%d)", res);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
os_memcpy(&cmd, buf, sizeof(int));
|
|
|
|
wpa_printf(MSG_DEBUG, "Command %d for interface %s",
|
|
|
|
cmd, iface->ifname);
|
|
|
|
cmd_buf = &buf[sizeof(int)];
|
|
|
|
cmd_len = res - sizeof(int);
|
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
case PRIVSEP_CMD_REGISTER:
|
|
|
|
wpa_priv_cmd_register(iface, &from);
|
|
|
|
break;
|
|
|
|
case PRIVSEP_CMD_UNREGISTER:
|
|
|
|
wpa_priv_cmd_unregister(iface, &from);
|
|
|
|
break;
|
|
|
|
case PRIVSEP_CMD_SCAN:
|
|
|
|
wpa_priv_cmd_scan(iface, cmd_buf, cmd_len);
|
|
|
|
break;
|
|
|
|
case PRIVSEP_CMD_GET_SCAN_RESULTS:
|
|
|
|
wpa_priv_cmd_get_scan_results(iface, &from);
|
|
|
|
break;
|
|
|
|
case PRIVSEP_CMD_ASSOCIATE:
|
|
|
|
wpa_priv_cmd_associate(iface, cmd_buf, cmd_len);
|
|
|
|
break;
|
|
|
|
case PRIVSEP_CMD_GET_BSSID:
|
|
|
|
wpa_priv_cmd_get_bssid(iface, &from);
|
|
|
|
break;
|
|
|
|
case PRIVSEP_CMD_GET_SSID:
|
|
|
|
wpa_priv_cmd_get_ssid(iface, &from);
|
|
|
|
break;
|
|
|
|
case PRIVSEP_CMD_SET_KEY:
|
|
|
|
wpa_priv_cmd_set_key(iface, cmd_buf, cmd_len);
|
|
|
|
break;
|
|
|
|
case PRIVSEP_CMD_GET_CAPA:
|
|
|
|
wpa_priv_cmd_get_capa(iface, &from);
|
|
|
|
break;
|
|
|
|
case PRIVSEP_CMD_L2_REGISTER:
|
|
|
|
wpa_priv_cmd_l2_register(iface, &from, cmd_buf, cmd_len);
|
|
|
|
break;
|
|
|
|
case PRIVSEP_CMD_L2_UNREGISTER:
|
|
|
|
wpa_priv_cmd_l2_unregister(iface, &from);
|
|
|
|
break;
|
|
|
|
case PRIVSEP_CMD_L2_NOTIFY_AUTH_START:
|
|
|
|
wpa_priv_cmd_l2_notify_auth_start(iface, &from);
|
|
|
|
break;
|
|
|
|
case PRIVSEP_CMD_L2_SEND:
|
|
|
|
wpa_priv_cmd_l2_send(iface, &from, cmd_buf, cmd_len);
|
|
|
|
break;
|
|
|
|
case PRIVSEP_CMD_SET_COUNTRY:
|
|
|
|
pos = cmd_buf;
|
|
|
|
if (pos + cmd_len >= buf + sizeof(buf))
|
|
|
|
break;
|
|
|
|
pos[cmd_len] = '\0';
|
|
|
|
wpa_priv_cmd_set_country(iface, pos);
|
|
|
|
break;
|
2015-10-14 04:30:17 +00:00
|
|
|
case PRIVSEP_CMD_AUTHENTICATE:
|
|
|
|
wpa_priv_cmd_authenticate(iface, cmd_buf, cmd_len);
|
|
|
|
break;
|
2009-03-01 22:10:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_interface_deinit(struct wpa_priv_interface *iface)
|
|
|
|
{
|
|
|
|
if (iface->drv_priv && iface->driver->deinit)
|
|
|
|
iface->driver->deinit(iface->drv_priv);
|
|
|
|
|
|
|
|
if (iface->fd >= 0) {
|
|
|
|
eloop_unregister_read_sock(iface->fd);
|
|
|
|
close(iface->fd);
|
|
|
|
unlink(iface->sock_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (iface->l2)
|
|
|
|
l2_packet_deinit(iface->l2);
|
|
|
|
|
|
|
|
os_free(iface->ifname);
|
|
|
|
os_free(iface->driver_name);
|
|
|
|
os_free(iface->sock_name);
|
|
|
|
os_free(iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static struct wpa_priv_interface *
|
|
|
|
wpa_priv_interface_init(const char *dir, const char *params)
|
|
|
|
{
|
|
|
|
struct wpa_priv_interface *iface;
|
|
|
|
char *pos;
|
|
|
|
size_t len;
|
|
|
|
struct sockaddr_un addr;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
pos = os_strchr(params, ':');
|
|
|
|
if (pos == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
iface = os_zalloc(sizeof(*iface));
|
|
|
|
if (iface == NULL)
|
|
|
|
return NULL;
|
|
|
|
iface->fd = -1;
|
|
|
|
|
|
|
|
len = pos - params;
|
2015-04-18 05:04:12 +00:00
|
|
|
iface->driver_name = dup_binstr(params, len);
|
2009-03-01 22:10:07 +00:00
|
|
|
if (iface->driver_name == NULL) {
|
|
|
|
wpa_priv_interface_deinit(iface);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
Import wpa_supplicant / hostapd 0.7.3.
Changes:
2010-09-07 - v0.7.3
* fixed fallback from failed PMKSA caching into full EAP authentication
[Bug 355]
* fixed issue with early D-Bus signals during initialization
* fixed X.509 name handling in internal TLS
* fixed WPS ER to use corrent Enrollee MAC Address in Credential
* fixed scanning routines ot improve AP selection for WPS
* added WPS workaround for open networks
* fixed WPS Diffie-Hellman derivation to use correct public key length
* fixed wpa_supplicant AP mode operations to ignore Supplicant and
scan result events
* improved SME operations with nl80211
* fixed WPS ER event_id handling in some cases
* fixed some issues with bgscan simple to avoid unnecessary scans
* fixed issue with l2_packet_ndis overlapped writes corrupting stack
[Bug 328]
* updated WinPcap to the latest stable version 4.1.2 in Windows
installer
2010-04-18 - v0.7.2
* nl80211: fixed number of issues with roaming
* avoid unnecessary roaming if multiple APs with similar signal
strength are present in scan results
* add TLS client events and server probing to ease design of
automatic detection of EAP parameters
* add option for server certificate matching (SHA256 hash of the
certificate) instead of trusted CA certificate configuration
* bsd: Cleaned up driver wrapper and added various low-level
configuration options
* wpa_gui-qt4: do not show too frequent WPS AP available events as
tray messages
* TNC: fixed issues with fragmentation
* EAP-TNC: add Flags field into fragment acknowledgement (needed to
interoperate with other implementations; may potentially breaks
compatibility with older wpa_supplicant/hostapd versions)
* wpa_cli: added option for using a separate process to receive event
messages to reduce latency in showing these
(CFLAGS += -DCONFIG_WPA_CLI_FORK=y in .config to enable this)
* maximum BSS table size can now be configured (bss_max_count)
* BSSes to be included in the BSS table can be filtered based on
configured SSIDs to save memory (filter_ssids)
* fix number of issues with IEEE 802.11r/FT; this version is not
backwards compatible with old versions
* nl80211: add support for IEEE 802.11r/FT protocol (both over-the-air
and over-the-DS)
* add freq_list network configuration parameter to allow the AP
selection to filter out entries based on the operating channel
* add signal strength change events for bgscan; this allows more
dynamic changes to background scanning interval based on changes in
the signal strength with the current AP; this improves roaming within
ESS quite a bit, e.g., with bgscan="simple:30:-45:300" in the network
configuration block to request background scans less frequently when
signal strength remains good and to automatically trigger background
scans whenever signal strength drops noticeably
(this is currently only available with nl80211)
* add BSSID and reason code (if available) to disconnect event messages
* wpa_gui-qt4: more complete support for translating the GUI with
linguist and add German translation
* fix DH padding with internal crypto code (mainly, for WPS)
* do not trigger initial scan automatically anymore if there are no
enabled networks
2010-01-16 - v0.7.1
* cleaned up driver wrapper API (struct wpa_driver_ops); the new API
is not fully backwards compatible, so out-of-tree driver wrappers
will need modifications
* cleaned up various module interfaces
* merge hostapd and wpa_supplicant developers' documentation into a
single document
* nl80211: use explicit deauthentication to clear cfg80211 state to
avoid issues when roaming between APs
* dbus: major design changes in the new D-Bus API
(fi.w1.wpa_supplicant1)
* nl80211: added support for IBSS networks
* added internal debugging mechanism with backtrace support and memory
allocation/freeing validation, etc. tests (CONFIG_WPA_TRACE=y)
* added WPS ER unsubscription command to more cleanly unregister from
receiving UPnP events when ER is terminated
* cleaned up AP mode operations to avoid need for virtual driver_ops
wrapper
* added BSS table to maintain more complete scan result information
over multiple scans (that may include only partial results)
* wpa_gui-qt4: update Peers dialog information more dynamically while
the dialog is kept open
* fixed PKCS#12 use with OpenSSL 1.0.0
* driver_wext: Added cfg80211-specific optimization to avoid some
unnecessary scans and to speed up association
2009-11-21 - v0.7.0
* increased wpa_cli ping interval to 5 seconds and made this
configurable with a new command line options (-G<seconds>)
* fixed scan buffer processing with WEXT to handle up to 65535
byte result buffer (previously, limited to 32768 bytes)
* allow multiple driver wrappers to be specified on command line
(e.g., -Dnl80211,wext); the first one that is able to initialize the
interface will be used
* added support for multiple SSIDs per scan request to optimize
scan_ssid=1 operations in ap_scan=1 mode (i.e., search for hidden
SSIDs); this requires driver support and can currently be used only
with nl80211
* added support for WPS USBA out-of-band mechanism with USB Flash
Drives (UFD) (CONFIG_WPS_UFD=y)
* driver_ndis: add PAE group address to the multicast address list to
fix wired IEEE 802.1X authentication
* fixed IEEE 802.11r key derivation function to match with the standard
(note: this breaks interoperability with previous version) [Bug 303]
* added better support for drivers that allow separate authentication
and association commands (e.g., mac80211-based Linux drivers with
nl80211; SME in wpa_supplicant); this allows over-the-air FT protocol
to be used (IEEE 802.11r)
* fixed SHA-256 based key derivation function to match with the
standard when using CCMP (for IEEE 802.11r and IEEE 802.11w)
(note: this breaks interoperability with previous version) [Bug 307]
* use shared driver wrapper files with hostapd
* added AP mode functionality (CONFIG_AP=y) with mode=2 in the network
block; this can be used for open and WPA2-Personal networks
(optionally, with WPS); this links in parts of hostapd functionality
into wpa_supplicant
* wpa_gui-qt4: added new Peers dialog to show information about peers
(other devices, including APs and stations, etc. in the neighborhood)
* added support for WPS External Registrar functionality (configure APs
and enroll new devices); can be used with wpa_gui-qt4 Peers dialog
and wpa_cli commands wps_er_start, wps_er_stop, wps_er_pin,
wps_er_pbc, wps_er_learn
(this can also be used with a new 'none' driver wrapper if no
wireless device or IEEE 802.1X on wired is needed)
* driver_nl80211: multiple updates to provide support for new Linux
nl80211/mac80211 functionality
* updated management frame protection to use IEEE Std 802.11w-2009
* fixed number of small WPS issues and added workarounds to
interoperate with common deployed broken implementations
* added support for NFC out-of-band mechanism with WPS
* driver_ndis: fixed wired IEEE 802.1X authentication with PAE group
address frames
* added preliminary support for IEEE 802.11r RIC processing
* added support for specifying subset of enabled frequencies to scan
(scan_freq option in the network configuration block); this can speed
up scanning process considerably if it is known that only a small
subset of channels is actually used in the network (this is currently
supported only with -Dnl80211)
* added a workaround for race condition between receiving the
association event and the following EAPOL-Key
* added background scan and roaming infrastructure to allow
network-specific optimizations to be used to improve roaming within
an ESS (same SSID)
* added new DBus interface (fi.w1.wpa_supplicant1)
2010-10-29 08:01:21 +00:00
|
|
|
for (i = 0; wpa_drivers[i]; i++) {
|
2009-03-01 22:10:07 +00:00
|
|
|
if (os_strcmp(iface->driver_name,
|
Import wpa_supplicant / hostapd 0.7.3.
Changes:
2010-09-07 - v0.7.3
* fixed fallback from failed PMKSA caching into full EAP authentication
[Bug 355]
* fixed issue with early D-Bus signals during initialization
* fixed X.509 name handling in internal TLS
* fixed WPS ER to use corrent Enrollee MAC Address in Credential
* fixed scanning routines ot improve AP selection for WPS
* added WPS workaround for open networks
* fixed WPS Diffie-Hellman derivation to use correct public key length
* fixed wpa_supplicant AP mode operations to ignore Supplicant and
scan result events
* improved SME operations with nl80211
* fixed WPS ER event_id handling in some cases
* fixed some issues with bgscan simple to avoid unnecessary scans
* fixed issue with l2_packet_ndis overlapped writes corrupting stack
[Bug 328]
* updated WinPcap to the latest stable version 4.1.2 in Windows
installer
2010-04-18 - v0.7.2
* nl80211: fixed number of issues with roaming
* avoid unnecessary roaming if multiple APs with similar signal
strength are present in scan results
* add TLS client events and server probing to ease design of
automatic detection of EAP parameters
* add option for server certificate matching (SHA256 hash of the
certificate) instead of trusted CA certificate configuration
* bsd: Cleaned up driver wrapper and added various low-level
configuration options
* wpa_gui-qt4: do not show too frequent WPS AP available events as
tray messages
* TNC: fixed issues with fragmentation
* EAP-TNC: add Flags field into fragment acknowledgement (needed to
interoperate with other implementations; may potentially breaks
compatibility with older wpa_supplicant/hostapd versions)
* wpa_cli: added option for using a separate process to receive event
messages to reduce latency in showing these
(CFLAGS += -DCONFIG_WPA_CLI_FORK=y in .config to enable this)
* maximum BSS table size can now be configured (bss_max_count)
* BSSes to be included in the BSS table can be filtered based on
configured SSIDs to save memory (filter_ssids)
* fix number of issues with IEEE 802.11r/FT; this version is not
backwards compatible with old versions
* nl80211: add support for IEEE 802.11r/FT protocol (both over-the-air
and over-the-DS)
* add freq_list network configuration parameter to allow the AP
selection to filter out entries based on the operating channel
* add signal strength change events for bgscan; this allows more
dynamic changes to background scanning interval based on changes in
the signal strength with the current AP; this improves roaming within
ESS quite a bit, e.g., with bgscan="simple:30:-45:300" in the network
configuration block to request background scans less frequently when
signal strength remains good and to automatically trigger background
scans whenever signal strength drops noticeably
(this is currently only available with nl80211)
* add BSSID and reason code (if available) to disconnect event messages
* wpa_gui-qt4: more complete support for translating the GUI with
linguist and add German translation
* fix DH padding with internal crypto code (mainly, for WPS)
* do not trigger initial scan automatically anymore if there are no
enabled networks
2010-01-16 - v0.7.1
* cleaned up driver wrapper API (struct wpa_driver_ops); the new API
is not fully backwards compatible, so out-of-tree driver wrappers
will need modifications
* cleaned up various module interfaces
* merge hostapd and wpa_supplicant developers' documentation into a
single document
* nl80211: use explicit deauthentication to clear cfg80211 state to
avoid issues when roaming between APs
* dbus: major design changes in the new D-Bus API
(fi.w1.wpa_supplicant1)
* nl80211: added support for IBSS networks
* added internal debugging mechanism with backtrace support and memory
allocation/freeing validation, etc. tests (CONFIG_WPA_TRACE=y)
* added WPS ER unsubscription command to more cleanly unregister from
receiving UPnP events when ER is terminated
* cleaned up AP mode operations to avoid need for virtual driver_ops
wrapper
* added BSS table to maintain more complete scan result information
over multiple scans (that may include only partial results)
* wpa_gui-qt4: update Peers dialog information more dynamically while
the dialog is kept open
* fixed PKCS#12 use with OpenSSL 1.0.0
* driver_wext: Added cfg80211-specific optimization to avoid some
unnecessary scans and to speed up association
2009-11-21 - v0.7.0
* increased wpa_cli ping interval to 5 seconds and made this
configurable with a new command line options (-G<seconds>)
* fixed scan buffer processing with WEXT to handle up to 65535
byte result buffer (previously, limited to 32768 bytes)
* allow multiple driver wrappers to be specified on command line
(e.g., -Dnl80211,wext); the first one that is able to initialize the
interface will be used
* added support for multiple SSIDs per scan request to optimize
scan_ssid=1 operations in ap_scan=1 mode (i.e., search for hidden
SSIDs); this requires driver support and can currently be used only
with nl80211
* added support for WPS USBA out-of-band mechanism with USB Flash
Drives (UFD) (CONFIG_WPS_UFD=y)
* driver_ndis: add PAE group address to the multicast address list to
fix wired IEEE 802.1X authentication
* fixed IEEE 802.11r key derivation function to match with the standard
(note: this breaks interoperability with previous version) [Bug 303]
* added better support for drivers that allow separate authentication
and association commands (e.g., mac80211-based Linux drivers with
nl80211; SME in wpa_supplicant); this allows over-the-air FT protocol
to be used (IEEE 802.11r)
* fixed SHA-256 based key derivation function to match with the
standard when using CCMP (for IEEE 802.11r and IEEE 802.11w)
(note: this breaks interoperability with previous version) [Bug 307]
* use shared driver wrapper files with hostapd
* added AP mode functionality (CONFIG_AP=y) with mode=2 in the network
block; this can be used for open and WPA2-Personal networks
(optionally, with WPS); this links in parts of hostapd functionality
into wpa_supplicant
* wpa_gui-qt4: added new Peers dialog to show information about peers
(other devices, including APs and stations, etc. in the neighborhood)
* added support for WPS External Registrar functionality (configure APs
and enroll new devices); can be used with wpa_gui-qt4 Peers dialog
and wpa_cli commands wps_er_start, wps_er_stop, wps_er_pin,
wps_er_pbc, wps_er_learn
(this can also be used with a new 'none' driver wrapper if no
wireless device or IEEE 802.1X on wired is needed)
* driver_nl80211: multiple updates to provide support for new Linux
nl80211/mac80211 functionality
* updated management frame protection to use IEEE Std 802.11w-2009
* fixed number of small WPS issues and added workarounds to
interoperate with common deployed broken implementations
* added support for NFC out-of-band mechanism with WPS
* driver_ndis: fixed wired IEEE 802.1X authentication with PAE group
address frames
* added preliminary support for IEEE 802.11r RIC processing
* added support for specifying subset of enabled frequencies to scan
(scan_freq option in the network configuration block); this can speed
up scanning process considerably if it is known that only a small
subset of channels is actually used in the network (this is currently
supported only with -Dnl80211)
* added a workaround for race condition between receiving the
association event and the following EAPOL-Key
* added background scan and roaming infrastructure to allow
network-specific optimizations to be used to improve roaming within
an ESS (same SSID)
* added new DBus interface (fi.w1.wpa_supplicant1)
2010-10-29 08:01:21 +00:00
|
|
|
wpa_drivers[i]->name) == 0) {
|
|
|
|
iface->driver = wpa_drivers[i];
|
2009-03-01 22:10:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (iface->driver == NULL) {
|
|
|
|
wpa_printf(MSG_ERROR, "Unsupported driver '%s'",
|
|
|
|
iface->driver_name);
|
|
|
|
wpa_priv_interface_deinit(iface);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
pos++;
|
|
|
|
iface->ifname = os_strdup(pos);
|
|
|
|
if (iface->ifname == NULL) {
|
|
|
|
wpa_priv_interface_deinit(iface);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
len = os_strlen(dir) + 1 + os_strlen(iface->ifname);
|
|
|
|
iface->sock_name = os_malloc(len + 1);
|
|
|
|
if (iface->sock_name == NULL) {
|
|
|
|
wpa_priv_interface_deinit(iface);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
os_snprintf(iface->sock_name, len + 1, "%s/%s", dir, iface->ifname);
|
|
|
|
if (os_strlen(iface->sock_name) >= sizeof(addr.sun_path)) {
|
|
|
|
wpa_priv_interface_deinit(iface);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
iface->fd = socket(PF_UNIX, SOCK_DGRAM, 0);
|
|
|
|
if (iface->fd < 0) {
|
2015-04-18 05:04:12 +00:00
|
|
|
wpa_printf(MSG_ERROR, "socket(PF_UNIX): %s", strerror(errno));
|
2009-03-01 22:10:07 +00:00
|
|
|
wpa_priv_interface_deinit(iface);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
os_memset(&addr, 0, sizeof(addr));
|
|
|
|
addr.sun_family = AF_UNIX;
|
|
|
|
os_strlcpy(addr.sun_path, iface->sock_name, sizeof(addr.sun_path));
|
|
|
|
|
|
|
|
if (bind(iface->fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
|
|
|
|
wpa_printf(MSG_DEBUG, "bind(PF_UNIX) failed: %s",
|
|
|
|
strerror(errno));
|
|
|
|
if (connect(iface->fd, (struct sockaddr *) &addr,
|
|
|
|
sizeof(addr)) < 0) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Socket exists, but does not "
|
|
|
|
"allow connections - assuming it was "
|
|
|
|
"leftover from forced program termination");
|
|
|
|
if (unlink(iface->sock_name) < 0) {
|
2015-04-18 05:04:12 +00:00
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"Could not unlink existing ctrl_iface socket '%s': %s",
|
|
|
|
iface->sock_name, strerror(errno));
|
2009-03-01 22:10:07 +00:00
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
if (bind(iface->fd, (struct sockaddr *) &addr,
|
|
|
|
sizeof(addr)) < 0) {
|
2015-04-18 05:04:12 +00:00
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"wpa-priv-iface-init: bind(PF_UNIX): %s",
|
|
|
|
strerror(errno));
|
2009-03-01 22:10:07 +00:00
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
wpa_printf(MSG_DEBUG, "Successfully replaced leftover "
|
|
|
|
"socket '%s'", iface->sock_name);
|
|
|
|
} else {
|
|
|
|
wpa_printf(MSG_INFO, "Socket exists and seems to be "
|
|
|
|
"in use - cannot override it");
|
|
|
|
wpa_printf(MSG_INFO, "Delete '%s' manually if it is "
|
|
|
|
"not used anymore", iface->sock_name);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (chmod(iface->sock_name, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
|
2015-04-18 05:04:12 +00:00
|
|
|
wpa_printf(MSG_ERROR, "chmod: %s", strerror(errno));
|
2009-03-01 22:10:07 +00:00
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
eloop_register_read_sock(iface->fd, wpa_priv_receive, iface, NULL);
|
|
|
|
|
|
|
|
return iface;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
wpa_priv_interface_deinit(iface);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int wpa_priv_send_event(struct wpa_priv_interface *iface, int event,
|
|
|
|
const void *data, size_t data_len)
|
|
|
|
{
|
|
|
|
struct msghdr msg;
|
|
|
|
struct iovec io[2];
|
|
|
|
|
|
|
|
io[0].iov_base = &event;
|
|
|
|
io[0].iov_len = sizeof(event);
|
|
|
|
io[1].iov_base = (u8 *) data;
|
|
|
|
io[1].iov_len = data_len;
|
|
|
|
|
|
|
|
os_memset(&msg, 0, sizeof(msg));
|
|
|
|
msg.msg_iov = io;
|
|
|
|
msg.msg_iovlen = data ? 2 : 1;
|
|
|
|
msg.msg_name = &iface->drv_addr;
|
|
|
|
msg.msg_namelen = sizeof(iface->drv_addr);
|
|
|
|
|
|
|
|
if (sendmsg(iface->fd, &msg, 0) < 0) {
|
2015-04-18 05:04:12 +00:00
|
|
|
wpa_printf(MSG_ERROR, "sendmsg(wpas_socket): %s",
|
|
|
|
strerror(errno));
|
2009-03-01 22:10:07 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-10-14 04:30:17 +00:00
|
|
|
static void wpa_priv_send_auth(struct wpa_priv_interface *iface,
|
|
|
|
union wpa_event_data *data)
|
|
|
|
{
|
|
|
|
size_t buflen = sizeof(struct privsep_event_auth) + data->auth.ies_len;
|
|
|
|
struct privsep_event_auth *auth;
|
|
|
|
u8 *buf, *pos;
|
|
|
|
|
|
|
|
buf = os_malloc(buflen);
|
|
|
|
if (buf == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
auth = (struct privsep_event_auth *) buf;
|
|
|
|
pos = (u8 *) (auth + 1);
|
|
|
|
|
|
|
|
os_memcpy(auth->peer, data->auth.peer, ETH_ALEN);
|
|
|
|
os_memcpy(auth->bssid, data->auth.bssid, ETH_ALEN);
|
|
|
|
auth->auth_type = data->auth.auth_type;
|
|
|
|
auth->auth_transaction = data->auth.auth_transaction;
|
|
|
|
auth->status_code = data->auth.status_code;
|
|
|
|
if (data->auth.ies) {
|
|
|
|
os_memcpy(pos, data->auth.ies, data->auth.ies_len);
|
|
|
|
auth->ies_len = data->auth.ies_len;
|
|
|
|
}
|
|
|
|
|
|
|
|
wpa_priv_send_event(iface, PRIVSEP_EVENT_AUTH, buf, buflen);
|
|
|
|
|
|
|
|
os_free(buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-01 22:10:07 +00:00
|
|
|
static void wpa_priv_send_assoc(struct wpa_priv_interface *iface, int event,
|
|
|
|
union wpa_event_data *data)
|
|
|
|
{
|
|
|
|
size_t buflen = 3 * sizeof(int);
|
|
|
|
u8 *buf, *pos;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
if (data) {
|
|
|
|
buflen += data->assoc_info.req_ies_len +
|
|
|
|
data->assoc_info.resp_ies_len +
|
|
|
|
data->assoc_info.beacon_ies_len;
|
|
|
|
}
|
|
|
|
|
|
|
|
buf = os_malloc(buflen);
|
|
|
|
if (buf == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
pos = buf;
|
|
|
|
|
|
|
|
if (data && data->assoc_info.req_ies) {
|
|
|
|
len = data->assoc_info.req_ies_len;
|
|
|
|
os_memcpy(pos, &len, sizeof(int));
|
|
|
|
pos += sizeof(int);
|
|
|
|
os_memcpy(pos, data->assoc_info.req_ies, len);
|
|
|
|
pos += len;
|
|
|
|
} else {
|
|
|
|
len = 0;
|
|
|
|
os_memcpy(pos, &len, sizeof(int));
|
|
|
|
pos += sizeof(int);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data && data->assoc_info.resp_ies) {
|
|
|
|
len = data->assoc_info.resp_ies_len;
|
|
|
|
os_memcpy(pos, &len, sizeof(int));
|
|
|
|
pos += sizeof(int);
|
|
|
|
os_memcpy(pos, data->assoc_info.resp_ies, len);
|
|
|
|
pos += len;
|
|
|
|
} else {
|
|
|
|
len = 0;
|
|
|
|
os_memcpy(pos, &len, sizeof(int));
|
|
|
|
pos += sizeof(int);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data && data->assoc_info.beacon_ies) {
|
|
|
|
len = data->assoc_info.beacon_ies_len;
|
|
|
|
os_memcpy(pos, &len, sizeof(int));
|
|
|
|
pos += sizeof(int);
|
|
|
|
os_memcpy(pos, data->assoc_info.beacon_ies, len);
|
|
|
|
pos += len;
|
|
|
|
} else {
|
|
|
|
len = 0;
|
|
|
|
os_memcpy(pos, &len, sizeof(int));
|
|
|
|
pos += sizeof(int);
|
|
|
|
}
|
|
|
|
|
|
|
|
wpa_priv_send_event(iface, event, buf, buflen);
|
|
|
|
|
|
|
|
os_free(buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_send_interface_status(struct wpa_priv_interface *iface,
|
|
|
|
union wpa_event_data *data)
|
|
|
|
{
|
|
|
|
int ievent;
|
|
|
|
size_t len, maxlen;
|
|
|
|
u8 *buf;
|
|
|
|
char *ifname;
|
|
|
|
|
|
|
|
if (data == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ievent = data->interface_status.ievent;
|
|
|
|
maxlen = sizeof(data->interface_status.ifname);
|
|
|
|
ifname = data->interface_status.ifname;
|
|
|
|
for (len = 0; len < maxlen && ifname[len]; len++)
|
|
|
|
;
|
|
|
|
|
|
|
|
buf = os_malloc(sizeof(int) + len);
|
|
|
|
if (buf == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
os_memcpy(buf, &ievent, sizeof(int));
|
|
|
|
os_memcpy(buf + sizeof(int), ifname, len);
|
|
|
|
|
|
|
|
wpa_priv_send_event(iface, PRIVSEP_EVENT_INTERFACE_STATUS,
|
|
|
|
buf, sizeof(int) + len);
|
|
|
|
|
|
|
|
os_free(buf);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_send_ft_response(struct wpa_priv_interface *iface,
|
|
|
|
union wpa_event_data *data)
|
|
|
|
{
|
|
|
|
size_t len;
|
|
|
|
u8 *buf, *pos;
|
|
|
|
|
|
|
|
if (data == NULL || data->ft_ies.ies == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
len = sizeof(int) + ETH_ALEN + data->ft_ies.ies_len;
|
|
|
|
buf = os_malloc(len);
|
|
|
|
if (buf == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
pos = buf;
|
|
|
|
os_memcpy(pos, &data->ft_ies.ft_action, sizeof(int));
|
|
|
|
pos += sizeof(int);
|
|
|
|
os_memcpy(pos, data->ft_ies.target_ap, ETH_ALEN);
|
|
|
|
pos += ETH_ALEN;
|
|
|
|
os_memcpy(pos, data->ft_ies.ies, data->ft_ies.ies_len);
|
|
|
|
|
|
|
|
wpa_priv_send_event(iface, PRIVSEP_EVENT_FT_RESPONSE, buf, len);
|
|
|
|
|
|
|
|
os_free(buf);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Import wpa_supplicant / hostapd 2.0.
2013-01-12 - v2.0
* added AP-STA-DISCONNECTED ctrl_iface event
* improved debug logging (human readable event names, interface name
included in more entries)
* added number of small changes to make it easier for static analyzers
to understand the implementation
* added a workaround for Windows 7 Michael MIC failure reporting and
use of the Secure bit in EAPOL-Key msg 3/4
* fixed number of small bugs (see git logs for more details)
* changed OpenSSL to read full certificate chain from server_cert file
* nl80211: number of updates to use new cfg80211/nl80211 functionality
- replace monitor interface with nl80211 commands
- additional information for driver-based AP SME
* EAP-pwd:
- fix KDF for group 21 and zero-padding
- added support for fragmentation
- increased maximum number of hunting-and-pecking iterations
* avoid excessive Probe Response retries for broadcast Probe Request
frames (only with drivers using hostapd SME/MLME)
* added preliminary support for using TLS v1.2 (CONFIG_TLSV12=y)
* fixed WPS operation stopping on dual concurrent AP
* added wps_rf_bands configuration parameter for overriding RF Bands
value for WPS
* added support for getting per-device PSK from RADIUS Tunnel-Password
* added support for libnl 3.2 and newer
* increased initial group key handshake retransmit timeout to 500 ms
* added a workaround for 4-way handshake to update SNonce even after
having sent EAPOL-Key 3/4 to avoid issues with some supplicant
implementations that can change SNonce for each EAP-Key 2/4
* added a workaround for EAPOL-Key 4/4 using incorrect type value in
WPA2 mode (some deployed stations use WPA type in that message)
* added a WPS workaround for mixed mode AP Settings with Windows 7
* changed WPS AP PIN disabling mechanism to disable the PIN after 10
consecutive failures in addition to using the exponential lockout
period
* added support for WFA Hotspot 2.0
- GAS/ANQP advertisement of network information
- disable_dgaf parameter to disable downstream group-addressed
forwarding
* simplified licensing terms by selecting the BSD license as the only
alternative
* EAP-SIM: fixed re-authentication not to update pseudonym
* EAP-SIM: use Notification round before EAP-Failure
* EAP-AKA: added support for AT_COUNTER_TOO_SMALL
* EAP-AKA: skip AKA/Identity exchange if EAP identity is recognized
* EAP-AKA': fixed identity for MK derivation
* EAP-AKA': updated to RFC 5448 (username prefixes changed); note: this
breaks interoperability with older versions
* EAP-SIM/AKA: allow pseudonym to be used after unknown reauth id
* changed ANonce to be a random number instead of Counter-based
* added support for canceling WPS operations with hostapd_cli wps_cancel
* fixed EAP/WPS to PSK transition on reassociation in cases where
deauthentication is missed
* hlr_auc_gw enhancements:
- a new command line parameter -u can be used to enable updating of
SQN in Milenage file
- use 5 bit IND for SQN updates
- SQLite database can now be used to store Milenage information
* EAP-SIM/AKA DB: added optional use of SQLite database for pseudonyms
and reauth data
* added support for Chargeable-User-Identity (RFC 4372)
* added radius_auth_req_attr and radius_acct_req_attr configuration
parameters to allow adding/overriding of RADIUS attributes in
Access-Request and Accounting-Request packets
* added support for RADIUS dynamic authorization server (RFC 5176)
* added initial support for WNM operations
- BSS max idle period
- WNM-Sleep Mode
* added new WPS NFC ctrl_iface mechanism
- removed obsoleted WPS_OOB command (including support for deprecated
UFD config_method)
* added FT support for drivers that implement MLME internally
* added SA Query support for drivers that implement MLME internally
* removed default ACM=1 from AC_VO and AC_VI
* changed VENDOR-TEST EAP method to use proper private enterprise number
(this will not interoperate with older versions)
* added hostapd.conf parameter vendor_elements to allow arbitrary vendor
specific elements to be added to the Beacon and Probe Response frames
* added support for configuring GCMP cipher for IEEE 802.11ad
* added support for 256-bit AES with internal TLS implementation
* changed EAPOL transmission to use AC_VO if WMM is active
* fixed EAP-TLS/PEAP/TTLS/FAST server to validate TLS Message Length
correctly; invalid messages could have caused the hostapd process to
terminate before this fix [CVE-2012-4445]
* limit number of active wildcard PINs for WPS Registrar to one to avoid
confusing behavior with multiple wildcard PINs
* added a workaround for WPS PBC session overlap detection to avoid
interop issues with deployed station implementations that do not
remove active PBC indication from Probe Request frames properly
* added support for using SQLite for the eap_user database
* added Acct-Session-Id attribute into Access-Request messages
* fixed EAPOL frame transmission to non-QoS STAs with nl80211
(do not send QoS frames if the STA did not negotiate use of QoS for
this association)
2012-05-10 - v1.0
* Add channel selection support in hostapd. See hostapd.conf.
* Add support for IEEE 802.11v Time Advertisement mechanism with UTC
TSF offset. See hostapd.conf for config info.
* Delay STA entry removal until Deauth/Disassoc TX status in AP mode.
This allows the driver to use PS buffering of Deauthentication and
Disassociation frames when the STA is in power save sleep. Only
available with drivers that provide TX status events for Deauth/
Disassoc frames (nl80211).
* Allow PMKSA caching to be disabled on the Authenticator. See
hostap.conf config parameter disable_pmksa_caching.
* atheros: Add support for IEEE 802.11w configuration.
* bsd: Add support for setting HT values in IFM_MMASK.
* Allow client isolation to be configured with ap_isolate. Client
isolation can be used to prevent low-level bridging of frames
between associated stations in the BSS. By default, this bridging
is allowed.
* Allow coexistance of HT BSSes with WEP/TKIP BSSes.
* Add require_ht config parameter, which can be used to configure
hostapd to reject association with any station that does not support
HT PHY.
* Add support for writing debug log to a file using "-f" option. Also
add relog CLI command to re-open the log file.
* Add bridge handling for WDS STA interfaces. By default they are
added to the configured bridge of the AP interface (if present),
but the user can also specify a separate bridge using cli command
wds_bridge.
* hostapd_cli:
- Add wds_bridge command for specifying bridge for WDS STA
interfaces.
- Add relog command for reopening log file.
- Send AP-STA-DISCONNECTED event when an AP disconnects a station
due to inactivity.
- Add wps_config ctrl_interface command for configuring AP. This
command can be used to configure the AP using the internal WPS
registrar. It works in the same way as new AP settings received
from an ER.
- Many WPS/WPS ER commands - see WPS/WPS ER sections for details.
- Add command get version, that returns hostapd version string.
* WNM: Add BSS Transition Management Request for ESS Disassoc Imminent.
Use hostapd_cli ess_disassoc (STA addr) (URL) to send the
notification to the STA.
* Allow AP mode to disconnect STAs based on low ACK condition (when
the data connection is not working properly, e.g., due to the STA
going outside the range of the AP). Disabled by default, enable by
config option disassoc_low_ack.
* Add WPA_IGNORE_CONFIG_ERRORS build option to continue in case of bad
config file.
* WPS:
- Send AP Settings as a wrapped Credential attribute to ctrl_iface
in WPS-NEW-AP-SETTINGS.
- Dispatch more WPS events through hostapd ctrl_iface.
- Add mechanism for indicating non-standard WPS errors.
- Change concurrent radio AP to use only one WPS UPnP instance.
- Add wps_check_pin command for processing PIN from user input.
UIs can use this command to process a PIN entered by a user and to
validate the checksum digit (if present).
- Add hostap_cli get_config command to display current AP config.
- Add new hostapd_cli command, wps_ap_pin, to manage AP PIN at
runtime and support dynamic AP PIN management.
- Disable AP PIN after 10 consecutive failures. Slow down attacks
on failures up to 10.
- Allow AP to start in Enrollee mode without AP PIN for probing,
to be compatible with Windows 7.
- Add Config Error into WPS-FAIL events to provide more info
to the user on how to resolve the issue.
- When controlling multiple interfaces:
- apply WPS commands to all interfaces configured to use WPS
- apply WPS config changes to all interfaces that use WPS
- when an attack is detected on any interface, disable AP PIN on
all interfaces
* WPS ER:
- Show SetSelectedRegistrar events as ctrl_iface events.
- Add special AP Setup Locked mode to allow read only ER.
ap_setup_locked=2 can now be used to enable a special mode where
WPS ER can learn the current AP settings, but cannot change them.
* WPS 2.0: Add support for WPS 2.0 (CONFIG_WPS2)
- Add build option CONFIG_WPS_EXTENSIBILITY_TESTING to enable tool
for testing protocol extensibility.
- Add build option CONFIG_WPS_STRICT to allow disabling of WPS
workarounds.
- Add support for AuthorizedMACs attribute.
* TDLS:
- Allow TDLS use or TDLS channel switching in the BSS to be
prohibited in the BSS, using config params tdls_prohibit and
tdls_prohibit_chan_switch.
* EAP server: Add support for configuring fragment size (see
fragment_size in hostapd.conf).
* wlantest: Add a tool wlantest for IEEE802.11 protocol testing.
wlantest can be used to capture frames from a monitor interface
for realtime capturing or from pcap files for offline analysis.
* Interworking: Support added for 802.11u. Enable in .config with
CONFIG_INTERWORKING. See hostapd.conf for config parameters for
interworking.
* Android: Add build and runtime support for Android hostapd.
* Add a new debug message level for excessive information. Use
-ddd to enable.
* TLS: Add support for tls_disable_time_checks=1 in client mode.
* Internal TLS:
- Add support for TLS v1.1 (RFC 4346). Enable with build parameter
CONFIG_TLSV11.
- Add domainComponent parser for X.509 names
* Reorder some IEs to get closer to IEEE 802.11 standard. Move
WMM into end of Beacon, Probe Resp and (Re)Assoc Resp frames.
Move HT IEs to be later in (Re)Assoc Resp.
* Many bugfixes.
2013-06-25 02:47:41 +00:00
|
|
|
void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
2009-03-01 22:10:07 +00:00
|
|
|
union wpa_event_data *data)
|
|
|
|
{
|
|
|
|
struct wpa_priv_interface *iface = ctx;
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "%s - event=%d", __func__, event);
|
|
|
|
|
|
|
|
if (!iface->wpas_registered) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Driver event received, but "
|
|
|
|
"wpa_supplicant not registered");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (event) {
|
|
|
|
case EVENT_ASSOC:
|
|
|
|
wpa_priv_send_assoc(iface, PRIVSEP_EVENT_ASSOC, data);
|
|
|
|
break;
|
|
|
|
case EVENT_DISASSOC:
|
|
|
|
wpa_priv_send_event(iface, PRIVSEP_EVENT_DISASSOC, NULL, 0);
|
|
|
|
break;
|
|
|
|
case EVENT_ASSOCINFO:
|
|
|
|
if (data == NULL)
|
|
|
|
return;
|
|
|
|
wpa_priv_send_assoc(iface, PRIVSEP_EVENT_ASSOCINFO, data);
|
|
|
|
break;
|
|
|
|
case EVENT_MICHAEL_MIC_FAILURE:
|
|
|
|
if (data == NULL)
|
|
|
|
return;
|
|
|
|
wpa_priv_send_event(iface, PRIVSEP_EVENT_MICHAEL_MIC_FAILURE,
|
|
|
|
&data->michael_mic_failure.unicast,
|
|
|
|
sizeof(int));
|
|
|
|
break;
|
2015-10-14 04:30:17 +00:00
|
|
|
case EVENT_SCAN_STARTED:
|
|
|
|
wpa_priv_send_event(iface, PRIVSEP_EVENT_SCAN_STARTED, NULL,
|
|
|
|
0);
|
|
|
|
break;
|
2009-03-01 22:10:07 +00:00
|
|
|
case EVENT_SCAN_RESULTS:
|
|
|
|
wpa_priv_send_event(iface, PRIVSEP_EVENT_SCAN_RESULTS, NULL,
|
|
|
|
0);
|
|
|
|
break;
|
|
|
|
case EVENT_INTERFACE_STATUS:
|
|
|
|
wpa_priv_send_interface_status(iface, data);
|
|
|
|
break;
|
|
|
|
case EVENT_PMKID_CANDIDATE:
|
|
|
|
if (data == NULL)
|
|
|
|
return;
|
|
|
|
wpa_priv_send_event(iface, PRIVSEP_EVENT_PMKID_CANDIDATE,
|
|
|
|
&data->pmkid_candidate,
|
|
|
|
sizeof(struct pmkid_candidate));
|
|
|
|
break;
|
|
|
|
case EVENT_STKSTART:
|
|
|
|
if (data == NULL)
|
|
|
|
return;
|
|
|
|
wpa_priv_send_event(iface, PRIVSEP_EVENT_STKSTART,
|
|
|
|
&data->stkstart.peer, ETH_ALEN);
|
|
|
|
break;
|
|
|
|
case EVENT_FT_RESPONSE:
|
|
|
|
wpa_priv_send_ft_response(iface, data);
|
|
|
|
break;
|
2015-10-14 04:30:17 +00:00
|
|
|
case EVENT_AUTH:
|
|
|
|
wpa_priv_send_auth(iface, data);
|
|
|
|
break;
|
2009-03-01 22:10:07 +00:00
|
|
|
default:
|
2015-10-14 04:30:17 +00:00
|
|
|
wpa_printf(MSG_DEBUG, "Unsupported driver event %d (%s) - TODO",
|
|
|
|
event, event_to_string(event));
|
2009-03-01 22:10:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
|
|
|
|
const u8 *buf, size_t len)
|
|
|
|
{
|
|
|
|
struct wpa_priv_interface *iface = ctx;
|
|
|
|
struct msghdr msg;
|
|
|
|
struct iovec io[3];
|
|
|
|
int event = PRIVSEP_EVENT_RX_EAPOL;
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "RX EAPOL from driver");
|
|
|
|
io[0].iov_base = &event;
|
|
|
|
io[0].iov_len = sizeof(event);
|
|
|
|
io[1].iov_base = (u8 *) src_addr;
|
|
|
|
io[1].iov_len = ETH_ALEN;
|
|
|
|
io[2].iov_base = (u8 *) buf;
|
|
|
|
io[2].iov_len = len;
|
|
|
|
|
|
|
|
os_memset(&msg, 0, sizeof(msg));
|
|
|
|
msg.msg_iov = io;
|
|
|
|
msg.msg_iovlen = 3;
|
|
|
|
msg.msg_name = &iface->drv_addr;
|
|
|
|
msg.msg_namelen = sizeof(iface->drv_addr);
|
|
|
|
|
|
|
|
if (sendmsg(iface->fd, &msg, 0) < 0)
|
2015-04-18 05:04:12 +00:00
|
|
|
wpa_printf(MSG_ERROR, "sendmsg(wpas_socket): %s",
|
|
|
|
strerror(errno));
|
2009-03-01 22:10:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Import wpa_supplicant / hostapd 2.0.
2013-01-12 - v2.0
* added AP-STA-DISCONNECTED ctrl_iface event
* improved debug logging (human readable event names, interface name
included in more entries)
* added number of small changes to make it easier for static analyzers
to understand the implementation
* added a workaround for Windows 7 Michael MIC failure reporting and
use of the Secure bit in EAPOL-Key msg 3/4
* fixed number of small bugs (see git logs for more details)
* changed OpenSSL to read full certificate chain from server_cert file
* nl80211: number of updates to use new cfg80211/nl80211 functionality
- replace monitor interface with nl80211 commands
- additional information for driver-based AP SME
* EAP-pwd:
- fix KDF for group 21 and zero-padding
- added support for fragmentation
- increased maximum number of hunting-and-pecking iterations
* avoid excessive Probe Response retries for broadcast Probe Request
frames (only with drivers using hostapd SME/MLME)
* added preliminary support for using TLS v1.2 (CONFIG_TLSV12=y)
* fixed WPS operation stopping on dual concurrent AP
* added wps_rf_bands configuration parameter for overriding RF Bands
value for WPS
* added support for getting per-device PSK from RADIUS Tunnel-Password
* added support for libnl 3.2 and newer
* increased initial group key handshake retransmit timeout to 500 ms
* added a workaround for 4-way handshake to update SNonce even after
having sent EAPOL-Key 3/4 to avoid issues with some supplicant
implementations that can change SNonce for each EAP-Key 2/4
* added a workaround for EAPOL-Key 4/4 using incorrect type value in
WPA2 mode (some deployed stations use WPA type in that message)
* added a WPS workaround for mixed mode AP Settings with Windows 7
* changed WPS AP PIN disabling mechanism to disable the PIN after 10
consecutive failures in addition to using the exponential lockout
period
* added support for WFA Hotspot 2.0
- GAS/ANQP advertisement of network information
- disable_dgaf parameter to disable downstream group-addressed
forwarding
* simplified licensing terms by selecting the BSD license as the only
alternative
* EAP-SIM: fixed re-authentication not to update pseudonym
* EAP-SIM: use Notification round before EAP-Failure
* EAP-AKA: added support for AT_COUNTER_TOO_SMALL
* EAP-AKA: skip AKA/Identity exchange if EAP identity is recognized
* EAP-AKA': fixed identity for MK derivation
* EAP-AKA': updated to RFC 5448 (username prefixes changed); note: this
breaks interoperability with older versions
* EAP-SIM/AKA: allow pseudonym to be used after unknown reauth id
* changed ANonce to be a random number instead of Counter-based
* added support for canceling WPS operations with hostapd_cli wps_cancel
* fixed EAP/WPS to PSK transition on reassociation in cases where
deauthentication is missed
* hlr_auc_gw enhancements:
- a new command line parameter -u can be used to enable updating of
SQN in Milenage file
- use 5 bit IND for SQN updates
- SQLite database can now be used to store Milenage information
* EAP-SIM/AKA DB: added optional use of SQLite database for pseudonyms
and reauth data
* added support for Chargeable-User-Identity (RFC 4372)
* added radius_auth_req_attr and radius_acct_req_attr configuration
parameters to allow adding/overriding of RADIUS attributes in
Access-Request and Accounting-Request packets
* added support for RADIUS dynamic authorization server (RFC 5176)
* added initial support for WNM operations
- BSS max idle period
- WNM-Sleep Mode
* added new WPS NFC ctrl_iface mechanism
- removed obsoleted WPS_OOB command (including support for deprecated
UFD config_method)
* added FT support for drivers that implement MLME internally
* added SA Query support for drivers that implement MLME internally
* removed default ACM=1 from AC_VO and AC_VI
* changed VENDOR-TEST EAP method to use proper private enterprise number
(this will not interoperate with older versions)
* added hostapd.conf parameter vendor_elements to allow arbitrary vendor
specific elements to be added to the Beacon and Probe Response frames
* added support for configuring GCMP cipher for IEEE 802.11ad
* added support for 256-bit AES with internal TLS implementation
* changed EAPOL transmission to use AC_VO if WMM is active
* fixed EAP-TLS/PEAP/TTLS/FAST server to validate TLS Message Length
correctly; invalid messages could have caused the hostapd process to
terminate before this fix [CVE-2012-4445]
* limit number of active wildcard PINs for WPS Registrar to one to avoid
confusing behavior with multiple wildcard PINs
* added a workaround for WPS PBC session overlap detection to avoid
interop issues with deployed station implementations that do not
remove active PBC indication from Probe Request frames properly
* added support for using SQLite for the eap_user database
* added Acct-Session-Id attribute into Access-Request messages
* fixed EAPOL frame transmission to non-QoS STAs with nl80211
(do not send QoS frames if the STA did not negotiate use of QoS for
this association)
2012-05-10 - v1.0
* Add channel selection support in hostapd. See hostapd.conf.
* Add support for IEEE 802.11v Time Advertisement mechanism with UTC
TSF offset. See hostapd.conf for config info.
* Delay STA entry removal until Deauth/Disassoc TX status in AP mode.
This allows the driver to use PS buffering of Deauthentication and
Disassociation frames when the STA is in power save sleep. Only
available with drivers that provide TX status events for Deauth/
Disassoc frames (nl80211).
* Allow PMKSA caching to be disabled on the Authenticator. See
hostap.conf config parameter disable_pmksa_caching.
* atheros: Add support for IEEE 802.11w configuration.
* bsd: Add support for setting HT values in IFM_MMASK.
* Allow client isolation to be configured with ap_isolate. Client
isolation can be used to prevent low-level bridging of frames
between associated stations in the BSS. By default, this bridging
is allowed.
* Allow coexistance of HT BSSes with WEP/TKIP BSSes.
* Add require_ht config parameter, which can be used to configure
hostapd to reject association with any station that does not support
HT PHY.
* Add support for writing debug log to a file using "-f" option. Also
add relog CLI command to re-open the log file.
* Add bridge handling for WDS STA interfaces. By default they are
added to the configured bridge of the AP interface (if present),
but the user can also specify a separate bridge using cli command
wds_bridge.
* hostapd_cli:
- Add wds_bridge command for specifying bridge for WDS STA
interfaces.
- Add relog command for reopening log file.
- Send AP-STA-DISCONNECTED event when an AP disconnects a station
due to inactivity.
- Add wps_config ctrl_interface command for configuring AP. This
command can be used to configure the AP using the internal WPS
registrar. It works in the same way as new AP settings received
from an ER.
- Many WPS/WPS ER commands - see WPS/WPS ER sections for details.
- Add command get version, that returns hostapd version string.
* WNM: Add BSS Transition Management Request for ESS Disassoc Imminent.
Use hostapd_cli ess_disassoc (STA addr) (URL) to send the
notification to the STA.
* Allow AP mode to disconnect STAs based on low ACK condition (when
the data connection is not working properly, e.g., due to the STA
going outside the range of the AP). Disabled by default, enable by
config option disassoc_low_ack.
* Add WPA_IGNORE_CONFIG_ERRORS build option to continue in case of bad
config file.
* WPS:
- Send AP Settings as a wrapped Credential attribute to ctrl_iface
in WPS-NEW-AP-SETTINGS.
- Dispatch more WPS events through hostapd ctrl_iface.
- Add mechanism for indicating non-standard WPS errors.
- Change concurrent radio AP to use only one WPS UPnP instance.
- Add wps_check_pin command for processing PIN from user input.
UIs can use this command to process a PIN entered by a user and to
validate the checksum digit (if present).
- Add hostap_cli get_config command to display current AP config.
- Add new hostapd_cli command, wps_ap_pin, to manage AP PIN at
runtime and support dynamic AP PIN management.
- Disable AP PIN after 10 consecutive failures. Slow down attacks
on failures up to 10.
- Allow AP to start in Enrollee mode without AP PIN for probing,
to be compatible with Windows 7.
- Add Config Error into WPS-FAIL events to provide more info
to the user on how to resolve the issue.
- When controlling multiple interfaces:
- apply WPS commands to all interfaces configured to use WPS
- apply WPS config changes to all interfaces that use WPS
- when an attack is detected on any interface, disable AP PIN on
all interfaces
* WPS ER:
- Show SetSelectedRegistrar events as ctrl_iface events.
- Add special AP Setup Locked mode to allow read only ER.
ap_setup_locked=2 can now be used to enable a special mode where
WPS ER can learn the current AP settings, but cannot change them.
* WPS 2.0: Add support for WPS 2.0 (CONFIG_WPS2)
- Add build option CONFIG_WPS_EXTENSIBILITY_TESTING to enable tool
for testing protocol extensibility.
- Add build option CONFIG_WPS_STRICT to allow disabling of WPS
workarounds.
- Add support for AuthorizedMACs attribute.
* TDLS:
- Allow TDLS use or TDLS channel switching in the BSS to be
prohibited in the BSS, using config params tdls_prohibit and
tdls_prohibit_chan_switch.
* EAP server: Add support for configuring fragment size (see
fragment_size in hostapd.conf).
* wlantest: Add a tool wlantest for IEEE802.11 protocol testing.
wlantest can be used to capture frames from a monitor interface
for realtime capturing or from pcap files for offline analysis.
* Interworking: Support added for 802.11u. Enable in .config with
CONFIG_INTERWORKING. See hostapd.conf for config parameters for
interworking.
* Android: Add build and runtime support for Android hostapd.
* Add a new debug message level for excessive information. Use
-ddd to enable.
* TLS: Add support for tls_disable_time_checks=1 in client mode.
* Internal TLS:
- Add support for TLS v1.1 (RFC 4346). Enable with build parameter
CONFIG_TLSV11.
- Add domainComponent parser for X.509 names
* Reorder some IEs to get closer to IEEE 802.11 standard. Move
WMM into end of Beacon, Probe Resp and (Re)Assoc Resp frames.
Move HT IEs to be later in (Re)Assoc Resp.
* Many bugfixes.
2013-06-25 02:47:41 +00:00
|
|
|
static void wpa_priv_terminate(int sig, void *signal_ctx)
|
2009-03-01 22:10:07 +00:00
|
|
|
{
|
|
|
|
wpa_printf(MSG_DEBUG, "wpa_priv termination requested");
|
|
|
|
eloop_terminate();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wpa_priv_fd_workaround(void)
|
|
|
|
{
|
|
|
|
#ifdef __linux__
|
|
|
|
int s, i;
|
|
|
|
/* When started from pcmcia-cs scripts, wpa_supplicant might start with
|
|
|
|
* fd 0, 1, and 2 closed. This will cause some issues because many
|
|
|
|
* places in wpa_supplicant are still printing out to stdout. As a
|
|
|
|
* workaround, make sure that fd's 0, 1, and 2 are not used for other
|
|
|
|
* sockets. */
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
s = open("/dev/null", O_RDWR);
|
|
|
|
if (s > 2) {
|
|
|
|
close(s);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* __linux__ */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void usage(void)
|
|
|
|
{
|
|
|
|
printf("wpa_priv v" VERSION_STR "\n"
|
|
|
|
"Copyright (c) 2007-2009, Jouni Malinen <j@w1.fi> and "
|
|
|
|
"contributors\n"
|
|
|
|
"\n"
|
|
|
|
"usage:\n"
|
2015-10-14 04:30:17 +00:00
|
|
|
" wpa_priv [-Bdd] [-c<ctrl dir>] [-P<pid file>] "
|
|
|
|
"<driver:ifname> \\\n"
|
|
|
|
" [driver:ifname ...]\n");
|
2009-03-01 22:10:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int c, i;
|
|
|
|
int ret = -1;
|
|
|
|
char *pid_file = NULL;
|
|
|
|
int daemonize = 0;
|
|
|
|
char *ctrl_dir = "/var/run/wpa_priv";
|
|
|
|
struct wpa_priv_interface *interfaces = NULL, *iface;
|
|
|
|
|
|
|
|
if (os_program_init())
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
wpa_priv_fd_workaround();
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
c = getopt(argc, argv, "Bc:dP:");
|
|
|
|
if (c < 0)
|
|
|
|
break;
|
|
|
|
switch (c) {
|
|
|
|
case 'B':
|
|
|
|
daemonize++;
|
|
|
|
break;
|
|
|
|
case 'c':
|
|
|
|
ctrl_dir = optarg;
|
|
|
|
break;
|
|
|
|
case 'd':
|
|
|
|
wpa_debug_level--;
|
|
|
|
break;
|
|
|
|
case 'P':
|
|
|
|
pid_file = os_rel2abs_path(optarg);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
usage();
|
2015-10-14 04:30:17 +00:00
|
|
|
goto out2;
|
2009-03-01 22:10:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (optind >= argc) {
|
|
|
|
usage();
|
2015-10-14 04:30:17 +00:00
|
|
|
goto out2;
|
2009-03-01 22:10:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "wpa_priv control directory: '%s'", ctrl_dir);
|
|
|
|
|
Import wpa_supplicant / hostapd 0.7.3.
Changes:
2010-09-07 - v0.7.3
* fixed fallback from failed PMKSA caching into full EAP authentication
[Bug 355]
* fixed issue with early D-Bus signals during initialization
* fixed X.509 name handling in internal TLS
* fixed WPS ER to use corrent Enrollee MAC Address in Credential
* fixed scanning routines ot improve AP selection for WPS
* added WPS workaround for open networks
* fixed WPS Diffie-Hellman derivation to use correct public key length
* fixed wpa_supplicant AP mode operations to ignore Supplicant and
scan result events
* improved SME operations with nl80211
* fixed WPS ER event_id handling in some cases
* fixed some issues with bgscan simple to avoid unnecessary scans
* fixed issue with l2_packet_ndis overlapped writes corrupting stack
[Bug 328]
* updated WinPcap to the latest stable version 4.1.2 in Windows
installer
2010-04-18 - v0.7.2
* nl80211: fixed number of issues with roaming
* avoid unnecessary roaming if multiple APs with similar signal
strength are present in scan results
* add TLS client events and server probing to ease design of
automatic detection of EAP parameters
* add option for server certificate matching (SHA256 hash of the
certificate) instead of trusted CA certificate configuration
* bsd: Cleaned up driver wrapper and added various low-level
configuration options
* wpa_gui-qt4: do not show too frequent WPS AP available events as
tray messages
* TNC: fixed issues with fragmentation
* EAP-TNC: add Flags field into fragment acknowledgement (needed to
interoperate with other implementations; may potentially breaks
compatibility with older wpa_supplicant/hostapd versions)
* wpa_cli: added option for using a separate process to receive event
messages to reduce latency in showing these
(CFLAGS += -DCONFIG_WPA_CLI_FORK=y in .config to enable this)
* maximum BSS table size can now be configured (bss_max_count)
* BSSes to be included in the BSS table can be filtered based on
configured SSIDs to save memory (filter_ssids)
* fix number of issues with IEEE 802.11r/FT; this version is not
backwards compatible with old versions
* nl80211: add support for IEEE 802.11r/FT protocol (both over-the-air
and over-the-DS)
* add freq_list network configuration parameter to allow the AP
selection to filter out entries based on the operating channel
* add signal strength change events for bgscan; this allows more
dynamic changes to background scanning interval based on changes in
the signal strength with the current AP; this improves roaming within
ESS quite a bit, e.g., with bgscan="simple:30:-45:300" in the network
configuration block to request background scans less frequently when
signal strength remains good and to automatically trigger background
scans whenever signal strength drops noticeably
(this is currently only available with nl80211)
* add BSSID and reason code (if available) to disconnect event messages
* wpa_gui-qt4: more complete support for translating the GUI with
linguist and add German translation
* fix DH padding with internal crypto code (mainly, for WPS)
* do not trigger initial scan automatically anymore if there are no
enabled networks
2010-01-16 - v0.7.1
* cleaned up driver wrapper API (struct wpa_driver_ops); the new API
is not fully backwards compatible, so out-of-tree driver wrappers
will need modifications
* cleaned up various module interfaces
* merge hostapd and wpa_supplicant developers' documentation into a
single document
* nl80211: use explicit deauthentication to clear cfg80211 state to
avoid issues when roaming between APs
* dbus: major design changes in the new D-Bus API
(fi.w1.wpa_supplicant1)
* nl80211: added support for IBSS networks
* added internal debugging mechanism with backtrace support and memory
allocation/freeing validation, etc. tests (CONFIG_WPA_TRACE=y)
* added WPS ER unsubscription command to more cleanly unregister from
receiving UPnP events when ER is terminated
* cleaned up AP mode operations to avoid need for virtual driver_ops
wrapper
* added BSS table to maintain more complete scan result information
over multiple scans (that may include only partial results)
* wpa_gui-qt4: update Peers dialog information more dynamically while
the dialog is kept open
* fixed PKCS#12 use with OpenSSL 1.0.0
* driver_wext: Added cfg80211-specific optimization to avoid some
unnecessary scans and to speed up association
2009-11-21 - v0.7.0
* increased wpa_cli ping interval to 5 seconds and made this
configurable with a new command line options (-G<seconds>)
* fixed scan buffer processing with WEXT to handle up to 65535
byte result buffer (previously, limited to 32768 bytes)
* allow multiple driver wrappers to be specified on command line
(e.g., -Dnl80211,wext); the first one that is able to initialize the
interface will be used
* added support for multiple SSIDs per scan request to optimize
scan_ssid=1 operations in ap_scan=1 mode (i.e., search for hidden
SSIDs); this requires driver support and can currently be used only
with nl80211
* added support for WPS USBA out-of-band mechanism with USB Flash
Drives (UFD) (CONFIG_WPS_UFD=y)
* driver_ndis: add PAE group address to the multicast address list to
fix wired IEEE 802.1X authentication
* fixed IEEE 802.11r key derivation function to match with the standard
(note: this breaks interoperability with previous version) [Bug 303]
* added better support for drivers that allow separate authentication
and association commands (e.g., mac80211-based Linux drivers with
nl80211; SME in wpa_supplicant); this allows over-the-air FT protocol
to be used (IEEE 802.11r)
* fixed SHA-256 based key derivation function to match with the
standard when using CCMP (for IEEE 802.11r and IEEE 802.11w)
(note: this breaks interoperability with previous version) [Bug 307]
* use shared driver wrapper files with hostapd
* added AP mode functionality (CONFIG_AP=y) with mode=2 in the network
block; this can be used for open and WPA2-Personal networks
(optionally, with WPS); this links in parts of hostapd functionality
into wpa_supplicant
* wpa_gui-qt4: added new Peers dialog to show information about peers
(other devices, including APs and stations, etc. in the neighborhood)
* added support for WPS External Registrar functionality (configure APs
and enroll new devices); can be used with wpa_gui-qt4 Peers dialog
and wpa_cli commands wps_er_start, wps_er_stop, wps_er_pin,
wps_er_pbc, wps_er_learn
(this can also be used with a new 'none' driver wrapper if no
wireless device or IEEE 802.1X on wired is needed)
* driver_nl80211: multiple updates to provide support for new Linux
nl80211/mac80211 functionality
* updated management frame protection to use IEEE Std 802.11w-2009
* fixed number of small WPS issues and added workarounds to
interoperate with common deployed broken implementations
* added support for NFC out-of-band mechanism with WPS
* driver_ndis: fixed wired IEEE 802.1X authentication with PAE group
address frames
* added preliminary support for IEEE 802.11r RIC processing
* added support for specifying subset of enabled frequencies to scan
(scan_freq option in the network configuration block); this can speed
up scanning process considerably if it is known that only a small
subset of channels is actually used in the network (this is currently
supported only with -Dnl80211)
* added a workaround for race condition between receiving the
association event and the following EAPOL-Key
* added background scan and roaming infrastructure to allow
network-specific optimizations to be used to improve roaming within
an ESS (same SSID)
* added new DBus interface (fi.w1.wpa_supplicant1)
2010-10-29 08:01:21 +00:00
|
|
|
if (eloop_init()) {
|
2009-03-01 22:10:07 +00:00
|
|
|
wpa_printf(MSG_ERROR, "Failed to initialize event loop");
|
2015-10-14 04:30:17 +00:00
|
|
|
goto out2;
|
2009-03-01 22:10:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = optind; i < argc; i++) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Adding driver:interface %s", argv[i]);
|
|
|
|
iface = wpa_priv_interface_init(ctrl_dir, argv[i]);
|
|
|
|
if (iface == NULL)
|
|
|
|
goto out;
|
|
|
|
iface->next = interfaces;
|
|
|
|
interfaces = iface;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (daemonize && os_daemonize(pid_file))
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
eloop_register_signal_terminate(wpa_priv_terminate, NULL);
|
|
|
|
eloop_run();
|
|
|
|
|
|
|
|
ret = 0;
|
|
|
|
|
|
|
|
out:
|
|
|
|
iface = interfaces;
|
|
|
|
while (iface) {
|
|
|
|
struct wpa_priv_interface *prev = iface;
|
|
|
|
iface = iface->next;
|
|
|
|
wpa_priv_interface_deinit(prev);
|
|
|
|
}
|
|
|
|
|
|
|
|
eloop_destroy();
|
|
|
|
|
2015-10-14 04:30:17 +00:00
|
|
|
out2:
|
|
|
|
if (daemonize)
|
|
|
|
os_daemonize_terminate(pid_file);
|
2009-03-01 22:10:07 +00:00
|
|
|
os_free(pid_file);
|
|
|
|
os_program_deinit();
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|