3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2025-08-02 17:37:22 +02:00

Compare commits

..

No commits in common. "master" and "0.19" have entirely different histories.
master ... 0.19

805 changed files with 23849 additions and 83823 deletions

View File

@ -1,3 +0,0 @@
[codespell]
ignore-words-list = fils, FILS, SME, assertIn, OCE, clen, aci, ELL, sav, ths
skip = build-aux, linux, autom4te.cache, aclocal.m4, AUTHORS, libtool, configure*, *.5, ell

31
.gitignore vendored
View File

@ -1,16 +1,9 @@
*.o *.o
*.lo *.lo
*.la *.la
*.gcno
*.gcda
.libs .libs
.deps .deps
.dirstamp .dirstamp
.cache
.ccls-cache
compile_commands.json
tags
cscope.*
Makefile Makefile
Makefile.in Makefile.in
aclocal.m4 aclocal.m4
@ -26,24 +19,14 @@ build-aux
autom4te.cache autom4te.cache
ell ell
src/iwd src/iwd
src/iwd.8
src/iwd.ap.5
src/iwd.debug.7
src/iwd.config.5
src/iwd.network.5
src/iwd.service src/iwd.service
client/iwctl client/iwctl
client/iwctl.1
monitor/iwmon monitor/iwmon
monitor/iwmon.1
wired/ead wired/ead
wired/ead.8
wired/ead.service wired/ead.service
tools/hwsim tools/hwsim
tools/hwsim.1 tools/test-runner
tools/probe-req doc/iwmon.1
tools/iwd-decrypt-profile
tools/iwd-psk
unit/test-cmac-aes unit/test-cmac-aes
unit/test-arc4 unit/test-arc4
unit/test-hmac-md5 unit/test-hmac-md5
@ -63,20 +46,10 @@ unit/test-eap-mschapv2
unit/test-eap-sim unit/test-eap-sim
unit/test-client unit/test-client
unit/test-p2p unit/test-p2p
unit/test-band
unit/test-dpp
unit/test-json
unit/test-nl80211util
unit/test-pmksa
unit/test-storage
unit/cert-*.pem unit/cert-*.pem
unit/cert-*.csr unit/cert-*.csr
unit/cert-*.srl unit/cert-*.srl
unit/*-settings.8021x
unit/*.log unit/*.log
unit/*.trs unit/*.trs
test-suite.log test-suite.log
src/builtin.h src/builtin.h
autotests/*/__pycache__
iwd-coverage.info
gcov

26
AUTHORS
View File

@ -16,28 +16,4 @@ Andreas Henriksson <andreas@fatal.se>
Jordan Glover <Golden_Miller83@protonmail.ch> Jordan Glover <Golden_Miller83@protonmail.ch>
Eduardo Abinader <eduardoabinader@gmail.com> Eduardo Abinader <eduardoabinader@gmail.com>
Matthias Schoepfer <matthias.schoepfer@ithinx.io> Matthias Schoepfer <matthias.schoepfer@ithinx.io>
Will Dietz <w@wdtz.org>
Henrik Stokseth <hstokset@users.sourceforge.net>
Pinghao Wu <xdavidwuph@gmail.com>
Rosen Penev <rosenp@gmail.com>
Diego Santa Cruz <Diego.SantaCruz@spinetix.com>
Alvin Šipraga <alsi@bang-olufsen.dk>
Daniel DE ALMEIDA BRAGA <daniel.de-almeida-braga@irisa.fr>
Ard Biesheuvel <ardb@kernel.org>
Mathy Vanhoef <Mathy.Vanhoef@kuleuven.be>
Jonathan Liu <net147@gmail.com>
Daniel Lin <ephemient@gmail.com>
Sean Anderson <sean.anderson@seco.com>
Joseph Benden <joe@benden.us>
Michael Johnson <mjohnson459@gmail.com>
Matt Oberle <matt.r.oberle@gmail.com>
Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
Torsten Schmitz <noreply.torsten@gmail.com>
Diederik de Haas <didi.debian@cknow.org>
Vladimír Dudr <vladimir@tango-dj.cz>
Emmanuel VAUTRIN <Emmanuel.VAUTRIN@cpexterne.org>
Jesse Lentz <jesse@twosheds.org>
Pinghao Wu <xdavidwuph@gmail.com>
Neehar Vijay <env252525@gmail.com>
Jiajie Chen <c@jia.je>
Ronan Pigott <ronan@rjp.ie>

396
ChangeLog
View File

@ -1,399 +1,3 @@
ver 3.9:
Fix issue with Access Point mode and frequency unlocking.
Fix issue with network configuration and BSS retry logic.
Fix issue with handling busy notification from Access Point.
Fix issue with handling P-192, P-224 and P-521 for SAE.
ver 3.8:
Fix issue with handling unit tests and missing kernel features.
ver 3.7:
Fix issue with handling length of EncryptedSecurity.
Fix issue with handling empty affinities lists.
Fix issue with handling survey scanning results.
Fix issue with handling duplicate values in DPP URI.
ver 3.6:
Fix issue with handling blacklisting and roaming requests.
Fix issue with handling CQM thresholds for FullMAC devices.
Add support for PMKSA when using FullMAC devices.
ver 3.5:
Add support for option to disable blacklist handling.
Add support for option to disable SAE for broken drivers.
ver 3.4:
Add support for the Test Anything Protocol.
ver 3.3:
Fix issue with handling External Authentication.
ver 3.2:
Fix issue with GCC 15 and -std=c23 build errors.
Add support for using PMKSA over SAE if available.
Add support for HighUtilization/StationCount thresholds.
Add support for disabling Multicast RX option.
ver 3.1:
Fix issue with handling OWE transition BSS selection.
Fix issue with handling oper class 136 starting frequency.
ver 3.0:
Fix issue with handling alpha2 code for United Kingdom.
Fix issue with handling empty TX/RX bitrate attributes.
Fix issue with handling RSSI polling fallback workaround.
Fix issue with handling harmless cloned information elements.
Add experimental support for External Authentication feature.
ver 2.22:
Fix issue with handling the Affinities property.
Fix issue with handling ConnectedAccessPoint signal when roaming.
ver 2.21:
Fix issue with pending scan requests after regdom update.
Fix issue with handling the rearming of the roaming timeout.
Fix issue with survey request and externally triggered scans.
Fix issue with RSSI fallback when setting CQM threshold fails.
Fix issue with FT-over-Air without offchannel support.
Add support for per station Affinities property.
ver 2.20:
Fix issue with PKEX timeout and number of frequencies used.
Fix issue with handling logic for handshake failures.
Fix issue with handling ConnectedAccessPoint signal.
ver 2.19:
Fix issue with handling flush flag for external scans.
Fix issue with handling SNR calculation in ranking.
ver 2.18:
Fix issue with handling BSS with invalid HE capabilities.
Fix issue with neighbor reports with invalid country codes.
Fix issue with EAP-TTLS Start packets with L flag set.
Add support for enabling SAE for AP mode operation.
ver 2.17:
Fix issue with handling deauthenticate on disconnect.
Fix issue with handling of rate estimation errors.
Fix issue with handling EAPOL frame listeners.
ver 2.16:
Fix issue with uninitialized variable and DPP encrypt.
Fix issue with Access Point mode and ATTR_MAC validation.
Fix issue with Access Point mode and frequency attributes.
Fix issue with P2P and handling client info description.
Fix issue with P2P and handling parsing of service info.
Fix issue with netconfig and handling domain list.
Add support for forcing a default ECC group.
ver 2.15:
Fix issue with notice events for connection timeouts.
Fix issue with reason code and deauthenticate event.
Fix issue with handling basename() functionality.
ver 2.14:
Fix issue with accepting PTK 4/4 after receiving PTK 2/4.
Fix issue with frequency limit for quick scans.
Fix issue with limiting DHCPv4 attempts.
ver 2.13:
Fix issue with handling netconfig and roaming conditions.
Fix issue with logging requirement for CMD_EXTERNAL_AUTH.
Fix issue with using OpenSSL 3.2 installations.
ver 2.12:
Fix issue with DPP extra settings not being used.
Fix issue with DPP and PRF+ handling on AARCH64.
Add support for SAE password identifiers.
ver 2.11:
Fix issue with handling iovecs with multiple IEs.
Fix issue with handling SAE password identifiers.
Fix issue with handling agent release method call.
ver 2.10:
Fix issue with buffer overflow for 32 byte SSIDs.
Fix issue with deauthentication before FT work completes.
Fix issue with power save disabling procedure.
ver 2.9:
Fix issue with handling certain FT failures.
Fix issue with handling user-disabled bands.
Fix issue with handling roam on beacon loss event.
Add support for PKEX configurator.
Add support for PKEX enrollee.
ver 2.8:
Fix issue with handling OWE AKM in association reply.
ver 2.7:
Fix issue with handling FT-8021X and SHA256 PMKID derivation.
ver 2.6:
Add support for setting driver specific quirks.
Add support for disabling power saving mode.
ver 2.5:
Fix issue with HT40+/- checks when creating chandef.
Fix issue with handling support for FT-8021X-SHA384.
Fix issue with handling secure bit check in handshake 1/4.
Fix issue with allowing roaming before netconfig finishes.
Fix issue with double free when disconnecting during FT.
ver 2.4:
Fix issue with FT-over-Air and same channel operation.
Fix issue with AP mode and missing support for GTK.
Fix issue with AP mode and channel switch event.
Fix issue with SSID string conversion handling.
ver 2.3:
Fix issue with length calculation for WMM IE.
Fix issue with channel number allocation off-by-one.
Fix issue with cached session when TLS phase2 fails.
Add support for FastReauthentication setting for EAP-TLS.
ver 2.2:
Fix issue with handling FT and multiple roaming scans.
Fix issue with handling multiple wiphy registrations.
Fix issue with with EAP-PEAP session resumption.
Add support for using PTK rekeying in AP mode.
Add support for setting country IE in AP mode.
Add support for setting WMM parameter IE in AP mode.
ver 2.1:
Fix issue with handling FT-over-DS action.
Fix issue with handling scan and 6 GHz support check.
Fix issue with handling when periodic scans get aborted.
Add support for using 5 GHz frequencies in AP mode.
ver 2.0:
Fix issue with handling P2P and limiting ciphers to CCMP.
Fix issue with scanning before forced roaming action.
Fix issue with provided scan frequencies from RRM.
Fix issue with handling Michael MIC failure message.
Fix issue with handling timestamp size in MPDU frames.
Fix issue with handling enablement of OCVC for FT AKMs.
Fix issue with handling FT work as highest priority.
Fix issue with handling roaming events and Multi-BSS.
Add support for utilizing roaming candidates list.
Add support for utilizing TLS session caching.
Add support for ciphers with 256 bits key size.
Add support for Access Point mode with legacy TKIP.
Add support for MAC address changes while powered.
Add support for IPv4 and IPv6 network configuration.
ver 1.30:
Fix issue with handling OWE if buggy AP is detected.
Fix issue with handling quick scan and enabling 6GHz.
Fix issue with handling tags for extended IEs.
Add support for handling HE capabilities.
Add support for handling regulatory domain changes.
Add support for handling netdev packet loss events.
ver 1.29:
Fix issue with handling EAP-Success message.
Fix issue with handling secure setting and EAPoL.
Add support for DeviceProvisioning API properties.
ver 1.28:
Fix issue with handling invalid EAPoL frames.
Fix issue with handling unexpectedly unencrypted EAP frames.
Fix issue with handling AlwaysRandomizeAddress/AddressOverride.
Fix issue with handling initial signal level notification.
Fix issue with handling sorting of scan requests.
Fix issue with handling frame type check in FT.
ver 1.27:
Fix issue with hidden networks on connection error.
Fix issue with directed roams if already trying to roam.
Fix issue with checking for connected in FT frame event.
ver 1.26:
Fix issue with handling BSS that changed frequency.
Fix issue with handling frequencies in neighbor report.
Fix issue with operating classes for 802.11ax standard.
Fix issue with enforcing of MFPR for 6 GHz frequencies.
Add support for band defined in the WiFi 6E amendment.
Add support for scanning while in AP mode.
ver 1.25:
Fix issue with handling abort of periodic scans.
Fix issue with handling connection when link goes down.
Fix issue with handling operating channel information.
Add support for encrypted network profile storage.
Add support for DPP initiating as a configurator.
ver 1.24:
Fix issue with handshake and missing rekeying support.
Fix issue with BSS ranking and zero signal strength.
Fix issue with setting OWE IE length correctly.
ver 1.23:
Fix issue with handling handshake offloading.
Fix issue with at_console and D-Bus policy.
ver 1.22:
Fix issue with handling periodic scanning.
Fix issue with handling scanning completion.
Fix issue with handling scanning for OWE auto-connect.
Add support for additional DPP features.
ver 1.21:
Fix issue with handling disconnect events issued by AP.
Add experimental support for DPP feature.
ver 1.20:
Fix issue with handling Hotspot 2.0 requirements.
Add support for evict_nocarrier setting during roaming.
Add support for experimental NetworkConfigurationAgent API.
ver 1.19:
Fix issue with handling OCV if offloading is supported.
Fix issue with handling SA Query on channel switch event.
Fix issue with starting FT-over-DS actions after roaming.
Add support for OWE transition networks.
Add support for extended key IDs.
ver 1.18:
Fix issue with handling faulty SAE duplicate commits.
Add support for Access Point FILS IP Address Assignment IE.
Add support for P2P GO-side 4-way handshake IP allocation.
Add support for forcing SAE group 19 if BSS requires it.
ver 1.17:
Fix issue with sending additional and vendor IEs.
Fix issue with IE ordering for 802.11-2020 support.
Fix issue with frequency update on channel switch events.
Fix issue with drivers and handling of IF_OPER_UP setting.
ver 1.16:
Fix issue with writing provisioning files with a passphrase.
Add support for Authenticator & Supplicant RSN Extension elements.
Add support for handling Transition Disable info.
Add support for SAE Hash-to-Element feature.
ver 1.15:
Add support for FT-over-DS procedure with multiple BSS.
Add support for estimation of VHT RX data rate.
Add support for exporting Daemon information.
ver 1.14:
Fix issue with scanning property and quick scan cancellation.
Fix issue with handling authentication timeouts from SAE.
Fix issue with handling association timeouts and retries.
Fix issue with handling roaming frequencies after roaming.
Fix issue with requesting neighbor report after roaming.
Add support for handling PSK offload connections.
ver 1.13:
Fix issue with EAPoL protocol version 2010 handling.
Fix issue with authenticator method logic handling.
Fix issue with getting scan results from firmware.
Add support for handling SAE offload connections.
Add support for roaming with FullMAC devices.
ver 1.12:
Fix issue with handling retry roaming without higher RSSI.
Fix issue with WPA3, OWE and FILS authentication handling.
Fix issue with handling locally generated deauth frames.
Fix issue with quick scanning and connect interaction.
Add support for diagnostic D-Bus interfaces.
ver 1.11:
Add support for ACD client for static configuration.
Add support for intelligent scan of all frequencies.
ver 1.10:
Add support for DHCP v6 configuration.
Add support for DHCP server operation with AP mode.
Add support for IP allocation during the 4-Way Handshake.
Add support for P2P Group-owner handling.
ver 1.9:
Fix issue with WPA3 connections in transition mode.
Fix issue with handling roaming attempt failures.
Add support for radio management work queue.
Add support P2P service manager interface.
Add support for WiFi Display client API.
ver 1.8:
Fix issue with handling FT AKMs when not supported.
Fix issue with handling FILS and RSNE in authenticate.
Fix issue with handling auto-connection and quick scan.
Fix issue with sending multiple scan requests.
Add support for P2P feature and API.
ver 1.7:
Fix issue with APs that send IGTK falsely in big endian.
Fix issue with setting linkmode & operstate for open networks.
ver 1.6:
Fix issue with handling missing AP stop events.
Fix issue with handling out-of-order disconnect events.
Fix issue with handling missing auth/assoc support.
Fix issue with handling omitted EAP-TLS-CACert.
Fix issue with handling OWE PTK derivation.
Add support for internal frame exchange API.
Add support for MAC randomization and override.
Add support for per-network MAC addresses.
ver 1.5:
Fix issue with handling missing NEW_WIPHY events.
Fix issue with interface creation and NEW_WIPHY events.
Fix issue with handling LastConnectedTime property change.
Fix issue with PEAPv0 interoperability with Windows.
ver 1.4:
Fix issue with handling Crypto-Binding and invalid MACs.
Fix issue with handling change station error results.
Fix issue with handling DNS resolving installations.
ver 1.3:
Fix issue with handling EAP-GTC and password requests.
Fix issue with handling Crypto-Binding TLV for PEAPv0.
Fix issue with handling key installation and PEAP Phase 2.
Fix issue with handling externally triggered scan requests.
Fix issue with handling RCPI calculation for RRM requests.
ver 1.2:
Fix issue with handling scan requests while connecting.
Fix issue with handling scan duration for RRM requests.
Fix issue with handling parent TSF value for RRM requests.
ver 1.1:
Fix issue with simple configuration support checks.
Fix issue with handling TLS tunnel and PEAPv0.
Add support for radio resource management.
ver 1.0:
Add support for stable D-Bus interfaces.
Add support for network configuration documentation.
ver 0.23:
Fix issue with strict certificate chain checks.
Fix issue with parsing RSNE_ADVANCE information.
Fix issue with parsing RSN information for WPA1.
Fix issue with logic error in scan frequency validation.
Fix issue with integer overflow and authentication frames.
Add support for installing various manual pages.
ver 0.22:
Fix issue with hotplug and device capability detection.
Add support for IPv6 network configuration handling.
Add support for embedding certificates in profiles.
ver 0.21:
Fix issue with cleartext ACK and tunneled EAP-Success.
Fix issue with setting bits in extended capabilities.
Fix issue with WPA-1 information element parsing.
Add support for handling QoS Map IE and frames.
Add support for STATE_DIRECTORY environment.
Add support for CONFIGURATION_DIRECTORY environment.
ver 0.20:
Add support for adding Extended Capabilities bits.
Add support for ServerDomainMask configuration option.
ver 0.19: ver 0.19:
Add support for Hotspot 2.0 functionality. Add support for Hotspot 2.0 functionality.
Add support for FILS Fast Transition feature. Add support for FILS Fast Transition feature.

View File

@ -5,7 +5,7 @@ If you fixed a bug or you want to add support for something, patches are
welcome! The preferred method of submitting the patches to the project is by welcome! The preferred method of submitting the patches to the project is by
email to the iwd mailing list: email to the iwd mailing list:
iwd@lists.linux.dev iwd@lists.01.org
In order to ease the inclusion of your patch, it's important to follow In order to ease the inclusion of your patch, it's important to follow
some rules, otherwise it will likely be rejected by maintainers. some rules, otherwise it will likely be rejected by maintainers.

View File

