3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2025-08-03 01:47:27 +02:00

Compare commits

..

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

714 changed files with 21295 additions and 70795 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

20
.gitignore vendored
View File

@ -1,16 +1,9 @@
*.o
*.lo
*.la
*.gcno
*.gcda
.libs
.deps
.dirstamp
.cache
.ccls-cache
compile_commands.json
tags
cscope.*
Makefile
Makefile.in
aclocal.m4
@ -27,7 +20,6 @@ autom4te.cache
ell
src/iwd
src/iwd.8
src/iwd.ap.5
src/iwd.debug.7
src/iwd.config.5
src/iwd.network.5
@ -41,9 +33,8 @@ wired/ead.8
wired/ead.service
tools/hwsim
tools/hwsim.1
tools/test-runner
tools/probe-req
tools/iwd-decrypt-profile
tools/iwd-psk
unit/test-cmac-aes
unit/test-arc4
unit/test-hmac-md5
@ -63,12 +54,6 @@ unit/test-eap-mschapv2
unit/test-eap-sim
unit/test-client
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-*.csr
unit/cert-*.srl
@ -77,6 +62,3 @@ unit/*.log
unit/*.trs
test-suite.log
src/builtin.h
autotests/*/__pycache__
iwd-coverage.info
gcov

22
AUTHORS
View File

@ -19,25 +19,3 @@ 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>

329
ChangeLog
View File

@ -1,332 +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.

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
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
some rules, otherwise it will likely be rejected by maintainers.

View File