@ -10,12 +10,12 @@ if EXTERNAL_ELL
ell_cflags = @ELL_CFLAGS@ ell_cflags = @ELL_CFLAGS@
ell_ldadd = @ELL_LIBS@ ell_ldadd = @ELL_LIBS@
ell_dependencies = ell_dependencies =
ell_built_sources = ell/shared ell_built_sources =
else else
ell_cflags = ell_cflags =
ell_ldadd = ell/libell-internal.la ell_ldadd = ell/libell-internal.la
ell_dependencies = $(ell_ldadd) ell_dependencies = $(ell_ldadd)
ell_built_sources = ell/shared ell/internal ell/ell.h ell_built_sources = ell/internal ell/ell.h
noinst_LTLIBRARIES = ell/libell-internal.la noinst_LTLIBRARIES = ell/libell-internal.la
@ -34,11 +34,11 @@ ell_headers = ell/util.h \
ell/io.h \ ell/io.h \
ell/ringbuf.h \ ell/ringbuf.h \
ell/log.h \ ell/log.h \
ell/plugin.h \
ell/checksum.h \ ell/checksum.h \
ell/netlink.h \ ell/netlink.h \
ell/genl.h \ ell/genl.h \
ell/dbus.h \ ell/dbus.h \
ell/rtnl.h \
ell/dbus-service.h \ ell/dbus-service.h \
ell/dbus-client.h \ ell/dbus-client.h \
ell/hwdb.h \ ell/hwdb.h \
@ -50,6 +50,7 @@ ell_headers = ell/util.h \
ell/tls.h \ ell/tls.h \
ell/uuid.h \ ell/uuid.h \
ell/key.h \ ell/key.h \
ell/pkcs5.h \
ell/file.h \ ell/file.h \
ell/dir.h \ ell/dir.h \
ell/net.h \ ell/net.h \
@ -57,30 +58,18 @@ ell_headers = ell/util.h \
ell/cert.h \ ell/cert.h \
ell/ecc.h \ ell/ecc.h \
ell/ecdh.h \ ell/ecdh.h \
ell/time.h \ ell/time.h
ell/path.h \
ell/icmp6.h \
ell/dhcp6.h \
ell/acd.h \
ell/cleanup.h \
ell/netconfig.h \
ell/sysctl.h \
ell/notifylist.h \
ell/minheap.h
ell_sources = ell/private.h \ ell_sources = ell/private.h \
ell/missing.h \ ell/missing.h \
ell/util.c \ ell/util.c \
ell/test-private.h \
ell/test.c \ ell/test.c \
ell/test-dbus.c \
ell/strv.c \ ell/strv.c \
ell/utf8.c \ ell/utf8.c \
ell/queue.c \ ell/queue.c \
ell/hashmap.c \ ell/hashmap.c \
ell/string.c \ ell/string.c \
ell/settings.c \ ell/settings.c \
ell/main-private.h \
ell/main.c \ ell/main.c \
ell/idle.c \ ell/idle.c \
ell/signal.c \ ell/signal.c \
@ -88,12 +77,12 @@ ell_sources = ell/private.h \
ell/io.c \ ell/io.c \
ell/ringbuf.c \ ell/ringbuf.c \
ell/log.c \ ell/log.c \
ell/plugin.c \
ell/checksum.c \ ell/checksum.c \
ell/netlink-private.h \ ell/netlink-private.h \
ell/netlink.c \ ell/netlink.c \
ell/genl-private.h \
ell/genl.c \ ell/genl.c \
ell/rtnl-private.h \
ell/rtnl.c \
ell/dbus-private.h \ ell/dbus-private.h \
ell/dbus.c \ ell/dbus.c \
ell/dbus-message.c \ ell/dbus-message.c \
@ -113,7 +102,6 @@ ell_sources = ell/private.h \
ell/base64.c \ ell/base64.c \
ell/asn1-private.h \ ell/asn1-private.h \
ell/pem.c \ ell/pem.c \
ell/pem-private.h \
ell/tls-private.h \ ell/tls-private.h \
ell/tls.c \ ell/tls.c \
ell/tls-record.c \ ell/tls-record.c \
@ -121,49 +109,24 @@ ell_sources = ell/private.h \
ell/tls-extensions.c \ ell/tls-extensions.c \
ell/uuid.c \ ell/uuid.c \
ell/key.c \ ell/key.c \
ell/pkcs5-private.h \
ell/pkcs5.c \
ell/file.c \ ell/file.c \
ell/dir.c \ ell/dir.c \
ell/net-private.h \
ell/net.c \ ell/net.c \
ell/dhcp-private.h \ ell/dhcp-private.h \
ell/dhcp.c \ ell/dhcp.c \
ell/dhcp-transport.c \ ell/dhcp-transport.c \
ell/dhcp-lease.c \ ell/dhcp-lease.c \
ell/dhcp-util.c \
ell/dhcp-server.c \
ell/cert-private.h \ ell/cert-private.h \
ell/cert.c \ ell/cert.c \
ell/cert-crypto.c \
ell/ecc-external.c \ ell/ecc-external.c \
ell/ecc-private.h \ ell/ecc-private.h \
ell/ecc.c \ ell/ecc.c \
ell/ecdh.c \ ell/ecdh.c \
ell/time.c \ ell/time.c
ell/time-private.h \
ell/path.c \
ell/dhcp6.c \
ell/dhcp6-private.h \
ell/icmp6.c \
ell/icmp6-private.h \
ell/dhcp6-lease.c \
ell/dhcp6-transport.c \
ell/acd.c \
ell/netconfig.c \
ell/sysctl.c \
ell/notifylist.c \
ell/minheap.c
ell_shared = ell/useful.h ell/asn1-private.h ell_libell_internal_la_SOURCES = $(ell_headers) $(ell_sources)
ell_libell_internal_la_SOURCES = $(ell_headers) $(ell_sources) $(ell_shared)
endif
if LIBEDIT
client_cflags = $(LIBEDIT_CFLAGS)
client_ldadd = $(LIBEDIT_LIBS)
else
client_cflags =
client_ldadd = $(READLINE_LIBS)
endif endif
bin_PROGRAMS = bin_PROGRAMS =
@ -182,22 +145,12 @@ systemd_unit_DATA =
dbus_busdir = @DBUS_BUSDIR@ dbus_busdir = @DBUS_BUSDIR@
dbus_bus_DATA = dbus_bus_DATA =
systemd_networkdir = @SYSTEMD_NETWORKDIR@
systemd_network_DATA =
systemd_modloaddir = @SYSTEMD_MODLOADDIR@ systemd_modloaddir = @SYSTEMD_MODLOADDIR@
systemd_modload_DATA = src/pkcs8.conf systemd_modload_DATA = src/pkcs8.conf
endif endif
if MANUAL_PAGES
man_MANS =
endif
manual_pages = src/iwd.8 src/iwd.debug.7 src/iwd.config.5 src/iwd.network.5 \
src/iwd.ap.5 client/iwctl.1 monitor/iwmon.1 wired/ead.8 \
tools/hwsim.1
eap_sources = src/eap.c src/eap.h src/eap-private.h \ eap_sources = src/eap.c src/eap.h src/eap-private.h \
src/eap-wsc.c src/eap-wsc.h \
src/eap-md5.c \ src/eap-md5.c \
src/eap-tls.c \ src/eap-tls.c \
src/eap-ttls.c \ src/eap-ttls.c \
@ -209,6 +162,7 @@ eap_sources = src/eap.c src/eap.h src/eap-private.h \
src/eap-pwd.c \ src/eap-pwd.c \
src/util.h src/util.c \ src/util.h src/util.c \
src/crypto.h src/crypto.c \ src/crypto.h src/crypto.c \
src/wscutil.h src/wscutil.c \
src/simutil.h src/simutil.c \ src/simutil.h src/simutil.c \
src/simauth.h src/simauth.c \ src/simauth.h src/simauth.c \
src/watchlist.h src/watchlist.c \ src/watchlist.h src/watchlist.c \
@ -218,11 +172,11 @@ eap_sources = src/eap.c src/eap.h src/eap-private.h \
if DAEMON if DAEMON
libexec_PROGRAMS += src/iwd libexec_PROGRAMS += src/iwd
src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h \ src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h src/missing.h \
src/missing.h src/defs.h \ src/plugin.h src/plugin.c \
src/netdev.h src/netdev.c \ src/netdev.h src/netdev.c \
src/wiphy.h src/wiphy.c \ src/wiphy.h src/wiphy.c \
src/device.c \ src/device.h src/device.c \
src/station.h src/station.c \ src/station.h src/station.c \
src/ie.h src/ie.c \ src/ie.h src/ie.c \
src/dbus.h src/dbus.c \ src/dbus.h src/dbus.c \
@ -235,13 +189,13 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h \
src/agent.h src/agent.c \ src/agent.h src/agent.c \
src/storage.h src/storage.c \ src/storage.h src/storage.c \
src/network.h src/network.c \ src/network.h src/network.c \
src/wsc.h src/wsc.c \ src/wsc.c \
src/backtrace.h src/backtrace.c \ src/backtrace.h src/backtrace.c \
src/knownnetworks.h \ src/knownnetworks.h \
src/knownnetworks.c \ src/knownnetworks.c \
src/rfkill.h src/rfkill.c \ src/rfkill.h src/rfkill.c \
src/ft.h src/ft.c \ src/ft.h src/ft.c \
src/ap.h src/ap.c src/adhoc.c \ src/ap.c src/adhoc.c \
src/sae.h src/sae.c \ src/sae.h src/sae.c \
src/nl80211util.h src/nl80211util.c \ src/nl80211util.h src/nl80211util.c \
src/nl80211cmd.h src/nl80211cmd.c \ src/nl80211cmd.h src/nl80211cmd.c \
@ -250,39 +204,28 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h \
src/manager.c \ src/manager.c \
src/erp.h src/erp.c \ src/erp.h src/erp.c \
src/fils.h src/fils.c \ src/fils.h src/fils.c \
src/rtnlutil.h src/rtnlutil.c \
src/auth-proto.h \ src/auth-proto.h \
src/anqp.h src/anqp.c \ src/anqp.h src/anqp.c \
src/anqputil.h src/anqputil.c \ src/anqputil.h src/anqputil.c \
src/netconfig.h src/netconfig.c\ src/netconfig.h src/netconfig.c\
src/netconfig-commit.c \ src/resolve.h src/resolve.c\
src/resolve.h src/resolve.c \ src/hotspot.h src/hotspot.c \
src/hotspot.c \
src/p2p.h src/p2p.c \
src/p2putil.h src/p2putil.c \ src/p2putil.h src/p2putil.c \
src/module.h src/module.c \
src/rrm.c \
src/frame-xchg.h src/frame-xchg.c \
src/eap-wsc.c src/eap-wsc.h \
src/wscutil.h src/wscutil.c \
src/diagnostic.h src/diagnostic.c \
src/ip-pool.h src/ip-pool.c \
src/band.h src/band.c \
src/sysfs.h src/sysfs.c \
src/offchannel.h src/offchannel.c \
src/dpp-util.h src/dpp-util.c \
src/json.h src/json.c \
src/dpp.c \
src/udev.c \
src/pmksa.h src/pmksa.c \
$(eap_sources) \ $(eap_sources) \
$(builtin_sources) $(builtin_sources)
src_iwd_LDADD = $(ell_ldadd) -ldl src_iwd_LDADD = $(ell_ldadd) -ldl
src_iwd_DEPENDENCIES = $(ell_dependencies) src_iwd_DEPENDENCIES = $(ell_dependencies)
if SIM_HARDCODED
builtin_modules += sim_hardcoded
builtin_sources += plugins/sim_hardcoded.c
endif
if OFONO if OFONO
builtin_modules += ofono builtin_modules += ofono
builtin_sources += src/ofono.c builtin_sources += plugins/ofono.c
endif endif
if DBUS_POLICY if DBUS_POLICY
@ -294,13 +237,6 @@ src_iwd_DEPENDENCIES += src/iwd.service
systemd_unit_DATA += src/iwd.service systemd_unit_DATA += src/iwd.service
dbus_bus_DATA += src/net.connman.iwd.service dbus_bus_DATA += src/net.connman.iwd.service
systemd_network_DATA += src/80-iwd.link
endif
if MANUAL_PAGES
man_MANS += src/iwd.8 src/iwd.debug.7 src/iwd.config.5 src/iwd.network.5 \
src/iwd.ap.5
endif endif
endif endif
@ -320,20 +256,8 @@ client_iwctl_SOURCES = client/main.c \
client/known-networks.c \ client/known-networks.c \
client/network.h client/network.c \ client/network.h client/network.c \
client/properties.h client/properties.c \ client/properties.h client/properties.c \
client/wsc.c client/station.c \ client/wsc.c client/station.c
client/diagnostic.c client/diagnostic.h \ client_iwctl_LDADD = $(ell_ldadd) -lreadline
client/daemon.c client/daemon.h \
client/dpp.c client/dpp-pkex.c \
client/station-debug.c \
client/bss.c \
src/util.c src/util.h \
src/band.c src/band.h
client_iwctl_LDADD = $(ell_ldadd) $(client_ldadd)
if MANUAL_PAGES
man_MANS += client/iwctl.1
endif
endif endif
if MONITOR if MONITOR
@ -350,15 +274,11 @@ monitor_iwmon_SOURCES = monitor/main.c linux/nl80211.h \
src/crypto.h src/crypto.c \ src/crypto.h src/crypto.c \
src/watchlist.h src/watchlist.c \ src/watchlist.h src/watchlist.c \
src/eapolutil.h src/eapolutil.c \ src/eapolutil.h src/eapolutil.c \
src/handshake.h src/handshake.c \
src/nl80211cmd.h src/nl80211cmd.c \ src/nl80211cmd.h src/nl80211cmd.c \
src/p2putil.c src/p2putil.h \ src/p2putil.c src/p2putil.h \
src/anqputil.h src/anqputil.c \ src/anqputil.h src/anqputil.c
src/band.h src/band.c
monitor_iwmon_LDADD = $(ell_ldadd) monitor_iwmon_LDADD = $(ell_ldadd)
if MANUAL_PAGES
man_MANS += monitor/iwmon.1
endif
endif endif
if WIRED if WIRED
@ -366,10 +286,7 @@ libexec_PROGRAMS += wired/ead
wired_ead_SOURCES = wired/main.c wired/ethdev.h wired/ethdev.c \ wired_ead_SOURCES = wired/main.c wired/ethdev.h wired/ethdev.c \
wired/network.h wired/network.c \ wired/network.h wired/network.c \
wired/dbus.h wired/dbus.c \ wired/dbus.h wired/dbus.c $(eap_sources)
src/module.h src/module.c \
src/band.h src/band.c \
$(eap_sources)
wired_ead_LDADD = $(ell_ldadd) wired_ead_LDADD = $(ell_ldadd)
wired_ead_DEPENDENCIES = $(ell_dependencies) wired_ead_DEPENDENCIES = $(ell_dependencies)
@ -383,28 +300,6 @@ wired_ead_DEPENDENCIES += wired/ead.service
systemd_unit_DATA += wired/ead.service systemd_unit_DATA += wired/ead.service
dbus_bus_DATA += wired/net.connman.ead.service dbus_bus_DATA += wired/net.connman.ead.service
endif endif
if MANUAL_PAGES
man_MANS += wired/ead.8
endif
endif
if DAEMON
noinst_PROGRAMS += tools/probe-req tools/iwd-decrypt-profile
tools_probe_req_SOURCES = tools/probe-req.c src/mpdu.h src/mpdu.c \
src/ie.h src/ie.c \
src/nl80211util.h src/nl80211util.c \
src/util.h src/util.c \
src/common.h src/common.c \
src/band.h src/band.c
tools_probe_req_LDADD = $(ell_ldadd)
tools_iwd_decrypt_profile_SOURCES = tools/iwd-decrypt-profile.c \
src/common.h src/common.c \
src/crypto.h src/crypto.c \
src/storage.h src/storage.c
tools_iwd_decrypt_profile_LDADD = ${ell_ldadd}
endif endif
if HWSIM if HWSIM
@ -412,37 +307,29 @@ bin_PROGRAMS += tools/hwsim
tools_hwsim_SOURCES = tools/hwsim.c src/mpdu.h \ tools_hwsim_SOURCES = tools/hwsim.c src/mpdu.h \
src/util.h src/util.c \ src/util.h src/util.c \
src/nl80211cmd.h src/nl80211cmd.c \
src/nl80211util.h src/nl80211util.c \
src/storage.h src/storage.c \ src/storage.h src/storage.c \
src/common.h src/common.c \ src/common.h src/common.c
src/band.h src/band.c \
src/ie.h src/ie.c \
src/crypto.h src/crypto.c
tools_hwsim_LDADD = $(ell_ldadd) tools_hwsim_LDADD = $(ell_ldadd)
if DBUS_POLICY if DBUS_POLICY
dist_dbus_data_DATA += tools/hwsim-dbus.conf dist_dbus_data_DATA += tools/hwsim-dbus.conf
endif endif
if MANUAL_PAGES
man_MANS += tools/hwsim.1
endif
endif endif
unit_tests = if TOOLS
noinst_PROGRAMS += tools/test-runner
if DAEMON tools_test_runner_SOURCES = tools/test-runner.c
unit_tests += unit/test-cmac-aes \ tools_test_runner_LDADD = $(ell_ldadd)
endif
unit_tests = unit/test-cmac-aes \
unit/test-hmac-md5 unit/test-hmac-sha1 unit/test-hmac-sha256 \ unit/test-hmac-md5 unit/test-hmac-sha1 unit/test-hmac-sha256 \
unit/test-prf-sha1 unit/test-kdf-sha256 \ unit/test-prf-sha1 unit/test-kdf-sha256 \
unit/test-crypto unit/test-eapol unit/test-mpdu \ unit/test-crypto unit/test-eapol unit/test-mpdu \
unit/test-ie unit/test-util unit/test-ssid-security \ unit/test-ie unit/test-util unit/test-ssid-security \
unit/test-arc4 unit/test-wsc unit/test-eap-mschapv2 \ unit/test-arc4 unit/test-wsc unit/test-eap-mschapv2 \
unit/test-eap-sim unit/test-sae unit/test-p2p unit/test-band \ unit/test-eap-sim unit/test-sae unit/test-p2p
unit/test-dpp unit/test-json unit/test-nl80211util \
unit/test-pmksa unit/test-storage
endif
if CLIENT if CLIENT
unit_tests += unit/test-client unit_tests += unit/test-client
@ -452,7 +339,6 @@ if MAINTAINER_MODE
noinst_PROGRAMS += $(unit_tests) noinst_PROGRAMS += $(unit_tests)
endif endif
if DAEMON
unit_test_eap_sim_SOURCES = unit/test-eap-sim.c \ unit_test_eap_sim_SOURCES = unit/test-eap-sim.c \
src/crypto.h src/crypto.c src/simutil.h src/simutil.c \ src/crypto.h src/crypto.c src/simutil.h src/simutil.c \
src/ie.h src/ie.c \ src/ie.h src/ie.c \
@ -460,13 +346,12 @@ unit_test_eap_sim_SOURCES = unit/test-eap-sim.c \
src/eapol.h src/eapol.c \ src/eapol.h src/eapol.c \
src/eapolutil.h src/eapolutil.c \ src/eapolutil.h src/eapolutil.c \
src/handshake.h src/handshake.c \ src/handshake.h src/handshake.c \
src/pmksa.h src/pmksa.c \
src/eap.h src/eap.c src/eap-private.h \ src/eap.h src/eap.c src/eap-private.h \
src/util.h src/util.c \ src/util.h src/util.c \
src/simauth.h src/simauth.c \ src/simauth.h src/simauth.c \
src/erp.h src/erp.c \ src/erp.h src/erp.c \
src/band.h src/band.c \
src/eap-sim.c src/eap-sim.c
unit_test_eap_sim_LDADD = $(ell_ldadd) unit_test_eap_sim_LDADD = $(ell_ldadd)
unit_test_cmac_aes_SOURCES = unit/test-cmac-aes.c \ unit_test_cmac_aes_SOURCES = unit/test-cmac-aes.c \
@ -475,6 +360,7 @@ unit_test_cmac_aes_LDADD = $(ell_ldadd)
unit_test_arc4_SOURCES = unit/test-arc4.c \ unit_test_arc4_SOURCES = unit/test-arc4.c \
src/crypto.h src/crypto.c src/crypto.h src/crypto.c
unit_test_arc4_LDADD = $(ell_ldadd) unit_test_arc4_LDADD = $(ell_ldadd)
unit_test_hmac_md5_SOURCES = unit/test-hmac-md5.c \ unit_test_hmac_md5_SOURCES = unit/test-hmac-md5.c \
@ -500,10 +386,6 @@ unit_test_kdf_sha256_LDADD = $(ell_ldadd)
unit_test_ie_SOURCES = unit/test-ie.c src/ie.h src/ie.c unit_test_ie_SOURCES = unit/test-ie.c src/ie.h src/ie.c
unit_test_ie_LDADD = $(ell_ldadd) unit_test_ie_LDADD = $(ell_ldadd)
unit_test_band_SOURCES = unit/test-band.c src/band.h src/band.c src/netdev.h \
src/ie.h src/ie.c
unit_test_band_LDADD = $(ell_ldadd)
unit_test_crypto_SOURCES = unit/test-crypto.c \ unit_test_crypto_SOURCES = unit/test-crypto.c \
src/crypto.h src/crypto.c src/crypto.h src/crypto.c
unit_test_crypto_LDADD = $(ell_ldadd) unit_test_crypto_LDADD = $(ell_ldadd)
@ -520,23 +402,19 @@ unit_test_eapol_SOURCES = unit/test-eapol.c \
src/eapol.h src/eapol.c \ src/eapol.h src/eapol.c \
src/eapolutil.h src/eapolutil.c \ src/eapolutil.h src/eapolutil.c \
src/handshake.h src/handshake.c \ src/handshake.h src/handshake.c \
src/pmksa.h src/pmksa.c \
src/eap.h src/eap.c src/eap-private.h \ src/eap.h src/eap.c src/eap-private.h \
src/eap-tls.c src/eap-ttls.c \ src/eap-tls.c src/eap-ttls.c \
src/eap-md5.c src/util.c \ src/eap-md5.c src/util.c \
src/eap-tls-common.h src/eap-tls-common.c \ src/eap-tls-common.h src/eap-tls-common.c \
src/erp.h src/erp.c \ src/erp.h src/erp.c \
src/band.h src/band.c \
src/mschaputil.h src/mschaputil.c src/mschaputil.h src/mschaputil.c
unit_test_eapol_LDADD = $(ell_ldadd) unit_test_eapol_LDADD = $(ell_ldadd)
unit_test_eapol_DEPENDENCIES = $(ell_dependencies) \ unit_test_eapol_DEPENDENCIES = unit/cert-server.pem \
unit/cert-server.pem \
unit/cert-server-key-pkcs8.pem \ unit/cert-server-key-pkcs8.pem \
unit/cert-client.pem \ unit/cert-client.pem \
unit/cert-client-key-pkcs8.pem \ unit/cert-client-key-pkcs8.pem
unit/tls-settings.8021x
unit_test_util_SOURCES = src/util.h src/util.c src/band.c src/band.h \ unit_test_util_SOURCES = src/util.h src/util.c \
unit/test-util.c unit/test-util.c
unit_test_util_LDADD = $(ell_ldadd) unit_test_util_LDADD = $(ell_ldadd)
@ -551,11 +429,9 @@ unit_test_wsc_SOURCES = unit/test-wsc.c src/wscutil.h src/wscutil.c \
src/eapol.h src/eapol.c \ src/eapol.h src/eapol.c \
src/eapolutil.h src/eapolutil.c \ src/eapolutil.h src/eapolutil.c \
src/handshake.h src/handshake.c \ src/handshake.h src/handshake.c \
src/pmksa.h src/pmksa.c \
src/eap.h src/eap.c src/eap-private.h \ src/eap.h src/eap.c src/eap-private.h \
src/util.h src/util.c \ src/util.h src/util.c \
src/erp.h src/erp.c \ src/erp.h src/erp.c \
src/band.h src/band.c \
src/eap-wsc.h src/eap-wsc.c src/eap-wsc.h src/eap-wsc.c
unit_test_wsc_LDADD = $(ell_ldadd) unit_test_wsc_LDADD = $(ell_ldadd)
@ -565,53 +441,6 @@ unit_test_eap_mschapv2_SOURCES = src/eap-mschapv2.h src/eap-mschapv2.c \
unit/test-eap-mschapv2.c unit/test-eap-mschapv2.c
unit_test_eap_mschapv2_LDADD = $(ell_ldadd) unit_test_eap_mschapv2_LDADD = $(ell_ldadd)
unit_test_sae_SOURCES = unit/test-sae.c \
src/sae.h src/sae.c \
src/crypto.h src/crypto.c \
src/ie.h src/ie.c \
src/handshake.h src/handshake.c \
src/pmksa.h src/pmksa.c \
src/erp.h src/erp.c \
src/band.h src/band.c \
src/util.h src/util.c \
src/mpdu.h src/mpdu.c
unit_test_sae_LDADD = $(ell_ldadd)
unit_test_sae_LDFLAGS = -Wl,-wrap,l_ecc_supported_ike_groups
unit_test_p2p_SOURCES = unit/test-p2p.c src/wscutil.h src/wscutil.c \
src/crypto.h src/crypto.c \
src/ie.h src/ie.c \
src/util.h src/util.c \
src/p2putil.h src/p2putil.c \
src/band.h src/band.c
unit_test_p2p_LDADD = $(ell_ldadd)
unit_test_dpp_SOURCES = unit/test-dpp.c src/dpp-util.h src/dpp-util.c \
src/band.h src/band.c \
src/util.h src/util.c src/crypto.h \
src/crypto.c src/json.h src/json.c
unit_test_dpp_LDADD = $(ell_ldadd)
unit_test_json_SOURCES = unit/test-json.c src/json.h src/json.c shared/jsmn.h
unit_test_json_LDADD = $(ell_ldadd)
unit_test_nl80211util_SOURCES = unit/test-nl80211util.c \
src/nl80211util.h src/nl80211util.c \
src/band.h src/band.c \
src/ie.h src/ie.c \
src/util.h src/util.c
unit_test_nl80211util_LDADD = $(ell_ldadd)
unit_test_pmksa_SOURCES = unit/test-pmksa.c src/pmksa.c src/pmksa.h \
src/module.h src/util.h
unit_test_pmksa_LDADD = $(ell_ldadd)
unit_test_storage_SOURCES = unit/test-storage.c src/storage.c src/storage.h \
src/crypto.c src/crypto.h \
src/common.c src/common.h
unit_test_storage_LDADD = $(ell_ldadd)
endif
if CLIENT if CLIENT
unit_test_client_SOURCES = unit/test-client.c \ unit_test_client_SOURCES = unit/test-client.c \
client/adapter.c \ client/adapter.c \
@ -622,33 +451,46 @@ unit_test_client_SOURCES = unit/test-client.c \
client/display.h client/display.c \ client/display.h client/display.c \
client/network.h client/network.c \ client/network.h client/network.c \
client/properties.h client/properties.c client/properties.h client/properties.c
unit_test_client_LDADD = $(ell_ldadd) $(client_ldadd) unit_test_client_LDADD = $(ell_ldadd) -lreadline
endif endif
LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ unit_test_sae_SOURCES = unit/test-sae.c \
$(top_srcdir)/build-aux/tap-driver.sh src/sae.h src/sae.c \
src/crypto.h src/crypto.c \
src/ie.h src/ie.c \
src/handshake.h src/handshake.c \
src/util.h src/util.c \
src/mpdu.h src/mpdu.c
unit_test_sae_LDADD = $(ell_ldadd)
unit_test_p2p_SOURCES = unit/test-p2p.c src/wscutil.h src/wscutil.c \
src/crypto.h src/crypto.c \
src/ie.h src/ie.c \
src/util.h src/util.c \
src/p2putil.h src/p2putil.c
unit_test_p2p_LDADD = $(ell_ldadd)
TESTS = $(unit_tests) TESTS = $(unit_tests)
manual_pages = doc/iwmon.1
if BUILD_DOCS
dist_man_MANS = $(manual_pages)
endif
EXTRA_DIST = src/genbuiltin src/iwd.service.in src/net.connman.iwd.service \ EXTRA_DIST = src/genbuiltin src/iwd.service.in src/net.connman.iwd.service \
wired/ead.service.in wired/net.connman.ead.service \ wired/ead.service.in wired/net.connman.ead.service \
src/80-iwd.link src/pkcs8.conf unit/gencerts.cnf \ src/pkcs8.conf unit/gencerts.cnf \
doc/main.conf \ doc/main.conf $(manual_pages:.1=.txt)
$(manual_pages) $(patsubst %.1,%.rst, \
$(patsubst %.5,%.rst, \
$(patsubst %.8,%.rst,$(manual_pages))))
AM_CFLAGS = $(ell_cflags) $(client_cflags) -fvisibility=hidden \ AM_CFLAGS = $(ell_cflags) -fvisibility=hidden \
-DUNITDIR=\""$(top_srcdir)/unit/"\" \ -DUNITDIR=\""$(top_srcdir)/unit/"\" \
-DCERTDIR=\""$(top_builddir)/unit/"\" -DCERTDIR=\""$(top_builddir)/unit/"\"
if MAINTAINER_MODE
AM_CFLAGS += -DHAVE_PKCS8_SUPPORT
endif
CLEANFILES = src/iwd.service wired/ead.service CLEANFILES = src/iwd.service wired/ead.service
DISTCHECK_CONFIGURE_FLAGS = --disable-dbus-policy --disable-systemd-service \ DISTCHECK_CONFIGURE_FLAGS = --disable-dbus-policy --disable-systemd-service \
--enable-sim-hardcoded \
--enable-ofono \ --enable-ofono \
--enable-wired \ --enable-wired \
--enable-hwsim \ --enable-hwsim \
@ -683,7 +525,7 @@ unit/cert-server.csr: unit/cert-server-key.pem unit/gencerts.cnf
-key $< -out $@ -key $< -out $@
unit/cert-server.pem: unit/cert-server.csr unit/cert-ca.pem unit/gencerts.cnf unit/cert-server.pem: unit/cert-server.csr unit/cert-ca.pem unit/gencerts.cnf
$(AM_V_GEN)openssl x509 -req -extensions server_ext \ $(AM_V_GEN)openssl x509 -req -extensions cert_ext \
-extfile $(srcdir)/unit/gencerts.cnf \ -extfile $(srcdir)/unit/gencerts.cnf \
-in $< -CA $(builddir)/unit/cert-ca.pem \ -in $< -CA $(builddir)/unit/cert-ca.pem \
-CAkey $(builddir)/unit/cert-ca-key.pem \ -CAkey $(builddir)/unit/cert-ca-key.pem \
@ -710,31 +552,8 @@ unit/cert-client.pem: unit/cert-client.csr unit/cert-ca.pem unit/gencerts.cnf
-CAserial $(builddir)/unit/cert-ca.srl \ -CAserial $(builddir)/unit/cert-ca.srl \
-CAcreateserial -sha256 -days 10000 -out $@ $($(AM_V_P)_redirect_openssl) -CAcreateserial -sha256 -days 10000 -out $@ $($(AM_V_P)_redirect_openssl)
unit/tls-settings.8021x: unit/cert-ca.pem unit/cert-client.pem unit/cert-client-key-pkcs8.pem
$(AM_V_GEN) \
$(file >$@,[Security]) \
$(file >>$@,EAP-Method=TLS) \
$(file >>$@,EAP-Identity=abc@example.com) \
$(file >>$@,EAP-TLS-CACert=embed:ca_cert) \
$(file >>$@,EAP-TLS-ClientCert=embed:client_cert) \
$(file >>$@,EAP-TLS-ClientKey=embed:client_key) \
$(file >>$@,[@pem@ca_cert]) \
$(shell cat unit/cert-ca.pem >> $@) \
$(file >>$@,[@pem@client_cert]) \
$(shell cat unit/cert-client.pem >> $@) \
$(file >>$@,[@pem@client_key]) \
$(shell cat unit/cert-client-key-pkcs8.pem >> $@)
BUILT_SOURCES = $(ell_built_sources) src/builtin.h BUILT_SOURCES = $(ell_built_sources) src/builtin.h
ell/shared: Makefile
$(AM_V_at)$(MKDIR_P) ell
$(AM_V_GEN)for f in $(ell_shared) ; do \
if [ ! -f $$f ] ; then \
$(LN_S) -t ell -f $(abs_srcdir)/../ell/$$f ; \
fi \
done > $@
ell/internal: Makefile ell/internal: Makefile
$(AM_V_at)$(MKDIR_P) ell $(AM_V_at)$(MKDIR_P) ell
$(AM_V_GEN)for f in $(ell_headers) $(ell_sources) ; do \ $(AM_V_GEN)for f in $(ell_headers) $(ell_sources) ; do \
@ -744,7 +563,6 @@ ell/internal: Makefile
done > $@ done > $@
ell/ell.h: Makefile ell/ell.h: Makefile
$(AM_V_at)$(MKDIR_P) ell
$(AM_V_at)echo -n > $@ $(AM_V_at)echo -n > $@
$(AM_V_GEN)for f in $(ell_headers) ; do \ $(AM_V_GEN)for f in $(ell_headers) ; do \
echo "#include <$$f>" >> $@ ; \ echo "#include <$$f>" >> $@ ; \
@ -752,61 +570,22 @@ ell/ell.h: Makefile
SED_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \ SED_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \
-e 's,@libexecdir\@,$(libexecdir),g' \ -e 's,@libexecdir\@,$(libexecdir),g' \
-e 's,@daemon_storagedir\@,$(daemon_storagedir),g' \
-e 's,@wired_storagedir\@,$(wired_storagedir),g' \
< $< > $@ < $< > $@
if RUN_RST2MAN
RST2MAN_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
$(RST2MAN) --strict --no-raw \
--no-generator --no-datestamp $< $@
else
RST2MAN_PROCESS = $(AM_V_GEN)test -f $@ || \
{ echo "Generated manual page $@ does not exist"; false; }
endif
%.service: %.service.in Makefile %.service: %.service.in Makefile
$(SED_PROCESS) $(SED_PROCESS)
%.1: %.rst Makefile %.1: %.txt
$(RST2MAN_PROCESS) $(AM_V_GEN)$(A2X) --doctype manpage --format manpage $(srcdir)/$<
%.5: %.rst Makefile clean-local:
$(RST2MAN_PROCESS) -rm -f unit/cert-*.pem unit/cert-*.csr unit/cert-*.srl
%.7: %.rst Makefile
$(RST2MAN_PROCESS)
%.8: %.rst Makefile
$(RST2MAN_PROCESS)
install-data-local:
if !SYSTEMD_SERVICE
if DAEMON
$(MKDIR_P) -m 700 $(DESTDIR)$(daemon_storagedir)
endif
if WIRED
$(MKDIR_P) -m 700 $(DESTDIR)$(wired_storagedir)
endif
endif
gcov-clean:
if GCOV
-$(LCOV) --quiet --directory $(builddir) -z
-rm -rf "$(builddir)/iwd-coverage.info" "$(builddir)/gcov"
-find . -name "*.gcda" -o -name "*.gcov" -o -name "*.gcno" -delete
endif
clean-local: gcov-clean
-rm -f unit/cert-*.pem unit/cert-*.csr unit/cert-*.srl unit/*-settings.8021x
maintainer-clean-local: maintainer-clean-local:
-rm -rf build-aux ell -rm -rf build-aux ell
gcov-report:
if GCOV
$(LCOV) --quiet --directory $(builddir) --capture --output-file "iwd-coverage.info"
LANG=C $(GENHTML) --quiet --prefix $(builddir) --output-directory "$(builddir)/gcov" --title "iwd Code Coverage" --legend "$(builddir)/iwd-coverage.info"
endif
src/builtin.h: src/genbuiltin config.status src/builtin.h: src/genbuiltin config.status
$(AM_V_at)$(MKDIR_P) $(@D) $(AM_V_at)$(MKDIR_P) $(@D)
$(AM_V_GEN)$(srcdir)/src/genbuiltin $(builtin_modules) > $@ $(AM_V_GEN)$(srcdir)/src/genbuiltin $(builtin_modules) > $@

52
README
View File

@ -1,7 +1,7 @@
Wireless daemon for Linux Wireless daemon for Linux
************************* *************************
Copyright (C) 2013-2019 Intel Corporation. All rights reserved. Copyright (C) 2013-2018 Intel Corporation. All rights reserved.
Compilation and installation Compilation and installation
@ -51,23 +51,6 @@ internally.
When using --enable-external-ell build option, it is not required that the When using --enable-external-ell build option, it is not required that the
Embedded Linux library source code is available in the top level directory. Embedded Linux library source code is available in the top level directory.
The tarballs include a copy of the Embedded Linux library source files. When
building from the tarballs, then it is not required to have the library
sources available in the top level directory.
Manual pages
============
The manual pages are generated from reStructuredText markup source files
during the normal build process. The generation requires the rst2man utility
from Python Docutils project. If rst2man is for some reason not available,
using --disable-manual-pages will skip the manual pages generation and
installation.
When building from the tarballs, a copy of the generated manual pages is
included and the rst2man utility is actually not needed.
Configuration and options Configuration and options
========================= =========================
@ -127,16 +110,6 @@ configuration options which are generally useful and enabled by default:
Note: This option affects all systemd unit setups. Note: This option affects all systemd unit setups.
--disable-manual-pages
Disable generation and installation of manual pages
By default all available manual pages will be generated
and installed. When disabling this options, no manual
pages are installed.
Note: This options affects all manual pages.
When building for a system that wants to use wireless technology, disabling When building for a system that wants to use wireless technology, disabling
any of the above options makes only limited sense. It may break the general any of the above options makes only limited sense. It may break the general
setup and usability for wireless connections. setup and usability for wireless connections.
@ -151,9 +124,13 @@ that can be enabled if the functionality is required:
This allows using an externally installed Embedded Linux This allows using an externally installed Embedded Linux
library instead of using the internal copy of ELL. library instead of using the internal copy of ELL.
Since the public API of Embedded Linux library is not yet Since the public API of Embedded Linux library is not yet
stable, the usage of the internal ELL copy is preferred. stable, the usage of the internal ELL copy is preferred.
--enable-wired --enable-wired
Enable installation of Ethernet authentication daemon Enable installation of Ethernet authentication daemon
@ -193,6 +170,18 @@ that can be enabled if the functionality is required:
Note: With --disable-daemon this option is ignored Note: With --disable-daemon this option is ignored
--enable-sim-hardcoded
Enable support for hard coded SIM keys
Note: With --disable-daemon this option is ignored
--enable-docs
Enable generation of documentation and manual pages
Note: This option does not provide any value right now
Netlink monitoring Netlink monitoring
================== ==================
@ -268,11 +257,10 @@ Information
=========== ===========
Mailing list: Mailing list:
https://lists.linux.dev/ https://lists.01.org/mailman/listinfo/iwd
https://lore.kernel.org/iwd/
IRC: IRC:
irc://irc.oftc.net/#iwd irc://irc.freenode.net/#iwd
Wiki: Wiki:
https://iwd.wiki.kernel.org/ https://iwd.wiki.kernel.org/

103
TODO
View File

@ -110,7 +110,7 @@ Wireless monitor
- Subscribe to all nl80211 multicast groups at startup - Subscribe to all nl80211 multicast groups at startup
It seems the nlmon packets are limited to actual subscribed multicast It seems the nlmon packets are limited to actual subscribed mutlicast
groups. To get a complete picture of all the nl80211 commands and groups. To get a complete picture of all the nl80211 commands and
events, it is required that iwmon adds membership to all multicast events, it is required that iwmon adds membership to all multicast
groups that the nl80211 lists. groups that the nl80211 lists.
@ -158,6 +158,25 @@ Wireless simulator
Wireless daemon Wireless daemon
=============== ===============
- Let EAP methods configure timeouts
Different EAP methods might have different recommendations for various
timeouts. E.g. retransmit timeout, overall timeout, etc. The EAP framework
should be updated to enable EAP methods to configure these timeouts
accordingly. A sane default should also be provided.
Priority: High
Complexity: C2
- EAPoL should take EAP timeouts into consideration
EAPoL state machine currently uses its own (very short) timeout for the
4-Way handshake / session key generation. This timeout does not take into
account the fact that EAP authentication might need to be performed first.
Priority: High
Complexity: C1
- Add unit test data with 2nd RSNE in Authenticator 3/4 message - Add unit test data with 2nd RSNE in Authenticator 3/4 message
The specification allows the AP to send a second RSN element in its 4-way The specification allows the AP to send a second RSN element in its 4-way
@ -199,6 +218,11 @@ Wireless daemon
Priority: Low Priority: Low
Complexity: C4 Complexity: C4
- Add support for 802.11u. This is required for Passpoint 2.0 support.
Priority: Low
Complexity: C8
- Add support for Wireless Network Management (WNM) from 802.11v. Parts of - Add support for Wireless Network Management (WNM) from 802.11v. Parts of
this are needed for Passpoint support. this are needed for Passpoint support.
@ -232,9 +256,21 @@ Wireless daemon
Priority: Low Priority: Low
Complexity: C4 Complexity: C4
- Take EAP MSK size into consideration.
MSK is mandated to be 64 bytes long, and depending on the AKM, different parts
of the MSK are used to generate keys. Some EAP methods produce MSKs with less
than 64 bytes of useable data. For example, LEAP produces only 16 bytes and
MSCHAPv2 produces 32 bytes. If the AKM requires MSK of a certain size, and
the EAP method does not provide enough data, then the handshake should be
aborted.
Priority: Medium
Complexity: C2
- Implement Enrollee Session Overlap Detection after WSC Protocol Run - Implement Enrollee Session Overlap Detection after WSC Protocol Run
WSC Best Practices v2.0.1, Section 3.15 describes an enhancement to detect WSC Best Practices v2.0.1, Section 3.15 describes an enhacement to detect
PBC session overlaps. The Enrollee is asked to perform an extra scan without PBC session overlaps. The Enrollee is asked to perform an extra scan without
the PBC request in the ProbeRequest frames after EAP-WSC completes the PBC request in the ProbeRequest frames after EAP-WSC completes
successfully. If another AP in PBC mode is found, then a SessionOverlap successfully. If another AP in PBC mode is found, then a SessionOverlap
@ -243,6 +279,14 @@ Wireless daemon
Priority: Low Priority: Low
Complexity: C2 Complexity: C2
- Use NL80211_CMD_CRIT_PROTOCOL_START / CRIT_PROTOCOL_STOP
Research whether iwd should be making use of these commands in order to
make EAP & 4-way handshakes, as well as DHCP exchanges more reliable.
Priority: Medium
Complexity: C2
- DPP Support - DPP Support
Device Provisioning Protocol is a new specification from WiFi Alliance. Device Provisioning Protocol is a new specification from WiFi Alliance.
@ -251,6 +295,33 @@ Wireless daemon
Priority: Low Priority: Low
Complexity: C8 Complexity: C8
- iwctl should register the agent even in non-interactive mode
When iwctl is started in non-interactive mode it currently does not register
the agent. This can lead to a .NoAgent error being reported when issuing
commands through iwctl in this mode. This behavior is generally okay for PSK
networks that only require the agent on the first connection. For 802.1x
networks the Agent can be used to obtain username/password/passphrase details
and thus used much more often. Make sure that iwctl supports this possibility
even in non-interactive mode.
Priority: High
Complexity: C1
- Implement EAP Authenticator certificate element matching
With TLS based EAP methods it is possible for certain Man-In-The-Middle
attacks to be performed by having a trusted CA issue a certificate for an
unrelated domain and then have an adversary utilize that certificate to spoof
trusted Access Points for a certain SSID. To prevent this it is possible
for clients to further limit what certificates they accept by utilizing
dNSName sub-element of SubjectAltName in the X.509 certificate (or
alternatively the SubjectName CN) of the Authenticator. This matching can
be done by suffix, an exact match, or perhaps even glob matching.
Priority: Medium
Complexity: C8
- Support receiving OCE FILS Discovery Frames - Support receiving OCE FILS Discovery Frames
When operating in station mode, we should support receiving of FILS When operating in station mode, we should support receiving of FILS
@ -286,7 +357,7 @@ Wireless daemon
- Support OCE mutually non-overlapping channels optimization. - Support OCE mutually non-overlapping channels optimization.
OCE Section 3.10 mandates that the STA should scan channels 1, 6 and 11 in OCE Section 3.10 mandates that the STA should scan channels 1, 6 and 11 in
the 2.4GHz band first, unless it expects to find an AP on a different the 2.4Ghz band first, unless it expects to find an AP on a different
channel. channel.
Priority: Low Priority: Low
@ -332,18 +403,24 @@ Wireless daemon
Priority: Medium Priority: Medium
Complexity: C4 Complexity: C4
- Support Diagnostics interface
Network Configuration The diagnostic interface for a particular Device would contain information
===================== (and possibly operations) that would be meant for diagnostics applications
or other applications that require access to very low level details. Such
applications would be expected how to interpret this information
appropriately.
- Support elements of RFC4436 - DNAv4 This interface would also be heavily utilized by the Auto-Test framework
in order to more easily ascertain the internal state of the hardware & the
daemon itself.
Assumption: netconfig is able to save lease information for networks that The list of possible information exposed via this interface includes:
have been joined previously and does not release the lease when the network - MAC address of the currently connected AP (in a Station)
is left temporarily. - MAC addresses of currently connected clients (Adhoc, AP, etc)
- packet error rates or signal strength
- Throughput statistics
- FTM / direction finding operations
Attempt to re-assume the lease via methods described in DNAv4 if we attempt Priority: Medium
to rejoin a network and the lease has not expired yet.
Priority: Low
Complexity: C4 Complexity: C4

View File

@ -46,30 +46,10 @@ AC_DEFUN([AC_PROG_CC_UBSAN], [
]) ])
]) ])
AC_DEFUN([AC_PROG_CC_GCOV], [
AC_CACHE_CHECK([whether ${CC-cc} accepts -fprofile-arcs], ac_cv_prog_cc_profile_arcs, [
echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -fprofile-arcs -c conftest.c 2>&1`"; then
ac_cv_prog_cc_profile_arcs=yes
else
ac_cv_prog_cc_profile_arcs=no
fi
rm -rf conftest*
])
AC_CACHE_CHECK([whether ${CC-cc} accepts -ftest_coverage], ac_cv_prog_cc_test_coverage, [
echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -ftest-coverage -c conftest.c 2>&1`"; then
ac_cv_prog_cc_test_coverage=yes
else
ac_cv_prog_cc_test_coverage=no
fi
rm -rf conftest*
])
])
AC_DEFUN([COMPILER_FLAGS], [ AC_DEFUN([COMPILER_FLAGS], [
if (test "${CFLAGS}" = ""); then if (test "${CFLAGS}" = ""); then
CFLAGS="-Wall -fsigned-char -fno-exceptions" CFLAGS="-Wall -O2 -fsigned-char -fno-exceptions"
CFLAGS+=" -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
fi fi
if (test "$USE_MAINTAINER_MODE" = "yes"); then if (test "$USE_MAINTAINER_MODE" = "yes"); then
CFLAGS+=" -Werror -Wextra" CFLAGS+=" -Werror -Wextra"
@ -78,14 +58,10 @@ AC_DEFUN([COMPILER_FLAGS], [
CFLAGS+=" -Wdeclaration-after-statement" CFLAGS+=" -Wdeclaration-after-statement"
CFLAGS+=" -Wmissing-declarations" CFLAGS+=" -Wmissing-declarations"
CFLAGS+=" -Wredundant-decls" CFLAGS+=" -Wredundant-decls"
CFALGS+=" -Wvariadic-macros"
CFLAGS+=" -Wformat -Wformat-security" CFLAGS+=" -Wformat -Wformat-security"
if ( $CC -v 2>/dev/null | grep "gcc version" ); then if ( $CC -v 2>/dev/null | grep "gcc version" ); then
CFLAGS+=" -Wcast-align" CFLAGS+=" -Wcast-align"
fi fi
fi fi
if (test "$CC" = "clang"); then
CFLAGS+=" -Wno-unknown-warning-option"
CFLAGS+=" -Wno-unknown-pragmas"
fi
]) ])

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,4 @@
# Phase 1 users
* TLS
# Phase 2
"abc@example.com" MD5 "testpasswd" [2]

View File

@ -0,0 +1,4 @@
# Phase 1 users
* TTLS
# Phase 2
"user" MSCHAPV2 "testpasswd" [2]

View File

@ -0,0 +1,4 @@
# Phase 1 users
* TTLS
# Phase 2
"abc@example.com" MD5 "testpasswd" [2]

View File

@ -0,0 +1 @@
"domain\User" MSCHAPV2 "Password"

View File

@ -0,0 +1,4 @@
# Phase 1 users
* PEAP
# Phase 2
"domain\User" MSCHAPV2 "Password" [2]

View File

@ -0,0 +1,4 @@
# Phase 1 users
* PEAP
# Phase 2
"132010000000000@example.com" SIM [2]

View File

@ -0,0 +1,4 @@
# Phase 1 users
* PEAP [ver=0]
# Phase 2
"secure@identity.com" MD5 "testpasswd" [2]

View File

@ -0,0 +1,4 @@
# Phase 1 users
* PEAP [ver=1]
# Phase 2
"secure@identity.com" MD5 "testpasswd" [2]

View File

@ -1,27 +0,0 @@
"112345678@phonesim.org" SIM
"012345678@phonesim.org" AKA
"612345678@phonesim.org" AKA'
"mschapv2@example.com" MSCHAPV2 "Password"
"pwd@example.com" PWD "Password"
# Phase 1 users
"tls@example.com" TLS
"ttls@example.com" TTLS
"peap@example.com" PEAP
"peapv0@example.com" PEAP [ver=0]
"peapv1@example.com" PEAP [ver=1]
# Phase 2
"md5-phase2@example.com" MD5 "Password" [2]
"gtc-phase2@example.com" GTC "Password" [2]
"mschapv2-phase2@example.com" MSCHAPV2 "Password" [2]
"ttls-chap-phase2@example.com" TTLS-CHAP "Password" [2]
"ttls-mschap-phase2@example.com" TTLS-MSCHAP "Password" [2]
"ttls-mschapv2-phase2@example.com" TTLS-MSCHAPV2 "Password" [2]
"ttls-pap-phase2@example.com" TTLS-PAP "Password" [2]
"112345678@phonesim.org" SIM [2]
# TODO: Hostapd is broken with phase1 lookups for reauthentication.
# Allowing a wildcard phase1 for PEAP/TTLS is a stop gap until
# hostapd is actually fixed.
* PEAP,TTLS

View File

@ -1,2 +0,0 @@
[SETUP]
num_radios=1

View File

@ -1,20 +0,0 @@
import unittest
import sys
sys.path.append('../util')
class Test(unittest.TestCase):
def test_connection_success(self):
pass
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
pass
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -1,3 +0,0 @@
[Security]
Passphrase=secret123
PairwiseCiphers=CCMP

View File

@ -1,66 +0,0 @@
#! /usr/bin/python3
import unittest
import sys
sys.path.append('../util')
import iwd
from iwd import IWD, NetworkType, PSKAgent
class Test(unittest.TestCase):
def test_no_ap_mode(self):
wd = IWD(True)
dev = wd.list_devices(1)[0]
with self.assertRaises(iwd.NotSupportedEx):
dev.start_ap('TestAP2', 'Password2')
def test_only_tkip_support(self):
wd = IWD(True)
devices = wd.list_devices(2)
dev_sta = devices[0]
dev_ap = devices[1]
dev_ap.start_ap('TestAP2', 'Password2')
self.assertTrue(dev_ap.group_cipher == 'TKIP')
self.assertIn('TKIP', dev_ap.pairwise_ciphers)
ordered_network = dev_sta.get_ordered_network('TestAP2')
if ordered_network.type != NetworkType.psk:
raise Exception("Network type mismatch")
psk_agent = PSKAgent('Password2')
wd.register_psk_agent(psk_agent)
ordered_network.network_object.connect()
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(dev_sta, condition)
wd.unregister_psk_agent(psk_agent)
def test_no_ccmp_support(self):
wd = IWD(True)
dev = wd.list_devices(2)[1]
# Should fail to start since the radio doesn't support CCMP but the
# profile only lists CCMP as allowed.
with self.assertRaises(iwd.NotSupportedEx):
dev.start_ap('TestAP2')
@classmethod
def setUpClass(cls):
IWD.copy_to_ap('TestAP2.ap')
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -1,9 +1,6 @@
[SETUP] [SETUP]
num_radios=2 num_radios=1
start_iwd=0 radio_confs=rad0
[rad0] [rad0]
iftype_disable=ap iftype_disable=ap
[rad1]
cipher_disable=ccmp,bip_cmac,gcmp,gcmp_256,ccmp_256,bip_gmac,bip_gmac_256,bip_cmac_256

View File

@ -1,24 +1,20 @@
#!/usr/bin/python3 #! /usr/bin/python3
import unittest import unittest
import sys import sys
import os
sys.path.append('../util') sys.path.append('../util')
import iwd
from iwd import IWD from iwd import IWD
from config import ctx
class Test(unittest.TestCase): class Test(unittest.TestCase):
def test_connection_success(self): def test_connection_success(self):
wd = IWD(True) wd = IWD()
devices = wd.list_devices(1) dev = wd.list_devices(1)[0]
device = devices[0]
device.autoconnect = True with self.assertRaises(iwd.NotSupportedEx):
device.scan(wait=False) dev.start_ap('TestAP2', 'Password2')
os.system('ip link set dev %s down' % device.name)
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):

View File

@ -1,2 +1,2 @@
[Settings] [Settings]
AutoConnect=False Autoconnect=False

View File

@ -1,2 +0,0 @@
[Security]
Passphrase=Password2

View File

@ -1,77 +0,0 @@
#! /usr/bin/python3
import unittest
import os
from iwd import IWD
from config import ctx
from validation import validate, client_connect
class Test(unittest.TestCase):
def test_connection_success(self):
IWD.copy_to_storage('TestAP1.psk')
wd = IWD(True)
dev1, dev2 = wd.list_devices(2)
client_connect(wd, dev1, 'TestAP1')
dev1.start_ap('TestAP2', 'Password2')
validate(wd, dev2, dev1, 'TestAP2', 'Password2')
# Finally test dev1 can go to client mode and connect again
client_connect(wd, dev1, 'TestAP1')
def test_client_start_ap(self):
IWD.copy_to_storage('TestAP1.psk')
wd = IWD(True)
dev1, dev2 = wd.list_devices(2)
ctx.start_process(['iwctl', 'device', dev1.name, 'set-property', 'Mode', 'ap'], check=True)
ctx.start_process(['iwctl', 'ap', dev1.name, 'start', 'TestAP2', 'Password2'], check=True)
iwctl = ctx.start_process(['iwctl', 'ap', 'list'], check=True)
self.assertIn(dev1.name, iwctl.out)
iwctl = ctx.start_process(['iwctl', 'ap', dev1.name, 'show'], check=True)
self.assertIn('TestAP2', iwctl.out)
validate(wd, dev2, dev1, 'TestAP2', 'Password2')
def test_valid_ciphers(self):
ciphers = ['TKIP', 'CCMP-128', 'GCMP-128', 'CCMP-256', 'GCMP-256']
for group in ciphers:
for pairwise in ciphers:
IWD.copy_to_ap('TestAP2.ap')
os.system('echo "PairwiseCiphers=%s" >> /tmp/iwd/ap/TestAP2.ap' % pairwise)
os.system('echo "GroupCipher=%s" >> /tmp/iwd/ap/TestAP2.ap' % group)
wd = IWD(True)
dev1, dev2 = wd.list_devices(2)
dev1.start_ap('TestAP2')
self.assertTrue(dev1.group_cipher == group)
self.assertIn(pairwise, dev1.pairwise_ciphers)
try:
validate(wd, dev2, dev1, 'TestAP2', 'Password2', ip_checks=False)
except:
raise Exception("Failed with pairwise=%s group=%s" % (pairwise, group))
finally:
IWD.clear_storage()
del wd
def tearDown(self):
IWD.clear_storage()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -1,10 +0,0 @@
[Security]
Passphrase=password123
[IPv4]
Address=192.168.1.1
Gateway=192.168.1.1
Netmask=255.255.255.0
DNSList=192.168.1.1,192.168.1.2
LeaseTime=10
IPRange=192.168.1.3,192.168.1.100

View File

@ -1,8 +0,0 @@
[Scan]
DisableMacAddressRandomization=true
[General]
EnableNetworkConfiguration=true
[IPv4]
APAddressPool=192.168.80.0/27

View File

@ -1,39 +0,0 @@
#! /usr/bin/python3
import unittest
from iwd import IWD
from config import ctx
from validation import validate
class Test(unittest.TestCase):
def test_connection_success(self):
# Using main.conf containing APRanges. The APConfig SSID should override
# this range.
wd = IWD(True, '/tmp/dhcp')
ns0 = ctx.get_namespace('ns0')
wd_ns0 = IWD(True, '/tmp/dhcp', namespace=ns0)
dev1 = wd_ns0.list_devices(1)[0]
dev2, dev3, dev4, dev5 = wd.list_devices(4)
dev3.disconnect()
dev4.disconnect()
dev5.disconnect()
dev1.start_ap('APConfig')
validate(wd, dev2, dev1, 'APConfig', 'password123',
sta_ip_info=('192.168.1.3', ctx), ap_ip_info=('192.168.1.1', ns0))
@classmethod
def setUpClass(cls):
IWD.copy_to_ap('dhcp/APConfig.ap')
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -1,70 +0,0 @@
#! /usr/bin/python3
import unittest
import sys, os
import iwd
from iwd import IWD
from iwd import PSKAgent
from iwd import NetworkType
from config import ctx
import testutil
from validation import validate
class Test(unittest.TestCase):
def test_connection_success(self):
wd = IWD(True, '/tmp/dhcp')
# dev1, dev3, and dev4 are all AP's
# The configured IP range only supports 2 subnets, so dev4 should fail
# to start AP.
dev1, dev2, dev3, dev4 = wd.list_devices(4)
dev1.start_ap('TestAP2', "Password2")
dev3.start_ap('TestAP3', 'Password3')
with self.assertRaises(iwd.AlreadyExistsEx):
dev4.start_ap('TestAP4', 'Password4')
validate(wd, dev2, dev1, 'TestAP2', 'Password2', ip_checks=False)
network = dev2.get_ordered_network('TestAP2', full_scan=True)
try:
testutil.test_ip_address_match(dev1.name, "192.168.80.1")
testutil.test_ip_address_match(dev2.name, "192.168.80.2")
ip = "192.168.80.1"
except:
testutil.test_ip_address_match(dev1.name, "192.168.80.17")
testutil.test_ip_address_match(dev2.name, "192.168.80.18")
ip = "192.168.80.17"
dev2.disconnect()
condition = 'not obj.connected'
wd.wait_for_object_condition(network.network_object, condition)
# This should release the IP */
dev1.stop_ap()
# This should now succeed and the IP should match the old IP dev1
# got initially.
dev4.start_ap('TestAP4', 'Password4')
testutil.test_ip_address_match(dev4.name, ip)
dev1.stop_ap()
dev3.stop_ap()
dev4.stop_ap()
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -8,50 +8,74 @@ import iwd
from iwd import IWD from iwd import IWD
from iwd import PSKAgent from iwd import PSKAgent
from iwd import NetworkType from iwd import NetworkType
from hostapd import HostapdCLI import hostapd
import testutil import testutil
class Test(unittest.TestCase): class Test(unittest.TestCase):
def client_connect(self, wd, dev): def client_connect(self, wd, dev):
hostapd = HostapdCLI(config='psk-ccmp.conf') condition = 'not obj.scanning'
wd.wait_for_object_condition(dev, condition)
ordered_network = dev.get_ordered_network('TestAP1', True) if not dev.get_ordered_networks():
dev.scan()
condition = 'obj.scanning'
wd.wait_for_object_condition(dev, condition)
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev, condition)
ordered_network = dev.get_ordered_network('TestAP1')
self.assertEqual(ordered_network.type, NetworkType.psk) self.assertEqual(ordered_network.type, NetworkType.psk)
psk_agent = PSKAgent('Password1') psk_agent = PSKAgent('Password1')
wd.register_psk_agent(psk_agent) wd.register_psk_agent(psk_agent)
try:
dev2.disconnect()
condition = 'not obj.connected'
wd.wait_for_object_condition(dev2, condition)
except:
pass
ordered_network.network_object.connect() ordered_network.network_object.connect()
condition = 'obj.state == DeviceState.connected' condition = 'obj.connected'
wd.wait_for_object_condition(dev, condition) wd.wait_for_object_condition(ordered_network.network_object, condition)
wd.unregister_psk_agent(psk_agent) wd.unregister_psk_agent(psk_agent)
testutil.test_iface_operstate(dev.name) testutil.test_iface_operstate(dev.name)
testutil.test_ifaces_connected(hostapd.ifname, dev.name) testutil.test_ifaces_connected(list(hostapd.hostapd_map.keys())[0],
dev.name)
dev.disconnect() dev.disconnect()
condition = 'not obj.connected' condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition) wd.wait_for_object_condition(ordered_network.network_object, condition)
def test_connection_failure(self): def test_connection_success(self):
wd = IWD(True) wd = IWD()
dev1, dev2 = wd.list_devices(2) dev1, dev2 = wd.list_devices(2)
dev1.disconnect()
dev2.disconnect()
self.client_connect(wd, dev1) self.client_connect(wd, dev1)
dev1.start_ap('TestAP2', 'Password2') dev1.start_ap('TestAP2', 'Password2')
try: try:
networks = {} condition = 'not obj.scanning'
networks['TestAP1'] = dev2.get_ordered_network('TestAP1', full_scan=True) wd.wait_for_object_condition(dev2, condition)
networks['TestAP2'] = dev2.get_ordered_network('TestAP2', full_scan=True) dev2.scan()
condition = 'obj.scanning'
wd.wait_for_object_condition(dev2, condition)
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev2, condition)
ordered_networks = dev2.get_ordered_networks()
networks = { n.name: n for n in ordered_networks }
self.assertEqual(networks['TestAP1'].type, NetworkType.psk) self.assertEqual(networks['TestAP1'].type, NetworkType.psk)
self.assertEqual(networks['TestAP2'].type, NetworkType.psk) self.assertEqual(networks['TestAP2'].type, NetworkType.psk)

View File

@ -1,9 +1,8 @@
[SETUP] [SETUP]
num_radios=6 num_radios=3
start_iwd=0 max_test_exec_interval_sec=40
iwd_config_dir=/tmp
tmpfs_extra_stuff=main.conf
[HOSTAPD] [HOSTAPD]
rad0=psk-ccmp.conf rad0=psk-ccmp.conf
[NameSpaces]
ns0=rad5

View File

@ -1,2 +1,2 @@
[Scan] [Scan]
DisableMacAddressRandomization=true disable_mac_address_randomization=true

View File

@ -1,20 +0,0 @@
#! /usr/bin/python3
import unittest
from iwd import IWD
class Test(unittest.TestCase):
def test_ap_scan(self):
wd = IWD(True)
dev = wd.list_devices(1)[0]
dev.start_ap('TestAP2', 'Password2')
dev.scan()
networks = dev.get_ordered_networks()
self.assertTrue(len(networks) == 1)
self.assertTrue(networks[0]['Name'] == 'TestAP1')

116
autotests/testAP/test.py Normal file
View File

@ -0,0 +1,116 @@
#! /usr/bin/python3
import unittest
import sys, os
sys.path.append('../util')
import iwd
from iwd import IWD
from iwd import PSKAgent
from iwd import NetworkType
import hostapd
import testutil
class Test(unittest.TestCase):
def client_connect(self, wd, dev):
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev, condition)
if not dev.get_ordered_networks():
dev.scan()
condition = 'obj.scanning'
wd.wait_for_object_condition(dev, condition)
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev, condition)
ordered_network = dev.get_ordered_network('TestAP1')
self.assertEqual(ordered_network.type, NetworkType.psk)
psk_agent = PSKAgent('Password1')
wd.register_psk_agent(psk_agent)
ordered_network.network_object.connect()
condition = 'obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
wd.unregister_psk_agent(psk_agent)
testutil.test_iface_operstate(dev.name)
testutil.test_ifaces_connected(list(hostapd.hostapd_map.keys())[0],
dev.name)
dev.disconnect()
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
def test_connection_success(self):
wd = IWD()
dev1, dev2 = wd.list_devices(2)
dev1.disconnect()
dev2.disconnect()
self.client_connect(wd, dev1)
dev1.start_ap('TestAP2', 'Password2')
try:
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev2, condition)
dev2.scan()
condition = 'obj.scanning'
wd.wait_for_object_condition(dev2, condition)
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev2, condition)
ordered_networks = dev2.get_ordered_networks()
networks = { n.name: n for n in ordered_networks }
self.assertEqual(networks['TestAP1'].type, NetworkType.psk)
self.assertEqual(networks['TestAP2'].type, NetworkType.psk)
psk_agent = PSKAgent('Password2')
wd.register_psk_agent(psk_agent)
try:
dev2.disconnect()
condition = 'not obj.connected'
wd.wait_for_object_condition(dev2, condition)
except:
pass
networks['TestAP2'].network_object.connect()
condition = 'obj.connected'
wd.wait_for_object_condition(networks['TestAP2'].network_object,
condition)
testutil.test_iface_operstate(dev2.name)
testutil.test_ifaces_connected(dev1.name, dev2.name)
wd.unregister_psk_agent(psk_agent)
dev2.disconnect()
condition = 'not obj.connected'
wd.wait_for_object_condition(networks['TestAP2'].network_object,
condition)
finally:
dev1.stop_ap()
# Finally test dev1 can go to client mode and connect again
self.client_connect(wd, dev1)
@classmethod
def setUpClass(cls):
IWD.copy_to_storage('TestAP1.psk')
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -1,71 +0,0 @@
from iwd import PSKAgent
from iwd import NetworkType
from hostapd import HostapdCLI
import testutil
def validate(wd, sta_dev, ap_dev, ssid, passphrase,
sta_ip_info=None, ap_ip_info=None, ip_checks=True):
try:
network = sta_dev.get_ordered_network(ssid, full_scan=True)
if network.type != NetworkType.psk:
raise Exception("Network type mismatch")
psk_agent = PSKAgent(passphrase)
wd.register_psk_agent(psk_agent)
network.network_object.connect()
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(sta_dev, condition)
testutil.test_iface_operstate(sta_dev.name)
# This implies separate namespaces so the iface names won't exist
if not sta_ip_info or not ap_ip_info:
testutil.test_ifaces_connected(ap_dev.name, sta_dev.name, group=False)
if not ip_checks:
return
if sta_ip_info:
testutil.test_ip_address_match(sta_dev.name, sta_ip_info[0])
if sta_ip_info and ap_ip_info:
testutil.test_ip_connected(sta_ip_info, ap_ip_info)
wd.unregister_psk_agent(psk_agent)
sta_dev.disconnect()
condition = 'not obj.connected'
wd.wait_for_object_condition(network.network_object, condition)
finally:
if ip_checks:
ap_dev.stop_ap()
def client_connect(wd, dev, ssid):
hostapd = HostapdCLI(config='psk-ccmp.conf')
ordered_network = dev.get_ordered_network(ssid)
if ordered_network.type != NetworkType.psk:
raise Exception("Network type mismatch")
psk_agent = PSKAgent('Password1')
wd.register_psk_agent(psk_agent)
ordered_network.network_object.connect()
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(dev, condition)
wd.unregister_psk_agent(psk_agent)
testutil.test_iface_operstate(dev.name)
testutil.test_ifaces_connected(hostapd.ifname, dev.name)
dev.disconnect()
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)