@ -10,12 +10,12 @@ if EXTERNAL_ELL
ell_cflags = @ELL_CFLAGS@
ell_ldadd = @ELL_LIBS@
ell_dependencies =
ell_built_sources = ell/shared
ell_built_sources =
else
ell_cflags =
ell_ldadd = ell/libell-internal.la
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
@ -34,6 +34,7 @@ ell_headers = ell/util.h \
ell/io.h \
ell/ringbuf.h \
ell/log.h \
ell/plugin.h \
ell/checksum.h \
ell/netlink.h \
ell/genl.h \
@ -50,6 +51,7 @@ ell_headers = ell/util.h \
ell/tls.h \
ell/uuid.h \
ell/key.h \
ell/pkcs5.h \
ell/file.h \
ell/dir.h \
ell/net.h \
@ -58,29 +60,18 @@ ell_headers = ell/util.h \
ell/ecc.h \
ell/ecdh.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/path.h
ell_sources = ell/private.h \
ell/missing.h \
ell/util.c \
ell/test-private.h \
ell/test.c \
ell/test-dbus.c \
ell/strv.c \
ell/utf8.c \
ell/queue.c \
ell/hashmap.c \
ell/string.c \
ell/settings.c \
ell/main-private.h \
ell/main.c \
ell/idle.c \
ell/signal.c \
@ -88,11 +79,11 @@ ell_sources = ell/private.h \
ell/io.c \
ell/ringbuf.c \
ell/log.c \
ell/plugin.c \
ell/checksum.c \
ell/netlink-private.h \
ell/netlink.c \
ell/genl.c \
ell/rtnl-private.h \
ell/rtnl.c \
ell/dbus-private.h \
ell/dbus.c \
@ -121,49 +112,25 @@ ell_sources = ell/private.h \
ell/tls-extensions.c \
ell/uuid.c \
ell/key.c \
ell/pkcs5-private.h \
ell/pkcs5.c \
ell/file.c \
ell/dir.c \
ell/net-private.h \
ell/net.c \
ell/dhcp-private.h \
ell/dhcp.c \
ell/dhcp-transport.c \
ell/dhcp-lease.c \
ell/dhcp-util.c \
ell/dhcp-server.c \
ell/cert-private.h \
ell/cert.c \
ell/cert-crypto.c \
ell/ecc-external.c \
ell/ecc-private.h \
ell/ecc.c \
ell/ecdh.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/path.c
ell_shared = ell/useful.h ell/asn1-private.h
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)
ell_libell_internal_la_SOURCES = $(ell_headers) $(ell_sources)
endif
bin_PROGRAMS =
@ -194,10 +161,10 @@ 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
client/iwctl.1 monitor/iwmon.1 wired/ead.8 tools/hwsim.1
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-tls.c \
src/eap-ttls.c \
@ -209,6 +176,7 @@ eap_sources = src/eap.c src/eap.h src/eap-private.h \
src/eap-pwd.c \
src/util.h src/util.c \
src/crypto.h src/crypto.c \
src/wscutil.h src/wscutil.c \
src/simutil.h src/simutil.c \
src/simauth.h src/simauth.c \
src/watchlist.h src/watchlist.c \
@ -218,8 +186,8 @@ eap_sources = src/eap.c src/eap.h src/eap-private.h \
if DAEMON
libexec_PROGRAMS += src/iwd
src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h \
src/missing.h src/defs.h \
src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h src/missing.h \
src/plugin.h src/plugin.c \
src/netdev.h src/netdev.c \
src/wiphy.h src/wiphy.c \
src/device.c \
@ -241,7 +209,7 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h \
src/knownnetworks.c \
src/rfkill.h src/rfkill.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/nl80211util.h src/nl80211util.c \
src/nl80211cmd.h src/nl80211cmd.c \
@ -254,35 +222,26 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h \
src/anqp.h src/anqp.c \
src/anqputil.h src/anqputil.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.c \
src/p2p.h src/p2p.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) \
$(builtin_sources)
src_iwd_LDADD = $(ell_ldadd) -ldl
src_iwd_DEPENDENCIES = $(ell_dependencies)
if SIM_HARDCODED
builtin_modules += sim_hardcoded
builtin_sources += plugins/sim_hardcoded.c
endif
if OFONO
builtin_modules += ofono
builtin_sources += src/ofono.c
builtin_sources += plugins/ofono.c
endif
if DBUS_POLICY
@ -299,8 +258,7 @@ 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
man_MANS += src/iwd.8 src/iwd.debug.7 src/iwd.config.5 src/iwd.network.5
endif
endif
@ -320,16 +278,8 @@ client_iwctl_SOURCES = client/main.c \
client/known-networks.c \
client/network.h client/network.c \
client/properties.h client/properties.c \
client/wsc.c client/station.c \
client/diagnostic.c client/diagnostic.h \
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)
client/wsc.c client/station.c
client_iwctl_LDADD = $(ell_ldadd) -lreadline
if MANUAL_PAGES
man_MANS += client/iwctl.1
@ -350,10 +300,10 @@ monitor_iwmon_SOURCES = monitor/main.c linux/nl80211.h \
src/crypto.h src/crypto.c \
src/watchlist.h src/watchlist.c \
src/eapolutil.h src/eapolutil.c \
src/handshake.h src/handshake.c \
src/nl80211cmd.h src/nl80211cmd.c \
src/p2putil.c src/p2putil.h \
src/anqputil.h src/anqputil.c \
src/band.h src/band.c
src/anqputil.h src/anqputil.c
monitor_iwmon_LDADD = $(ell_ldadd)
if MANUAL_PAGES
@ -368,7 +318,6 @@ wired_ead_SOURCES = wired/main.c wired/ethdev.h wired/ethdev.c \
wired/network.h wired/network.c \
wired/dbus.h wired/dbus.c \
src/module.h src/module.c \
src/band.h src/band.c \
$(eap_sources)
wired_ead_LDADD = $(ell_ldadd)
wired_ead_DEPENDENCIES = $(ell_dependencies)
@ -389,36 +338,22 @@ man_MANS += wired/ead.8
endif
endif
if DAEMON
noinst_PROGRAMS += tools/probe-req tools/iwd-decrypt-profile
noinst_PROGRAMS += tools/probe-req
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
src/common.h src/common.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
if HWSIM
bin_PROGRAMS += tools/hwsim
tools_hwsim_SOURCES = tools/hwsim.c src/mpdu.h \
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/common.h src/common.c \
src/band.h src/band.c \
src/ie.h src/ie.c \
src/crypto.h src/crypto.c
src/common.h src/common.c
tools_hwsim_LDADD = $(ell_ldadd)
if DBUS_POLICY
@ -430,19 +365,20 @@ man_MANS += tools/hwsim.1
endif
endif
unit_tests =
if TOOLS
noinst_PROGRAMS += tools/test-runner
if DAEMON
unit_tests += unit/test-cmac-aes \
tools_test_runner_SOURCES = tools/test-runner.c
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-prf-sha1 unit/test-kdf-sha256 \
unit/test-crypto unit/test-eapol unit/test-mpdu \
unit/test-ie unit/test-util unit/test-ssid-security \
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-dpp unit/test-json unit/test-nl80211util \
unit/test-pmksa unit/test-storage
endif
unit/test-eap-sim unit/test-sae unit/test-p2p
if CLIENT
unit_tests += unit/test-client
@ -452,7 +388,6 @@ if MAINTAINER_MODE
noinst_PROGRAMS += $(unit_tests)
endif
if DAEMON
unit_test_eap_sim_SOURCES = unit/test-eap-sim.c \
src/crypto.h src/crypto.c src/simutil.h src/simutil.c \
src/ie.h src/ie.c \
@ -460,13 +395,12 @@ unit_test_eap_sim_SOURCES = unit/test-eap-sim.c \
src/eapol.h src/eapol.c \
src/eapolutil.h src/eapolutil.c \
src/handshake.h src/handshake.c \
src/pmksa.h src/pmksa.c \
src/eap.h src/eap.c src/eap-private.h \
src/util.h src/util.c \
src/simauth.h src/simauth.c \
src/erp.h src/erp.c \
src/band.h src/band.c \
src/eap-sim.c
unit_test_eap_sim_LDADD = $(ell_ldadd)
unit_test_cmac_aes_SOURCES = unit/test-cmac-aes.c \
@ -475,6 +409,7 @@ unit_test_cmac_aes_LDADD = $(ell_ldadd)
unit_test_arc4_SOURCES = unit/test-arc4.c \
src/crypto.h src/crypto.c
unit_test_arc4_LDADD = $(ell_ldadd)
unit_test_hmac_md5_SOURCES = unit/test-hmac-md5.c \
@ -500,10 +435,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_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 \
src/crypto.h src/crypto.c
unit_test_crypto_LDADD = $(ell_ldadd)
@ -520,13 +451,11 @@ unit_test_eapol_SOURCES = unit/test-eapol.c \
src/eapol.h src/eapol.c \
src/eapolutil.h src/eapolutil.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-tls.c src/eap-ttls.c \
src/eap-md5.c src/util.c \
src/eap-tls-common.h src/eap-tls-common.c \
src/erp.h src/erp.c \
src/band.h src/band.c \
src/mschaputil.h src/mschaputil.c
unit_test_eapol_LDADD = $(ell_ldadd)
unit_test_eapol_DEPENDENCIES = $(ell_dependencies) \
@ -536,7 +465,7 @@ unit_test_eapol_DEPENDENCIES = $(ell_dependencies) \
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_LDADD = $(ell_ldadd)
@ -551,11 +480,9 @@ unit_test_wsc_SOURCES = unit/test-wsc.c src/wscutil.h src/wscutil.c \
src/eapol.h src/eapol.c \
src/eapolutil.h src/eapolutil.c \
src/handshake.h src/handshake.c \
src/pmksa.h src/pmksa.c \
src/eap.h src/eap.c src/eap-private.h \
src/util.h src/util.c \
src/erp.h src/erp.c \
src/band.h src/band.c \
src/eap-wsc.h src/eap-wsc.c
unit_test_wsc_LDADD = $(ell_ldadd)
@ -565,53 +492,6 @@ unit_test_eap_mschapv2_SOURCES = src/eap-mschapv2.h src/eap-mschapv2.c \
unit/test-eap-mschapv2.c
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
unit_test_client_SOURCES = unit/test-client.c \
client/adapter.c \
@ -622,23 +502,35 @@ unit_test_client_SOURCES = unit/test-client.c \
client/display.h client/display.c \
client/network.h client/network.c \
client/properties.h client/properties.c
unit_test_client_LDADD = $(ell_ldadd) $(client_ldadd)
unit_test_client_LDADD = $(ell_ldadd) -lreadline
endif
LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
$(top_srcdir)/build-aux/tap-driver.sh
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/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)
EXTRA_DIST = src/genbuiltin src/iwd.service.in src/net.connman.iwd.service \
wired/ead.service.in wired/net.connman.ead.service \
src/80-iwd.link src/pkcs8.conf unit/gencerts.cnf \
doc/main.conf \
$(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/"\" \
-DCERTDIR=\""$(top_builddir)/unit/"\"
@ -649,6 +541,7 @@ endif
CLEANFILES = src/iwd.service wired/ead.service
DISTCHECK_CONFIGURE_FLAGS = --disable-dbus-policy --disable-systemd-service \
--enable-sim-hardcoded \
--enable-ofono \
--enable-wired \
--enable-hwsim \
@ -727,14 +620,6 @@ unit/tls-settings.8021x: unit/cert-ca.pem unit/cert-client.pem unit/cert-client-
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
$(AM_V_at)$(MKDIR_P) ell
$(AM_V_GEN)for f in $(ell_headers) $(ell_sources) ; do \
@ -744,7 +629,6 @@ ell/internal: Makefile
done > $@
ell/ell.h: Makefile
$(AM_V_at)$(MKDIR_P) ell
$(AM_V_at)echo -n > $@
$(AM_V_GEN)for f in $(ell_headers) ; do \
echo "#include <$$f>" >> $@ ; \
@ -788,25 +672,12 @@ if WIRED
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
clean-local:
-rm -f unit/cert-*.pem unit/cert-*.csr unit/cert-*.srl unit/*-settings.8021x
maintainer-clean-local:
-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
$(AM_V_at)$(MKDIR_P) $(@D)
$(AM_V_GEN)$(srcdir)/src/genbuiltin $(builtin_modules) > $@

11
README
View File

@ -193,6 +193,12 @@ that can be enabled if the functionality is required:
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
Netlink monitoring
==================
@ -268,11 +274,10 @@ Information
===========
Mailing list:
https://lists.linux.dev/
https://lore.kernel.org/iwd/
https://lists.01.org/postorius/lists/iwd.lists.01.org/
IRC:
irc://irc.oftc.net/#iwd
irc://irc.freenode.net/#iwd
Wiki:
https://iwd.wiki.kernel.org/

57
TODO
View File

@ -110,7 +110,7 @@ Wireless monitor
- 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
events, it is required that iwmon adds membership to all multicast
groups that the nl80211 lists.
@ -199,6 +199,11 @@ Wireless daemon
Priority: Low
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
this are needed for Passpoint support.
@ -232,9 +237,21 @@ Wireless daemon
Priority: Low
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
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
the PBC request in the ProbeRequest frames after EAP-WSC completes
successfully. If another AP in PBC mode is found, then a SessionOverlap
@ -243,6 +260,14 @@ Wireless daemon
Priority: Low
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
Device Provisioning Protocol is a new specification from WiFi Alliance.
@ -286,7 +311,7 @@ Wireless daemon
- Support OCE mutually non-overlapping channels optimization.
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.
Priority: Low
@ -332,18 +357,24 @@ Wireless daemon
Priority: Medium
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
have been joined previously and does not release the lease when the network
is left temporarily.
The list of possible information exposed via this interface includes:
- MAC address of the currently connected AP (in a Station)
- 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
to rejoin a network and the lease has not expired yet.
Priority: Low
Priority: Medium
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], [
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
if (test "$USE_MAINTAINER_MODE" = "yes"); then
CFLAGS+=" -Werror -Wextra"
@ -78,14 +58,10 @@ AC_DEFUN([COMPILER_FLAGS], [
CFLAGS+=" -Wdeclaration-after-statement"
CFLAGS+=" -Wmissing-declarations"
CFLAGS+=" -Wredundant-decls"
CFALGS+=" -Wvariadic-macros"
CFLAGS+=" -Wformat -Wformat-security"
if ( $CC -v 2>/dev/null | grep "gcc version" ); then
CFLAGS+=" -Wcast-align"
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" MSCHAPV2 "testpasswd" [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,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]
num_radios=2
start_iwd=0
num_radios=1
radio_confs=rad0
[rad0]
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 sys
import os
sys.path.append('../util')
import iwd
from iwd import IWD
from config import ctx
class Test(unittest.TestCase):
def test_connection_success(self):
wd = IWD(True)
wd = IWD()
devices = wd.list_devices(1)
device = devices[0]
dev = wd.list_devices(1)[0]
device.autoconnect = True
device.scan(wait=False)
os.system('ip link set dev %s down' % device.name)
with self.assertRaises(iwd.NotSupportedEx):
dev.start_ap('TestAP2', 'Password2')
@classmethod
def setUpClass(cls):

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 PSKAgent
from iwd import NetworkType
from hostapd import HostapdCLI
import hostapd
import testutil
class Test(unittest.TestCase):
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)
psk_agent = PSKAgent('Password1')
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()
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(dev, condition)
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(hostapd.ifname, 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_failure(self):
wd = IWD(True)
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:
networks = {}
networks['TestAP1'] = dev2.get_ordered_network('TestAP1', full_scan=True)
networks['TestAP2'] = dev2.get_ordered_network('TestAP2', full_scan=True)
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)

View File

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

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')
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
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)
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'
self.wd.wait_for_object_condition(self.device, condition)
condition = 'obj.connected'
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):
from_bss.send_bss_transition(self.device.address,
self.neighbor_list,
disassoc_imminent=expect_roam)
condition = 'obj.state == DeviceState.roaming'
wd.wait_for_object_condition(device, condition, 15)
if expect_roam:
from_condition = 'obj.state == DeviceState.roaming'
to_condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_change(self.device, from_condition, to_condition)
condition = 'obj.state != DeviceState.roaming'
wd.wait_for_object_condition(device, condition, 5)
to_bss.wait_for_event('AP-STA-CONNECTED %s' % self.device.address)
else:
self.device.wait_for_event("no-roam-candidates")
self.assertEqual(device.state, iwd.DeviceState.connected)
self.assertTrue(bss_hostapd[1].list_sta())
device.disconnect()
def test_disassoc_imminent(self):
self.initial_connection()
self.validate_roam(self.bss_hostapd[0], self.bss_hostapd[1])
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
def test_no_candidates(self):
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
wd.unregister_psk_agent(psk_agent)
@classmethod
def setUpClass(cls):
IWD.copy_to_storage('TestAPRoam.psk')
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"),
]
pass
@classmethod
def tearDownClass(cls):

View File

@ -1,7 +1,6 @@
[SETUP]
num_radios=4
hwsim_medium=true
start_iwd=false
needs_hwsim=1
[HOSTAPD]
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 sys
import time
from time import sleep
sys.path.append('../util')
import iwd
from iwd import IWD
from iwd import AdHocDevice
from config import ctx
import testutil
class Test(unittest.TestCase):
def validate_connection(self, wd, client=False):
def validate_connection(self, wd):
dev1, dev2 = wd.list_devices(2)
self.assertIsNotNone(dev1)
self.assertIsNotNone(dev2)
adhoc1 = dev1.start_adhoc("AdHocNetwork", "secret123")
dev1.start_adhoc("AdHocNetwork", "secret123")
dev2.start_adhoc("AdHocNetwork", "secret123")
condition = 'obj.started == True'
wd.wait_for_object_condition(adhoc1, condition)
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)
dev1.adhoc_wait_for_connected(dev2.address)
dev2.adhoc_wait_for_connected(dev1.address)
testutil.test_iface_operstate(dev1.name)
testutil.test_iface_operstate(dev2.name)
@ -49,10 +33,6 @@ class Test(unittest.TestCase):
self.validate_connection(wd)
def test_client_adhoc(self):
wd = IWD(True)
self.validate_connection(wd, client=True)
@classmethod
def setUpClass(cls):
pass

View File

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

View File

@ -18,25 +18,16 @@ class Test(unittest.TestCase):
self.assertIsNotNone(dev1)
self.assertIsNotNone(dev2)
adhoc1 = dev1.start_adhoc("AdHocNetwork")
dev1.start_adhoc("AdHocNetwork")
sleep(1)
dev2.start_adhoc("AdHocNetwork")
condition = 'obj.started == True'
wd.wait_for_object_condition(adhoc1, condition)
dev1.adhoc_wait_for_connected(dev2.address)
dev2.adhoc_wait_for_connected(dev1.address)
adhoc2 = dev2.start_adhoc("AdHocNetwork")
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(dev2.name)
testutil.test_ifaces_connected(dev1.name, dev2.name)
#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):
wd = IWD(True)

View File

@ -24,8 +24,8 @@ class Test(unittest.TestCase):
ordered_network.network_object.connect()
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
condition = 'obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
testutil.test_iface_operstate()
testutil.test_ifaces_connected()
@ -45,8 +45,16 @@ class Test(unittest.TestCase):
perm_addr = device.address
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
device.scan()
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
# 1. Test per-network deterministic MAC generation
IWD.copy_to_storage('pernetwork.psk', name='ssidCCMP.psk')
os.system('cat pernetwork.psk > /var/lib/iwd/ssidCCMP.psk')
new_addr = self.try_connection(wd)
self.assertNotEqual(perm_addr, new_addr)
# try again to ensure the generation was deterministic
@ -54,7 +62,7 @@ class Test(unittest.TestCase):
self.assertEqual(new_addr, new_addr2)
# 2. Test FullAddressRandomization
IWD.copy_to_storage('full_random.psk', name='ssidCCMP.psk')
os.system('cat full_random.psk > /var/lib/iwd/ssidCCMP.psk')
new_addr = self.try_connection(wd)
self.assertNotEqual(perm_addr, new_addr)
# try again to make sure the generation was random
@ -62,7 +70,7 @@ class Test(unittest.TestCase):
self.assertNotEqual(new_addr, new_addr2)
# 3. Test AddressOverride
IWD.copy_to_storage('override.psk', name='ssidCCMP.psk')
os.system('cat override.psk > /var/lib/iwd/ssidCCMP.psk')
new_addr = self.try_connection(wd)
self.assertEqual(new_addr, 'e6:f6:38:a9:02:02')

View File

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

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,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 PSKAgent
from iwd import NetworkType
from iwd import IWD_CONFIG_DIR
from hostapd import HostapdCLI
from hostapd import hostapd_map
from hwsim import Hwsim
import time
class Test(unittest.TestCase):
def test_temp_blacklist(self):
rule0 = self.rule0
rule1 = self.rule1
rule2 = self.rule2
bss_hostapd = self.bss_hostapd
wd = self.wd
def test_connection_success(self):
hwsim = Hwsim()
rule0.signal = -8000
rule1.signal = -7000
rule2.signal = -2000
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("secret123")
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)
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'
wd.wait_for_object_condition(device, condition)
# This connect should work
ordered_network.network_object.connect()
device.scan()
condition = 'obj.state == DeviceState.connected'
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
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)
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.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)
# Have AP1 drop all packets, should result in a connection timeout
@ -214,12 +83,14 @@ class Test(unittest.TestCase):
# should automatically try the next BSS in the list, which is
# bss_hostapd[1]
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
device.disconnect()
device.autoconnect = True
# Next try autoconnecting to a network with a blacklisted BSS. Since an
# explicit disconnect call would disable autoconnect we reset
# hostapd which will disconnect IWD.
bss_hostapd[1].reload()
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
@ -227,24 +98,32 @@ class Test(unittest.TestCase):
# Now we wait... AutoConnect should take over
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'
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.
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)
elapsed = time.time() - start
if elapsed < 15:
wd.wait(15 - elapsed)
if elapsed < 11:
time.sleep(11 - elapsed)
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)
@ -253,111 +132,20 @@ class Test(unittest.TestCase):
ordered_network.network_object.connect()
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
condition = 'obj.connected'
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)
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
wd.unregister_psk_agent(psk_agent)
@classmethod
def setUpClass(cls):
cls.hwsim = Hwsim()
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
IWD.copy_to_storage('main.conf')
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
cls.hwsim.rules.remove_all()
if __name__ == '__main__':
unittest.main(exit=True)

View File

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

View File

@ -2,4 +2,4 @@
InitialTimeout=10
[Scan]
DisableMacAddressRandomization=true
disable_mac_randomization=true

View File

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

View File

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

View File

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

View File

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

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 @@
[SETUP]
num_radios=2
[HOSTAPD]
rad0=ssidCCMP.conf

View File

@ -8,91 +8,114 @@ 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]
wd = IWD()
device = wd.list_devices(1)[0]
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
ordered_network = device.get_ordered_network(ssid)
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(device, condition)
condition = 'obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, 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)
wd.wait_for_object_condition(ordered_network.network_object, condition)
def test_connection_with_passphrase(self):
ssid = 'ssidPassphrase'
self.establish_network(ssid)
device = self.wd.list_devices(1)[0]
wd = IWD()
device = 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)
subprocess.check_call(['iwctl', '-d', 'station',
device.name, 'connect', ssid])
ctx.start_process(['iwctl', '-P', 'passphrase', 'station', device.name, 'connect', ssid],
check=True)
subprocess.check_call(['iwctl', '-P', 'passphrase',
'station', device.name, 'connect', ssid])
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]
wd = IWD()
device = wd.list_devices(1)[0]
subprocess.check_call(['iwctl', '-u', 'user', '-p', 'password',
'station', device.name, 'connect', ssid])
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]
wd = IWD()
ctx.start_process(['iwctl', '-p', 'password', 'station', device.name, 'connect', ssid],
check=True)
device = wd.list_devices(1)[0]
subprocess.check_call(['iwctl', '-p', 'password',
'station', device.name, 'connect', ssid])
self.check_connection_success(ssid)
def test_connection_failure(self):
ssid = 'ssidPassphrase'
self.establish_network(ssid)
device = self.wd.list_devices(1)[0]
wd = IWD()
device = wd.list_devices(1)[0]
with self.assertRaises(subprocess.CalledProcessError):
ctx.start_process(['iwctl', '-P', 'incorrect_passphrase', 'station', device.name, \
'connect', ssid], check=True)
subprocess.check_call(['iwctl', '-P', 'incorrect_passphrase',
'station', device.name, 'connect', ssid])
def test_invalid_command_line_option(self):
ssid = 'ssidPassphrase'
self.establish_network(ssid)
device = self.wd.list_devices(1)[0]
wd = IWD()
device = wd.list_devices(1)[0]
with self.assertRaises(subprocess.CalledProcessError):
ctx.start_process(['iwctl', '-z', 'station', device.name, 'connect', ssid], check=True)
subprocess.check_call(['iwctl', '-z',
'station', device.name, 'connect', ssid])
def test_invalid_command(self):
wd = IWD()
device = wd.list_devices(1)[0]
with self.assertRaises(subprocess.CalledProcessError):
ctx.start_process(['iwctl', 'inexistent', 'command'], check=True)
subprocess.check_call(['iwctl', 'inexistent', 'command'])
@classmethod
def setUpClass(cls):
IWD.copy_to_storage('ssidUNameAndPWord.8021x')
IWD.copy_to_storage('ssidPWord.8021x')
cls.wd = IWD()
wd = IWD()
device = wd.list_devices(1)[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)
@classmethod
def tearDownClass(cls):

View File

@ -1,5 +1,7 @@
[SETUP]
num_radios=4
max_test_exec_interval_sec=40
tmpfs_extra_stuff=../misc/certs:eap-user-ttls-mschap.text
[HOSTAPD]
rad0=ssidPassphrase.conf

View File

@ -11,7 +11,7 @@ from iwd import IWD
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
present at start time: Connect: AutoConnect: Result:

View File

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

View File

@ -11,7 +11,7 @@ from iwd import IWD
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
present at start time: Connect: AutoConnect: Result:
@ -24,10 +24,6 @@ class TestOpenNetwork(unittest.TestCase):
tca.validate('ssidOpen', False)
tca.validate('ssidOpen', True)
def setUp(self):
IWD.copy_to_storage('ssidOpen.open')
def tearDown(self):
IWD.clear_storage()
if __name__ == '__main__':

View File

@ -6,7 +6,7 @@ wpa=3
wpa_key_mgmt=WPA-EAP
ieee8021x=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
server_cert=/tmp/certs/cert-server.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-ClientCert=/tmp/certs/cert-client.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
ieee8021x=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
server_cert=/tmp/certs/cert-server.pem
private_key=/tmp/certs/cert-server-key.pem

View File

@ -12,7 +12,7 @@ from iwd import NetworkType
class TestConnectAutoConnect(unittest.TestCase):
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'
wd.wait_for_object_condition(ordered_network.network_object, condition)
@ -24,12 +24,10 @@ class TestConnectAutoConnect(unittest.TestCase):
else:
ordered_network.network_object.connect()
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
condition = 'obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
def check_autoconnect(self, wd, device, ssid, throws):
device.autoconnect = True
if throws is None:
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
@ -56,6 +54,12 @@ class TestConnectAutoConnect(unittest.TestCase):
self.assertIsNotNone(devices)
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:
self.check_autoconnect(wd, device, ssid, throws)
else:

View File

@ -11,7 +11,7 @@ from iwd import IWD
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
present at start time: Connect: AutoConnect: Result:

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

View File

@ -1,336 +0,0 @@
#!/usr/bin/python3
import unittest
import sys
sys.path.append('../util')
from iwd import IWD, SharedCodeAgent, DeviceState
from iwd import DeviceProvisioning
from wpas import Wpas
from hostapd import HostapdCLI
from hwsim import Hwsim
from config import ctx
from time import time
import os
class Test(unittest.TestCase):
def start_wpas_pkex(self, code, curve=None, **kwargs):
self.wpas.dpp_bootstrap_gen(type='pkex', curve=curve)
self.wpas.dpp_pkex_add(code=code, **kwargs)
if kwargs.get('role', 'configurator') == 'configurator':
self.wpas.dpp_configurator_create()
self.wpas.dpp_listen(2437)
def stop_wpas_pkex(self):
self.wpas.dpp_pkex_remove()
self.wpas.dpp_stop_listen()
self.wpas.dpp_configurator_remove()
def start_iwd_pkex_configurator(self, device, agent=False, profile='ssidCCMP.psk'):
self.hapd.reload()
self.hapd.wait_for_event('AP-ENABLED')
IWD.copy_to_storage(profile)
device.autoconnect = True
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(device, condition)
if agent:
self.agent = SharedCodeAgent(codes = {"test": "secret123"})
device.dpp_pkex_start_configurator(self.agent.path)
else:
device.dpp_pkex_configure_enrollee('secret123', identifier="test")
#
# WPA Supplicant has awful handling of retransmissions and no-ACK
# conditions. It only handles retransmitting the exchange request when
# there is no-ACK, which makes zero sense since its a broadcast...
#
# So, really, testing against wpa_supplicant is fragile and dependent on
# how the scheduling works out. If IWD doesn't ACK due to being on the
# next frequency or in between offchannel requests wpa_supplicant gets
# into a state where it thinks a PKEX session has been started (having
# received the exchange request) but will only accept commit-reveal
# frames. IWD is unaware because it never got a response so it keeps
# sending exchange requests which are ignored.
#
# Nevertheless we should still test against wpa_supplicant for
# compatibility so attempt to detect this case and restart the
# wpa_supplicant configurator.
#
def restart_wpas_if_needed(self):
i = 0
while i < 10:
data = self.wpas.wait_for_event("DPP-RX")
self.assertIn("type=7", data)
data = self.wpas.wait_for_event("DPP-TX")
self.assertIn("type=8", data)
data = self.wpas.wait_for_event("DPP-TX-STATUS")
if "result=no-ACK" in data:
self.stop_wpas_pkex()
self.start_wpas_pkex('secret123', identifier="test")
else:
return
i += 1
raise Exception("wpa_supplicant could not complete PKEX after 10 retries")
def test_pkex_iwd_as_enrollee(self):
self.start_wpas_pkex('secret123', identifier="test")
self.device[0].dpp_pkex_enroll('secret123', identifier="test")
self.restart_wpas_if_needed()
self.wpas.wait_for_event("DPP-AUTH-SUCCESS")
def test_pkex_iwd_as_enrollee_retransmit(self):
self.rule_reveal_req.enabled = True
self.start_wpas_pkex('secret123', identifier="test")
self.device[0].dpp_pkex_enroll('secret123', identifier="test")
self.restart_wpas_if_needed()
self.wpas.wait_for_event("DPP-AUTH-SUCCESS")
def test_pkex_unsupported_version(self):
self.start_wpas_pkex('secret123', identifier="test", version=2)
now = time()
self.device[0].dpp_pkex_enroll('secret123', identifier="test")
condition = "obj.started == False"
self.wd.wait_for_object_condition(self.device[0]._sc_device_provisioning,
condition, max_wait=125)
# Check the enrollee stopped after 2 minutes
elapsed = time() - now
self.assertLess(elapsed, 125)
def test_pkex_configurator_timeout(self):
self.start_iwd_pkex_configurator(self.device[0])
now = time()
condition = "obj.started == False"
self.wd.wait_for_object_condition(self.device[0]._sc_device_provisioning,
condition, max_wait=125)
# Check the enrollee stopped after 2 minutes
elapsed = time() - now
self.assertLess(elapsed, 125)
def test_pkex_iwd_as_configurator(self):
self.start_iwd_pkex_configurator(self.device[0])
self.start_wpas_pkex('secret123', identifier="test", initiator=True,
role='enrollee')
self.wpas.wait_for_event("DPP-AUTH-SUCCESS")
self.wpas.wait_for_event("DPP-CONF-RECEIVED")
def test_pkex_iwd_as_configurator_retransmit(self):
self.rule_xchg_resp.enabled = True
self.rule_reveal_resp.enabled = True
self.start_iwd_pkex_configurator(self.device[0])
self.start_wpas_pkex('secret123', identifier="test", initiator=True,
role='enrollee')
self.wpas.wait_for_event("DPP-AUTH-SUCCESS")
self.wpas.wait_for_event("DPP-CONF-RECEIVED")
def test_pkex_iwd_as_configurator_bad_group(self):
self.start_iwd_pkex_configurator(self.device[0])
self.start_wpas_pkex('secret123', identifier="test", initiator=True,
role='enrollee', curve='P-384')
self.wpas.wait_for_event(f"DPP-RX src={self.device[0].address} freq=2437 type=8")
self.wpas.wait_for_event("DPP-FAIL")
def test_pkex_iwd_to_iwd(self):
self.start_iwd_pkex_configurator(self.device[0])
self.device[1].autoconnect = True
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(self.device[1], condition)
# Check additional settings were carried over
with open('/tmp/ns0/ssidCCMP.psk', 'r') as f:
settings = f.read()
self.assertIn("SendHostname=true", settings)
def test_pkex_configurator_with_agent(self):
self.start_iwd_pkex_configurator(self.device[0], agent=True)
self.device[1].autoconnect = True
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(self.device[1], condition)
self.agent = None
def test_existing_network(self):
self.hapd.reload()
self.hapd.wait_for_event('AP-ENABLED')
IWD.copy_to_storage("existingProfile.psk", "/tmp/ns0/", "ssidCCMP.psk")
# Scan first so a network object exists, and its a known network
self.device[1].scan()
self.wd.wait_for_object_condition(self.device[1], 'obj.scanning == True')
self.wd.wait_for_object_condition(self.device[1], 'obj.scanning == False')
self.start_iwd_pkex_configurator(self.device[0])
self.device[1].autoconnect = False
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(self.device[1], condition)
# Check additional settings were carried over
with open('/tmp/ns0/ssidCCMP.psk', 'r') as f:
settings = f.read()
self.assertIn("SendHostname=true", settings)
def test_existing_incorrect_profile(self):
self.hapd.reload()
self.hapd.wait_for_event('AP-ENABLED')
IWD.copy_to_storage("existingProfile.psk", "/tmp/ns0/", "ssidCCMP.psk")
# Start connecting
self.device[1].autoconnect = True
self.wd.wait_for_object_condition(self.device[1], 'obj.state == DeviceState.connecting')
# We should be able to start DPP despite the connecting state
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
self.start_iwd_pkex_configurator(self.device[0])
self.assertEqual(self.device[1].state, DeviceState.disconnected)
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(self.device[1], condition)
def test_existing_hidden_network(self):
self.hapd_hidden.reload()
self.hapd_hidden.wait_for_event('AP-ENABLED')
IWD.copy_to_storage("existingProfile.psk", "/tmp/ns0/", "ssidHidden.psk")
# Scan first so a network object exists, and its a known network
self.device[1].scan()
self.wd.wait_for_object_condition(self.device[1], 'obj.scanning == True')
self.wd.wait_for_object_condition(self.device[1], 'obj.scanning == False')
self.start_iwd_pkex_configurator(self.device[0], profile='ssidHidden.psk')
self.device[1].autoconnect = False
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(self.device[1], condition)
# Check additional settings were carried over
with open('/tmp/ns0/ssidHidden.psk', 'r') as f:
settings = f.read()
self.assertIn("Hidden=true", settings)
def test_hidden_network(self):
self.hapd_hidden.reload()
self.hapd_hidden.wait_for_event('AP-ENABLED')
self.start_iwd_pkex_configurator(self.device[0], profile='ssidHidden.psk')
self.device[1].autoconnect = False
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(self.device[1], condition)
# Check additional settings were carried over
with open('/tmp/ns0/ssidHidden.psk', 'r') as f:
settings = f.read()
self.assertIn("Hidden=true", settings)
def setUp(self):
ns0 = ctx.get_namespace('ns0')
self.wpas = Wpas('wpas.conf')
self.wd = IWD(True)
self.wd_ns0 = IWD(True, iwd_storage_dir='/tmp/ns0', namespace=ns0)
self.device = []
self.device.append(self.wd.list_devices(1)[0])
self.device.append(self.wd_ns0.list_devices(1)[0])
self.hapd = HostapdCLI('hostapd.conf')
self.hapd.disable()
self.hapd_hidden = HostapdCLI('ssidHidden.conf')
self.hapd_hidden.disable()
self.hwsim = Hwsim()
self.rule_xchg_resp = self.hwsim.rules.create()
self.rule_xchg_resp.prefix = 'd0'
self.rule_xchg_resp.match_offset = 24
self.rule_xchg_resp.match = '04 09 50 6f 9a 1a 01 08'
self.rule_xchg_resp.match_times = 1
self.rule_xchg_resp.drop = True
self.rule_reveal_resp = self.hwsim.rules.create()
self.rule_reveal_resp.prefix = 'd0'
self.rule_reveal_resp.match_offset = 24
self.rule_reveal_resp.match = '04 09 50 6f 9a 1a 01 0a'
self.rule_reveal_resp.match_times = 1
self.rule_reveal_resp.drop = True
self.rule_reveal_req = self.hwsim.rules.create()
self.rule_reveal_req.prefix = 'd0'
self.rule_reveal_req.match_offset = 24
self.rule_reveal_req.match = '04 09 50 6f 9a 1a 01 09'
self.rule_reveal_req.match_times = 1
self.rule_reveal_req.drop = True
def tearDown(self):
# Tests end in various states, don't fail when tearing down.
try:
self.device[0].disconnect()
self.device[0].dpp_pkex_stop()
self.device[1].disconnect()
self.device[1].dpp_pkex_stop()
except:
pass
self.wpas.dpp_configurator_remove()
self.wpas.clean_up()
self.wd = None
self.wd_ns0 = None
self.device = None
self.wpas = None
self.hapd = None
self.rule_xchg_resp = None
IWD.clear_storage()
IWD.clear_storage('/tmp/ns0')
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
pass
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -1,5 +0,0 @@
[Security]
Passphrase=secret123
[IPv4]
SendHostname=true

View File

@ -1,9 +0,0 @@
hw_mode=g
channel=6
ssid=ssidHidden
wpa=1
wpa_pairwise=TKIP
wpa_passphrase=secret123
ignore_broadcast_ssid=1

View File

@ -1,5 +0,0 @@
[Security]
Passphrase=secret123
[Settings]
Hidden=true

View File

@ -1,107 +0,0 @@
#!/usr/bin/python3
import unittest
import sys
sys.path.append('../util')
from iwd import IWD, SharedCodeAgent, DeviceState
from iwd import DeviceProvisioning
from wpas import Wpas
from hostapd import HostapdCLI
from hwsim import Hwsim
from config import ctx
from time import time
import os
class Test(unittest.TestCase):
def auto_connect(self):
IWD.copy_to_storage('ssidCCMP.psk')
self.device.autoconnect = True
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(self.device, condition)
def test_configurator_stops_on_disconnect(self):
self.auto_connect()
self.device.dpp_start_configurator()
self.device.disconnect()
condition = 'obj.state == DeviceState.disconnected'
self.wd.wait_for_object_condition(self.device, condition)
self.assertEqual(self.device._device_provisioning.started, False)
def test_enrollee_stops_on_connect(self):
# Scan to get a list of networks
self.device.scan()
self.wd.wait_for_object_condition(self.device, 'obj.scanning == True')
self.wd.wait_for_object_condition(self.device, 'obj.scanning == False')
self.device.dpp_start_enrollee()
network = self.device.get_ordered_network("ssidCCMP")
network.network_object.connect()
condition = 'obj.state == DeviceState.connected'
self.wd.wait_for_object_condition(self.device, condition)
self.assertEqual(self.device._device_provisioning.started, False)
def test_enrollee_disconnects_automatically(self):
self.auto_connect()
self.device.dpp_start_enrollee()
condition = 'obj.state == DeviceState.disconnected'
self.wd.wait_for_object_condition(self.device, condition)
def test_enrollee_autoconnect_stays_on(self):
# Put in an autoconnecting state, no saved profile though
self.device.autoconnect = True
self.device.dpp_start_enrollee()
# DPP should set autoconnect false, but then re-enable after it stops
self.wd.wait_for_object_condition(self.device, "obj.autoconnect == False")
self.wd.wait_for_object_condition(self.device._device_provisioning, "obj.started == True")
# Stop DPP
self.device.dpp_stop()
self.wd.wait_for_object_condition(self.device, "obj.autoconnect == True")
def test_enrollee_autoconnect_stays_off(self):
# Autoconnect should be off by default
self.device.dpp_start_enrollee()
# DPP should set autoconnect false, but stay off after it stops
self.wd.wait_for_object_condition(self.device, "obj.autoconnect == False")
self.wd.wait_for_object_condition(self.device._device_provisioning, "obj.started == True")
# Stop DPP
self.device.dpp_stop()
self.wd.wait_for_object_condition(self.device, "obj.autoconnect == False")
def setUp(self):
self.wd = IWD(True)
self.device = self.wd.list_devices(1)[0]
def tearDown(self):
self.wd.stop()
self.wd = None
@classmethod
def setUpClass(cls):
hapd = HostapdCLI(config="hostapd.conf")
hapd.reload()
hapd.wait_for_event("AP-ENABLED")
@classmethod
def tearDownClass(cls):
pass
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -1,6 +0,0 @@
ctrl_interface=/tmp/rad1-p2p-wpas
update_config=0
pmf=2
dpp_config_processing=2
p2p_disabled=1

View File

@ -10,6 +10,7 @@ from iwd import DeviceState
from iwd import NetworkType
from hostapd import HostapdCLI
from hostapd import hostapd_map
class Test(unittest.TestCase):
@ -19,9 +20,15 @@ class Test(unittest.TestCase):
devices = wd.list_devices(1)
device = devices[0]
hostapd = HostapdCLI(config='ssidOpen.conf')
hostapd_if = list(hostapd_map.values())[0]
hostapd = HostapdCLI(hostapd_if)
ordered_network = device.get_ordered_network('ssidOpen', full_scan=True)
device.scan()
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
ordered_network = device.get_ordered_network('ssidOpen')
ordered_network.network_object.connect()

View File

@ -20,6 +20,14 @@ class Test(unittest.TestCase):
device = wd.list_devices(1)[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)
wpa_net = device.get_ordered_network('ssidTKIP')
self.assertEqual(wpa_net.type, NetworkType.psk)
@ -28,16 +36,16 @@ class Test(unittest.TestCase):
wpa_net.network_object.connect()
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
condition = 'obj.connected'
wd.wait_for_object_condition(wpa_net.network_object, condition)
open_net = device.get_ordered_network('ssidOpen')
self.assertEqual(open_net.type, NetworkType.open)
open_net.network_object.connect()
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
condition = 'obj.connected'
wd.wait_for_object_condition(open_net.network_object, condition)
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)

View File

@ -1,5 +1,6 @@
[SETUP]
num_radios=3
max_test_exec_interval_sec=40
[HOSTAPD]
rad0=ssidTKIP.conf

View File

@ -1,44 +0,0 @@
#!/usr/bin/python3
import unittest
import sys
import os
import shutil
sys.path.append('../util')
from iwd import IWD
from config import ctx
from ead import EAD
class Test(unittest.TestCase):
def test_connection_success(self):
env = os.environ.copy()
env['STATE_DIRECTORY'] = '/tmp/ead'
p = ctx.start_process(['ead', '-i', 'eth1', '-d'], env=env)
ead = EAD()
adapter = ead.list_adapters(1)[0]
condition = 'obj.connected == True'
IWD._wait_for_object_condition(adapter, condition)
condition = 'obj.authenticated == True'
IWD._wait_for_object_condition(adapter, condition)
ctx.stop_process(p)
@classmethod
def setUpClass(cls):
os.mkdir('/tmp/ead')
IWD.copy_to_storage('default.8021x', storage_dir='/tmp/ead')
@classmethod
def tearDownClass(cls):
IWD.clear_storage(storage_dir='/tmp/ead')
shutil.rmtree('/tmp/ead')
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -1,6 +0,0 @@
[SETUP]
num_radios=0
start_iwd=0
[HOSTAPD]
radius_server=wired.conf

View File

@ -1,17 +0,0 @@
interface=eth0
driver=wired
logger_stdout=-1
logger_stdout_level=1
ieee8021x=1
eap_reauth_period=3600
use_pae_group_addr=1
nas_identifier=ap.example.com
radius_server_clients=/tmp/certs/radius-clients.text
radius_server_auth_port=1812
eap_user_file=/tmp/secrets/eap-user.text
eap_server=1

View File

@ -0,0 +1,66 @@
#!/usr/bin/python3
import unittest
import sys
sys.path.append('../util')
import iwd
from iwd import IWD
from iwd import NetworkType
from hlrauc import AuthCenter
from ofono import Ofono
class Test(unittest.TestCase):
def test_connection_success(self):
auth = AuthCenter('/tmp/hlrauc.sock', '/tmp/sim.db')
ofono = Ofono()
ofono.enable_modem('/phonesim')
ofono.wait_for_sim_auth()
wd = IWD()
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('ssidEAP-AKA')
self.assertEqual(ordered_network.type, NetworkType.eap)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
try:
ordered_network.network_object.connect()
except:
auth.stop()
raise
condition = 'obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
device.disconnect()
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
auth.stop()
@classmethod
def setUpClass(cls):
IWD.copy_to_storage('ssidEAP-AKA.8021x')
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -0,0 +1,8 @@
[SETUP]
num_radios=2
max_test_exec_interval_sec=40
tmpfs_extra_stuff=sim.eap_user:sim.db:../misc/phonesim/phonesim.conf
sim_keys=ofono
[HOSTAPD]
rad0=ssidEAP-AKA.conf

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