View File

@ -1,2 +0,0 @@
[Security]
Passphrase=secret123

View File

@ -6,75 +6,79 @@ import sys
sys.path.append('../util') sys.path.append('../util')
import iwd import iwd
from iwd import IWD from iwd import IWD
from iwd import PSKAgent
from iwd import NetworkType from iwd import NetworkType
from hostapd import HostapdCLI from hostapd import HostapdCLI
from hostapd import hostapd_map
from hwsim import Hwsim
class Test(unittest.TestCase): class Test(unittest.TestCase):
def initial_connection(self):
ordered_network = self.device.get_ordered_network('TestAPRoam') def test_connection_success(self):
hwsim = Hwsim()
bss_hostapd = [ HostapdCLI(config='ssid1.conf'),
HostapdCLI(config='ssid2.conf'),
HostapdCLI(config='ssid3.conf') ]
bss_radio = [ hwsim.get_radio('rad0'),
hwsim.get_radio('rad1'),
hwsim.get_radio('rad2') ]
wd = IWD()
psk_agent = PSKAgent("secret123")
wd.register_psk_agent(psk_agent)
devices = wd.list_devices(1)
device = devices[0]
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
device.scan()
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
ordered_network = device.get_ordered_network('TestAPRoam')
self.assertEqual(ordered_network.type, NetworkType.psk) self.assertEqual(ordered_network.type, NetworkType.psk)
condition = 'not obj.connected' condition = 'not obj.connected'
self.wd.wait_for_object_condition(ordered_network.network_object, condition) wd.wait_for_object_condition(ordered_network.network_object, condition)
self.device.connect_bssid(self.bss_hostapd[0].bssid) ordered_network.network_object.connect()
condition = 'obj.state == DeviceState.connected' condition = 'obj.connected'
self.wd.wait_for_object_condition(self.device, condition) wd.wait_for_object_condition(ordered_network.network_object, condition)
self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED') self.assertTrue(bss_hostapd[0].list_sta())
self.assertFalse(bss_hostapd[1].list_sta())
self.assertFalse(self.bss_hostapd[1].list_sta()) bss_hostapd[0].send_bss_transition(device.address,
[(bss_radio[1].addresses[0], '8f0000005102060603000000'),
(bss_radio[2].addresses[0], '8f0000005103060603000000')])
def validate_roam(self, from_bss, to_bss, expect_roam=True): condition = 'obj.state == DeviceState.roaming'
from_bss.send_bss_transition(self.device.address, wd.wait_for_object_condition(device, condition, 15)
self.neighbor_list,
disassoc_imminent=expect_roam)
if expect_roam: condition = 'obj.state != DeviceState.roaming'
from_condition = 'obj.state == DeviceState.roaming' wd.wait_for_object_condition(device, condition, 5)
to_condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_change(self.device, from_condition, to_condition)
to_bss.wait_for_event('AP-STA-CONNECTED %s' % self.device.address) self.assertEqual(device.state, iwd.DeviceState.connected)
else: self.assertTrue(bss_hostapd[1].list_sta())
self.device.wait_for_event("no-roam-candidates") device.disconnect()
def test_disassoc_imminent(self): condition = 'not obj.connected'
self.initial_connection() wd.wait_for_object_condition(ordered_network.network_object, condition)
self.validate_roam(self.bss_hostapd[0], self.bss_hostapd[1])
def test_no_candidates(self): wd.unregister_psk_agent(psk_agent)
self.initial_connection()
# We now have BSS0 roam blacklisted
self.validate_roam(self.bss_hostapd[0], self.bss_hostapd[1])
# Try and trigger another roam back, which shouldn't happen since now
# both BSS's are roam blacklisted
self.validate_roam(self.bss_hostapd[1], self.bss_hostapd[0], expect_roam=False)
def setUp(self):
self.wd = IWD(True)
devices = self.wd.list_devices(1)
self.device = devices[0]
def tearDown(self):
self.wd = None
self.device = None
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
IWD.copy_to_storage('TestAPRoam.psk') pass
cls.bss_hostapd = [ HostapdCLI(config='ssid1.conf'),
HostapdCLI(config='ssid2.conf'),
HostapdCLI(config='ssid3.conf') ]
cls.neighbor_list = [
(cls.bss_hostapd[0].bssid, "8f0000005101060603000000"),
(cls.bss_hostapd[1].bssid, "8f0000005102060603000000"),
]
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):

View File

@ -1,7 +1,6 @@
[SETUP] [SETUP]
num_radios=4 num_radios=4
hwsim_medium=true needs_hwsim=1
start_iwd=false
[HOSTAPD] [HOSTAPD]
rad0=ssid1.conf rad0=ssid1.conf

View File

@ -1,6 +0,0 @@
[General]
RoamThreshold=-72
CriticalRoamThreshold=-72
[Blacklist]
InitialAccessPointBusyTimeout=20

View File

@ -1,183 +0,0 @@
#!/usr/bin/python3
import unittest
import sys
sys.path.append('../util')
import iwd
from iwd import IWD, IWD_CONFIG_DIR
from iwd import NetworkType
from hostapd import HostapdCLI
from hwsim import Hwsim
class Test(unittest.TestCase):
def validate_connected(self, hostapd):
ordered_network = self.device.get_ordered_network('TestAPRoam')
self.assertEqual(ordered_network.type, NetworkType.psk)
condition = 'not obj.connected'
self.wd.wait_for_object_condition(ordered_network.network_object, condition)
self.device.connect_bssid(hostapd.bssid)
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(self.device, condition)
hostapd.wait_for_event('AP-STA-CONNECTED')
def validate_ap_roamed(self, from_hostapd, to_hostapd):
from_hostapd.send_bss_transition(
self.device.address, self.neighbor_list, disassoc_imminent=True
)
from_condition = 'obj.state == DeviceState.roaming'
to_condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_change(self.device, from_condition, to_condition)
to_hostapd.wait_for_event('AP-STA-CONNECTED %s' % self.device.address)
self.device.wait_for_event("ap-roam-blacklist-added")
def test_roam_to_optimal_candidates(self):
# In this test IWD will naturally transition down the list after each
# BSS gets roam blacklisted. All BSS's are above the RSSI thresholds.
self.rule_ssid1.signal = -5000
self.rule_ssid2.signal = -6500
self.rule_ssid3.signal = -6900
# Connect to BSS0
self.validate_connected(self.bss_hostapd[0])
# AP directed roam to BSS1
self.validate_ap_roamed(self.bss_hostapd[0], self.bss_hostapd[1])
# AP directed roam to BSS2
self.validate_ap_roamed(self.bss_hostapd[1], self.bss_hostapd[2])
def test_avoiding_under_threshold_bss(self):
# In this test IWD will blacklist BSS0, then roam the BSS1. BSS1 will
# then tell IWD to roam, but it should go back to BSS0 since the only
# non-blacklisted BSS is under the roam threshold.
self.rule_ssid1.signal = -5000
self.rule_ssid2.signal = -6500
self.rule_ssid3.signal = -7300
# Connect to BSS0
self.validate_connected(self.bss_hostapd[0])
# AP directed roam to BSS1
self.validate_ap_roamed(self.bss_hostapd[0], self.bss_hostapd[1])
# AP directed roam, but IWD should choose BSS0 since BSS2 is -73dB
self.validate_ap_roamed(self.bss_hostapd[1], self.bss_hostapd[0])
def test_connect_to_roam_blacklisted_bss(self):
# In this test a BSS will be roam blacklisted, but all other options are
# below the RSSI threshold so IWD should roam back to the blacklisted
# BSS.
self.rule_ssid1.signal = -5000
self.rule_ssid2.signal = -8000
self.rule_ssid3.signal = -8500
# Connect to BSS0
self.validate_connected(self.bss_hostapd[0])
# AP directed roam, should connect to BSS1 as its the next best
self.validate_ap_roamed(self.bss_hostapd[0], self.bss_hostapd[1])
# Connected to BSS1, but the signal is bad, so IWD should try to roam
# again. BSS0 is still blacklisted, but its the only reasonable option
# since both BSS1 and BSS2 are below the set RSSI threshold (-72dB)
from_condition = 'obj.state == DeviceState.roaming'
to_condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_change(self.device, from_condition, to_condition)
# IWD should have connected to BSS0, even though its roam blacklisted
self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % self.device.address)
def test_blacklist_during_roam_scan(self):
# Tests that an AP roam request mid-roam results in the AP still being
# blacklisted even though the request itself doesn't directly trigger
# a roam.
self.rule_ssid1.signal = -7300
self.rule_ssid2.signal = -7500
self.rule_ssid3.signal = -8500
# Connect to BSS0 under the roam threshold so IWD will immediately try
# roaming elsewhere
self.validate_connected(self.bss_hostapd[0])
self.device.wait_for_event("roam-scan-triggered")
self.bss_hostapd[0].send_bss_transition(
self.device.address, self.neighbor_list, disassoc_imminent=True
)
self.device.wait_for_event("ap-roam-blacklist-added")
# BSS0 should have gotten blacklisted even though IWD was mid-roam,
# causing IWD to choose BSS1 when it gets is results.
from_condition = 'obj.state == DeviceState.roaming'
to_condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_change(self.device, from_condition, to_condition)
self.bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % self.device.address)
def setUp(self):
self.wd = IWD(True)
devices = self.wd.list_devices(1)
self.device = devices[0]
def tearDown(self):
self.wd = None
self.device = None
@classmethod
def setUpClass(cls):
IWD.copy_to_storage("main.conf.roaming", IWD_CONFIG_DIR, "main.conf")
IWD.copy_to_storage('TestAPRoam.psk')
hwsim = Hwsim()
cls.bss_hostapd = [ HostapdCLI(config='ssid1.conf'),
HostapdCLI(config='ssid2.conf'),
HostapdCLI(config='ssid3.conf') ]
HostapdCLI.group_neighbors(*cls.bss_hostapd)
rad0 = hwsim.get_radio('rad0')
rad1 = hwsim.get_radio('rad1')
rad2 = hwsim.get_radio('rad2')
cls.neighbor_list = [
(cls.bss_hostapd[0].bssid, "8f0000005101060603000000"),
(cls.bss_hostapd[1].bssid, "8f0000005102060603000000"),
(cls.bss_hostapd[2].bssid, "8f0000005103060603000000"),
]
cls.rule_ssid1 = hwsim.rules.create()
cls.rule_ssid1.source = rad0.addresses[0]
cls.rule_ssid1.bidirectional = True
cls.rule_ssid1.enabled = True
cls.rule_ssid2 = hwsim.rules.create()
cls.rule_ssid2.source = rad1.addresses[0]
cls.rule_ssid2.bidirectional = True
cls.rule_ssid2.enabled = True
cls.rule_ssid3 = hwsim.rules.create()
cls.rule_ssid3.source = rad2.addresses[0]
cls.rule_ssid3.bidirectional = True
cls.rule_ssid3.enabled = True
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -2,43 +2,27 @@
import unittest import unittest
import sys import sys
import time
from time import sleep
sys.path.append('../util') sys.path.append('../util')
import iwd
from iwd import IWD from iwd import IWD
from iwd import AdHocDevice
from config import ctx
import testutil import testutil
class Test(unittest.TestCase): class Test(unittest.TestCase):
def validate_connection(self, wd, client=False): def validate_connection(self, wd):
dev1, dev2 = wd.list_devices(2) dev1, dev2 = wd.list_devices(2)
self.assertIsNotNone(dev1) self.assertIsNotNone(dev1)
self.assertIsNotNone(dev2) self.assertIsNotNone(dev2)
adhoc1 = dev1.start_adhoc("AdHocNetwork", "secret123") dev1.start_adhoc("AdHocNetwork", "secret123")
dev2.start_adhoc("AdHocNetwork", "secret123")
condition = 'obj.started == True' dev1.adhoc_wait_for_connected(dev2.address)
wd.wait_for_object_condition(adhoc1, condition) dev2.adhoc_wait_for_connected(dev1.address)
if not client:
adhoc2 = dev2.start_adhoc("AdHocNetwork", "secret123")
else:
ctx.start_process(['iwctl', 'device', dev2.name, 'set-property',
'Mode', 'ad-hoc'], check=True)
ctx.start_process(['iwctl', 'ad-hoc', dev2.name, 'start',
'AdHocNetwork', 'secret123'], check=True)
adhoc2 = AdHocDevice(dev2.device_path)
condition = 'obj.started == True'
wd.wait_for_object_condition(adhoc1, condition)
condition = '"%s" in obj.connected_peers' % dev2.address
wd.wait_for_object_condition(adhoc1, condition)
condition = '"%s" in obj.connected_peers' % dev1.address
wd.wait_for_object_condition(adhoc2, condition)
testutil.test_iface_operstate(dev1.name) testutil.test_iface_operstate(dev1.name)
testutil.test_iface_operstate(dev2.name) testutil.test_iface_operstate(dev2.name)
@ -49,10 +33,6 @@ class Test(unittest.TestCase):
self.validate_connection(wd) self.validate_connection(wd)
def test_client_adhoc(self):
wd = IWD(True)
self.validate_connection(wd, client=True)
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
pass pass

View File

@ -1,3 +1,4 @@
[SETUP] [SETUP]
num_radios=2 num_radios=2
max_test_exec_interval_sec=35
start_iwd=0 start_iwd=0

View File

@ -18,25 +18,16 @@ class Test(unittest.TestCase):
self.assertIsNotNone(dev1) self.assertIsNotNone(dev1)
self.assertIsNotNone(dev2) self.assertIsNotNone(dev2)
adhoc1 = dev1.start_adhoc("AdHocNetwork") dev1.start_adhoc("AdHocNetwork")
sleep(1)
dev2.start_adhoc("AdHocNetwork")
condition = 'obj.started == True' dev1.adhoc_wait_for_connected(dev2.address)
wd.wait_for_object_condition(adhoc1, condition) dev2.adhoc_wait_for_connected(dev1.address)
adhoc2 = dev2.start_adhoc("AdHocNetwork") #testutil.test_iface_operstate(dev1.name)
#testutil.test_iface_operstate(dev2.name)
condition = 'obj.started == True' #testutil.test_ifaces_connected(dev1.name, dev2.name)
wd.wait_for_object_condition(adhoc1, condition)
condition = '"%s" in obj.connected_peers' % dev2.address
wd.wait_for_object_condition(adhoc1, condition)
condition = '"%s" in obj.connected_peers' % dev1.address
wd.wait_for_object_condition(adhoc2, condition)
testutil.test_iface_operstate(dev1.name)
testutil.test_iface_operstate(dev2.name)
testutil.test_ifaces_connected(dev1.name, dev2.name)
def test_connection_success(self): def test_connection_success(self):
wd = IWD(True) wd = IWD(True)

View File

@ -1,78 +0,0 @@
#!/usr/bin/python3
import unittest
import sys
import os
sys.path.append('../util')
import iwd
from iwd import IWD
from iwd import NetworkType
import testutil
class Test(unittest.TestCase):
def try_connection(self, wd):
devices = wd.list_devices(1)
device = devices[0]
ordered_network = device.get_ordered_network('ssidCCMP')
self.assertEqual(ordered_network.type, NetworkType.psk)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
ordered_network.network_object.connect()
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
testutil.test_iface_operstate()
testutil.test_ifaces_connected()
device.disconnect()
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
return device.address
def test_connection_success(self):
wd = IWD()
devices = wd.list_devices(1)
device = devices[0]
perm_addr = device.address
# 1. Test per-network deterministic MAC generation
IWD.copy_to_storage('pernetwork.psk', name='ssidCCMP.psk')
new_addr = self.try_connection(wd)
self.assertNotEqual(perm_addr, new_addr)
# try again to ensure the generation was deterministic
new_addr2 = self.try_connection(wd)
self.assertEqual(new_addr, new_addr2)
# 2. Test FullAddressRandomization
IWD.copy_to_storage('full_random.psk', name='ssidCCMP.psk')
new_addr = self.try_connection(wd)
self.assertNotEqual(perm_addr, new_addr)
# try again to make sure the generation was random
new_addr2 = self.try_connection(wd)
self.assertNotEqual(new_addr, new_addr2)
# 3. Test AddressOverride
IWD.copy_to_storage('override.psk', name='ssidCCMP.psk')
new_addr = self.try_connection(wd)
self.assertEqual(new_addr, 'e6:f6:38:a9:02:02')
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -1,6 +0,0 @@
[Security]
Passphrase=secret123
[Settings]
AlwaysRandomizeAddress=true
AutoConnect=false

View File

@ -1,5 +0,0 @@
[SETUP]
num_radios=2
[HOSTAPD]
rad0=ssidCCMP.conf

View File

@ -1,2 +0,0 @@
[General]
AddressRandomization=network

View File

@ -1,6 +0,0 @@
[Security]
Passphrase=secret123
[Settings]
AddressOverride=e6:f6:38:a9:02:02
AutoConnect=false

View File

@ -1,5 +0,0 @@
[Security]
Passphrase=secret123
[Settings]
AutoConnect=false

View File

@ -1,2 +0,0 @@
[Security]
Passphrase=EasilyGuessedPassword

View File

@ -1,41 +0,0 @@
hw_mode=g
channel=1
ssid=TestFT
utf8_ssid=1
ctrl_interface=/var/run/hostapd
r1_key_holder=120000000001
nas_identifier=dummy1
wpa=2
# Can support WPA-PSK and FT-PSK (space separated list) and/or EAP at the same
# time but we want to force FT
wpa_key_mgmt=FT-PSK
wpa_pairwise=CCMP
wpa_passphrase=EasilyGuessedPassword
ieee80211w=0
rsn_preauth=1
rsn_preauth_interfaces=lo
disable_pmksa_caching=0
# Allow PMK cache to be shared opportunistically among configured interfaces
# and BSSes (i.e., all configurations within a single hostapd process).
okc=1
mobility_domain=1234
reassociation_deadline=60000
r0kh=12:00:00:00:00:01 dummy1 000102030405060708090a0b0c0d0e0f
r0kh=12:00:00:00:00:02 dummy2 000102030405060708090a0b0c0d0e0f
r1kh=12:00:00:00:00:01 00:00:00:00:00:01 000102030405060708090a0b0c0d0e0f
r1kh=12:00:00:00:00:02 00:00:00:00:00:02 000102030405060708090a0b0c0d0e0f
# Push mode only needed for 8021x, not PSK mode since msk already known
pmk_r1_push=0
# Allow locally generated FT response so we don't have to configure push/pull
# between BSSes running as separate hostapd processes as in the test-runner
# case. Only works with FT-PSK, otherwise brctl needs to be installed and
# CONFIG_BRIDGE enabled in the kernel.
ft_psk_generate_local=1
rkh_pull_timeout=50
ft_over_ds=0
ap_table_expiration_time=36000
ap_table_max_size=10
rrm_neighbor_report=1
ocv=1

View File

@ -1,8 +0,0 @@
[SETUP]
num_radios=3
start_iwd=0
hwsim_medium=yes
[HOSTAPD]
rad0=ft-psk-ccmp-1.conf
rad1=ft-psk-ccmp-2.conf

View File

@ -1,5 +0,0 @@
[Scan]
DisableMacAddressRandomization=true
[General]
RoamRetryInterval=1

View File

@ -1,216 +0,0 @@
#! /usr/bin/python3
import unittest
import sys, os
import dbus
sys.path.append('../util')
from config import ctx
import iwd
from iwd import IWD, IWDDBusAbstract
from iwd import NetworkType
from hwsim import Hwsim
from hostapd import HostapdCLI
#
# Separate client used to test DBus disconnects so we don't bring down the
# entire IWD python library
#
class AffinityClient(IWDDBusAbstract):
def __init__(self, device_path):
self._bus = dbus.bus.BusConnection(address_or_type=ctx.dbus_address)
self._station_prop_if = dbus.Interface(
self._bus.get_object(iwd.IWD_SERVICE, device_path),
iwd.DBUS_PROPERTIES)
def set(self, values):
self._station_prop_if.Set(iwd.IWD_STATION_INTERFACE, 'Affinities', dbus.Array([dbus.ObjectPath(v) for v in values], signature="o"))
def close(self):
self._bus.close()
class Test(unittest.TestCase):
def connect(self, device, hapd):
ordered_network = device.get_ordered_network('TestFT', full_scan=True)
self.assertEqual(ordered_network.type, NetworkType.psk)
condition = 'not obj.connected'
self.wd.wait_for_object_condition(ordered_network.network_object, condition)
device.connect_bssid(hapd.bssid)
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(device, condition)
def test_set_affinity(self):
device = self.wd.list_devices(1)[0]
self.connect(device, self.bss_hostapd[0])
print(device.connected_bss)
device.affinities = [device.connected_bss]
# IWD should not attempt to roam
with self.assertRaises(TimeoutError):
device.wait_for_event("roam-scan-triggered")
device.affinities = []
device.wait_for_event("roam-scan-triggered")
def test_roam_below_critical(self):
device = self.wd.list_devices(1)[0]
self.connect(device, self.bss_hostapd[0])
device.affinities = [device.connected_bss]
# IWD should not attempt to roam
with self.assertRaises(TimeoutError):
device.wait_for_event("roam-scan-triggered")
# Lower signal past critical level
self.bss0_rule.signal = -9000
device.wait_for_event("roam-scan-triggered")
def test_error_conditions(self):
device = self.wd.list_devices(1)[0]
# Calling set while disconnected should fail
with self.assertRaises(iwd.NotConnectedEx):
device.affinities = ["/some/path"]
self.connect(device, self.bss_hostapd[0])
device.affinities = [device.connected_bss]
# An invalid path should fail
with self.assertRaises(iwd.InvalidArgumentsEx):
device.affinities = [device.connected_bss, "/an/invalid/path"]
def test_affinity_client_disconnect(self):
device = self.wd.list_devices(1)[0]
client = AffinityClient(device.device_path)
self.connect(device, self.bss_hostapd[0])
client.set([device.connected_bss])
with self.assertRaises(TimeoutError):
device.wait_for_event("roam-scan-triggered")
client._bus.close()
device.wait_for_event("roam-scan-triggered")
def test_affinity_client_reconnect_during_roam(self):
device = self.wd.list_devices(1)[0]
client = AffinityClient(device.device_path)
self.connect(device, self.bss_hostapd[0])
client.set([device.connected_bss])
# Lower signal past critical level
self.bss0_rule.signal = -9000
device.wait_for_event("roam-scan-triggered")
client.close()
del client
client = AffinityClient(device.device_path)
# setting here should get cleared after connecting
client.set([device.connected_bss])
device.wait_for_event("ft-authenticating")
device.wait_for_event("associating")
device.wait_for_event("connected")
# Affinity should be reset, and IWD should be trying to roam
device.wait_for_event("roam-scan-triggered")
def test_cleanup_with_connected_client(self):
device = self.wd.list_devices(1)[0]
client = AffinityClient(device.device_path)
self.connect(device, self.bss_hostapd[0])
client.set([device.connected_bss])
self.wd.stop()
def test_affinity_removed_after_roam(self):
device = self.wd.list_devices(1)[0]
self.connect(device, self.bss_hostapd[0])
device.affinities = [device.connected_bss]
# Lower signal past critical level
self.bss0_rule.signal = -9000
device.wait_for_event("roam-scan-triggered")
device.wait_for_event("ft-authenticating")
device.wait_for_event("associating")
device.wait_for_event("connected")
self.assertEqual(device.affinities, [])
def tearDown(self):
os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down')
os.system('ip link set "' + self.bss_hostapd[1].ifname + '" down')
os.system('ip link set "' + self.bss_hostapd[0].ifname + '" up')
os.system('ip link set "' + self.bss_hostapd[1].ifname + '" up')
self.wd.stop()
self.wd = None
def setUp(self):
self.bss0_rule.signal = -8000
self.bss1_rule.signal = -8000
self.wd = IWD(True)
@classmethod
def setUpClass(cls):
hwsim = Hwsim()
IWD.copy_to_storage('TestFT.psk')
cls.bss_hostapd = [ HostapdCLI(config='ft-psk-ccmp-1.conf'),
HostapdCLI(config='ft-psk-ccmp-2.conf') ]
rad0 = hwsim.get_radio('rad0')
rad1 = hwsim.get_radio('rad1')
cls.bss0_rule = hwsim.rules.create()
cls.bss0_rule.source = rad0.addresses[0]
cls.bss0_rule.bidirectional = True
cls.bss0_rule.signal = -8000
cls.bss0_rule.enabled = True
cls.bss1_rule = hwsim.rules.create()
cls.bss1_rule.source = rad1.addresses[0]
cls.bss1_rule.bidirectional = True
cls.bss1_rule.signal = -8000
cls.bss1_rule.enabled = True
cls.bss_hostapd[0].set_address('12:00:00:00:00:01')
cls.bss_hostapd[1].set_address('12:00:00:00:00:02')
HostapdCLI.group_neighbors(*cls.bss_hostapd)
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
cls.bss_hostapd = None
cls.bss0_rule.remove()
cls.bss1_rule.remove()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -1,83 +0,0 @@
#!/usr/bin/python3
import unittest
import sys
import dbus
sys.path.append('../util')
import iwd
from iwd import IWD
from iwd import PSKAgent
from iwd import NetworkType
import testutil
import subprocess
from config import ctx
class Test(unittest.TestCase):
def check_connection(self, wd, ssid):
device = wd.list_devices(1)[0]
ordered_network = device.get_ordered_network(ssid)
ordered_network.network_object.connect()
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
condition = 'obj.connected_network is not None'
wd.wait_for_object_condition(device, condition)
testutil.test_iface_operstate(device.name)
device.disconnect()
condition = 'obj.state == DeviceState.disconnected'
wd.wait_for_object_condition(device, condition)
def test_connection_with_no_agent(self):
wd = IWD()
with self.assertRaises(iwd.NoAgentEx):
self.check_connection(wd, 'ssid1')
IWD.clear_storage()
def test_connection_with_own_agent(self):
wd = IWD()
psk_agent = PSKAgent("secret_ssid1")
wd.register_psk_agent(psk_agent)
self.check_connection(wd, 'ssid1')
wd.unregister_psk_agent(psk_agent)
IWD.clear_storage()
def test_connection_use_first_from_multiple_registered(self):
wd = IWD()
psk_agent = PSKAgent("secret_ssid1")
wd.register_psk_agent(psk_agent)
psk_agent = PSKAgent("secret_ssid2")
wd.register_psk_agent(psk_agent)
self.check_connection(wd, 'ssid1')
wd.unregister_psk_agent(psk_agent)
IWD.clear_storage()
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -1,6 +0,0 @@
[SETUP]
num_radios=3
[HOSTAPD]
rad0=ssid1.conf
rad1=ssid2.conf

View File

@ -1,7 +0,0 @@
hw_mode=g
channel=1
ssid=ssid1
wpa=1
wpa_pairwise=TKIP
wpa_passphrase=secret_ssid1

View File

@ -1,7 +0,0 @@
hw_mode=g
channel=1
ssid=ssid2
wpa=1
wpa_pairwise=TKIP
wpa_passphrase=secret_ssid2

View File

@ -1,2 +0,0 @@
[Security]
Passphrase=secret123

View File

@ -0,0 +1,99 @@
#!/usr/bin/python3
import unittest
import sys
sys.path.append('../util')
import iwd
from iwd import IWD
from iwd import PSKAgent
from iwd import NetworkType
from hostapd import HostapdCLI
from hostapd import hostapd_map
from hwsim import Hwsim
import time
class Test(unittest.TestCase):
def test_connection_success(self):
hwsim = Hwsim()
bss_hostapd = [ HostapdCLI(config='ssid1.conf'),
HostapdCLI(config='ssid2.conf'),
HostapdCLI(config='ssid3.conf') ]
bss_radio = [ hwsim.get_radio('rad0'),
hwsim.get_radio('rad1'),
hwsim.get_radio('rad2') ]
rule0 = hwsim.rules.create()
rule0.source = bss_radio[0].addresses[0]
rule0.bidirectional = True
rule0.signal = -2000
rule1 = hwsim.rules.create()
rule1.source = bss_radio[1].addresses[0]
rule1.bidirectional = True
rule1.signal = -8000
rule2 = hwsim.rules.create()
rule2.source = bss_radio[2].addresses[0]
rule2.bidirectional = True
rule2.signal = -10000
wd = IWD(True)
psk_agent = PSKAgent(["secret123", 'secret123'])
wd.register_psk_agent(psk_agent)
devices = wd.list_devices(1)
device = devices[0]
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
device.scan()
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
ordered_network = device.get_ordered_network("TestBlacklist")
self.assertEqual(ordered_network.type, NetworkType.psk)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
# Have both APs drop all packets, both should get blacklisted
rule0.drop = True
rule1.drop = True
rule2.drop = True
with self.assertRaises(iwd.FailedEx):
ordered_network.network_object.connect()
rule0.drop = False
rule1.drop = False
# This connect should work
ordered_network.network_object.connect()
condition = 'obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
self.assertIn(device.address, bss_hostapd[0].list_sta())
wd.unregister_psk_agent(psk_agent)
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -0,0 +1,96 @@
#!/usr/bin/python3
import unittest
import sys
sys.path.append('../util')
import iwd
from iwd import IWD
from iwd import PSKAgent
from iwd import NetworkType
from hostapd import HostapdCLI
from hostapd import hostapd_map
from hwsim import Hwsim
import time
class Test(unittest.TestCase):
def test_connection_success(self):
hwsim = Hwsim()
bss_hostapd = [ HostapdCLI(config='ssid1.conf'),
HostapdCLI(config='ssid2.conf'),
HostapdCLI(config='ssid3.conf') ]
bss_radio = [ hwsim.get_radio('rad0'),
hwsim.get_radio('rad1'),
hwsim.get_radio('rad2') ]
rule0 = hwsim.rules.create()
rule0.source = bss_radio[0].addresses[0]
rule0.bidirectional = True
rule0.signal = -2000
rule1 = hwsim.rules.create()
rule1.source = bss_radio[1].addresses[0]
rule1.bidirectional = True
rule1.signal = -8000
rule2 = hwsim.rules.create()
rule2.source = bss_radio[2].addresses[0]
rule2.bidirectional = True
rule2.signal = -10000
wd = IWD(True, '/tmp')
psk_agent = PSKAgent("wrong_password")
wd.register_psk_agent(psk_agent)
devices = wd.list_devices(1)
device = devices[0]
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
device.scan()
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
ordered_network = device.get_ordered_network("TestBlacklist")
self.assertEqual(ordered_network.type, NetworkType.psk)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
with self.assertRaises(iwd.FailedEx):
ordered_network.network_object.connect()
wd.unregister_psk_agent(psk_agent)
psk_agent = PSKAgent("secret123")
wd.register_psk_agent(psk_agent)
ordered_network.network_object.connect()
# We failed to connect bss_hostapd[0], but with a bad password. Verify
# that this did not trigger a blacklist and that we did reconnect
# successfully to bss_hostapd[0]
self.assertIn(device.address, bss_hostapd[0].list_sta())
condition = 'obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -8,195 +8,64 @@ import iwd
from iwd import IWD from iwd import IWD
from iwd import PSKAgent from iwd import PSKAgent
from iwd import NetworkType from iwd import NetworkType
from iwd import IWD_CONFIG_DIR
from hostapd import HostapdCLI from hostapd import HostapdCLI
from hostapd import hostapd_map
from hwsim import Hwsim from hwsim import Hwsim
import time import time
class Test(unittest.TestCase): class Test(unittest.TestCase):
def test_temp_blacklist(self):
rule0 = self.rule0
rule1 = self.rule1
rule2 = self.rule2
bss_hostapd = self.bss_hostapd def test_connection_success(self):
wd = self.wd hwsim = Hwsim()
rule0.signal = -8000 bss_hostapd = [ HostapdCLI(config='ssid1.conf'),
rule1.signal = -7000 HostapdCLI(config='ssid2.conf'),
rule2.signal = -2000 HostapdCLI(config='ssid3.conf') ]
bss_radio = [ hwsim.get_radio('rad0'),
hwsim.get_radio('rad1'),
hwsim.get_radio('rad2') ]
rule0 = hwsim.rules.create()
rule0.source = bss_radio[0].addresses[0]
rule0.bidirectional = True
rule0.signal = -2000
rule1 = hwsim.rules.create()
rule1.source = bss_radio[1].addresses[0]
rule1.bidirectional = True
rule1.signal = -8000
rule2 = hwsim.rules.create()
rule2.source = bss_radio[2].addresses[0]
rule2.bidirectional = True
rule2.signal = -10000
wd = IWD(True, '/tmp')
psk_agent = PSKAgent("secret123") psk_agent = PSKAgent("secret123")
wd.register_psk_agent(psk_agent) wd.register_psk_agent(psk_agent)
dev1, dev2 = wd.list_devices(2)
ordered_network = dev1.get_ordered_network("TestBlacklist", full_scan=True)
self.assertEqual(ordered_network.type, NetworkType.psk)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
ordered_network.network_object.connect()
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(dev1, condition)
bss_hostapd[2].wait_for_event('AP-STA-CONNECTED %s' % dev1.address)
# dev1 now connected, this should max out the first AP, causing the next
# connection to fail to this AP.
ordered_network = dev2.get_ordered_network("TestBlacklist", full_scan=True)
self.assertEqual(ordered_network.type, NetworkType.psk)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
ordered_network.network_object.connect()
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(dev2, condition)
# We should have temporarily blacklisted the first BSS, and connected
# to this one.
bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % dev2.address)
# Now check that the first BSS is still not blacklisted. We can
# disconnect dev1, opening up the AP for more connections
dev1.disconnect()
dev2.disconnect()
ordered_network = dev2.get_ordered_network("TestBlacklist")
self.assertEqual(ordered_network.type, NetworkType.psk)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
ordered_network.network_object.connect()
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(dev2, condition)
bss_hostapd[2].wait_for_event('AP-STA-CONNECTED %s' % dev2.address)
wd.unregister_psk_agent(psk_agent)
def test_all_blacklisted(self):
wd = self.wd
bss_hostapd = self.bss_hostapd
rule0 = self.rule0
rule1 = self.rule1
rule2 = self.rule2
psk_agent = PSKAgent(["secret123", 'secret123'])
wd.register_psk_agent(psk_agent)
devices = wd.list_devices(1) devices = wd.list_devices(1)
device = devices[0] device = devices[0]
ordered_network = device.get_ordered_network("TestBlacklist", full_scan=True)
self.assertEqual(ordered_network.type, NetworkType.psk)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
# Have both APs drop all packets, both should get blacklisted
rule0.drop = True
rule0.enabled = True
rule1.drop = True
rule1.enabled = True
rule2.drop = True
rule2.enabled = True
with self.assertRaises(iwd.FailedEx):
ordered_network.network_object.connect()
rule0.drop = False
rule1.drop = False
rule2.drop = False
# Wait for scanning (likely a quick-scan) to finish, otherwise we will
# may not have all BSS's in the list.
condition = 'not obj.scanning' condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition) wd.wait_for_object_condition(device, condition)
# This connect should work device.scan()
ordered_network.network_object.connect()
condition = 'obj.state == DeviceState.connected' condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition) wd.wait_for_object_condition(device, condition)
bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address) ordered_network = device.get_ordered_network("TestBlacklist")
wd.unregister_psk_agent(psk_agent)
def test_invalid_password(self):
wd = self.wd
bss_hostapd = self.bss_hostapd
psk_agent = PSKAgent("wrong_password")
wd.register_psk_agent(psk_agent)
devices = wd.list_devices(1)
device = devices[0]
ordered_network = device.get_ordered_network("TestBlacklist", full_scan=True)
self.assertEqual(ordered_network.type, NetworkType.psk) self.assertEqual(ordered_network.type, NetworkType.psk)
condition = 'not obj.connected' condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition) wd.wait_for_object_condition(ordered_network.network_object, condition)
with self.assertRaises(iwd.FailedEx):
ordered_network.network_object.connect()
wd.unregister_psk_agent(psk_agent)
psk_agent = PSKAgent("secret123")
wd.register_psk_agent(psk_agent)
ordered_network.network_object.connect()
# We failed to connect bss_hostapd[0], but with a bad password. Verify
# that this did not trigger a blacklist and that we did reconnect
# successfully to bss_hostapd[0]
self.assertIn(device.address, bss_hostapd[0].list_sta())
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
wd.unregister_psk_agent(psk_agent)
def test_connection_success(self):
wd = self.wd
bss_hostapd = self.bss_hostapd
rule0 = self.rule0
psk_agent = PSKAgent("secret123")
wd.register_psk_agent(psk_agent)
devices = wd.list_devices(2)
device = devices[0]
devices[1].disconnect()
ordered_network = device.get_ordered_network("TestBlacklist", full_scan=True)
self.assertEqual(ordered_network.type, NetworkType.psk)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
rule0.drop = True
ordered_network.network_object.connect(wait=False) ordered_network.network_object.connect(wait=False)
# Have AP1 drop all packets, should result in a connection timeout # Have AP1 drop all packets, should result in a connection timeout
@ -214,37 +83,47 @@ class Test(unittest.TestCase):
# should automatically try the next BSS in the list, which is # should automatically try the next BSS in the list, which is
# bss_hostapd[1] # bss_hostapd[1]
self.assertNotIn(device.address, bss_hostapd[0].list_sta()) self.assertNotIn(device.address, bss_hostapd[0].list_sta())
bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % device.address) self.assertIn(device.address, bss_hostapd[1].list_sta())
rule0.drop = False rule0.drop = False
device.disconnect() # Next try autoconnecting to a network with a blacklisted BSS. Since an
device.autoconnect = True # explicit disconnect call would disable autoconnect we reset
# hostapd which will disconnect IWD.
bss_hostapd[1].reload()
condition = 'not obj.connected' condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition) wd.wait_for_object_condition(ordered_network.network_object, condition)
# Now we wait... AutoConnect should take over # Now we wait... Autoconnect should take over
condition = 'obj.state == DeviceState.connecting' condition = 'obj.state == DeviceState.connecting'
wd.wait_for_object_condition(device, condition) wd.wait_for_object_condition(device, condition, 15)
condition = 'obj.state == DeviceState.connected' condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition) wd.wait_for_object_condition(device, condition, 15)
# Same as before, make sure we didn't connect to the blacklisted AP. # Same as before, make sure we didn't connect to the blacklisted AP.
self.assertNotIn(device.address, bss_hostapd[0].list_sta()) self.assertNotIn(device.address, bss_hostapd[0].list_sta())
bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % device.address) self.assertIn(device.address, bss_hostapd[1].list_sta())
# Wait for the blacklist to expire (10 seconds) # Wait for the blacklist to expire (10 seconds)
elapsed = time.time() - start elapsed = time.time() - start
if elapsed < 15: if elapsed < 11:
wd.wait(15 - elapsed) time.sleep(11 - elapsed)
device.disconnect() device.disconnect()
ordered_network = device.get_ordered_network("TestBlacklist", full_scan=True) condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
device.scan()
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
ordered_network = device.get_ordered_network("TestBlacklist")
self.assertEqual(ordered_network.type, NetworkType.psk) self.assertEqual(ordered_network.type, NetworkType.psk)
@ -253,111 +132,20 @@ class Test(unittest.TestCase):
ordered_network.network_object.connect() ordered_network.network_object.connect()
condition = 'obj.state == DeviceState.connected' condition = 'obj.connected'
wd.wait_for_object_condition(device, condition) wd.wait_for_object_condition(ordered_network.network_object, condition)
bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address) self.assertIn(device.address, bss_hostapd[0].list_sta())
self.wd.unregister_psk_agent(psk_agent) wd.unregister_psk_agent(psk_agent)
def test_blacklist_disabled(self):
wd = self.wd
bss_hostapd = self.bss_hostapd
rule0 = self.rule0
rule1 = self.rule1
rule2 = self.rule2
psk_agent = PSKAgent(["secret123", 'secret123'])
wd.register_psk_agent(psk_agent)
devices = wd.list_devices(1)
device = devices[0]
rule0.drop = True
rule0.enabled = True
device.autoconnect = True
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
ordered_network = device.get_ordered_network("TestBlacklist", full_scan=True)
self.assertEqual(ordered_network.type, NetworkType.psk)
# The first BSS should fail, and we should connect to the second. This
# should not result in a connection blacklist though since its disabled.
bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % device.address)
device.disconnect()
rule0.drop = False
device.autoconnect = True
# Verify the first BSS wasn't blacklisted.
bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
def setUp(self):
_, _, name = self.id().split(".")
# TODO: If we have this pattern elsewhere it might be nice to turn this
# into a decorator e.g.
#
# @config("main.conf.disabled")
# @profile("TestBlacklist.psk")
# def test_blacklist_disabled(self)
# ...
#
if name == "test_blacklist_disabled":
IWD.copy_to_storage("main.conf.disabled", IWD_CONFIG_DIR, "main.conf")
IWD.copy_to_storage("TestBlacklist.psk")
else:
IWD.copy_to_storage("main.conf.default", IWD_CONFIG_DIR, "main.conf")
self.wd = IWD(True)
def tearDown(self):
IWD.clear_storage()
self.wd = None
self.rule0.drop = False
self.rule1.drop = False
self.rule2.drop = False
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
cls.hwsim = Hwsim() IWD.copy_to_storage('main.conf')
cls.bss_hostapd = [ HostapdCLI(config='ssid1.conf'),
HostapdCLI(config='ssid2.conf'),
HostapdCLI(config='ssid3.conf') ]
cls.bss_radio = [ cls.hwsim.get_radio('rad0'),
cls.hwsim.get_radio('rad1'),
cls.hwsim.get_radio('rad2') ]
cls.rule0 = cls.hwsim.rules.create()
cls.rule0.source = cls.bss_radio[0].addresses[0]
cls.rule0.bidirectional = True
cls.rule0.signal = -2000
cls.rule0.enabled = True
cls.rule1 = cls.hwsim.rules.create()
cls.rule1.source = cls.bss_radio[1].addresses[0]
cls.rule1.bidirectional = True
cls.rule1.signal = -7000
cls.rule1.enabled = True
cls.rule2 = cls.hwsim.rules.create()
cls.rule2.source = cls.bss_radio[2].addresses[0]
cls.rule2.bidirectional = True
cls.rule2.signal = -8000
cls.rule2.enabled = True
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
IWD.clear_storage() IWD.clear_storage()
cls.hwsim.rules.remove_all()
if __name__ == '__main__': if __name__ == '__main__':
unittest.main(exit=True) unittest.main(exit=True)

View File

@ -1,7 +1,8 @@
[SETUP] [SETUP]
num_radios=5 num_radios=5
tmpfs_extra_stuff=main.conf
max_test_exec_interval_sec=45
start_iwd=0 start_iwd=0
hwsim_medium=yes
[HOSTAPD] [HOSTAPD]
rad0=ssid1.conf rad0=ssid1.conf

View File

@ -0,0 +1,5 @@
[Blacklist]
bss_blacklist_time=10
[Scan]
disable_mac_randomization=true

View File

@ -1,5 +0,0 @@
[Blacklist]
InitialTimeout=10
[Scan]
DisableMacAddressRandomization=true

View File

@ -1,2 +0,0 @@
[Blacklist]
InitialTimeout=0

View File

@ -9,4 +9,3 @@ wpa_passphrase=secret123
ctrl_interface=/var/run/hostapd ctrl_interface=/var/run/hostapd
rrm_neighbor_report=1 rrm_neighbor_report=1
beacon_int=10

View File

@ -9,4 +9,3 @@ wpa_passphrase=secret123
ctrl_interface=/var/run/hostapd ctrl_interface=/var/run/hostapd
rrm_neighbor_report=1 rrm_neighbor_report=1
beacon_int=10

View File

@ -9,5 +9,4 @@ wpa_passphrase=secret123
ctrl_interface=/var/run/hostapd ctrl_interface=/var/run/hostapd
rrm_neighbor_report=1 rrm_neighbor_report=1
max_num_sta=1 max_num_sta=1
beacon_int=10

View File

@ -0,0 +1,131 @@
#!/usr/bin/python3
import unittest
import sys
sys.path.append('../util')
import iwd
from iwd import IWD
from iwd import PSKAgent
from iwd import NetworkType
from hostapd import HostapdCLI
from hostapd import hostapd_map
from hwsim import Hwsim
import time
class Test(unittest.TestCase):
def test_connection_success(self):
hwsim = Hwsim()
bss_hostapd = [ HostapdCLI(config='ssid1.conf'),
HostapdCLI(config='ssid2.conf'),
HostapdCLI(config='ssid3.conf') ]
bss_radio = [ hwsim.get_radio('rad0'),
hwsim.get_radio('rad1'),
hwsim.get_radio('rad2') ]
rule0 = hwsim.rules.create()
rule0.source = bss_radio[0].addresses[0]
rule0.bidirectional = True
rule0.signal = -8000
rule1 = hwsim.rules.create()
rule1.source = bss_radio[1].addresses[0]
rule1.bidirectional = True
rule1.signal = -2500
rule2 = hwsim.rules.create()
rule2.source = bss_radio[2].addresses[0]
rule2.bidirectional = True
rule2.signal = -2000
wd = IWD(True, '/tmp')
psk_agent = PSKAgent("secret123")
wd.register_psk_agent(psk_agent)
dev1, dev2 = wd.list_devices(2)
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev1, condition)
dev1.scan()
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev1, condition)
ordered_network = dev1.get_ordered_network("TestBlacklist")
self.assertEqual(ordered_network.type, NetworkType.psk)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
ordered_network.network_object.connect()
self.assertIn(dev1.address, bss_hostapd[2].list_sta())
# dev1 now connected, this should max out the first AP, causing the next
# connection to fail to this AP.
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev2, condition)
dev2.scan()
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev2, condition)
ordered_network = dev2.get_ordered_network("TestBlacklist")
self.assertEqual(ordered_network.type, NetworkType.psk)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
ordered_network.network_object.connect()
# We should have temporarily blacklisted the first BSS, and connected
# to this one.
self.assertIn(dev2.address, bss_hostapd[1].list_sta())
# Now check that the first BSS is still not blacklisted. We can
# disconnect dev1, opening up the AP for more connections
dev1.disconnect()
dev2.disconnect()
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev2, condition)
dev2.scan()
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev2, condition)
ordered_network = dev2.get_ordered_network("TestBlacklist")
self.assertEqual(ordered_network.type, NetworkType.psk)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
ordered_network.network_object.connect()
self.assertIn(dev2.address, bss_hostapd[2].list_sta())
wd.unregister_psk_agent(psk_agent)
@classmethod
def setUpClass(cls):
IWD.copy_to_storage('main.conf')
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -1,98 +0,0 @@
#! /usr/bin/python3
import unittest
import sys, os
sys.path.append('../util')
import iwd
from iwd import IWD
from iwd import PSKAgent
from iwd import NetworkType
from hwsim import Hwsim
from hostapd import HostapdCLI
import testutil
class Test(unittest.TestCase):
def test_bss_unregister(self):
device = self.wd.list_devices(1)[0]
ordered_network = device.get_ordered_network('ssidTKIP', full_scan=True)
network = ordered_network.network_object
self.assertEqual(len(network.extended_service_set), 2)
ends = [parts.split('/')[-1] for parts in network.extended_service_set]
self.assertIn(self.bss_hostapd[0].bssid.replace(':', ''), ends)
self.assertIn(self.bss_hostapd[1].bssid.replace(':', ''), ends)
self.rule_bss1.enabled = True
# Even with flushing, the kernel still seems to return the scan
# results
self.wd.wait(40)
ordered_network = device.get_ordered_network('ssidTKIP', full_scan=True)
network = ordered_network.network_object
ends = [parts.split('/')[-1] for parts in network.extended_service_set]
self.assertIn(self.bss_hostapd[0].bssid.replace(':', ''), ends)
self.assertNotIn(self.bss_hostapd[1].bssid.replace(':', ''), ends)
self.rule_bss0.enabled = True
self.wd.wait(40)
ordered_networks = device.get_ordered_networks('ssidTKIP', full_scan=True)
self.assertIsNone(ordered_networks)
self.rule_bss0.enabled = False
ordered_networks = device.get_ordered_networks('ssidTKIP', full_scan=True)
ends = [parts.split('/')[-1] for parts in network.extended_service_set]
self.assertIn(self.bss_hostapd[0].bssid.replace(':', ''), ends)
self.assertNotIn(self.bss_hostapd[1].bssid.replace(':', ''), ends)
def tearDown(self):
self.rule_bss0.enabled = False
self.rule_bss1.enabled = False
self.wd.stop()
self.wd.wait(10)
self.wd = None
def setUp(self):
self.wd = IWD(True)
@classmethod
def setUpClass(cls):
hwsim = Hwsim()
IWD.copy_to_storage('ssidTKIP.psk')
cls.bss_hostapd = [ HostapdCLI(config='ssidTKIP-1.conf'),
HostapdCLI(config='ssidTKIP-2.conf') ]
rad0 = hwsim.get_radio('rad0')
rad1 = hwsim.get_radio('rad1')
cls.rule_bss0 = hwsim.rules.create()
cls.rule_bss0.source = rad0.addresses[0]
cls.rule_bss0.bidirectional = True
cls.rule_bss0.drop = True
cls.rule_bss1 = hwsim.rules.create()
cls.rule_bss1.source = rad1.addresses[0]
cls.rule_bss1.bidirectional = True
cls.rule_bss1.drop = True
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
cls.bss_hostapd = None
cls.rule_bss0.remove()
cls.rule_bss1.remove()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -1,8 +0,0 @@
[SETUP]
num_radios=3
hwsim_medium=yes
start_iwd=no
[HOSTAPD]
rad0=ssidTKIP-1.conf
rad1=ssidTKIP-2.conf

View File

@ -1,7 +0,0 @@
hw_mode=g
channel=1
ssid=ssidTKIP
wpa=1
wpa_pairwise=TKIP
wpa_passphrase=secret123

View File

@ -1,7 +0,0 @@
hw_mode=g
channel=2
ssid=ssidTKIP
wpa=1
wpa_pairwise=TKIP
wpa_passphrase=secret123

View File

@ -1,5 +0,0 @@
[Security]
Passphrase=secret123
[Settings]
AutoConnect=False

View File

@ -1,5 +0,0 @@
[SETUP]
num_radios=2
[HOSTAPD]
rad0=ssidCCMP.conf

View File

@ -1,8 +0,0 @@
hw_mode=g
channel=1
ssid=ssidCCMP
wpa=2
wpa_pairwise=CCMP
wpa_passphrase=secret123
ocv=1

View File

@ -1,102 +0,0 @@
#!/usr/bin/python3
import unittest
import sys
sys.path.append('../util')
import iwd
from iwd import IWD
import testutil
import subprocess
from config import ctx
class Test(unittest.TestCase):
def check_connection_success(self, ssid):
device = self.wd.list_devices(1)[0]
ordered_network = device.get_ordered_network(ssid)
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(device, condition)
device.disconnect()
condition = 'not obj.connected'
self.wd.wait_for_object_condition(ordered_network.network_object, condition)
def establish_network(self, ssid):
device = self.wd.list_devices(1)[0]
device.get_ordered_network(ssid)
def test_connection_with_passphrase(self):
ssid = 'ssidPassphrase'
self.establish_network(ssid)
device = self.wd.list_devices(1)[0]
# Use --dontaks cmd-line option
with self.assertRaises(subprocess.CalledProcessError):
ctx.start_process(['iwctl', 'd', 'station', device.name, 'connect', ssid], check=True)
ctx.start_process(['iwctl', '-P', 'passphrase', 'station', device.name, 'connect', ssid],
check=True)
self.check_connection_success(ssid)
def test_connection_with_username_and_password(self):
ssid = 'ssidUNameAndPWord'
self.establish_network(ssid)
device = self.wd.list_devices(1)[0]
ctx.start_process(['iwctl', '-u', 'user', '-p', 'password', 'station', \
device.name, 'connect', ssid], check=True)
self.check_connection_success(ssid)
def test_connection_with_password(self):
ssid = 'ssidPWord'
self.establish_network(ssid)
device = self.wd.list_devices(1)[0]
ctx.start_process(['iwctl', '-p', 'password', 'station', device.name, 'connect', ssid],
check=True)
self.check_connection_success(ssid)
def test_connection_failure(self):
ssid = 'ssidPassphrase'
self.establish_network(ssid)
device = self.wd.list_devices(1)[0]
with self.assertRaises(subprocess.CalledProcessError):
ctx.start_process(['iwctl', '-P', 'incorrect_passphrase', 'station', device.name, \
'connect', ssid], check=True)
def test_invalid_command_line_option(self):
ssid = 'ssidPassphrase'
self.establish_network(ssid)
device = self.wd.list_devices(1)[0]
with self.assertRaises(subprocess.CalledProcessError):
ctx.start_process(['iwctl', '-z', 'station', device.name, 'connect', ssid], check=True)
def test_invalid_command(self):
with self.assertRaises(subprocess.CalledProcessError):
ctx.start_process(['iwctl', 'inexistent', 'command'], check=True)
@classmethod
def setUpClass(cls):
IWD.copy_to_storage('ssidUNameAndPWord.8021x')
IWD.copy_to_storage('ssidPWord.8021x')
cls.wd = IWD()
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -1,4 +0,0 @@
# Phase 1 users
* TTLS
# Phase 2
"user" TTLS-MSCHAP "password" [2]

View File

@ -1,7 +0,0 @@
[SETUP]
num_radios=4
[HOSTAPD]
rad0=ssidPassphrase.conf
rad1=ssidUNameAndPWord.conf
rad2=ssidPWord.conf

View File

@ -1,9 +0,0 @@
[Security]
EAP-Method=TTLS
EAP-Identity=anonymous
EAP-TTLS-Phase2-Method=Tunneled-MSCHAP
EAP-TTLS-Phase2-Identity=user
[Settings]
AutoConnect=False

View File

@ -1,7 +0,0 @@
hw_mode=g
channel=1
ssid=ssidPassphrase
wpa=1
wpa_pairwise=TKIP
wpa_passphrase=passphrase

View File

@ -1,10 +0,0 @@
[Security]
EAP-Method=TTLS
EAP-Identity=anonymous
EAP-TTLS-Phase2-Method=Tunneled-MSCHAP
EAP-TTLS-Phase2-Identity=user
#EAP-TTLS-Phase2-Password=password
[Settings]
AutoConnect=False

View File

@ -6,15 +6,15 @@ import sys
sys.path.append('../util') sys.path.append('../util')
import iwd import iwd
import validation import validation
from validation import TestConnectAutoConnect from validation import TestConnectAutoconnect
from iwd import IWD from iwd import IWD
class Test8021xNetwork(unittest.TestCase): class Test8021xNetwork(unittest.TestCase):
''' '''
The below test cases excesise the following connection scenarios: The bellow test cases excesise the following connection scenarios:
Network config is Network config is
present at start time: Connect: AutoConnect: Result: present at start time: Connect: Autoconnect: Result:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
False True NotConfiguredEx is thrown False True NotConfiguredEx is thrown
True True Connection succeeds True True Connection succeeds
@ -23,7 +23,7 @@ class Test8021xNetwork(unittest.TestCase):
supported by IWD supported by IWD
''' '''
def test_8021x(self): def test_8021x(self):
tca = TestConnectAutoConnect() tca = TestConnectAutoconnect()
tca.validate('ssidEAP-TLS', True, iwd.NotConfiguredEx) tca.validate('ssidEAP-TLS', True, iwd.NotConfiguredEx)
IWD.copy_to_storage('ssidEAP-TLS.8021x') IWD.copy_to_storage('ssidEAP-TLS.8021x')

View File

@ -1,9 +1,11 @@
[SETUP] [SETUP]
num_radios=5 num_radios=5
start_iwd=0 start_iwd=0
max_test_exec_interval_sec=120
tmpfs_extra_stuff=../misc/certs
[HOSTAPD] [HOSTAPD]
rad0=ssidOpen.conf rad0=ssidOpen.conf
rad1=ssidWPA.conf rad1=ssidWPA.conf
rad2=ssidEAP-TLS.conf rad2=ssidEAP-TLS.conf
rad3=ssidEAP-Other.conf rad3=ssidEAP-Other.conf

View File

@ -6,28 +6,24 @@ import sys
sys.path.append('../util') sys.path.append('../util')
import iwd import iwd
import validation import validation
from validation import TestConnectAutoConnect from validation import TestConnectAutoconnect
from iwd import IWD from iwd import IWD
class TestOpenNetwork(unittest.TestCase): class TestOpenNetwork(unittest.TestCase):
''' '''
The below test cases excesise the following connection scenarios: The bellow test cases excesise the following connection scenarios:
Network config is Network config is
present at start time: Connect: AutoConnect: Result: present at start time: Connect: Autoconnect: Result:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
False True Connection succeeds False True Connection succeeds
True True Connection succeeds True True Connection succeeds
''' '''
def test_open(self): def test_open(self):
tca = TestConnectAutoConnect() tca = TestConnectAutoconnect()
tca.validate('ssidOpen', False) tca.validate('ssidOpen', False)
tca.validate('ssidOpen', True) tca.validate('ssidOpen', True)
def setUp(self):
IWD.copy_to_storage('ssidOpen.open')
def tearDown(self):
IWD.clear_storage() IWD.clear_storage()
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -6,7 +6,7 @@ wpa=3
wpa_key_mgmt=WPA-EAP wpa_key_mgmt=WPA-EAP
ieee8021x=1 ieee8021x=1
eap_server=1 eap_server=1
eap_user_file=/tmp/secrets/eap-user.text eap_user_file=/tmp/certs/eap-user-ttls.text
ca_cert=/tmp/certs/cert-ca.pem ca_cert=/tmp/certs/cert-ca.pem
server_cert=/tmp/certs/cert-server.pem server_cert=/tmp/certs/cert-server.pem
private_key=/tmp/certs/cert-server-key.pem private_key=/tmp/certs/cert-server-key.pem

View File

@ -3,4 +3,4 @@ EAP-Method=TLS
EAP-TLS-CACert=/tmp/certs/cert-ca.pem EAP-TLS-CACert=/tmp/certs/cert-ca.pem
EAP-TLS-ClientCert=/tmp/certs/cert-client.pem EAP-TLS-ClientCert=/tmp/certs/cert-client.pem
EAP-TLS-ClientKey=/tmp/certs/cert-client-key-pkcs8.pem EAP-TLS-ClientKey=/tmp/certs/cert-client-key-pkcs8.pem
EAP-Identity=tls@example.com EAP-Identity=abc@example.com

View File

@ -6,7 +6,7 @@ wpa=3
wpa_key_mgmt=WPA-EAP wpa_key_mgmt=WPA-EAP
ieee8021x=1 ieee8021x=1
eap_server=1 eap_server=1
eap_user_file=/tmp/secrets/eap-user.text eap_user_file=/tmp/certs/eap-user-tls.text
ca_cert=/tmp/certs/cert-ca.pem ca_cert=/tmp/certs/cert-ca.pem
server_cert=/tmp/certs/cert-server.pem server_cert=/tmp/certs/cert-server.pem
private_key=/tmp/certs/cert-server-key.pem private_key=/tmp/certs/cert-server-key.pem

View File

@ -9,10 +9,10 @@ from iwd import IWD
from iwd import PSKAgent from iwd import PSKAgent
from iwd import NetworkType from iwd import NetworkType
class TestConnectAutoConnect(unittest.TestCase): class TestConnectAutoconnect(unittest.TestCase):
def check_connect(self, wd, device, ssid, throws): def check_connect(self, wd, device, ssid, throws):
ordered_network = device.get_ordered_network(ssid, scan_if_needed=True) ordered_network = device.get_ordered_network(ssid)
condition = 'not obj.connected' condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition) wd.wait_for_object_condition(ordered_network.network_object, condition)
@ -24,12 +24,10 @@ class TestConnectAutoConnect(unittest.TestCase):
else: else:
ordered_network.network_object.connect() ordered_network.network_object.connect()
condition = 'obj.state == DeviceState.connected' condition = 'obj.connected'
wd.wait_for_object_condition(device, condition) wd.wait_for_object_condition(ordered_network.network_object, condition)
def check_autoconnect(self, wd, device, ssid, throws): def check_autoconnect(self, wd, device, ssid, throws):
device.autoconnect = True
if throws is None: if throws is None:
condition = 'obj.state == DeviceState.connected' condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition) wd.wait_for_object_condition(device, condition)
@ -56,6 +54,12 @@ class TestConnectAutoConnect(unittest.TestCase):
self.assertIsNotNone(devices) self.assertIsNotNone(devices)
device = devices[0] device = devices[0]
condition = 'obj.scanning'
wd.wait_for_object_condition(device, condition)
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
if autoconnect: if autoconnect:
self.check_autoconnect(wd, device, ssid, throws) self.check_autoconnect(wd, device, ssid, throws)
else: else:

View File

@ -6,22 +6,22 @@ import sys
sys.path.append('../util') sys.path.append('../util')
import iwd import iwd
import validation import validation
from validation import TestConnectAutoConnect from validation import TestConnectAutoconnect
from iwd import IWD from iwd import IWD
class TestWpaNetwork(unittest.TestCase): class TestWpaNetwork(unittest.TestCase):
''' '''
The below test cases exercise the following connection scenarios: The bellow test cases exercise the following connection scenarios:
Network config is Network config is
present at start time: Connect: AutoConnect: Result: present at start time: Connect: Autoconnect: Result:
-------------------------------------------------------------------------- --------------------------------------------------------------------------
False True Connection succeeds False True Connection succeeds
True True Connection succeeds True True Connection succeeds
''' '''
def test_wpa(self): def test_wpa(self):
tca = TestConnectAutoConnect() tca = TestConnectAutoconnect()
tca.validate('ssidWPA', False, None, True) tca.validate('ssidWPA', False, None, True)
tca.validate('ssidWPA', True, None, True) tca.validate('ssidWPA', True, None, True)

View File

@ -1,175 +0,0 @@
#!/usr/bin/python3
import unittest
import sys
sys.path.append('../util')
from iwd import IWD
from iwd import DeviceProvisioning
from wpas import Wpas
from hostapd import HostapdCLI
from hwsim import Hwsim
from config import ctx
class Test(unittest.TestCase):
def test_iwd_as_enrollee(self):
self.device.autoconnect = True
self.hapd.reload()
uri = self.device.dpp_start_enrollee()
self.wpas.dpp_configurator_create(uri)
self.wpas.dpp_configurator_start('ssidCCMP', 'secret123')
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(self.device, condition)
def test_iwd_as_enrollee_channel_switch(self):
self.device.autoconnect = True
self.hapd.reload()
uri = self.device.dpp_start_enrollee()
self.wpas.dpp_configurator_create(uri)
self.wpas.dpp_configurator_start('ssidCCMP', 'secret123', freq=2462)
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(self.device, condition)
def test_iwd_as_enrollee_scan_after(self):
self.wpas.disconnect()
self.device.autoconnect = True
uri = self.device.dpp_start_enrollee()
self.wpas.dpp_configurator_create(uri)
self.wpas.dpp_configurator_start('ssidCCMP', 'secret123')
with self.assertRaises(Exception):
self.device.get_ordered_network('ssidCCMP', scan_if_needed=False)
self.hapd.reload()
self.hapd.wait_for_event('AP-ENABLED')
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(self.device, condition)
def test_iwd_as_enrollee_no_ack(self):
self.rule0.enabled = True
self.device.autoconnect = True
self.hapd.reload()
uri = self.device.dpp_start_enrollee()
self.wpas.dpp_configurator_create(uri)
self.wpas.dpp_configurator_start('ssidCCMP', 'secret123')
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(self.device, condition)
def test_iwd_as_configurator(self):
self.hapd.reload()
self.hapd.wait_for_event('AP-ENABLED')
IWD.copy_to_storage('ssidCCMP.psk')
self.device.autoconnect = True
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(self.device, condition)
uri = self.device.dpp_start_configurator()
self.wpas.dpp_enrollee_start(uri)
self.wpas.wait_for_event('DPP-CONF-RECEIVED', timeout=30)
def test_iwd_as_configurator_initiator(self):
self.hapd.reload()
self.hapd.wait_for_event('AP-ENABLED')
IWD.copy_to_storage('ssidCCMP.psk')
self.device.autoconnect = True
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(self.device, condition)
uri = self.wpas.dpp_enrollee_start(oper_and_channel='81/2')
self.device.dpp_start_configurator(uri)
self.wpas.wait_for_event('DPP-CONF-RECEIVED', timeout=30)
def test_client_as_configurator(self):
self.hapd.reload()
self.hapd.wait_for_event('AP-ENABLED')
IWD.copy_to_storage('ssidCCMP.psk')
self.device.autoconnect = True
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(self.device, condition)
ctx.start_process(['iwctl', 'dpp', self.device.name, 'start-configurator'], check=True)
dpp = DeviceProvisioning(self.device.device_path)
self.wpas.dpp_enrollee_start(dpp.uri)
self.wpas.wait_for_event('DPP-CONF-RECEIVED', timeout=30)
def test_client_as_enrollee(self):
self.device.autoconnect = True
self.hapd.reload()
ctx.start_process(['iwctl', 'dpp', self.device.name, 'start-enrollee'], check=True)
dpp = DeviceProvisioning(self.device.device_path)
self.wpas.dpp_configurator_create(dpp.uri)
self.wpas.dpp_configurator_start('ssidCCMP', 'secret123')
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(self.device, condition)
def setUp(self):
self.wpas = Wpas('wpas.conf')
self.wd = IWD(True)
self.device = self.wd.list_devices(1)[0]
self.hapd = HostapdCLI('hostapd.conf')
self.hapd.disable()
self.hwsim = Hwsim()
self.rule0 = self.hwsim.rules.create()
self.rule0.prefix = 'd0'
self.rule0.match_offset = 24
self.rule0.match = '04 09 50 6f 9a 1a 01 01'
self.rule0.match_times = 1
self.rule0.drop = True
def tearDown(self):
# Tests end in various states, don't fail when tearing down.
try:
self.device.disconnect()
self.device.dpp_stop()
except:
pass
self.wpas.dpp_configurator_remove()
self.wpas.clean_up()
self.wd = None
self.device = None
self.wpas = None
self.hapd = None
self.rule0 = None
IWD.clear_storage()
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
pass
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -1,2 +0,0 @@
[Security]
Passphrase=IncorrectPassphrase

View File

@ -1,7 +0,0 @@
hw_mode=g
channel=6
ssid=ssidCCMP
wpa=2
wpa_pairwise=CCMP
wpa_passphrase=secret123

View File

@ -1,14 +0,0 @@
[SETUP]
num_radios=5
start_iwd=0
hwsim_medium=yes
[WPA_SUPPLICANT]
rad0=wpas.conf
[HOSTAPD]
rad1=hostapd.conf
rad2=ssidHidden.conf
[NameSpaces]
ns0=rad3

Some files were not shown because too many files have changed in this diff Show More