mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-12-21 10:38:16 +01:00
Compare commits
386 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e7a8feee0 | ||
|
|
3760a49650 | ||
|
|
c4d114d804 | ||
|
|
ffe79bfada | ||
|
|
c0efaf21ad | ||
|
|
cee079da5b | ||
|
|
df30309aac | ||
|
|
2fe8c13016 | ||
|
|
84666b9703 | ||
|
|
54c0dbb3c8 | ||
|
|
6e9e0928b0 | ||
|
|
a1247fe46e | ||
|
|
088bb2e308 | ||
|
|
57dc5d843c | ||
|
|
8cb134f935 | ||
|
|
46037c428c | ||
|
|
161de4a3ad | ||
|
|
77ee863f04 | ||
|
|
405d1ab77c | ||
|
|
dc1589f3fe | ||
|
|
755280a4cc | ||
|
|
df2c5cf7fa | ||
|
|
fee0e5de33 | ||
|
|
601d9b0e02 | ||
|
|
f209e00dde | ||
|
|
86523b0597 | ||
|
|
85a2637fc5 | ||
|
|
2f991918b1 | ||
|
|
5b5a9b60fb | ||
|
|
5287809043 | ||
|
|
ea9ff2dcaf | ||
|
|
9dce36fe3d | ||
|
|
c4718a5355 | ||
|
|
c9c8790ff2 | ||
|
|
d135bfc4b8 | ||
|
|
e269beadba | ||
|
|
3e55fc855a | ||
|
|
c8d9936f9d | ||
|
|
79940956ef | ||
|
|
9f98c6c3c8 | ||
|
|
93eef7b02d | ||
|
|
26ed1f8b9f | ||
|
|
243db1d256 | ||
|
|
5224b0b0e7 | ||
|
|
3267d356d2 | ||
|
|
78f4e6240e | ||
|
|
36b1086f60 | ||
|
|
266eb405f2 | ||
|
|
0a8e646231 | ||
|
|
8ebc4780ea | ||
|
|
4ded663e68 | ||
|
|
c00bc3a065 | ||
|
|
f469db8a95 | ||
|
|
c3a27354ff | ||
|
|
d927fd07c1 | ||
|
|
8dff156eb6 | ||
|
|
e5c41a8024 | ||
|
|
603d6b2881 | ||
|
|
d1aa4009bc | ||
|
|
3c5081c7a6 | ||
|
|
7d5bcd738b | ||
|
|
0a93c55552 | ||
|
|
7f9ea7640d | ||
|
|
c52d913f20 | ||
|
|
651b647570 | ||
|
|
8cf9734d2b | ||
|
|
d70fbade44 | ||
|
|
f0e515b6ff | ||
|
|
47ef40d645 | ||
|
|
9e10efbef5 | ||
|
|
224afbb9ca | ||
|
|
bf69e6210c | ||
|
|
258482d509 | ||
|
|
1caad4ca88 | ||
|
|
59464a0ca4 | ||
|
|
93b25c87d6 | ||
|
|
e971ef71d5 | ||
|
|
bff5006b38 | ||
|
|
ea571861d6 | ||
|
|
f3e4263f51 | ||
|
|
77639d2d45 | ||
|
|
1662707f22 | ||
|
|
5f4bf2a5e5 | ||
|
|
40af18f96a | ||
|
|
ab4fa30c7e | ||
|
|
43f73823ec | ||
|
|
f4439fd2b6 | ||
|
|
bf82aff039 | ||
|
|
4b535cee1f | ||
|
|
7144741537 | ||
|
|
64b872f363 | ||
|
|
83a2457550 | ||
|
|
43f895142c | ||
|
|
c352b35bf1 | ||
|
|
d4bba5c838 | ||
|
|
1dd9f94713 | ||
|
|
c458e6612d | ||
|
|
45db339dcd | ||
|
|
887d8c8fe8 | ||
|
|
c6932efa30 | ||
|
|
f3ba82b0e1 | ||
|
|
a26fcd8f2d | ||
|
|
ab49b404fd | ||
|
|
9bc71b2853 | ||
|
|
5b104967ce | ||
|
|
4680c0c13b | ||
|
|
c36358cc7c | ||
|
|
235f6e5f14 | ||
|
|
980e132f48 | ||
|
|
900aa5810e | ||
|
|
8cf83d6620 | ||
|
|
ee52bc60ff | ||
|
|
3f4a29651e | ||
|
|
f58cad8cd9 | ||
|
|
b9c3feb198 | ||
|
|
94ebc9d90b | ||
|
|
b0759ebbb2 | ||
|
|
f2ac45eb52 | ||
|
|
7c5b40ff6b | ||
|
|
7465abe5f8 | ||
|
|
a910a21beb | ||
|
|
c40e665094 | ||
|
|
bb57d61add | ||
|
|
fc2965649c | ||
|
|
fa25de4ad1 | ||
|
|
901305dcdd | ||
|
|
b4a4495537 | ||
|
|
ccd91fe556 | ||
|
|
e89e4d692c | ||
|
|
0868418ad1 | ||
|
|
d81de65533 | ||
|
|
65073ffcfa | ||
|
|
d0b9fc84b5 | ||
|
|
e0727bfeb6 | ||
|
|
8e10e00904 | ||
|
|
a2b2f66c4c | ||
|
|
ca9b7ccaf6 | ||
|
|
354bce64dd | ||
|
|
ff4edacb42 | ||
|
|
a6edf6f31e | ||
|
|
31787e3788 | ||
|
|
e98a76aefb | ||
|
|
4a04d41409 | ||
|
|
8bb22a722b | ||
|
|
c459dc75c0 | ||
|
|
1a554a300d | ||
|
|
6cc6a8a2cb | ||
|
|
b0a011d8f4 | ||
|
|
a27b7823df | ||
|
|
14b9291490 | ||
|
|
354200f9da | ||
|
|
acc5daf0e2 | ||
|
|
5c22ab6621 | ||
|
|
af99fbb6c0 | ||
|
|
4b2c6de45c | ||
|
|
30cc3ecf7b | ||
|
|
87a8884f25 | ||
|
|
4f2bf0b0a6 | ||
|
|
184c3efcb3 | ||
|
|
3f06d0128a | ||
|
|
3bc8b90c0e | ||
|
|
f6cfcb8ca2 | ||
|
|
163c2ebd37 | ||
|
|
154a29be05 | ||
|
|
23cf6107c6 | ||
|
|
c66438e34f | ||
|
|
c778ddf0c2 | ||
|
|
2ad9561069 | ||
|
|
f4ec1ee509 | ||
|
|
b98bc30c23 | ||
|
|
4c3cbdc8d3 | ||
|
|
61cba6bd28 | ||
|
|
574b0d80dc | ||
|
|
0c228f4465 | ||
|
|
1ac3915641 | ||
|
|
e9ac7ab378 | ||
|
|
7ba5b0f924 | ||
|
|
54b6330845 | ||
|
|
b5aff74e3b | ||
|
|
294426b450 | ||
|
|
4482b8dc24 | ||
|
|
bf2441e311 | ||
|
|
95a9e052de | ||
|
|
5c7777ff0f | ||
|
|
d223f49fbc | ||
|
|
e5c0e18751 | ||
|
|
5f74ed75e7 | ||
|
|
17fbab110c | ||
|
|
02ec70e290 | ||
|
|
5118f08d79 | ||
|
|
e565b75032 | ||
|
|
db9c0480ef | ||
|
|
10f5bc9be7 | ||
|
|
548ef00291 | ||
|
|
93806cd522 | ||
|
|
1a3a035404 | ||
|
|
6d94599977 | ||
|
|
c639bf0b19 | ||
|
|
514e483bc3 | ||
|
|
7604762013 | ||
|
|
f81855349a | ||
|
|
1455988efb | ||
|
|
d2f14b2951 | ||
|
|
73c79dbd41 | ||
|
|
0d7ff8ebd9 | ||
|
|
05166d0999 | ||
|
|
0e3322b5da | ||
|
|
a7d8b9a068 | ||
|
|
b31e298df4 | ||
|
|
a73b877c5b | ||
|
|
68e1d055dd | ||
|
|
aca92df19b | ||
|
|
560ad581ad | ||
|
|
fe2a91ae11 | ||
|
|
cd1507620f | ||
|
|
7ee7848a96 | ||
|
|
be7b19d587 | ||
|
|
16f5bbc20a | ||
|
|
8a27cff8c0 | ||
|
|
d43f05224d | ||
|
|
96492483ee | ||
|
|
194d8a3052 | ||
|
|
d500a44ff3 | ||
|
|
faa6a392e4 | ||
|
|
e33fa63243 | ||
|
|
d7f669dd7c | ||
|
|
993e48cab2 | ||
|
|
9762c61b4d | ||
|
|
d8803b309d | ||
|
|
f9a55e3728 | ||
|
|
a63fd6abb9 | ||
|
|
eff2a2afcf | ||
|
|
5cdad6ab86 | ||
|
|
30ca00d2c4 | ||
|
|
fbf8ed4140 | ||
|
|
64d68b4f08 | ||
|
|
91f7253ae1 | ||
|
|
06c8080664 | ||
|
|
b7da34a5d2 | ||
|
|
a972b77dc2 | ||
|
|
d27de1b111 | ||
|
|
d2cda84383 | ||
|
|
af1b017003 | ||
|
|
556f90ec28 | ||
|
|
22f238706c | ||
|
|
906afefbf3 | ||
|
|
38c36ff145 | ||
|
|
9ea0117dc4 | ||
|
|
4f81953338 | ||
|
|
ffc6d6325d | ||
|
|
6d46698494 | ||
|
|
b54dcafa80 | ||
|
|
ac0f13798b | ||
|
|
51771694cd | ||
|
|
9232991e25 | ||
|
|
71dc347582 | ||
|
|
31b18a8c8b | ||
|
|
d92e4c5663 | ||
|
|
300f0ddac5 | ||
|
|
77cf621f15 | ||
|
|
5c824cc24e | ||
|
|
3fd5250c0d | ||
|
|
8de70b1952 | ||
|
|
35808debae | ||
|
|
685d105739 | ||
|
|
43d5e89fac | ||
|
|
88a71eca72 | ||
|
|
b4983fdcae | ||
|
|
16a05316b2 | ||
|
|
1dda441b85 | ||
|
|
5cf826c73a | ||
|
|
9a5c64481e | ||
|
|
6de09a5eba | ||
|
|
03645acf4f | ||
|
|
c1e2a6c44c | ||
|
|
b3e7b7539e | ||
|
|
fdbbd8b383 | ||
|
|
70d1d71612 | ||
|
|
4bfc794a37 | ||
|
|
8a1f8d1a9a | ||
|
|
b05c1cafcd | ||
|
|
3be01a83ab | ||
|
|
26efca80d7 | ||
|
|
5fb3ac5937 | ||
|
|
9274f70fec | ||
|
|
78bdb26296 | ||
|
|
3132e9f595 | ||
|
|
b9e4dfbd40 | ||
|
|
2e80a09184 | ||
|
|
49cddea10b | ||
|
|
be3f6a2ca0 | ||
|
|
88d3261bc2 | ||
|
|
e5816b024f | ||
|
|
9cdc726dc1 | ||
|
|
e196cb1178 | ||
|
|
468cecdbca | ||
|
|
546dea11b6 | ||
|
|
da13aab419 | ||
|
|
ccd702f7da | ||
|
|
6365c1f6de | ||
|
|
2f2b5740da | ||
|
|
6b94ab3889 | ||
|
|
6bedcb4622 | ||
|
|
121c2c5653 | ||
|
|
eb3345b51b | ||
|
|
795f57e816 | ||
|
|
71a7190ed2 | ||
|
|
405b897687 | ||
|
|
62e2a3535d | ||
|
|
d9aaf6c842 | ||
|
|
b7559d68c7 | ||
|
|
8bb3e3c4fa | ||
|
|
c76f7eac05 | ||
|
|
c2ad0006eb | ||
|
|
5fcfb430b2 | ||
|
|
3a17c8e3c5 | ||
|
|
6febe5bed1 | ||
|
|
338577bb3a | ||
|
|
83c032a583 | ||
|
|
d34b4e16e0 | ||
|
|
52a47c9fd4 | ||
|
|
816d258cab | ||
|
|
5067654a6d | ||
|
|
aef394895d | ||
|
|
cdbd59103e | ||
|
|
52c6a6b8ea | ||
|
|
42273fd122 | ||
|
|
14aa333a39 | ||
|
|
ee52968043 | ||
|
|
d13af0a4a2 | ||
|
|
9f18bf402c | ||
|
|
9d4c34dc7a | ||
|
|
e296a61e3f | ||
|
|
82161909a1 | ||
|
|
c2ef5f3f68 | ||
|
|
fba4ee90d0 | ||
|
|
a559bd7c40 | ||
|
|
988f68e916 | ||
|
|
b38f71f221 | ||
|
|
3f04bc427d | ||
|
|
3ab09e0ae2 | ||
|
|
cc0fcb2bb4 | ||
|
|
b1edef3a14 | ||
|
|
c0058c07bf | ||
|
|
9f31663e21 | ||
|
|
793228028d | ||
|
|
d4c68d7d83 | ||
|
|
77cdbd186b | ||
|
|
98ae3d4197 | ||
|
|
d8a6fb86c1 | ||
|
|
32f3745745 | ||
|
|
c54ef5a8da | ||
|
|
a507c08bfe | ||
|
|
ba5a6df2d1 | ||
|
|
6315b42861 | ||
|
|
42b4da1be2 | ||
|
|
bcfbaa096d | ||
|
|
593c9dee6c | ||
|
|
aa0a439856 | ||
|
|
1fe68aef0b | ||
|
|
643503eeea | ||
|
|
085a2511f6 | ||
|
|
6415420f1c | ||
|
|
1a79092383 | ||
|
|
f52180d41c | ||
|
|
197087d081 | ||
|
|
d03b06db85 | ||
|
|
4b3e82f742 | ||
|
|
a6638513d4 | ||
|
|
5abf54f2dc | ||
|
|
7080a4453e | ||
|
|
8f7443b0b3 | ||
|
|
407a8a4441 | ||
|
|
705898d1db | ||
|
|
aaf1d91d51 | ||
|
|
b0ad6158e1 | ||
|
|
0a3797a4d4 | ||
|
|
77e5c94dc6 | ||
|
|
593fad5260 | ||
|
|
a2fff11823 | ||
|
|
cfb468e44d | ||
|
|
a5f5578a61 | ||
|
|
cc371641ed | ||
|
|
9ba6dac066 | ||
|
|
ba9717d445 | ||
|
|
e89ba32d30 |
3
.codespellrc
Normal file
3
.codespellrc
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[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
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@ -66,6 +66,9 @@ unit/test-p2p
|
|||||||
unit/test-band
|
unit/test-band
|
||||||
unit/test-dpp
|
unit/test-dpp
|
||||||
unit/test-json
|
unit/test-json
|
||||||
|
unit/test-nl80211util
|
||||||
|
unit/test-pmksa
|
||||||
|
unit/test-storage
|
||||||
unit/cert-*.pem
|
unit/cert-*.pem
|
||||||
unit/cert-*.csr
|
unit/cert-*.csr
|
||||||
unit/cert-*.srl
|
unit/cert-*.srl
|
||||||
|
|||||||
108
ChangeLog
108
ChangeLog
@ -1,3 +1,111 @@
|
|||||||
|
ver 3.10:
|
||||||
|
Fix issue with handling neighbor report on BSS TM request.
|
||||||
|
Fix issue with handling deauth and FT association failure.
|
||||||
|
Fix issue with handling roaming and old frequencies.
|
||||||
|
|
||||||
|
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:
|
ver 2.12:
|
||||||
Fix issue with DPP extra settings not being used.
|
Fix issue with DPP extra settings not being used.
|
||||||
Fix issue with DPP and PRF+ handling on AARCH64.
|
Fix issue with DPP and PRF+ handling on AARCH64.
|
||||||
|
|||||||
45
Makefile.am
45
Makefile.am
@ -64,12 +64,16 @@ ell_headers = ell/util.h \
|
|||||||
ell/acd.h \
|
ell/acd.h \
|
||||||
ell/cleanup.h \
|
ell/cleanup.h \
|
||||||
ell/netconfig.h \
|
ell/netconfig.h \
|
||||||
ell/sysctl.h
|
ell/sysctl.h \
|
||||||
|
ell/notifylist.h \
|
||||||
|
ell/minheap.h
|
||||||
|
|
||||||
ell_sources = ell/private.h \
|
ell_sources = ell/private.h \
|
||||||
ell/missing.h \
|
ell/missing.h \
|
||||||
ell/util.c \
|
ell/util.c \
|
||||||
|
ell/test-private.h \
|
||||||
ell/test.c \
|
ell/test.c \
|
||||||
|
ell/test-dbus.c \
|
||||||
ell/strv.c \
|
ell/strv.c \
|
||||||
ell/utf8.c \
|
ell/utf8.c \
|
||||||
ell/queue.c \
|
ell/queue.c \
|
||||||
@ -145,7 +149,9 @@ ell_sources = ell/private.h \
|
|||||||
ell/dhcp6-transport.c \
|
ell/dhcp6-transport.c \
|
||||||
ell/acd.c \
|
ell/acd.c \
|
||||||
ell/netconfig.c \
|
ell/netconfig.c \
|
||||||
ell/sysctl.c
|
ell/sysctl.c \
|
||||||
|
ell/notifylist.c \
|
||||||
|
ell/minheap.c
|
||||||
|
|
||||||
ell_shared = ell/useful.h ell/asn1-private.h
|
ell_shared = ell/useful.h ell/asn1-private.h
|
||||||
|
|
||||||
@ -212,7 +218,8 @@ eap_sources = src/eap.c src/eap.h src/eap-private.h \
|
|||||||
if DAEMON
|
if DAEMON
|
||||||
libexec_PROGRAMS += src/iwd
|
libexec_PROGRAMS += src/iwd
|
||||||
|
|
||||||
src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h src/missing.h \
|
src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h \
|
||||||
|
src/missing.h src/defs.h \
|
||||||
src/netdev.h src/netdev.c \
|
src/netdev.h src/netdev.c \
|
||||||
src/wiphy.h src/wiphy.c \
|
src/wiphy.h src/wiphy.c \
|
||||||
src/device.c \
|
src/device.c \
|
||||||
@ -265,6 +272,10 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h src/missing.h \
|
|||||||
src/dpp-util.h src/dpp-util.c \
|
src/dpp-util.h src/dpp-util.c \
|
||||||
src/json.h src/json.c \
|
src/json.h src/json.c \
|
||||||
src/dpp.c \
|
src/dpp.c \
|
||||||
|
src/udev.c \
|
||||||
|
src/pmksa.h src/pmksa.c \
|
||||||
|
src/vendor_quirks.h \
|
||||||
|
src/vendor_quirks.c \
|
||||||
$(eap_sources) \
|
$(eap_sources) \
|
||||||
$(builtin_sources)
|
$(builtin_sources)
|
||||||
|
|
||||||
@ -316,6 +327,7 @@ client_iwctl_SOURCES = client/main.c \
|
|||||||
client/daemon.c client/daemon.h \
|
client/daemon.c client/daemon.h \
|
||||||
client/dpp.c client/dpp-pkex.c \
|
client/dpp.c client/dpp-pkex.c \
|
||||||
client/station-debug.c \
|
client/station-debug.c \
|
||||||
|
client/bss.c \
|
||||||
src/util.c src/util.h \
|
src/util.c src/util.h \
|
||||||
src/band.c src/band.h
|
src/band.c src/band.h
|
||||||
|
|
||||||
@ -430,7 +442,8 @@ unit_tests += unit/test-cmac-aes \
|
|||||||
unit/test-ie unit/test-util unit/test-ssid-security \
|
unit/test-ie unit/test-util unit/test-ssid-security \
|
||||||
unit/test-arc4 unit/test-wsc unit/test-eap-mschapv2 \
|
unit/test-arc4 unit/test-wsc unit/test-eap-mschapv2 \
|
||||||
unit/test-eap-sim unit/test-sae unit/test-p2p unit/test-band \
|
unit/test-eap-sim unit/test-sae unit/test-p2p unit/test-band \
|
||||||
unit/test-dpp unit/test-json
|
unit/test-dpp unit/test-json unit/test-nl80211util \
|
||||||
|
unit/test-pmksa unit/test-storage
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if CLIENT
|
if CLIENT
|
||||||
@ -449,6 +462,7 @@ unit_test_eap_sim_SOURCES = unit/test-eap-sim.c \
|
|||||||
src/eapol.h src/eapol.c \
|
src/eapol.h src/eapol.c \
|
||||||
src/eapolutil.h src/eapolutil.c \
|
src/eapolutil.h src/eapolutil.c \
|
||||||
src/handshake.h src/handshake.c \
|
src/handshake.h src/handshake.c \
|
||||||
|
src/pmksa.h src/pmksa.c \
|
||||||
src/eap.h src/eap.c src/eap-private.h \
|
src/eap.h src/eap.c src/eap-private.h \
|
||||||
src/util.h src/util.c \
|
src/util.h src/util.c \
|
||||||
src/simauth.h src/simauth.c \
|
src/simauth.h src/simauth.c \
|
||||||
@ -508,6 +522,7 @@ unit_test_eapol_SOURCES = unit/test-eapol.c \
|
|||||||
src/eapol.h src/eapol.c \
|
src/eapol.h src/eapol.c \
|
||||||
src/eapolutil.h src/eapolutil.c \
|
src/eapolutil.h src/eapolutil.c \
|
||||||
src/handshake.h src/handshake.c \
|
src/handshake.h src/handshake.c \
|
||||||
|
src/pmksa.h src/pmksa.c \
|
||||||
src/eap.h src/eap.c src/eap-private.h \
|
src/eap.h src/eap.c src/eap-private.h \
|
||||||
src/eap-tls.c src/eap-ttls.c \
|
src/eap-tls.c src/eap-ttls.c \
|
||||||
src/eap-md5.c src/util.c \
|
src/eap-md5.c src/util.c \
|
||||||
@ -538,6 +553,7 @@ unit_test_wsc_SOURCES = unit/test-wsc.c src/wscutil.h src/wscutil.c \
|
|||||||
src/eapol.h src/eapol.c \
|
src/eapol.h src/eapol.c \
|
||||||
src/eapolutil.h src/eapolutil.c \
|
src/eapolutil.h src/eapolutil.c \
|
||||||
src/handshake.h src/handshake.c \
|
src/handshake.h src/handshake.c \
|
||||||
|
src/pmksa.h src/pmksa.c \
|
||||||
src/eap.h src/eap.c src/eap-private.h \
|
src/eap.h src/eap.c src/eap-private.h \
|
||||||
src/util.h src/util.c \
|
src/util.h src/util.c \
|
||||||
src/erp.h src/erp.c \
|
src/erp.h src/erp.c \
|
||||||
@ -556,6 +572,7 @@ unit_test_sae_SOURCES = unit/test-sae.c \
|
|||||||
src/crypto.h src/crypto.c \
|
src/crypto.h src/crypto.c \
|
||||||
src/ie.h src/ie.c \
|
src/ie.h src/ie.c \
|
||||||
src/handshake.h src/handshake.c \
|
src/handshake.h src/handshake.c \
|
||||||
|
src/pmksa.h src/pmksa.c \
|
||||||
src/erp.h src/erp.c \
|
src/erp.h src/erp.c \
|
||||||
src/band.h src/band.c \
|
src/band.h src/band.c \
|
||||||
src/util.h src/util.c \
|
src/util.h src/util.c \
|
||||||
@ -579,6 +596,22 @@ 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_SOURCES = unit/test-json.c src/json.h src/json.c shared/jsmn.h
|
||||||
unit_test_json_LDADD = $(ell_ldadd)
|
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
|
endif
|
||||||
|
|
||||||
if CLIENT
|
if CLIENT
|
||||||
@ -594,6 +627,9 @@ unit_test_client_SOURCES = unit/test-client.c \
|
|||||||
unit_test_client_LDADD = $(ell_ldadd) $(client_ldadd)
|
unit_test_client_LDADD = $(ell_ldadd) $(client_ldadd)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
|
||||||
|
$(top_srcdir)/build-aux/tap-driver.sh
|
||||||
|
|
||||||
TESTS = $(unit_tests)
|
TESTS = $(unit_tests)
|
||||||
|
|
||||||
EXTRA_DIST = src/genbuiltin src/iwd.service.in src/net.connman.iwd.service \
|
EXTRA_DIST = src/genbuiltin src/iwd.service.in src/net.connman.iwd.service \
|
||||||
@ -710,6 +746,7 @@ ell/internal: Makefile
|
|||||||
done > $@
|
done > $@
|
||||||
|
|
||||||
ell/ell.h: Makefile
|
ell/ell.h: Makefile
|
||||||
|
$(AM_V_at)$(MKDIR_P) ell
|
||||||
$(AM_V_at)echo -n > $@
|
$(AM_V_at)echo -n > $@
|
||||||
$(AM_V_GEN)for f in $(ell_headers) ; do \
|
$(AM_V_GEN)for f in $(ell_headers) ; do \
|
||||||
echo "#include <$$f>" >> $@ ; \
|
echo "#include <$$f>" >> $@ ; \
|
||||||
|
|||||||
4
TODO
4
TODO
@ -110,7 +110,7 @@ Wireless monitor
|
|||||||
|
|
||||||
- Subscribe to all nl80211 multicast groups at startup
|
- Subscribe to all nl80211 multicast groups at startup
|
||||||
|
|
||||||
It seems the nlmon packets are limited to actual subscribed mutlicast
|
It seems the nlmon packets are limited to actual subscribed multicast
|
||||||
groups. To get a complete picture of all the nl80211 commands and
|
groups. To get a complete picture of all the nl80211 commands and
|
||||||
events, it is required that iwmon adds membership to all multicast
|
events, it is required that iwmon adds membership to all multicast
|
||||||
groups that the nl80211 lists.
|
groups that the nl80211 lists.
|
||||||
@ -234,7 +234,7 @@ Wireless daemon
|
|||||||
|
|
||||||
- Implement Enrollee Session Overlap Detection after WSC Protocol Run
|
- Implement Enrollee Session Overlap Detection after WSC Protocol Run
|
||||||
|
|
||||||
WSC Best Practices v2.0.1, Section 3.15 describes an enhacement to detect
|
WSC Best Practices v2.0.1, Section 3.15 describes an enhancement to detect
|
||||||
PBC session overlaps. The Enrollee is asked to perform an extra scan without
|
PBC session overlaps. The Enrollee is asked to perform an extra scan without
|
||||||
the PBC request in the ProbeRequest frames after EAP-WSC completes
|
the PBC request in the ProbeRequest frames after EAP-WSC completes
|
||||||
successfully. If another AP in PBC mode is found, then a SessionOverlap
|
successfully. If another AP in PBC mode is found, then a SessionOverlap
|
||||||
|
|||||||
156
autotests/testAPRoam/bad_neighbor_report_test.py
Normal file
156
autotests/testAPRoam/bad_neighbor_report_test.py
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.append('../util')
|
||||||
|
import iwd
|
||||||
|
from iwd import IWD
|
||||||
|
from iwd import NetworkType
|
||||||
|
|
||||||
|
from hostapd import HostapdCLI
|
||||||
|
|
||||||
|
class Test(unittest.TestCase):
|
||||||
|
def initial_connection(self):
|
||||||
|
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(self.bss_hostapd[0].bssid)
|
||||||
|
|
||||||
|
condition = 'obj.state == DeviceState.connected'
|
||||||
|
self.wd.wait_for_object_condition(self.device, condition)
|
||||||
|
|
||||||
|
self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED')
|
||||||
|
|
||||||
|
self.assertFalse(self.bss_hostapd[1].list_sta())
|
||||||
|
|
||||||
|
def test_full_scan(self):
|
||||||
|
"""
|
||||||
|
Tests that IWD first tries a limited scan, then a full scan after
|
||||||
|
an AP directed roam. After the full scan yields no results IWD
|
||||||
|
should stop trying to roam.
|
||||||
|
"""
|
||||||
|
self.initial_connection()
|
||||||
|
|
||||||
|
# Disable other APs, so the scans come up empty
|
||||||
|
self.bss_hostapd[1].disable()
|
||||||
|
self.bss_hostapd[2].disable()
|
||||||
|
|
||||||
|
# Send a bad candidate list with the BSS TM request which contains a
|
||||||
|
# channel with no AP operating on it.
|
||||||
|
self.bss_hostapd[0].send_bss_transition(
|
||||||
|
self.device.address,
|
||||||
|
[(self.bss_hostapd[1].bssid, "8f0000005105060603000000")]
|
||||||
|
)
|
||||||
|
self.device.wait_for_event("roam-scan-triggered")
|
||||||
|
self.device.wait_for_event("no-roam-candidates")
|
||||||
|
# IWD should then trigger a full scan
|
||||||
|
self.device.wait_for_event("full-roam-scan")
|
||||||
|
self.device.wait_for_event("no-roam-candidates", timeout=30)
|
||||||
|
|
||||||
|
# IWD should not trigger a roam again after the above 2 failures.
|
||||||
|
with self.assertRaises(TimeoutError):
|
||||||
|
self.device.wait_for_event("roam-scan-triggered", timeout=60)
|
||||||
|
|
||||||
|
def test_bad_candidate_list(self):
|
||||||
|
"""
|
||||||
|
Tests behavior when the AP sends a candidate list but the scan
|
||||||
|
finds no BSS's. IWD should fall back to a full scan after.
|
||||||
|
"""
|
||||||
|
self.initial_connection()
|
||||||
|
|
||||||
|
# Send a bad candidate list with the BSS TM request which contains a
|
||||||
|
# channel with no AP operating on it.
|
||||||
|
self.bss_hostapd[0].send_bss_transition(
|
||||||
|
self.device.address,
|
||||||
|
[(self.bss_hostapd[1].bssid, "8f0000005105060603000000")]
|
||||||
|
)
|
||||||
|
self.device.wait_for_event("roam-scan-triggered")
|
||||||
|
self.device.wait_for_event("no-roam-candidates")
|
||||||
|
# IWD should then trigger a full scan
|
||||||
|
self.device.wait_for_event("full-roam-scan")
|
||||||
|
self.device.wait_for_event("roaming", timeout=30)
|
||||||
|
self.device.wait_for_event("connected")
|
||||||
|
|
||||||
|
def test_bad_neighbor_report(self):
|
||||||
|
"""
|
||||||
|
Tests behavior when the AP sends no candidate list. IWD should
|
||||||
|
request a neighbor report. If the limited scan yields no BSS's IWD
|
||||||
|
should fall back to a full scan.
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Set a bad neighbor (channel that no AP is on) to force the limited
|
||||||
|
# roam scan to fail
|
||||||
|
self.bss_hostapd[0].set_neighbor(
|
||||||
|
self.bss_hostapd[1].bssid,
|
||||||
|
"TestAPRoam",
|
||||||
|
'%s8f000000%s%s060603000000' % (self.bss_hostapd[1].bssid.replace(':', ''), "51", "0b")
|
||||||
|
)
|
||||||
|
|
||||||
|
self.initial_connection()
|
||||||
|
|
||||||
|
self.bss_hostapd[0].send_bss_transition(self.device.address, [])
|
||||||
|
self.device.wait_for_event("roam-scan-triggered")
|
||||||
|
# The AP will have sent a neighbor report with a single BSS but on
|
||||||
|
# channel 11 which no AP is on. This should result in a limited scan
|
||||||
|
# picking up no candidates.
|
||||||
|
self.device.wait_for_event("no-roam-candidates", timeout=30)
|
||||||
|
# IWD should then trigger a full scan
|
||||||
|
self.device.wait_for_event("full-roam-scan")
|
||||||
|
self.device.wait_for_event("roaming", timeout=30)
|
||||||
|
self.device.wait_for_event("connected")
|
||||||
|
|
||||||
|
def test_ignore_candidate_list_quirk(self):
|
||||||
|
"""
|
||||||
|
Tests that IWD ignores the candidate list sent by the AP since its
|
||||||
|
OUI indicates it should be ignored.
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Set the OUI so the candidate list should be ignored
|
||||||
|
for hapd in self.bss_hostapd:
|
||||||
|
hapd.set_value('vendor_elements', 'dd0400180a01')
|
||||||
|
|
||||||
|
self.initial_connection()
|
||||||
|
|
||||||
|
# Send with a candidate list (should be ignored)
|
||||||
|
self.bss_hostapd[0].send_bss_transition(
|
||||||
|
self.device.address,
|
||||||
|
[(self.bss_hostapd[1].bssid, "8f0000005105060603000000")]
|
||||||
|
)
|
||||||
|
# IWD should ignore the list and trigger a full scan since we have not
|
||||||
|
# set any neighbors
|
||||||
|
self.device.wait_for_event("full-roam-scan")
|
||||||
|
self.device.wait_for_event("roaming", timeout=30)
|
||||||
|
self.device.wait_for_event("connected")
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
for hapd in self.bss_hostapd:
|
||||||
|
hapd.reload()
|
||||||
|
|
||||||
|
@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') ]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
IWD.clear_storage()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main(exit=True)
|
||||||
@ -11,52 +11,58 @@ from iwd import NetworkType
|
|||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
def initial_connection(self):
|
||||||
def validate(self, expect_roam=True):
|
ordered_network = self.device.get_ordered_network('TestAPRoam')
|
||||||
wd = IWD()
|
|
||||||
|
|
||||||
devices = wd.list_devices(1)
|
|
||||||
device = devices[0]
|
|
||||||
|
|
||||||
ordered_network = device.get_ordered_network('TestAPRoam')
|
|
||||||
|
|
||||||
self.assertEqual(ordered_network.type, NetworkType.psk)
|
self.assertEqual(ordered_network.type, NetworkType.psk)
|
||||||
|
|
||||||
condition = 'not obj.connected'
|
condition = 'not obj.connected'
|
||||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
self.wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||||
|
|
||||||
device.connect_bssid(self.bss_hostapd[0].bssid)
|
self.device.connect_bssid(self.bss_hostapd[0].bssid)
|
||||||
|
|
||||||
condition = 'obj.state == DeviceState.connected'
|
condition = 'obj.state == DeviceState.connected'
|
||||||
wd.wait_for_object_condition(device, condition)
|
self.wd.wait_for_object_condition(self.device, condition)
|
||||||
|
|
||||||
self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED')
|
self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED')
|
||||||
|
|
||||||
self.assertFalse(self.bss_hostapd[1].list_sta())
|
self.assertFalse(self.bss_hostapd[1].list_sta())
|
||||||
|
|
||||||
self.bss_hostapd[0].send_bss_transition(device.address,
|
def validate_roam(self, from_bss, to_bss, expect_roam=True):
|
||||||
[(self.bss_hostapd[1].bssid, '8f0000005102060603000000')],
|
from_bss.send_bss_transition(self.device.address,
|
||||||
|
self.neighbor_list,
|
||||||
disassoc_imminent=expect_roam)
|
disassoc_imminent=expect_roam)
|
||||||
|
|
||||||
if expect_roam:
|
if expect_roam:
|
||||||
from_condition = 'obj.state == DeviceState.roaming'
|
from_condition = 'obj.state == DeviceState.roaming'
|
||||||
to_condition = 'obj.state == DeviceState.connected'
|
to_condition = 'obj.state == DeviceState.connected'
|
||||||
wd.wait_for_object_change(device, from_condition, to_condition)
|
self.wd.wait_for_object_change(self.device, from_condition, to_condition)
|
||||||
|
|
||||||
self.bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % device.address)
|
to_bss.wait_for_event('AP-STA-CONNECTED %s' % self.device.address)
|
||||||
else:
|
else:
|
||||||
device.wait_for_event("no-roam-candidates")
|
self.device.wait_for_event("no-roam-candidates")
|
||||||
|
|
||||||
device.disconnect()
|
|
||||||
|
|
||||||
condition = 'not obj.connected'
|
|
||||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
|
||||||
|
|
||||||
def test_disassoc_imminent(self):
|
def test_disassoc_imminent(self):
|
||||||
self.validate(expect_roam=True)
|
self.initial_connection()
|
||||||
|
self.validate_roam(self.bss_hostapd[0], self.bss_hostapd[1])
|
||||||
|
|
||||||
def test_no_candidates(self):
|
def test_no_candidates(self):
|
||||||
self.validate(expect_roam=False)
|
self.initial_connection()
|
||||||
|
# We now have BSS0 roam blacklisted
|
||||||
|
self.validate_roam(self.bss_hostapd[0], self.bss_hostapd[1])
|
||||||
|
# Try and trigger another roam back, which shouldn't happen since now
|
||||||
|
# both BSS's are roam blacklisted
|
||||||
|
self.validate_roam(self.bss_hostapd[1], self.bss_hostapd[0], expect_roam=False)
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.wd = IWD(True)
|
||||||
|
|
||||||
|
devices = self.wd.list_devices(1)
|
||||||
|
self.device = devices[0]
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.wd = None
|
||||||
|
self.device = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
@ -65,6 +71,10 @@ class Test(unittest.TestCase):
|
|||||||
cls.bss_hostapd = [ HostapdCLI(config='ssid1.conf'),
|
cls.bss_hostapd = [ HostapdCLI(config='ssid1.conf'),
|
||||||
HostapdCLI(config='ssid2.conf'),
|
HostapdCLI(config='ssid2.conf'),
|
||||||
HostapdCLI(config='ssid3.conf') ]
|
HostapdCLI(config='ssid3.conf') ]
|
||||||
|
cls.neighbor_list = [
|
||||||
|
(cls.bss_hostapd[0].bssid, "8f0000005101060603000000"),
|
||||||
|
(cls.bss_hostapd[1].bssid, "8f0000005102060603000000"),
|
||||||
|
]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
[SETUP]
|
[SETUP]
|
||||||
num_radios=4
|
num_radios=4
|
||||||
|
hwsim_medium=true
|
||||||
|
start_iwd=false
|
||||||
|
|
||||||
[HOSTAPD]
|
[HOSTAPD]
|
||||||
rad0=ssid1.conf
|
rad0=ssid1.conf
|
||||||
|
|||||||
6
autotests/testAPRoam/main.conf.roaming
Normal file
6
autotests/testAPRoam/main.conf.roaming
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[General]
|
||||||
|
RoamThreshold=-72
|
||||||
|
CriticalRoamThreshold=-72
|
||||||
|
|
||||||
|
[Blacklist]
|
||||||
|
InitialAccessPointBusyTimeout=20
|
||||||
183
autotests/testAPRoam/roam_blacklist_test.py
Normal file
183
autotests/testAPRoam/roam_blacklist_test.py
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
#!/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)
|
||||||
2
autotests/testAffinity/TestFT.psk
Normal file
2
autotests/testAffinity/TestFT.psk
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[Security]
|
||||||
|
Passphrase=EasilyGuessedPassword
|
||||||
41
autotests/testAffinity/ft-psk-ccmp-1.conf
Normal file
41
autotests/testAffinity/ft-psk-ccmp-1.conf
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
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
|
||||||
41
autotests/testAffinity/ft-psk-ccmp-2.conf
Normal file
41
autotests/testAffinity/ft-psk-ccmp-2.conf
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
hw_mode=g
|
||||||
|
channel=2
|
||||||
|
ssid=TestFT
|
||||||
|
utf8_ssid=1
|
||||||
|
ctrl_interface=/var/run/hostapd
|
||||||
|
|
||||||
|
r1_key_holder=120000000002
|
||||||
|
nas_identifier=dummy2
|
||||||
|
|
||||||
|
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
|
||||||
8
autotests/testAffinity/hw.conf
Normal file
8
autotests/testAffinity/hw.conf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[SETUP]
|
||||||
|
num_radios=3
|
||||||
|
start_iwd=0
|
||||||
|
hwsim_medium=yes
|
||||||
|
|
||||||
|
[HOSTAPD]
|
||||||
|
rad0=ft-psk-ccmp-1.conf
|
||||||
|
rad1=ft-psk-ccmp-2.conf
|
||||||
5
autotests/testAffinity/main.conf
Normal file
5
autotests/testAffinity/main.conf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[Scan]
|
||||||
|
DisableMacAddressRandomization=true
|
||||||
|
|
||||||
|
[General]
|
||||||
|
RoamRetryInterval=1
|
||||||
216
autotests/testAffinity/test_set_affinity.py
Normal file
216
autotests/testAffinity/test_set_affinity.py
Normal file
@ -0,0 +1,216 @@
|
|||||||
|
#! /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)
|
||||||
@ -260,12 +260,69 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
self.wd.unregister_psk_agent(psk_agent)
|
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):
|
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)
|
self.wd = IWD(True)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
IWD.clear_storage()
|
IWD.clear_storage()
|
||||||
self.wd = None
|
self.wd = None
|
||||||
|
self.rule0.drop = False
|
||||||
|
self.rule1.drop = False
|
||||||
|
self.rule2.drop = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
|||||||
2
autotests/testBSSBlacklist/main.conf.disabled
Normal file
2
autotests/testBSSBlacklist/main.conf.disabled
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[Blacklist]
|
||||||
|
InitialTimeout=0
|
||||||
98
autotests/testBasicServiceSet/basic_service_set_test.py
Normal file
98
autotests/testBasicServiceSet/basic_service_set_test.py
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
#! /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)
|
||||||
8
autotests/testBasicServiceSet/hw.conf
Normal file
8
autotests/testBasicServiceSet/hw.conf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[SETUP]
|
||||||
|
num_radios=3
|
||||||
|
hwsim_medium=yes
|
||||||
|
start_iwd=no
|
||||||
|
|
||||||
|
[HOSTAPD]
|
||||||
|
rad0=ssidTKIP-1.conf
|
||||||
|
rad1=ssidTKIP-2.conf
|
||||||
7
autotests/testBasicServiceSet/ssidTKIP-1.conf
Normal file
7
autotests/testBasicServiceSet/ssidTKIP-1.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
hw_mode=g
|
||||||
|
channel=1
|
||||||
|
ssid=ssidTKIP
|
||||||
|
|
||||||
|
wpa=1
|
||||||
|
wpa_pairwise=TKIP
|
||||||
|
wpa_passphrase=secret123
|
||||||
7
autotests/testBasicServiceSet/ssidTKIP-2.conf
Normal file
7
autotests/testBasicServiceSet/ssidTKIP-2.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
hw_mode=g
|
||||||
|
channel=2
|
||||||
|
ssid=ssidTKIP
|
||||||
|
|
||||||
|
wpa=1
|
||||||
|
wpa_pairwise=TKIP
|
||||||
|
wpa_passphrase=secret123
|
||||||
5
autotests/testBasicServiceSet/ssidTKIP.psk
Normal file
5
autotests/testBasicServiceSet/ssidTKIP.psk
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[Security]
|
||||||
|
Passphrase=secret123
|
||||||
|
|
||||||
|
[Settings]
|
||||||
|
AutoConnect=False
|
||||||
@ -11,7 +11,7 @@ from iwd import IWD
|
|||||||
|
|
||||||
class Test8021xNetwork(unittest.TestCase):
|
class Test8021xNetwork(unittest.TestCase):
|
||||||
'''
|
'''
|
||||||
The bellow test cases excesise the following connection scenarios:
|
The below test cases excesise the following connection scenarios:
|
||||||
|
|
||||||
Network config is
|
Network config is
|
||||||
present at start time: Connect: AutoConnect: Result:
|
present at start time: Connect: AutoConnect: Result:
|
||||||
|
|||||||
@ -11,7 +11,7 @@ from iwd import IWD
|
|||||||
|
|
||||||
class TestOpenNetwork(unittest.TestCase):
|
class TestOpenNetwork(unittest.TestCase):
|
||||||
'''
|
'''
|
||||||
The bellow test cases excesise the following connection scenarios:
|
The below test cases excesise the following connection scenarios:
|
||||||
|
|
||||||
Network config is
|
Network config is
|
||||||
present at start time: Connect: AutoConnect: Result:
|
present at start time: Connect: AutoConnect: Result:
|
||||||
|
|||||||
@ -11,7 +11,7 @@ from iwd import IWD
|
|||||||
|
|
||||||
class TestWpaNetwork(unittest.TestCase):
|
class TestWpaNetwork(unittest.TestCase):
|
||||||
'''
|
'''
|
||||||
The bellow test cases exercise the following connection scenarios:
|
The below test cases exercise the following connection scenarios:
|
||||||
|
|
||||||
Network config is
|
Network config is
|
||||||
present at start time: Connect: AutoConnect: Result:
|
present at start time: Connect: AutoConnect: Result:
|
||||||
|
|||||||
@ -38,20 +38,18 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
def test_iwd_as_enrollee_scan_after(self):
|
def test_iwd_as_enrollee_scan_after(self):
|
||||||
self.wpas.disconnect()
|
self.wpas.disconnect()
|
||||||
|
self.device.autoconnect = True
|
||||||
uri = self.device.dpp_start_enrollee()
|
uri = self.device.dpp_start_enrollee()
|
||||||
|
|
||||||
self.wpas.dpp_configurator_create(uri)
|
self.wpas.dpp_configurator_create(uri)
|
||||||
self.wpas.dpp_configurator_start('ssidCCMP', 'secret123')
|
self.wpas.dpp_configurator_start('ssidCCMP', 'secret123')
|
||||||
|
|
||||||
self.hapd.reload()
|
|
||||||
|
|
||||||
with self.assertRaises(Exception):
|
with self.assertRaises(Exception):
|
||||||
self.device.get_ordered_network('ssidCCMP', scan_if_needed=False)
|
self.device.get_ordered_network('ssidCCMP', scan_if_needed=False)
|
||||||
|
|
||||||
|
self.hapd.reload()
|
||||||
self.hapd.wait_for_event('AP-ENABLED')
|
self.hapd.wait_for_event('AP-ENABLED')
|
||||||
|
|
||||||
self.device.autoconnect = True
|
|
||||||
|
|
||||||
condition = 'obj.state == DeviceState.connected'
|
condition = 'obj.state == DeviceState.connected'
|
||||||
self.wd.wait_for_object_condition(self.device, condition)
|
self.wd.wait_for_object_condition(self.device, condition)
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import unittest
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append('../util')
|
sys.path.append('../util')
|
||||||
from iwd import IWD, SharedCodeAgent
|
from iwd import IWD, SharedCodeAgent, DeviceState
|
||||||
from iwd import DeviceProvisioning
|
from iwd import DeviceProvisioning
|
||||||
from wpas import Wpas
|
from wpas import Wpas
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
@ -160,10 +160,8 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
def test_pkex_iwd_to_iwd(self):
|
def test_pkex_iwd_to_iwd(self):
|
||||||
self.start_iwd_pkex_configurator(self.device[0])
|
self.start_iwd_pkex_configurator(self.device[0])
|
||||||
|
|
||||||
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
|
|
||||||
|
|
||||||
self.device[1].autoconnect = True
|
self.device[1].autoconnect = True
|
||||||
|
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
|
||||||
|
|
||||||
condition = 'obj.state == DeviceState.connected'
|
condition = 'obj.state == DeviceState.connected'
|
||||||
self.wd.wait_for_object_condition(self.device[1], condition)
|
self.wd.wait_for_object_condition(self.device[1], condition)
|
||||||
@ -176,10 +174,8 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
def test_pkex_configurator_with_agent(self):
|
def test_pkex_configurator_with_agent(self):
|
||||||
self.start_iwd_pkex_configurator(self.device[0], agent=True)
|
self.start_iwd_pkex_configurator(self.device[0], agent=True)
|
||||||
|
|
||||||
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
|
|
||||||
|
|
||||||
self.device[1].autoconnect = True
|
self.device[1].autoconnect = True
|
||||||
|
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
|
||||||
|
|
||||||
condition = 'obj.state == DeviceState.connected'
|
condition = 'obj.state == DeviceState.connected'
|
||||||
self.wd.wait_for_object_condition(self.device[1], condition)
|
self.wd.wait_for_object_condition(self.device[1], condition)
|
||||||
@ -198,8 +194,8 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
self.start_iwd_pkex_configurator(self.device[0])
|
self.start_iwd_pkex_configurator(self.device[0])
|
||||||
|
|
||||||
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
|
|
||||||
self.device[1].autoconnect = False
|
self.device[1].autoconnect = False
|
||||||
|
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
|
||||||
|
|
||||||
condition = 'obj.state == DeviceState.connected'
|
condition = 'obj.state == DeviceState.connected'
|
||||||
self.wd.wait_for_object_condition(self.device[1], condition)
|
self.wd.wait_for_object_condition(self.device[1], condition)
|
||||||
@ -210,6 +206,24 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertIn("SendHostname=true", settings)
|
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):
|
def test_existing_hidden_network(self):
|
||||||
self.hapd_hidden.reload()
|
self.hapd_hidden.reload()
|
||||||
self.hapd_hidden.wait_for_event('AP-ENABLED')
|
self.hapd_hidden.wait_for_event('AP-ENABLED')
|
||||||
@ -222,8 +236,9 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
self.start_iwd_pkex_configurator(self.device[0], profile='ssidHidden.psk')
|
self.start_iwd_pkex_configurator(self.device[0], profile='ssidHidden.psk')
|
||||||
|
|
||||||
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
|
|
||||||
self.device[1].autoconnect = False
|
self.device[1].autoconnect = False
|
||||||
|
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
|
||||||
|
|
||||||
|
|
||||||
condition = 'obj.state == DeviceState.connected'
|
condition = 'obj.state == DeviceState.connected'
|
||||||
self.wd.wait_for_object_condition(self.device[1], condition)
|
self.wd.wait_for_object_condition(self.device[1], condition)
|
||||||
@ -239,8 +254,8 @@ class Test(unittest.TestCase):
|
|||||||
self.hapd_hidden.wait_for_event('AP-ENABLED')
|
self.hapd_hidden.wait_for_event('AP-ENABLED')
|
||||||
self.start_iwd_pkex_configurator(self.device[0], profile='ssidHidden.psk')
|
self.start_iwd_pkex_configurator(self.device[0], profile='ssidHidden.psk')
|
||||||
|
|
||||||
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
|
|
||||||
self.device[1].autoconnect = False
|
self.device[1].autoconnect = False
|
||||||
|
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
|
||||||
|
|
||||||
condition = 'obj.state == DeviceState.connected'
|
condition = 'obj.state == DeviceState.connected'
|
||||||
self.wd.wait_for_object_condition(self.device[1], condition)
|
self.wd.wait_for_object_condition(self.device[1], condition)
|
||||||
|
|||||||
107
autotests/testDPP/state_change_test.py
Normal file
107
autotests/testDPP/state_change_test.py
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
#!/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)
|
||||||
@ -104,7 +104,7 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertTrue(self.profile_is_encrypted('ssidCCMP.psk'))
|
self.assertTrue(self.profile_is_encrypted('ssidCCMP.psk'))
|
||||||
|
|
||||||
# Tests that a profile that doesn't decrypt wont become a known network
|
# Tests that a profile that doesn't decrypt won't become a known network
|
||||||
def test_decryption_failure(self):
|
def test_decryption_failure(self):
|
||||||
bad_config = \
|
bad_config = \
|
||||||
'''
|
'''
|
||||||
|
|||||||
@ -1,2 +1,5 @@
|
|||||||
[Security]
|
[Security]
|
||||||
Passphrase=secret123
|
Passphrase=secret123
|
||||||
|
|
||||||
|
[General]
|
||||||
|
AutoConnect=false
|
||||||
|
|||||||
76
autotests/testFrameFuzzing/fake_ap.py
Normal file
76
autotests/testFrameFuzzing/fake_ap.py
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
import unittest
|
||||||
|
import sys
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
from scapy.layers.dot11 import *
|
||||||
|
from scapy.arch import str2mac
|
||||||
|
try:
|
||||||
|
from scapy.arch import get_if_raw_hwaddr
|
||||||
|
except:
|
||||||
|
from scapy.arch.unix import get_if_raw_hwaddr
|
||||||
|
from time import time, sleep
|
||||||
|
from threading import Thread
|
||||||
|
|
||||||
|
def if_hwaddr(iff):
|
||||||
|
return str2mac(get_if_raw_hwaddr(iff)[1])
|
||||||
|
|
||||||
|
def config_mon(iface, channel):
|
||||||
|
"""set the interface in monitor mode and then change channel using iw"""
|
||||||
|
os.system("ip link set dev %s down" % iface)
|
||||||
|
os.system("iw dev %s set type monitor" % iface)
|
||||||
|
os.system("ip link set dev %s up" % iface)
|
||||||
|
os.system("iw dev %s set channel %d" % (iface, channel))
|
||||||
|
|
||||||
|
class AP:
|
||||||
|
def __init__(self, ssid, psk, mac=None, mode="stdio", iface="wlan0", channel=1):
|
||||||
|
self.channel = channel
|
||||||
|
self.iface = iface
|
||||||
|
self.mode = mode
|
||||||
|
if self.mode == "iface":
|
||||||
|
if not mac:
|
||||||
|
mac = if_hwaddr(iface)
|
||||||
|
config_mon(iface, channel)
|
||||||
|
if not mac:
|
||||||
|
raise Exception("Need a mac")
|
||||||
|
else:
|
||||||
|
self.mac = mac
|
||||||
|
self.boottime = time()
|
||||||
|
|
||||||
|
def get_radiotap_header(self):
|
||||||
|
return RadioTap()
|
||||||
|
|
||||||
|
def dot11_beacon(self, contents):
|
||||||
|
evil_packet = (
|
||||||
|
self.get_radiotap_header()
|
||||||
|
/ Dot11(
|
||||||
|
subtype=8, addr1="ff:ff:ff:ff:ff:ff", addr2=self.mac, addr3=self.mac
|
||||||
|
)
|
||||||
|
/ Dot11Beacon(cap=0x3101)
|
||||||
|
/ contents
|
||||||
|
)
|
||||||
|
self.sendp(evil_packet)
|
||||||
|
|
||||||
|
def run(self, contents):
|
||||||
|
interval = 0.05
|
||||||
|
num_beacons = 100
|
||||||
|
|
||||||
|
while num_beacons:
|
||||||
|
self.dot11_beacon(contents)
|
||||||
|
sleep(interval)
|
||||||
|
num_beacons -= 1
|
||||||
|
|
||||||
|
def start(self, contents):
|
||||||
|
self.thread = Thread(target=self.run, args=(contents,))
|
||||||
|
self.thread.start()
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
self.thread.join()
|
||||||
|
|
||||||
|
def sendp(self, packet, verbose=False):
|
||||||
|
if self.mode == "stdio":
|
||||||
|
x = packet.build()
|
||||||
|
sys.stdout.buffer.write(struct.pack("<L", len(x)) + x)
|
||||||
|
sys.stdout.buffer.flush()
|
||||||
|
return
|
||||||
|
assert self.mode == "iface"
|
||||||
|
sendp(packet, iface=self.iface, verbose=False)
|
||||||
7
autotests/testFrameFuzzing/hw.conf
Normal file
7
autotests/testFrameFuzzing/hw.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[SETUP]
|
||||||
|
num_radios=2
|
||||||
|
start_iwd=0
|
||||||
|
hwsim_medium=yes
|
||||||
|
|
||||||
|
[rad1]
|
||||||
|
reserve=true
|
||||||
37
autotests/testFrameFuzzing/test_frame_fuzzing.py
Normal file
37
autotests/testFrameFuzzing/test_frame_fuzzing.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#! /usr/bin/python3
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import sys
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
from fake_ap import AP
|
||||||
|
|
||||||
|
sys.path.append('../util')
|
||||||
|
from iwd import IWD
|
||||||
|
|
||||||
|
# Probe frame that causes IWD to crash
|
||||||
|
beacon=b'\xdd\nPo\x9a\t\x0e\x00\x00\x19\x10\x00\xdd/Po\x9a\t\x0c\x02\x00\x00\xdd\x05\x03\x03\x03Po\x9a\x10\x00\x0b\x05\x0e\x00\x00\x00\x00\x0b\x05\x00\x00\x00\xdd\x05\x00\x03\x03\x03\x03\x00\x00\x00\xdd\x05\x03\x03\x03\x03\x03'
|
||||||
|
|
||||||
|
class Test(unittest.TestCase):
|
||||||
|
def test_beacon_crash(self):
|
||||||
|
wd = IWD(True)
|
||||||
|
|
||||||
|
devs = wd.list_devices()
|
||||||
|
|
||||||
|
self.assertEqual(len(devs), 1)
|
||||||
|
|
||||||
|
devs[0].autoconnect = True
|
||||||
|
|
||||||
|
os.system("iw phy rad1 interface add wlan1 type managed")
|
||||||
|
|
||||||
|
ap = AP("evilAP", "password1234", mode="iface", iface="wlan1", channel=4)
|
||||||
|
ap.start(beacon)
|
||||||
|
|
||||||
|
condition = "obj.scanning == True"
|
||||||
|
wd.wait_for_object_condition(devs[0], condition)
|
||||||
|
|
||||||
|
condition = "obj.scanning == False"
|
||||||
|
wd.wait_for_object_condition(devs[0], condition)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main(exit=True)
|
||||||
@ -12,7 +12,7 @@ from hostapd import HostapdCLI
|
|||||||
|
|
||||||
class TestWpaNetwork(unittest.TestCase):
|
class TestWpaNetwork(unittest.TestCase):
|
||||||
'''
|
'''
|
||||||
The bellow test cases excesise the following connection scenarios:
|
The below test cases excesise the following connection scenarios:
|
||||||
|
|
||||||
Network config is
|
Network config is
|
||||||
present at start time: Connect: AutoConnect: Result:
|
present at start time: Connect: AutoConnect: Result:
|
||||||
|
|||||||
@ -12,7 +12,7 @@ from hostapd import HostapdCLI
|
|||||||
|
|
||||||
class TestOpenNetwork(unittest.TestCase):
|
class TestOpenNetwork(unittest.TestCase):
|
||||||
'''
|
'''
|
||||||
The bellow test cases excesise the following connection scenarios:
|
The below test cases excesise the following connection scenarios:
|
||||||
|
|
||||||
Network config is
|
Network config is
|
||||||
present at start time: Connect: AutoConnect: Result:
|
present at start time: Connect: AutoConnect: Result:
|
||||||
|
|||||||
@ -12,7 +12,7 @@ from hostapd import HostapdCLI
|
|||||||
|
|
||||||
class TestWpaNetwork(unittest.TestCase):
|
class TestWpaNetwork(unittest.TestCase):
|
||||||
'''
|
'''
|
||||||
The bellow test cases excesise the following connection scenarios:
|
The below test cases excesise the following connection scenarios:
|
||||||
|
|
||||||
Network config is
|
Network config is
|
||||||
present at start time: Connect: AutoConnect: Result:
|
present at start time: Connect: AutoConnect: Result:
|
||||||
|
|||||||
@ -4,17 +4,15 @@ import unittest
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append('../util')
|
sys.path.append('../util')
|
||||||
import iwd
|
|
||||||
from iwd import IWD
|
from iwd import IWD
|
||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from hwsim import Hwsim
|
||||||
import testutil
|
|
||||||
import os
|
import os
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
def connect_network(self, wd, device, network):
|
def connect_network(self, wd, device, network):
|
||||||
ordered_network = device.get_ordered_network(network)
|
ordered_network = device.get_ordered_network(network, full_scan=True)
|
||||||
|
|
||||||
condition = 'not obj.connected'
|
condition = 'not obj.connected'
|
||||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||||
@ -30,7 +28,7 @@ class Test(unittest.TestCase):
|
|||||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||||
|
|
||||||
def test_connection_success(self):
|
def test_connection_success(self):
|
||||||
wd = IWD(True, '/tmp')
|
wd = self.wd
|
||||||
|
|
||||||
psk_agent = PSKAgent("secret123")
|
psk_agent = PSKAgent("secret123")
|
||||||
wd.register_psk_agent(psk_agent)
|
wd.register_psk_agent(psk_agent)
|
||||||
@ -38,6 +36,11 @@ class Test(unittest.TestCase):
|
|||||||
devices = wd.list_devices(1)
|
devices = wd.list_devices(1)
|
||||||
device = devices[0]
|
device = devices[0]
|
||||||
|
|
||||||
|
|
||||||
|
# Set the signals so that the 2.4GHz ranking will be higher
|
||||||
|
self.ssidccmp_2g_rule.signal = -2000
|
||||||
|
self.ssidccmp_5g_rule.signal = -8000
|
||||||
|
|
||||||
#
|
#
|
||||||
# Connect to the PSK network, then Hotspot so IWD creates 2 entries in
|
# Connect to the PSK network, then Hotspot so IWD creates 2 entries in
|
||||||
# the known frequency file.
|
# the known frequency file.
|
||||||
@ -75,8 +78,10 @@ class Test(unittest.TestCase):
|
|||||||
#
|
#
|
||||||
self.assertIsNotNone(psk_freqs)
|
self.assertIsNotNone(psk_freqs)
|
||||||
self.assertIsNotNone(psk_uuid)
|
self.assertIsNotNone(psk_uuid)
|
||||||
self.assertIn('5180', psk_freqs)
|
|
||||||
self.assertIn('2412', psk_freqs)
|
# The 2.4GHz frequency should come first, as it was ranked higher
|
||||||
|
self.assertEqual('2412', psk_freqs[0])
|
||||||
|
self.assertEqual('5180', psk_freqs[1])
|
||||||
|
|
||||||
self.assertIsNotNone(hs20_freqs)
|
self.assertIsNotNone(hs20_freqs)
|
||||||
self.assertIsNotNone(hs20_uuid)
|
self.assertIsNotNone(hs20_uuid)
|
||||||
@ -92,6 +97,10 @@ class Test(unittest.TestCase):
|
|||||||
psk_agent = PSKAgent("secret123")
|
psk_agent = PSKAgent("secret123")
|
||||||
wd.register_psk_agent(psk_agent)
|
wd.register_psk_agent(psk_agent)
|
||||||
|
|
||||||
|
# Now set the signals so that the 5GHz ranking will be higher
|
||||||
|
self.ssidccmp_2g_rule.signal = -8000
|
||||||
|
self.ssidccmp_5g_rule.signal = -2000
|
||||||
|
|
||||||
#
|
#
|
||||||
# Reconnect, this should generate a completely new UUID since we
|
# Reconnect, this should generate a completely new UUID since we
|
||||||
# previously forgot the network.
|
# previously forgot the network.
|
||||||
@ -120,8 +129,78 @@ class Test(unittest.TestCase):
|
|||||||
self.assertIsNotNone(psk_freqs)
|
self.assertIsNotNone(psk_freqs)
|
||||||
self.assertIsNotNone(psk_uuid2)
|
self.assertIsNotNone(psk_uuid2)
|
||||||
self.assertNotEqual(psk_uuid, psk_uuid2)
|
self.assertNotEqual(psk_uuid, psk_uuid2)
|
||||||
self.assertIn('5180', psk_freqs)
|
# Now the 5GHz frequency should be first
|
||||||
self.assertIn('2412', psk_freqs)
|
self.assertEqual('5180', psk_freqs[0])
|
||||||
|
self.assertEqual('2412', psk_freqs[1])
|
||||||
|
|
||||||
|
def test_maximum_frequencies(self):
|
||||||
|
psk_agent = PSKAgent("secret123")
|
||||||
|
self.wd.register_psk_agent(psk_agent)
|
||||||
|
|
||||||
|
devices = self.wd.list_devices(1)
|
||||||
|
device = devices[0]
|
||||||
|
|
||||||
|
# Connect and generate a known frequencies file
|
||||||
|
self.connect_network(self.wd, device, 'ssidCCMP')
|
||||||
|
|
||||||
|
self.wd.unregister_psk_agent(psk_agent)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Rewrite the known frequencies file to move the valid network
|
||||||
|
# frequencies to the end, past the maximum for a quick scan
|
||||||
|
#
|
||||||
|
config = ConfigParser()
|
||||||
|
config.read('/tmp/iwd/.known_network.freq')
|
||||||
|
for s in config.sections():
|
||||||
|
if os.path.basename(config[s]['name']) == 'ssidCCMP.psk':
|
||||||
|
config.set(s, 'list', "2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472 2484 2412 5180")
|
||||||
|
break
|
||||||
|
|
||||||
|
self.wd.stop()
|
||||||
|
|
||||||
|
with open('/tmp/iwd/.known_network.freq', 'w') as f:
|
||||||
|
config.write(f)
|
||||||
|
|
||||||
|
self.wd = IWD(True)
|
||||||
|
|
||||||
|
devices = self.wd.list_devices(1)
|
||||||
|
device = devices[0]
|
||||||
|
|
||||||
|
device.autoconnect = True
|
||||||
|
|
||||||
|
device.wait_for_event("autoconnect_quick")
|
||||||
|
|
||||||
|
condition = "obj.scanning == True"
|
||||||
|
self.wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
condition = "obj.scanning == False"
|
||||||
|
self.wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check that the quick scan didn't return any results
|
||||||
|
#
|
||||||
|
with self.assertRaises(Exception):
|
||||||
|
device.get_ordered_network("ssidCCMP", scan_if_needed=False)
|
||||||
|
|
||||||
|
device.wait_for_event("autoconnect_full")
|
||||||
|
|
||||||
|
condition = "obj.scanning == True"
|
||||||
|
self.wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
condition = "obj.scanning == False"
|
||||||
|
self.wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
#
|
||||||
|
# The full scan should now see the network
|
||||||
|
#
|
||||||
|
device.get_ordered_network("ssidCCMP", scan_if_needed=False)
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.wd = IWD(True)
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.wd.stop()
|
||||||
|
self.wd = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
@ -129,10 +208,23 @@ class Test(unittest.TestCase):
|
|||||||
conf = '[General]\nDisableANQP=0\n'
|
conf = '[General]\nDisableANQP=0\n'
|
||||||
os.system('echo "%s" > /tmp/main.conf' % conf)
|
os.system('echo "%s" > /tmp/main.conf' % conf)
|
||||||
|
|
||||||
|
hwsim = Hwsim()
|
||||||
|
|
||||||
|
cls.ssidccmp_2g_rule = hwsim.rules.create()
|
||||||
|
cls.ssidccmp_2g_rule.source = hwsim.get_radio('rad1').addresses[0]
|
||||||
|
cls.ssidccmp_2g_rule.enabled = True
|
||||||
|
|
||||||
|
cls.ssidccmp_5g_rule = hwsim.rules.create()
|
||||||
|
cls.ssidccmp_5g_rule.source = hwsim.get_radio('rad2').addresses[0]
|
||||||
|
cls.ssidccmp_5g_rule.enabled = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
IWD.clear_storage()
|
IWD.clear_storage()
|
||||||
os.remove('/tmp/main.conf')
|
os.remove('/tmp/main.conf')
|
||||||
|
|
||||||
|
cls.ssidccmp_2g_rule.remove()
|
||||||
|
cls.ssidccmp_5g_rule.remove()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main(exit=True)
|
unittest.main(exit=True)
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
num_radios=5
|
num_radios=5
|
||||||
start_iwd=0
|
start_iwd=0
|
||||||
reg_domain=US
|
reg_domain=US
|
||||||
|
hwsim_medium=yes
|
||||||
|
|
||||||
[HOSTAPD]
|
[HOSTAPD]
|
||||||
rad0=ssidNew.conf
|
rad0=ssidNew.conf
|
||||||
|
|||||||
@ -11,7 +11,7 @@ from iwd import NetworkType
|
|||||||
|
|
||||||
class TestMFP(unittest.TestCase):
|
class TestMFP(unittest.TestCase):
|
||||||
'''
|
'''
|
||||||
The bellow test cases excesise the following MFP option setting scenarios:
|
The below test cases excesise the following MFP option setting scenarios:
|
||||||
|
|
||||||
IWD_MFP: AP_MFP: Result:
|
IWD_MFP: AP_MFP: Result:
|
||||||
0 0 No MFP, connection succeeds
|
0 0 No MFP, connection succeeds
|
||||||
|
|||||||
2
autotests/testNetconfig/autoconnect.psk
Normal file
2
autotests/testNetconfig/autoconnect.psk
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[IPv4]
|
||||||
|
SendHostname=true
|
||||||
@ -137,7 +137,7 @@ class Test(unittest.TestCase):
|
|||||||
# since (T2 - T1) / 2 is shorter than 60s. It is now about 10s since the last
|
# since (T2 - T1) / 2 is shorter than 60s. It is now about 10s since the last
|
||||||
# renewal or 5s before the next DHCPREQUEST frame that is going to be lost. We'll
|
# renewal or 5s before the next DHCPREQUEST frame that is going to be lost. We'll
|
||||||
# wait T1 seconds, so until about 10s after the failed attempt, we'll check that
|
# wait T1 seconds, so until about 10s after the failed attempt, we'll check that
|
||||||
# there was no renewal by that time, just in case, and we'll reenable frame delivery.
|
# there was no renewal by that time, just in case, and we'll re-enable frame delivery.
|
||||||
# We'll then wait another 60s and we should see the lease has been successfully
|
# We'll then wait another 60s and we should see the lease has been successfully
|
||||||
# renewed some 10 seconds earlier on the 1st DHCPREQUEST retransmission.
|
# renewed some 10 seconds earlier on the 1st DHCPREQUEST retransmission.
|
||||||
#
|
#
|
||||||
|
|||||||
@ -81,14 +81,21 @@ class Test(unittest.TestCase):
|
|||||||
self.assertEqual(expected_routes6, set(testutil.get_routes6(ifname)))
|
self.assertEqual(expected_routes6, set(testutil.get_routes6(ifname)))
|
||||||
|
|
||||||
rclog = open('/tmp/resolvconf.log', 'r')
|
rclog = open('/tmp/resolvconf.log', 'r')
|
||||||
entries = rclog.readlines()
|
entries = [l.strip() for l in rclog.readlines()[-7:]]
|
||||||
rclog.close()
|
rclog.close()
|
||||||
expected_rclog = ['-a %s.dns\n' % (ifname,), 'nameserver 192.168.1.2\n',
|
expected_rclog = [
|
||||||
'nameserver 3ffe:501:ffff:100::10\n', 'nameserver 3ffe:501:ffff:100::50\n',
|
'-a %s.dns' % (ifname,),
|
||||||
'-a %s.domain\n' % (ifname,), 'search test1\n', 'search test2\n']
|
'nameserver 192.168.1.2',
|
||||||
# Every resolvconf -a run overwrites the previous settings. Check the last seven lines
|
'nameserver 3ffe:501:ffff:100::10',
|
||||||
# of our log since we care about the end result here.
|
'nameserver 3ffe:501:ffff:100::50',
|
||||||
self.assertEqual(expected_rclog, entries[-7:])
|
'-a %s.domain' % (ifname,),
|
||||||
|
'search test1',
|
||||||
|
'search test2'
|
||||||
|
]
|
||||||
|
|
||||||
|
for line in expected_rclog:
|
||||||
|
self.assertIn(line, entries)
|
||||||
|
expected_rclog.remove(line)
|
||||||
|
|
||||||
device.disconnect()
|
device.disconnect()
|
||||||
condition = 'not obj.connected'
|
condition = 'not obj.connected'
|
||||||
|
|||||||
@ -91,16 +91,11 @@ class Test(unittest.TestCase):
|
|||||||
# using the same static config. The new client's ACD client should
|
# using the same static config. The new client's ACD client should
|
||||||
# detect an IP conflict and not allow the device to reach the
|
# detect an IP conflict and not allow the device to reach the
|
||||||
# "connected" state although the DBus .Connect call will succeed.
|
# "connected" state although the DBus .Connect call will succeed.
|
||||||
ordered_network.network_object.connect()
|
with self.assertRaises(iwd.FailedEx):
|
||||||
self.assertEqual(dev2.state, iwd.DeviceState.connecting)
|
ordered_network.network_object.connect(timeout=500)
|
||||||
try:
|
|
||||||
# We should either stay in "connecting" indefinitely or move to
|
condition = 'obj.state == DeviceState.disconnected'
|
||||||
# "disconnecting"
|
|
||||||
condition = 'obj.state != DeviceState.connecting'
|
|
||||||
iwd_ns0_1.wait_for_object_condition(dev2, condition, max_wait=21)
|
iwd_ns0_1.wait_for_object_condition(dev2, condition, max_wait=21)
|
||||||
self.assertEqual(dev2.state, iwd.DeviceState.disconnecting)
|
|
||||||
except TimeoutError:
|
|
||||||
dev2.disconnect()
|
|
||||||
|
|
||||||
iwd_ns0_1.unregister_psk_agent(psk_agent_ns0_1)
|
iwd_ns0_1.unregister_psk_agent(psk_agent_ns0_1)
|
||||||
del dev2
|
del dev2
|
||||||
|
|||||||
78
autotests/testNetconfig/timeout_test.py
Normal file
78
autotests/testNetconfig/timeout_test.py
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
import unittest
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
sys.path.append('../util')
|
||||||
|
from iwd import IWD
|
||||||
|
from iwd import PSKAgent
|
||||||
|
from iwd import NetworkType
|
||||||
|
|
||||||
|
class Test(unittest.TestCase):
|
||||||
|
def connect_failure(self, ex):
|
||||||
|
self.failure_triggered = True
|
||||||
|
|
||||||
|
def test_netconfig_timeout(self):
|
||||||
|
IWD.copy_to_storage('autoconnect.psk', name='ap-ns1.psk')
|
||||||
|
|
||||||
|
wd = IWD(True)
|
||||||
|
|
||||||
|
psk_agent = PSKAgent("secret123")
|
||||||
|
wd.register_psk_agent(psk_agent)
|
||||||
|
|
||||||
|
devices = wd.list_devices(1)
|
||||||
|
device = devices[0]
|
||||||
|
|
||||||
|
ordered_network = device.get_ordered_network('ap-ns1')
|
||||||
|
|
||||||
|
self.assertEqual(ordered_network.type, NetworkType.psk)
|
||||||
|
|
||||||
|
condition = 'not obj.connected'
|
||||||
|
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||||
|
|
||||||
|
self.failure_triggered = False
|
||||||
|
|
||||||
|
# Set our error handler here so we can check if it fails
|
||||||
|
ordered_network.network_object.connect(
|
||||||
|
wait=False,
|
||||||
|
timeout=1000,
|
||||||
|
error_handler=self.connect_failure
|
||||||
|
)
|
||||||
|
|
||||||
|
# IWD should attempt to try both BSS's with both failing netconfig.
|
||||||
|
# Then the autoconnect list should be exhausted, and IWD should
|
||||||
|
# transition to a disconnected state, then proceed to full autoconnect.
|
||||||
|
device.wait_for_event("netconfig-failed", timeout=1000)
|
||||||
|
device.wait_for_event("netconfig-failed", timeout=1000)
|
||||||
|
device.wait_for_event("disconnected")
|
||||||
|
|
||||||
|
device.wait_for_event("autoconnect_full")
|
||||||
|
|
||||||
|
# The connect call should have failed
|
||||||
|
self.assertTrue(self.failure_triggered)
|
||||||
|
|
||||||
|
condition = "obj.scanning"
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
condition = "not obj.scanning"
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
# IWD should attempt to connect, but it will of course fail again.
|
||||||
|
device.wait_for_event("netconfig-failed", timeout=1000)
|
||||||
|
|
||||||
|
device.disconnect()
|
||||||
|
condition = 'obj.state == DeviceState.disconnected'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
cls.orig_path = os.environ['PATH']
|
||||||
|
os.environ['PATH'] = '/tmp/test-bin:' + os.environ['PATH']
|
||||||
|
IWD.copy_to_storage('resolvconf', '/tmp/test-bin')
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
IWD.clear_storage()
|
||||||
|
os.system('rm -rf /tmp/radvd.conf /tmp/resolvconf.log /tmp/test-bin')
|
||||||
|
os.environ['PATH'] = cls.orig_path
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main(exit=True)
|
||||||
2
autotests/testNetconfigRoam/TestFT.psk
Normal file
2
autotests/testNetconfigRoam/TestFT.psk
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[Security]
|
||||||
|
Passphrase=EasilyGuessedPassword
|
||||||
41
autotests/testNetconfigRoam/ft-psk-ccmp-1.conf
Normal file
41
autotests/testNetconfigRoam/ft-psk-ccmp-1.conf
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
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=1
|
||||||
|
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
|
||||||
41
autotests/testNetconfigRoam/ft-psk-ccmp-2.conf
Normal file
41
autotests/testNetconfigRoam/ft-psk-ccmp-2.conf
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
hw_mode=g
|
||||||
|
channel=2
|
||||||
|
ssid=TestFT
|
||||||
|
utf8_ssid=1
|
||||||
|
ctrl_interface=/var/run/hostapd
|
||||||
|
|
||||||
|
r1_key_holder=120000000002
|
||||||
|
nas_identifier=dummy2
|
||||||
|
|
||||||
|
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=1
|
||||||
|
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
|
||||||
8
autotests/testNetconfigRoam/hw.conf
Normal file
8
autotests/testNetconfigRoam/hw.conf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[SETUP]
|
||||||
|
num_radios=3
|
||||||
|
start_iwd=0
|
||||||
|
hwsim_medium=yes
|
||||||
|
|
||||||
|
[HOSTAPD]
|
||||||
|
rad0=ft-psk-ccmp-1.conf
|
||||||
|
rad1=ft-psk-ccmp-2.conf
|
||||||
3
autotests/testNetconfigRoam/main.conf
Normal file
3
autotests/testNetconfigRoam/main.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[General]
|
||||||
|
EnableNetworkConfiguration=true
|
||||||
|
RoamRetryInterval=1
|
||||||
91
autotests/testNetconfigRoam/netconfig_roam_test.py
Normal file
91
autotests/testNetconfigRoam/netconfig_roam_test.py
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
#! /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 iwd import DeviceState
|
||||||
|
from hwsim import Hwsim
|
||||||
|
from hostapd import HostapdCLI
|
||||||
|
import testutil
|
||||||
|
|
||||||
|
class Test(unittest.TestCase):
|
||||||
|
def test_roam_before_netconfig(self):
|
||||||
|
wd = IWD(True)
|
||||||
|
|
||||||
|
device = wd.list_devices(1)[0]
|
||||||
|
device.get_ordered_network('TestFT', full_scan=True)
|
||||||
|
device.connect_bssid(self.bss_hostapd[1].bssid, wait=False)
|
||||||
|
|
||||||
|
self.bss_hostapd[1].wait_for_event(f'AP-STA-CONNECTED {device.address}')
|
||||||
|
device.wait_for_event("connecting (netconfig)")
|
||||||
|
|
||||||
|
roam_to = 0
|
||||||
|
roam_from = 1
|
||||||
|
|
||||||
|
# Roam back and forth, ensuring that the state transitions between
|
||||||
|
# roaming and connecting (netconfig).
|
||||||
|
for _ in range(0, 5):
|
||||||
|
self.rules[roam_to].signal = -2000
|
||||||
|
self.rules[roam_from].signal = -8000
|
||||||
|
|
||||||
|
# Station should internally transition to roaming, but remain in a
|
||||||
|
# connecting state on DBus
|
||||||
|
device.wait_for_event("ft-roaming")
|
||||||
|
self.assertEqual(device.state, DeviceState.connecting)
|
||||||
|
|
||||||
|
self.bss_hostapd[roam_to].wait_for_event(f'AP-STA-CONNECTED {device.address}')
|
||||||
|
device.wait_for_event("connecting (netconfig)")
|
||||||
|
|
||||||
|
tmp = roam_from
|
||||||
|
roam_from = roam_to
|
||||||
|
roam_to = tmp
|
||||||
|
|
||||||
|
self.bss_hostapd[roam_from].deauthenticate(device.address)
|
||||||
|
condition = 'obj.state == DeviceState.disconnected'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
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')
|
||||||
|
|
||||||
|
@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') ]
|
||||||
|
|
||||||
|
rule0 = hwsim.rules.create()
|
||||||
|
rule0.source = cls.bss_hostapd[0].bssid
|
||||||
|
rule0.signal = -6000
|
||||||
|
rule0.enabled = True
|
||||||
|
|
||||||
|
rule1 = hwsim.rules.create()
|
||||||
|
rule1.source = cls.bss_hostapd[1].bssid
|
||||||
|
rule1.signal = -2000
|
||||||
|
rule1.enabled = True
|
||||||
|
|
||||||
|
cls.rules = [rule0, rule1]
|
||||||
|
|
||||||
|
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.rules = None
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main(exit=True)
|
||||||
@ -64,6 +64,39 @@ class Test(unittest.TestCase):
|
|||||||
self.assertRaises(Exception, testutil.test_ifaces_connected,
|
self.assertRaises(Exception, testutil.test_ifaces_connected,
|
||||||
(hapd0.ifname, device.name, True, True))
|
(hapd0.ifname, device.name, True, True))
|
||||||
|
|
||||||
|
def test_auto_default_group(self):
|
||||||
|
wd = IWD()
|
||||||
|
hapd = HostapdCLI(config='ssidOWE-1.conf')
|
||||||
|
|
||||||
|
devices = wd.list_devices(1)
|
||||||
|
device = devices[0]
|
||||||
|
|
||||||
|
device.get_ordered_network('ssidOWE')
|
||||||
|
|
||||||
|
device.connect_bssid(hapd.bssid)
|
||||||
|
|
||||||
|
condition = 'obj.state == DeviceState.connected'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
# Should have rejected group 20, but still connected on 19
|
||||||
|
self.assertEqual(device.event_ocurred("ecc-group-rejected"), True)
|
||||||
|
|
||||||
|
testutil.test_iface_operstate()
|
||||||
|
testutil.test_ifaces_connected(device.name, hapd.ifname)
|
||||||
|
|
||||||
|
device.disconnect()
|
||||||
|
|
||||||
|
device.connect_bssid(hapd.bssid)
|
||||||
|
|
||||||
|
condition = 'obj.state == DeviceState.connected'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
# IWD should have used the default group, no rejection
|
||||||
|
self.assertEqual(device.event_ocurred("ecc-group-rejected"), False)
|
||||||
|
|
||||||
|
testutil.test_iface_operstate()
|
||||||
|
testutil.test_ifaces_connected(device.name, hapd.ifname)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
pass
|
pass
|
||||||
|
|||||||
114
autotests/testPMKSA-SAE/connection_test.py
Normal file
114
autotests/testPMKSA-SAE/connection_test.py
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.append('../util')
|
||||||
|
from iwd import IWD
|
||||||
|
from iwd import PSKAgent
|
||||||
|
from iwd import NetworkType
|
||||||
|
from hostapd import HostapdCLI
|
||||||
|
import testutil
|
||||||
|
|
||||||
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
|
def validate_connection(self, wd, ssid, hostapd, expected_group):
|
||||||
|
psk_agent = PSKAgent("secret123")
|
||||||
|
wd.register_psk_agent(psk_agent)
|
||||||
|
|
||||||
|
devices = wd.list_devices(1)
|
||||||
|
self.assertIsNotNone(devices)
|
||||||
|
device = devices[0]
|
||||||
|
|
||||||
|
device.disconnect()
|
||||||
|
|
||||||
|
network = device.get_ordered_network(ssid, full_scan=True)
|
||||||
|
|
||||||
|
self.assertEqual(network.type, NetworkType.psk)
|
||||||
|
|
||||||
|
network.network_object.connect()
|
||||||
|
|
||||||
|
condition = 'obj.state == DeviceState.connected'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
wd.wait(2)
|
||||||
|
|
||||||
|
testutil.test_iface_operstate(intf=device.name)
|
||||||
|
testutil.test_ifaces_connected(if0=device.name, if1=hostapd.ifname)
|
||||||
|
|
||||||
|
# Initial connection PMKSA should not be used. So we should see the
|
||||||
|
# SAE group set.
|
||||||
|
sta_status = hostapd.sta_status(device.address)
|
||||||
|
self.assertEqual(int(sta_status["sae_group"]), expected_group)
|
||||||
|
|
||||||
|
device.disconnect()
|
||||||
|
|
||||||
|
condition = 'not obj.connected'
|
||||||
|
wd.wait_for_object_condition(network.network_object, condition)
|
||||||
|
|
||||||
|
wd.unregister_psk_agent(psk_agent)
|
||||||
|
|
||||||
|
network.network_object.connect(wait=False)
|
||||||
|
|
||||||
|
condition = 'obj.state == DeviceState.connected'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
wd.wait(2)
|
||||||
|
|
||||||
|
testutil.test_iface_operstate(intf=device.name)
|
||||||
|
testutil.test_ifaces_connected(if0=device.name, if1=hostapd.ifname)
|
||||||
|
|
||||||
|
# Having connected once prior we should have a PMKSA and SAE should not
|
||||||
|
# have been used.
|
||||||
|
sta_status = hostapd.sta_status(device.address)
|
||||||
|
self.assertNotIn("sae_group", sta_status.keys())
|
||||||
|
|
||||||
|
device.disconnect()
|
||||||
|
|
||||||
|
condition = 'not obj.connected'
|
||||||
|
wd.wait_for_object_condition(network.network_object, condition)
|
||||||
|
|
||||||
|
hostapd.pmksa_flush()
|
||||||
|
|
||||||
|
wd.wait(5)
|
||||||
|
|
||||||
|
network.network_object.connect()
|
||||||
|
|
||||||
|
device.wait_for_event("pmksa-invalid-pmkid")
|
||||||
|
|
||||||
|
condition = 'obj.state == DeviceState.connected'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
wd.wait(2)
|
||||||
|
|
||||||
|
testutil.test_iface_operstate(intf=device.name)
|
||||||
|
testutil.test_ifaces_connected(if0=device.name, if1=hostapd.ifname)
|
||||||
|
|
||||||
|
# Manually flushing the PMKSA from the AP then reconnecting we should
|
||||||
|
# have failed (INVALID_PMKID) then retried the same BSS with SAE, not
|
||||||
|
# PMKSA.
|
||||||
|
sta_status = hostapd.sta_status(device.address)
|
||||||
|
self.assertEqual(int(sta_status["sae_group"]), expected_group)
|
||||||
|
|
||||||
|
def test_pmksa_sae(self):
|
||||||
|
self.hostapd.wait_for_event("AP-ENABLED")
|
||||||
|
self.validate_connection(self.wd, "ssidSAE", self.hostapd, 19)
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.hostapd.default()
|
||||||
|
self.wd = IWD(True)
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.wd.clear_storage()
|
||||||
|
self.wd = None
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
cls.hostapd = HostapdCLI(config='ssidSAE.conf')
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
pass
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main(exit=True)
|
||||||
7
autotests/testPMKSA-SAE/hw.conf
Normal file
7
autotests/testPMKSA-SAE/hw.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[SETUP]
|
||||||
|
num_radios=2
|
||||||
|
start_iwd=0
|
||||||
|
hwsim_medium=yes
|
||||||
|
|
||||||
|
[HOSTAPD]
|
||||||
|
rad0=ssidSAE.conf
|
||||||
12
autotests/testPMKSA-SAE/ssidSAE.conf
Normal file
12
autotests/testPMKSA-SAE/ssidSAE.conf
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
hw_mode=g
|
||||||
|
channel=1
|
||||||
|
ssid=ssidSAE
|
||||||
|
|
||||||
|
wpa=2
|
||||||
|
wpa_key_mgmt=SAE
|
||||||
|
wpa_pairwise=CCMP
|
||||||
|
sae_password=secret123
|
||||||
|
sae_groups=19
|
||||||
|
ieee80211w=2
|
||||||
|
sae_pwe=0
|
||||||
|
rsn_preauth=1
|
||||||
114
autotests/testPSK-roam/chan_switch_test.py
Normal file
114
autotests/testPSK-roam/chan_switch_test.py
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
#! /usr/bin/python3
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import sys, os
|
||||||
|
|
||||||
|
sys.path.append('../util')
|
||||||
|
from iwd import IWD
|
||||||
|
from iwd import NetworkType
|
||||||
|
from hostapd import HostapdCLI
|
||||||
|
from packaging import version
|
||||||
|
from subprocess import run
|
||||||
|
import re
|
||||||
|
import testutil
|
||||||
|
|
||||||
|
#
|
||||||
|
# The CSA handling was added in kernel 6.8, so for any earlier kernel this test
|
||||||
|
# won't pass.
|
||||||
|
#
|
||||||
|
def kernel_is_newer(min_version="6.8"):
|
||||||
|
proc = run(["uname", "-r"], capture_output=True)
|
||||||
|
|
||||||
|
version_str = proc.stdout.decode("utf-8")
|
||||||
|
match = re.match(r"(\d+\.\d+)", version_str)
|
||||||
|
if not match:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return version.parse(match.group(1)) >= version.parse(min_version)
|
||||||
|
|
||||||
|
class Test(unittest.TestCase):
|
||||||
|
def test_channel_switch_during_roam(self):
|
||||||
|
wd = self.wd
|
||||||
|
|
||||||
|
device = wd.list_devices(1)[0]
|
||||||
|
|
||||||
|
ordered_network = device.get_ordered_network('TestFT', full_scan=True)
|
||||||
|
|
||||||
|
self.assertEqual(ordered_network.type, NetworkType.psk)
|
||||||
|
|
||||||
|
condition = 'not obj.connected'
|
||||||
|
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||||
|
|
||||||
|
self.assertFalse(self.bss_hostapd[0].list_sta())
|
||||||
|
self.assertFalse(self.bss_hostapd[1].list_sta())
|
||||||
|
|
||||||
|
device.connect_bssid(self.bss_hostapd[0].bssid)
|
||||||
|
|
||||||
|
condition = 'obj.state == DeviceState.connected'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
|
||||||
|
|
||||||
|
testutil.test_iface_operstate(device.name)
|
||||||
|
testutil.test_ifaces_connected(self.bss_hostapd[0].ifname, device.name)
|
||||||
|
self.assertRaises(Exception, testutil.test_ifaces_connected,
|
||||||
|
(self.bss_hostapd[1].ifname, device.name, True, True))
|
||||||
|
|
||||||
|
# Start a channel switch and wait for it to begin
|
||||||
|
self.bss_hostapd[1].chan_switch(6, wait=False)
|
||||||
|
self.bss_hostapd[1].wait_for_event("CTRL-EVENT-STARTED-CHANNEL-SWITCH")
|
||||||
|
# Initiate a roam immediately which should get rejected by the kernel
|
||||||
|
device.roam(self.bss_hostapd[1].bssid)
|
||||||
|
|
||||||
|
# IWD should authenticate, then proceed to association
|
||||||
|
device.wait_for_event("ft-authenticating")
|
||||||
|
device.wait_for_event("ft-roaming")
|
||||||
|
|
||||||
|
# The kernel should reject the association, which should trigger a
|
||||||
|
# disconnect
|
||||||
|
condition = 'obj.state == DeviceState.disconnected'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
condition = 'obj.state == DeviceState.connected'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
|
||||||
|
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')
|
||||||
|
|
||||||
|
for hapd in self.bss_hostapd:
|
||||||
|
hapd.default()
|
||||||
|
|
||||||
|
self.wd.stop()
|
||||||
|
self.wd = None
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.wd = IWD(True)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
if not kernel_is_newer():
|
||||||
|
raise unittest.SkipTest()
|
||||||
|
|
||||||
|
IWD.copy_to_storage('TestFT.psk')
|
||||||
|
|
||||||
|
cls.bss_hostapd = [ HostapdCLI(config='ft-psk-ccmp-1.conf'),
|
||||||
|
HostapdCLI(config='ft-psk-ccmp-2.conf'),
|
||||||
|
HostapdCLI(config='ft-psk-ccmp-3.conf') ]
|
||||||
|
|
||||||
|
unused = HostapdCLI(config='ft-psk-ccmp-3.conf')
|
||||||
|
unused.disable()
|
||||||
|
|
||||||
|
cls.bss_hostapd[0].set_address('12:00:00:00:00:01')
|
||||||
|
cls.bss_hostapd[1].set_address('12:00:00:00:00:02')
|
||||||
|
cls.bss_hostapd[2].set_address('12:00:00:00:00:03')
|
||||||
|
|
||||||
|
HostapdCLI.group_neighbors(*cls.bss_hostapd)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
IWD.clear_storage()
|
||||||
|
cls.bss_hostapd = None
|
||||||
@ -91,13 +91,9 @@ class Test(unittest.TestCase):
|
|||||||
wd.wait_for_object_condition(device, condition)
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
def test_ft_psk(self):
|
def test_ft_psk(self):
|
||||||
wd = IWD(True)
|
self.validate_connection(self.wd)
|
||||||
|
|
||||||
self.validate_connection(wd)
|
|
||||||
|
|
||||||
def test_ft_psk_over_ds(self):
|
def test_ft_psk_over_ds(self):
|
||||||
wd = IWD(True)
|
|
||||||
|
|
||||||
self.bss_hostapd[0].set_value('ft_over_ds', '1')
|
self.bss_hostapd[0].set_value('ft_over_ds', '1')
|
||||||
self.bss_hostapd[0].reload()
|
self.bss_hostapd[0].reload()
|
||||||
self.bss_hostapd[0].wait_for_event("AP-ENABLED")
|
self.bss_hostapd[0].wait_for_event("AP-ENABLED")
|
||||||
@ -106,11 +102,9 @@ class Test(unittest.TestCase):
|
|||||||
self.bss_hostapd[1].reload()
|
self.bss_hostapd[1].reload()
|
||||||
self.bss_hostapd[1].wait_for_event("AP-ENABLED")
|
self.bss_hostapd[1].wait_for_event("AP-ENABLED")
|
||||||
|
|
||||||
self.validate_connection(wd, over_ds=True)
|
self.validate_connection(self.wd, over_ds=True)
|
||||||
|
|
||||||
def test_reassociate_psk(self):
|
def test_reassociate_psk(self):
|
||||||
wd = IWD(True)
|
|
||||||
|
|
||||||
self.bss_hostapd[0].set_value('wpa_key_mgmt', 'WPA-PSK')
|
self.bss_hostapd[0].set_value('wpa_key_mgmt', 'WPA-PSK')
|
||||||
self.bss_hostapd[0].reload()
|
self.bss_hostapd[0].reload()
|
||||||
self.bss_hostapd[0].wait_for_event("AP-ENABLED")
|
self.bss_hostapd[0].wait_for_event("AP-ENABLED")
|
||||||
@ -119,12 +113,10 @@ class Test(unittest.TestCase):
|
|||||||
self.bss_hostapd[1].reload()
|
self.bss_hostapd[1].reload()
|
||||||
self.bss_hostapd[1].wait_for_event("AP-ENABLED")
|
self.bss_hostapd[1].wait_for_event("AP-ENABLED")
|
||||||
|
|
||||||
self.validate_connection(wd)
|
self.validate_connection(self.wd)
|
||||||
|
|
||||||
def test_roam_packet_loss(self):
|
def test_roam_packet_loss(self):
|
||||||
wd = IWD(True)
|
self.validate_connection(self.wd, pkt_loss=True)
|
||||||
|
|
||||||
self.validate_connection(wd, pkt_loss=True)
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down')
|
os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down')
|
||||||
@ -139,6 +131,12 @@ class Test(unittest.TestCase):
|
|||||||
for hapd in self.bss_hostapd:
|
for hapd in self.bss_hostapd:
|
||||||
hapd.default()
|
hapd.default()
|
||||||
|
|
||||||
|
self.wd.stop()
|
||||||
|
self.wd = None
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.wd = IWD(True)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
hwsim = Hwsim()
|
hwsim = Hwsim()
|
||||||
@ -146,9 +144,10 @@ class Test(unittest.TestCase):
|
|||||||
IWD.copy_to_storage('TestFT.psk')
|
IWD.copy_to_storage('TestFT.psk')
|
||||||
|
|
||||||
cls.bss_hostapd = [ HostapdCLI(config='ft-psk-ccmp-1.conf'),
|
cls.bss_hostapd = [ HostapdCLI(config='ft-psk-ccmp-1.conf'),
|
||||||
HostapdCLI(config='ft-psk-ccmp-2.conf'),
|
HostapdCLI(config='ft-psk-ccmp-2.conf') ]
|
||||||
HostapdCLI(config='ft-psk-ccmp-3.conf') ]
|
|
||||||
cls.bss_hostapd[2].disable()
|
unused = HostapdCLI(config='ft-psk-ccmp-3.conf')
|
||||||
|
unused.disable()
|
||||||
|
|
||||||
rad0 = hwsim.get_radio('rad0')
|
rad0 = hwsim.get_radio('rad0')
|
||||||
rad3 = hwsim.get_radio('rad3')
|
rad3 = hwsim.get_radio('rad3')
|
||||||
@ -178,8 +177,9 @@ class Test(unittest.TestCase):
|
|||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
IWD.clear_storage()
|
IWD.clear_storage()
|
||||||
cls.bss_hostapd = None
|
cls.bss_hostapd = None
|
||||||
cls.rule0.enabled = False
|
|
||||||
cls.rule0.remove()
|
cls.rule0.remove()
|
||||||
|
cls.rule1.remove()
|
||||||
|
cls.rule2.remove()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main(exit=True)
|
unittest.main(exit=True)
|
||||||
|
|||||||
112
autotests/testPSK-roam/disconnect_during_handshake_test.py
Normal file
112
autotests/testPSK-roam/disconnect_during_handshake_test.py
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
#! /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 validate_connection(self, wd):
|
||||||
|
device = wd.list_devices(1)[0]
|
||||||
|
|
||||||
|
ordered_network = device.get_ordered_network('TestFT', full_scan=True)
|
||||||
|
|
||||||
|
self.assertEqual(ordered_network.type, NetworkType.psk)
|
||||||
|
|
||||||
|
condition = 'not obj.connected'
|
||||||
|
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||||
|
|
||||||
|
self.assertFalse(self.bss_hostapd[0].list_sta())
|
||||||
|
self.assertFalse(self.bss_hostapd[1].list_sta())
|
||||||
|
|
||||||
|
device.connect_bssid(self.bss_hostapd[0].bssid)
|
||||||
|
|
||||||
|
condition = 'obj.state == DeviceState.connected'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
|
||||||
|
|
||||||
|
testutil.test_iface_operstate(device.name)
|
||||||
|
testutil.test_ifaces_connected(self.bss_hostapd[0].ifname, device.name)
|
||||||
|
self.assertRaises(Exception, testutil.test_ifaces_connected,
|
||||||
|
(self.bss_hostapd[1].ifname, device.name, True, True))
|
||||||
|
|
||||||
|
self.rule0.enabled = True
|
||||||
|
|
||||||
|
device.roam(self.bss_hostapd[1].bssid)
|
||||||
|
|
||||||
|
device.clear_events()
|
||||||
|
device.wait_for_event("handshake-started")
|
||||||
|
self.bss_hostapd[1].deauthenticate(device.address, reason=15, test=1)
|
||||||
|
|
||||||
|
# Check that iwd is on BSS 1 once out of roaming state and doesn't
|
||||||
|
# go through 'disconnected', 'autoconnect', 'connecting' in between
|
||||||
|
from_condition = 'obj.state == DeviceState.roaming'
|
||||||
|
to_condition = 'obj.state == DeviceState.disconnected'
|
||||||
|
wd.wait_for_object_change(device, from_condition, to_condition)
|
||||||
|
|
||||||
|
def test_disconnect_during_handshake(self):
|
||||||
|
self.bss_hostapd[0].set_value('wpa_key_mgmt', 'WPA-PSK')
|
||||||
|
self.bss_hostapd[0].reload()
|
||||||
|
self.bss_hostapd[0].wait_for_event("AP-ENABLED")
|
||||||
|
|
||||||
|
self.bss_hostapd[1].set_value('wpa_key_mgmt', 'WPA-PSK')
|
||||||
|
self.bss_hostapd[1].reload()
|
||||||
|
self.bss_hostapd[1].wait_for_event("AP-ENABLED")
|
||||||
|
|
||||||
|
self.validate_connection(self.wd)
|
||||||
|
|
||||||
|
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')
|
||||||
|
|
||||||
|
for hapd in self.bss_hostapd:
|
||||||
|
hapd.default()
|
||||||
|
|
||||||
|
self.wd.stop()
|
||||||
|
self.wd = None
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
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') ]
|
||||||
|
|
||||||
|
unused = HostapdCLI(config='ft-psk-ccmp-3.conf')
|
||||||
|
unused.disable()
|
||||||
|
|
||||||
|
cls.bss_hostapd[0].set_address('12:00:00:00:00:01')
|
||||||
|
cls.bss_hostapd[1].set_address('12:00:00:00:00:02')
|
||||||
|
|
||||||
|
rad1 = hwsim.get_radio('rad1')
|
||||||
|
|
||||||
|
cls.rule0 = hwsim.rules.create()
|
||||||
|
cls.rule0.destination = rad1.addresses[0]
|
||||||
|
cls.rule0.prefix = '08'
|
||||||
|
cls.rule0.drop = True
|
||||||
|
|
||||||
|
HostapdCLI.group_neighbors(*cls.bss_hostapd)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
IWD.clear_storage()
|
||||||
|
cls.bss_hostapd = None
|
||||||
|
cls.rule0.remove()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main(exit=True)
|
||||||
@ -60,7 +60,7 @@ class Test(unittest.TestCase):
|
|||||||
self.rule0.enabled = False
|
self.rule0.enabled = False
|
||||||
|
|
||||||
# IWD should then try BSS 2, and succeed
|
# IWD should then try BSS 2, and succeed
|
||||||
device.wait_for_event('ft-roam', timeout=60)
|
device.wait_for_event('ft-roaming', timeout=60)
|
||||||
self.verify_roam(self.wd, device, self.bss_hostapd[0], self.bss_hostapd[2])
|
self.verify_roam(self.wd, device, self.bss_hostapd[0], self.bss_hostapd[2])
|
||||||
|
|
||||||
self.bss_hostapd[2].deauthenticate(device.address)
|
self.bss_hostapd[2].deauthenticate(device.address)
|
||||||
@ -75,7 +75,7 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
self.connect(self.wd, device, self.bss_hostapd[0])
|
self.connect(self.wd, device, self.bss_hostapd[0])
|
||||||
|
|
||||||
device.wait_for_event('ft-roam', timeout=60)
|
device.wait_for_event('ft-roaming', timeout=60)
|
||||||
|
|
||||||
condition = 'obj.state == DeviceState.disconnected'
|
condition = 'obj.state == DeviceState.disconnected'
|
||||||
self.wd.wait_for_object_condition(device, condition)
|
self.wd.wait_for_object_condition(device, condition)
|
||||||
@ -101,14 +101,14 @@ class Test(unittest.TestCase):
|
|||||||
# IWD should connect, then attempt a roam to BSS 1, which should
|
# IWD should connect, then attempt a roam to BSS 1, which should
|
||||||
# fail and cause a fallback to reassociation
|
# fail and cause a fallback to reassociation
|
||||||
device.wait_for_event('ft-fallback-to-reassoc', timeout=60)
|
device.wait_for_event('ft-fallback-to-reassoc', timeout=60)
|
||||||
device.wait_for_event('reassoc-roam', timeout=60)
|
device.wait_for_event('roaming', timeout=60)
|
||||||
|
|
||||||
self.verify_roam(self.wd, device, self.bss_hostapd[0], self.bss_hostapd[2])
|
self.verify_roam(self.wd, device, self.bss_hostapd[0], self.bss_hostapd[2])
|
||||||
|
|
||||||
# Trigger another roam
|
# Trigger another roam
|
||||||
self.rule_bss2.signal = -8000
|
self.rule_bss2.signal = -8000
|
||||||
|
|
||||||
device.wait_for_event('ft-roam', timeout=60)
|
device.wait_for_event('ft-roaming', timeout=60)
|
||||||
|
|
||||||
# Ensure an FT roam back to a properly configured AP works.
|
# Ensure an FT roam back to a properly configured AP works.
|
||||||
self.verify_roam(self.wd, device, self.bss_hostapd[2], self.bss_hostapd[1])
|
self.verify_roam(self.wd, device, self.bss_hostapd[2], self.bss_hostapd[1])
|
||||||
@ -141,7 +141,7 @@ class Test(unittest.TestCase):
|
|||||||
# fail and cause the rank to be re-computed. This should then put
|
# fail and cause the rank to be re-computed. This should then put
|
||||||
# bss 1 as the next candidate (since the FT factor is removed)
|
# bss 1 as the next candidate (since the FT factor is removed)
|
||||||
device.wait_for_event('ft-fallback-to-reassoc', timeout=60)
|
device.wait_for_event('ft-fallback-to-reassoc', timeout=60)
|
||||||
device.wait_for_event('ft-roam', timeout=60)
|
device.wait_for_event('ft-roaming', timeout=60)
|
||||||
|
|
||||||
self.verify_roam(self.wd, device, self.bss_hostapd[0], self.bss_hostapd[1])
|
self.verify_roam(self.wd, device, self.bss_hostapd[0], self.bss_hostapd[1])
|
||||||
|
|
||||||
@ -149,6 +149,21 @@ class Test(unittest.TestCase):
|
|||||||
condition = 'obj.state == DeviceState.disconnected'
|
condition = 'obj.state == DeviceState.disconnected'
|
||||||
self.wd.wait_for_object_condition(device, condition)
|
self.wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
def test_ft_deauth_before_association(self):
|
||||||
|
self.rule2.enabled = True
|
||||||
|
self.rule3.enabled = True
|
||||||
|
|
||||||
|
device = self.wd.list_devices(1)[0]
|
||||||
|
|
||||||
|
self.connect(self.wd, device, self.bss_hostapd[0])
|
||||||
|
|
||||||
|
device.wait_for_event('ft-authenticating', timeout=60)
|
||||||
|
|
||||||
|
self.bss_hostapd[1].deauthenticate(device.address)
|
||||||
|
|
||||||
|
condition = 'obj.state == DeviceState.disconnected'
|
||||||
|
self.wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.wd = IWD(True)
|
self.wd = IWD(True)
|
||||||
|
|
||||||
@ -221,12 +236,20 @@ class Test(unittest.TestCase):
|
|||||||
cls.rule_bss2 = hwsim.rules.create()
|
cls.rule_bss2 = hwsim.rules.create()
|
||||||
cls.rule_bss2.source = hwsim.get_radio('rad2').addresses[0]
|
cls.rule_bss2.source = hwsim.get_radio('rad2').addresses[0]
|
||||||
|
|
||||||
|
HostapdCLI.group_neighbors(*cls.bss_hostapd)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
IWD.clear_storage()
|
IWD.clear_storage()
|
||||||
cls.bss_hostapd = None
|
cls.bss_hostapd = None
|
||||||
cls.rule0.remove()
|
cls.rule0.remove()
|
||||||
cls.rule1.remove()
|
cls.rule1.remove()
|
||||||
|
cls.rule2.remove()
|
||||||
|
cls.rule3.remove()
|
||||||
|
cls.assoc_rule.remove()
|
||||||
|
cls.rule_bss0.remove()
|
||||||
|
cls.rule_bss1.remove()
|
||||||
|
cls.rule_bss2.remove()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main(exit=True)
|
unittest.main(exit=True)
|
||||||
|
|||||||
@ -13,7 +13,7 @@ wpa=2
|
|||||||
wpa_key_mgmt=FT-PSK
|
wpa_key_mgmt=FT-PSK
|
||||||
wpa_pairwise=CCMP
|
wpa_pairwise=CCMP
|
||||||
wpa_passphrase=EasilyGuessedPassword
|
wpa_passphrase=EasilyGuessedPassword
|
||||||
ieee80211w=1
|
ieee80211w=0
|
||||||
rsn_preauth=1
|
rsn_preauth=1
|
||||||
rsn_preauth_interfaces=lo
|
rsn_preauth_interfaces=lo
|
||||||
disable_pmksa_caching=0
|
disable_pmksa_caching=0
|
||||||
|
|||||||
@ -13,7 +13,7 @@ wpa=2
|
|||||||
wpa_key_mgmt=FT-PSK
|
wpa_key_mgmt=FT-PSK
|
||||||
wpa_pairwise=CCMP
|
wpa_pairwise=CCMP
|
||||||
wpa_passphrase=EasilyGuessedPassword
|
wpa_passphrase=EasilyGuessedPassword
|
||||||
ieee80211w=1
|
ieee80211w=0
|
||||||
rsn_preauth=1
|
rsn_preauth=1
|
||||||
rsn_preauth_interfaces=lo
|
rsn_preauth_interfaces=lo
|
||||||
disable_pmksa_caching=0
|
disable_pmksa_caching=0
|
||||||
|
|||||||
@ -13,7 +13,7 @@ wpa=2
|
|||||||
wpa_key_mgmt=FT-PSK
|
wpa_key_mgmt=FT-PSK
|
||||||
wpa_pairwise=CCMP
|
wpa_pairwise=CCMP
|
||||||
wpa_passphrase=EasilyGuessedPassword
|
wpa_passphrase=EasilyGuessedPassword
|
||||||
ieee80211w=1
|
ieee80211w=0
|
||||||
rsn_preauth=1
|
rsn_preauth=1
|
||||||
rsn_preauth_interfaces=lo
|
rsn_preauth_interfaces=lo
|
||||||
disable_pmksa_caching=0
|
disable_pmksa_caching=0
|
||||||
|
|||||||
@ -3,3 +3,6 @@ DisableMacAddressRandomization=true
|
|||||||
|
|
||||||
[General]
|
[General]
|
||||||
RoamRetryInterval=1
|
RoamRetryInterval=1
|
||||||
|
|
||||||
|
# For disconnect_during_handshake_test
|
||||||
|
ManagementFrameProtection=0
|
||||||
|
|||||||
@ -14,8 +14,7 @@ class Test(unittest.TestCase):
|
|||||||
# Tests a crash reported where multiple roam scans combined with an AP
|
# Tests a crash reported where multiple roam scans combined with an AP
|
||||||
# disconnect result in a crash getting scan results.
|
# disconnect result in a crash getting scan results.
|
||||||
#
|
#
|
||||||
def validate(self):
|
def validate(self, wd):
|
||||||
wd = IWD(True)
|
|
||||||
device = wd.list_devices(1)[0]
|
device = wd.list_devices(1)[0]
|
||||||
|
|
||||||
ordered_network = device.get_ordered_network('TestFT', full_scan=True)
|
ordered_network = device.get_ordered_network('TestFT', full_scan=True)
|
||||||
@ -43,14 +42,15 @@ class Test(unittest.TestCase):
|
|||||||
wd.wait_for_object_condition(device, condition)
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
def test_ap_disconnect_no_neighbors(self):
|
def test_ap_disconnect_no_neighbors(self):
|
||||||
self.validate()
|
self.validate(self.wd)
|
||||||
|
|
||||||
def test_ap_disconnect_neighbors(self):
|
def test_ap_disconnect_neighbors(self):
|
||||||
HostapdCLI.group_neighbors(*self.bss_hostapd)
|
HostapdCLI.group_neighbors(*self.bss_hostapd)
|
||||||
|
|
||||||
self.validate()
|
self.validate(self.wd)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
self.wd = IWD(True)
|
||||||
self.bss_hostapd[0].reload()
|
self.bss_hostapd[0].reload()
|
||||||
self.bss_hostapd[0].wait_for_event("AP-ENABLED")
|
self.bss_hostapd[0].wait_for_event("AP-ENABLED")
|
||||||
|
|
||||||
@ -63,6 +63,9 @@ class Test(unittest.TestCase):
|
|||||||
self.bss_hostapd[0].remove_neighbor(self.bss_hostapd[1].bssid)
|
self.bss_hostapd[0].remove_neighbor(self.bss_hostapd[1].bssid)
|
||||||
self.bss_hostapd[1].remove_neighbor(self.bss_hostapd[0].bssid)
|
self.bss_hostapd[1].remove_neighbor(self.bss_hostapd[0].bssid)
|
||||||
|
|
||||||
|
self.wd.stop()
|
||||||
|
self.wd = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
hwsim = Hwsim()
|
hwsim = Hwsim()
|
||||||
@ -78,12 +81,21 @@ class Test(unittest.TestCase):
|
|||||||
cls.bss_hostapd[0].set_value('ocv', '0')
|
cls.bss_hostapd[0].set_value('ocv', '0')
|
||||||
cls.bss_hostapd[0].set_value('ieee80211w', '0')
|
cls.bss_hostapd[0].set_value('ieee80211w', '0')
|
||||||
|
|
||||||
|
rad0 = hwsim.get_radio('rad0')
|
||||||
|
rad1 = hwsim.get_radio('rad1')
|
||||||
|
|
||||||
cls.rule0 = hwsim.rules.create()
|
cls.rule0 = hwsim.rules.create()
|
||||||
cls.rule0.source = 'any'
|
cls.rule0.source = rad0.addresses[0]
|
||||||
cls.rule0.bidirectional = True
|
cls.rule0.bidirectional = True
|
||||||
cls.rule0.signal = -8000
|
cls.rule0.signal = -8000
|
||||||
cls.rule0.enabled = True
|
cls.rule0.enabled = True
|
||||||
|
|
||||||
|
cls.rule1 = hwsim.rules.create()
|
||||||
|
cls.rule1.source = rad1.addresses[0]
|
||||||
|
cls.rule1.bidirectional = True
|
||||||
|
cls.rule1.signal = -8500
|
||||||
|
cls.rule1.enabled = True
|
||||||
|
|
||||||
cls.bss_hostapd[0].set_address('12:00:00:00:00:01')
|
cls.bss_hostapd[0].set_address('12:00:00:00:00:01')
|
||||||
cls.bss_hostapd[1].set_address('12:00:00:00:00:02')
|
cls.bss_hostapd[1].set_address('12:00:00:00:00:02')
|
||||||
|
|
||||||
@ -92,6 +104,7 @@ class Test(unittest.TestCase):
|
|||||||
IWD.clear_storage()
|
IWD.clear_storage()
|
||||||
cls.bss_hostapd = None
|
cls.bss_hostapd = None
|
||||||
cls.rule0.remove()
|
cls.rule0.remove()
|
||||||
|
cls.rule1.remove()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main(exit=True)
|
unittest.main(exit=True)
|
||||||
|
|||||||
@ -17,7 +17,7 @@ from hwsim import Hwsim
|
|||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
# Normally the time between a failed roam attempt and the next roam attempt
|
# Normally the time between a failed roam attempt and the next roam attempt
|
||||||
# is 60 seconds (default RoamRetryInterval). Test that we retry roaming
|
# is 60 seconds (default RoamRetryInterval). Test that we retry roaming
|
||||||
# faster if the transision looks like this: LOW [roam] [same bss] HIGH LOW.
|
# faster if the transition looks like this: LOW [roam] [same bss] HIGH LOW.
|
||||||
def test_fast_retry(self):
|
def test_fast_retry(self):
|
||||||
hwsim = Hwsim()
|
hwsim = Hwsim()
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ from hostapd import HostapdCLI
|
|||||||
from hwsim import Hwsim
|
from hwsim import Hwsim
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
# Test that we do not periodically retry roaming if the transision looks
|
# Test that we do not periodically retry roaming if the transition looks
|
||||||
# like this: LOW [roam] [new bss] HIGH.
|
# like this: LOW [roam] [new bss] HIGH.
|
||||||
def test_stop_retry(self):
|
def test_stop_retry(self):
|
||||||
hwsim = Hwsim()
|
hwsim = Hwsim()
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import testutil
|
|||||||
from config import ctx
|
from config import ctx
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
def validate_connection(self, wd, ft=True):
|
def validate_connection(self, wd, ft=True, check_used_pmksa=False):
|
||||||
device = wd.list_devices(1)[0]
|
device = wd.list_devices(1)[0]
|
||||||
|
|
||||||
# This won't guarantee all BSS's are found, but at least ensures that
|
# This won't guarantee all BSS's are found, but at least ensures that
|
||||||
@ -37,6 +37,14 @@ class Test(unittest.TestCase):
|
|||||||
self.assertRaises(Exception, testutil.test_ifaces_connected,
|
self.assertRaises(Exception, testutil.test_ifaces_connected,
|
||||||
(self.bss_hostapd[1].ifname, device.name, True, True))
|
(self.bss_hostapd[1].ifname, device.name, True, True))
|
||||||
|
|
||||||
|
# If PMKSA was used, hostapd should not include the sae_group key in
|
||||||
|
# its status for the station.
|
||||||
|
sta_status = self.bss_hostapd[0].sta_status(device.address)
|
||||||
|
if check_used_pmksa:
|
||||||
|
self.assertNotIn("sae_group", sta_status.keys())
|
||||||
|
else:
|
||||||
|
self.assertIn("sae_group", sta_status.keys())
|
||||||
|
|
||||||
device.roam(self.bss_hostapd[1].bssid)
|
device.roam(self.bss_hostapd[1].bssid)
|
||||||
|
|
||||||
# Check that iwd is on BSS 1 once out of roaming state and doesn't
|
# Check that iwd is on BSS 1 once out of roaming state and doesn't
|
||||||
@ -88,6 +96,31 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
self.validate_connection(wd, True)
|
self.validate_connection(wd, True)
|
||||||
|
|
||||||
|
def test_ft_roam_pmksa(self):
|
||||||
|
wd = IWD(True)
|
||||||
|
|
||||||
|
self.bss_hostapd[0].set_value('wpa_key_mgmt', 'FT-SAE SAE')
|
||||||
|
self.bss_hostapd[0].reload()
|
||||||
|
self.bss_hostapd[0].wait_for_event("AP-ENABLED")
|
||||||
|
self.bss_hostapd[1].set_value('wpa_key_mgmt', 'FT-SAE SAE')
|
||||||
|
self.bss_hostapd[1].reload()
|
||||||
|
self.bss_hostapd[1].wait_for_event("AP-ENABLED")
|
||||||
|
self.bss_hostapd[2].set_value('wpa_key_mgmt', 'FT-PSK')
|
||||||
|
self.bss_hostapd[2].reload()
|
||||||
|
self.bss_hostapd[2].wait_for_event("AP-ENABLED")
|
||||||
|
|
||||||
|
self.validate_connection(wd, True)
|
||||||
|
|
||||||
|
device = wd.list_devices(1)[0]
|
||||||
|
device.disconnect()
|
||||||
|
|
||||||
|
for hapd in self.bss_hostapd:
|
||||||
|
hapd.deauthenticate(device.address)
|
||||||
|
|
||||||
|
wd.wait(5)
|
||||||
|
|
||||||
|
self.validate_connection(wd, True, check_used_pmksa=True)
|
||||||
|
|
||||||
def test_reassociate_roam_success(self):
|
def test_reassociate_roam_success(self):
|
||||||
wd = IWD(True)
|
wd = IWD(True)
|
||||||
|
|
||||||
@ -103,6 +136,31 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
self.validate_connection(wd, False)
|
self.validate_connection(wd, False)
|
||||||
|
|
||||||
|
def test_reassociate_roam_pmksa(self):
|
||||||
|
wd = IWD(True)
|
||||||
|
|
||||||
|
self.bss_hostapd[0].set_value('wpa_key_mgmt', 'SAE')
|
||||||
|
self.bss_hostapd[0].reload()
|
||||||
|
self.bss_hostapd[0].wait_for_event("AP-ENABLED")
|
||||||
|
self.bss_hostapd[1].set_value('wpa_key_mgmt', 'SAE')
|
||||||
|
self.bss_hostapd[1].reload()
|
||||||
|
self.bss_hostapd[1].wait_for_event("AP-ENABLED")
|
||||||
|
self.bss_hostapd[2].set_value('wpa_key_mgmt', 'WPA-PSK')
|
||||||
|
self.bss_hostapd[2].reload()
|
||||||
|
self.bss_hostapd[2].wait_for_event("AP-ENABLED")
|
||||||
|
|
||||||
|
self.validate_connection(wd, False)
|
||||||
|
|
||||||
|
device = wd.list_devices(1)[0]
|
||||||
|
device.disconnect()
|
||||||
|
|
||||||
|
for hapd in self.bss_hostapd:
|
||||||
|
hapd.deauthenticate(device.address)
|
||||||
|
|
||||||
|
wd.wait(5)
|
||||||
|
|
||||||
|
self.validate_connection(wd, False, check_used_pmksa=True)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down')
|
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[1].ifname + '" down')
|
||||||
|
|||||||
@ -12,8 +12,7 @@ from hostapd import HostapdCLI
|
|||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def validate_connection(self, wd):
|
def validate_connection(self, wd, ssid):
|
||||||
|
|
||||||
devices = wd.list_devices(1)
|
devices = wd.list_devices(1)
|
||||||
self.assertIsNotNone(devices)
|
self.assertIsNotNone(devices)
|
||||||
device = devices[0]
|
device = devices[0]
|
||||||
@ -25,7 +24,7 @@ class Test(unittest.TestCase):
|
|||||||
condition = 'obj.connected_network is not None'
|
condition = 'obj.connected_network is not None'
|
||||||
wd.wait_for_object_condition(device, condition)
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
ordered_network = device.get_ordered_network('ssidSAE')
|
ordered_network = device.get_ordered_network(ssid)
|
||||||
|
|
||||||
self.assertTrue(ordered_network.network_object.connected)
|
self.assertTrue(ordered_network.network_object.connected)
|
||||||
|
|
||||||
@ -35,29 +34,27 @@ class Test(unittest.TestCase):
|
|||||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||||
|
|
||||||
def test_SAE(self):
|
def test_SAE(self):
|
||||||
IWD.copy_to_storage("ssidSAE.psk.default", name="ssidSAE.psk")
|
IWD.copy_to_storage("profiles/ssidSAE.psk.default", name="ssidSAE.psk")
|
||||||
self.hostapd.wait_for_event("AP-ENABLED")
|
self.hostapd.wait_for_event("AP-ENABLED")
|
||||||
|
|
||||||
wd = IWD(True)
|
wd = IWD(True)
|
||||||
self.validate_connection(wd)
|
self.validate_connection(wd, "ssidSAE")
|
||||||
|
|
||||||
def test_SAE_H2E(self):
|
def test_SAE_H2E(self):
|
||||||
IWD.copy_to_storage("ssidSAE.psk.default", name="ssidSAE.psk")
|
IWD.copy_to_storage("profiles/ssidSAE.psk.default", name="ssidSAE-H2E.psk")
|
||||||
self.hostapd.set_value('sae_pwe', '1')
|
self.hostapd_h2e.set_value('sae_groups', '20')
|
||||||
self.hostapd.set_value('sae_groups', '20')
|
self.hostapd_h2e.reload()
|
||||||
self.hostapd.reload()
|
self.hostapd_h2e.wait_for_event("AP-ENABLED")
|
||||||
self.hostapd.wait_for_event("AP-ENABLED")
|
|
||||||
wd = IWD(True)
|
wd = IWD(True)
|
||||||
self.validate_connection(wd)
|
self.validate_connection(wd, "ssidSAE-H2E")
|
||||||
|
|
||||||
def test_SAE_H2E_password_identifier(self):
|
def test_SAE_H2E_password_identifier(self):
|
||||||
IWD.copy_to_storage("ssidSAE.psk.identifier", name="ssidSAE.psk")
|
IWD.copy_to_storage("profiles/ssidSAE.psk.identifier", name="ssidSAE-H2E.psk")
|
||||||
self.hostapd.set_value('sae_pwe', '1')
|
self.hostapd_h2e.set_value('sae_groups', '20')
|
||||||
self.hostapd.set_value('sae_groups', '20')
|
self.hostapd_h2e.reload()
|
||||||
self.hostapd.reload()
|
self.hostapd_h2e.wait_for_event("AP-ENABLED")
|
||||||
self.hostapd.wait_for_event("AP-ENABLED")
|
|
||||||
wd = IWD(True)
|
wd = IWD(True)
|
||||||
self.validate_connection(wd)
|
self.validate_connection(wd, "ssidSAE-H2E")
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.hostapd.default()
|
self.hostapd.default()
|
||||||
@ -68,6 +65,7 @@ class Test(unittest.TestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.hostapd = HostapdCLI(config='ssidSAE.conf')
|
cls.hostapd = HostapdCLI(config='ssidSAE.conf')
|
||||||
|
cls.hostapd_h2e = HostapdCLI(config='ssidSAE-H2E.conf')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main(exit=True)
|
unittest.main(exit=True)
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import testutil
|
|||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def validate_connection(self, wd):
|
def validate_connection(self, wd, ssid, hostapd, expected_group):
|
||||||
psk_agent = PSKAgent("secret123")
|
psk_agent = PSKAgent("secret123")
|
||||||
wd.register_psk_agent(psk_agent)
|
wd.register_psk_agent(psk_agent)
|
||||||
|
|
||||||
@ -23,11 +23,11 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
device.disconnect()
|
device.disconnect()
|
||||||
|
|
||||||
network = device.get_ordered_network('ssidSAE', full_scan=True)
|
network = device.get_ordered_network(ssid, full_scan=True)
|
||||||
|
|
||||||
self.assertEqual(network.type, NetworkType.psk)
|
self.assertEqual(network.type, NetworkType.psk)
|
||||||
|
|
||||||
network.network_object.connect()
|
network.network_object.connect(wait=False)
|
||||||
|
|
||||||
condition = 'obj.state == DeviceState.connected'
|
condition = 'obj.state == DeviceState.connected'
|
||||||
wd.wait_for_object_condition(device, condition)
|
wd.wait_for_object_condition(device, condition)
|
||||||
@ -35,7 +35,11 @@ class Test(unittest.TestCase):
|
|||||||
wd.wait(2)
|
wd.wait(2)
|
||||||
|
|
||||||
testutil.test_iface_operstate(intf=device.name)
|
testutil.test_iface_operstate(intf=device.name)
|
||||||
testutil.test_ifaces_connected(if0=device.name, if1=self.hostapd.ifname)
|
testutil.test_ifaces_connected(if0=device.name, if1=hostapd.ifname)
|
||||||
|
|
||||||
|
sta_status = hostapd.sta_status(device.address)
|
||||||
|
|
||||||
|
self.assertEqual(int(sta_status["sae_group"]), expected_group)
|
||||||
|
|
||||||
device.disconnect()
|
device.disconnect()
|
||||||
|
|
||||||
@ -46,37 +50,25 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
def test_SAE(self):
|
def test_SAE(self):
|
||||||
self.hostapd.wait_for_event("AP-ENABLED")
|
self.hostapd.wait_for_event("AP-ENABLED")
|
||||||
self.validate_connection(self.wd)
|
self.validate_connection(self.wd, "ssidSAE", self.hostapd, 19)
|
||||||
|
|
||||||
def test_SAE_force_group_19(self):
|
|
||||||
# Vendor data from APs which require group 19 be used first
|
|
||||||
# TODO: (for all tests) verify the expected group was used
|
|
||||||
self.hostapd.set_value('vendor_elements', 'dd0cf4f5e8050500000000000000')
|
|
||||||
self.hostapd.reload()
|
|
||||||
self.hostapd.wait_for_event("AP-ENABLED")
|
|
||||||
self.validate_connection(self.wd)
|
|
||||||
|
|
||||||
def test_SAE_Group20(self):
|
def test_SAE_Group20(self):
|
||||||
self.hostapd.set_value('sae_groups', '20')
|
self.hostapd.set_value('sae_groups', '20')
|
||||||
self.hostapd.set_value('vendor_elements', '')
|
|
||||||
self.hostapd.reload()
|
self.hostapd.reload()
|
||||||
self.hostapd.wait_for_event("AP-ENABLED")
|
self.hostapd.wait_for_event("AP-ENABLED")
|
||||||
self.validate_connection(self.wd)
|
self.validate_connection(self.wd, "ssidSAE", self.hostapd, 20)
|
||||||
|
|
||||||
def test_SAE_H2E(self):
|
def test_SAE_H2E(self):
|
||||||
self.hostapd.set_value('sae_pwe', '1')
|
self.hostapd_h2e.set_value('sae_groups', '19')
|
||||||
self.hostapd.set_value('vendor_elements', '')
|
self.hostapd_h2e.reload()
|
||||||
self.hostapd.reload()
|
self.hostapd_h2e.wait_for_event("AP-ENABLED")
|
||||||
self.hostapd.wait_for_event("AP-ENABLED")
|
self.validate_connection(self.wd, "ssidSAE-H2E", self.hostapd_h2e, 19)
|
||||||
self.validate_connection(self.wd)
|
|
||||||
|
|
||||||
def test_SAE_H2E_Group20(self):
|
def test_SAE_H2E_Group20(self):
|
||||||
self.hostapd.set_value('sae_pwe', '1')
|
self.hostapd_h2e.set_value('sae_groups', '20')
|
||||||
self.hostapd.set_value('sae_groups', '20')
|
self.hostapd_h2e.reload()
|
||||||
self.hostapd.set_value('vendor_elements', '')
|
self.hostapd_h2e.wait_for_event("AP-ENABLED")
|
||||||
self.hostapd.reload()
|
self.validate_connection(self.wd, "ssidSAE-H2E", self.hostapd_h2e, 20)
|
||||||
self.hostapd.wait_for_event("AP-ENABLED")
|
|
||||||
self.validate_connection(self.wd)
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.hostapd.default()
|
self.hostapd.default()
|
||||||
@ -89,6 +81,7 @@ class Test(unittest.TestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.hostapd = HostapdCLI(config='ssidSAE.conf')
|
cls.hostapd = HostapdCLI(config='ssidSAE.conf')
|
||||||
|
cls.hostapd_h2e = HostapdCLI(config='ssidSAE-H2E.conf')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
|
|||||||
104
autotests/testSAE/default_group_test.py
Normal file
104
autotests/testSAE/default_group_test.py
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
sys.path.append('../util')
|
||||||
|
import iwd
|
||||||
|
from iwd import IWD
|
||||||
|
from iwd import PSKAgent
|
||||||
|
from iwd import NetworkType
|
||||||
|
from hostapd import HostapdCLI
|
||||||
|
import testutil
|
||||||
|
|
||||||
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
|
def validate_connection(self, wd, hostapd, rejected=False):
|
||||||
|
devices = wd.list_devices(1)
|
||||||
|
self.assertIsNotNone(devices)
|
||||||
|
device = devices[0]
|
||||||
|
|
||||||
|
device.autoconnect = True
|
||||||
|
|
||||||
|
if rejected:
|
||||||
|
device.wait_for_event("ecc-group-rejected", timeout=60)
|
||||||
|
|
||||||
|
condition = 'obj.state == DeviceState.connected'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
wd.wait(2)
|
||||||
|
|
||||||
|
testutil.test_iface_operstate(intf=device.name)
|
||||||
|
testutil.test_ifaces_connected(if0=device.name, if1=hostapd.ifname)
|
||||||
|
|
||||||
|
if not rejected:
|
||||||
|
self.assertEqual(device.event_ocurred("ecc-group-rejected"), False)
|
||||||
|
|
||||||
|
print(hostapd._get_status())
|
||||||
|
|
||||||
|
sta_status = hostapd.sta_status(device.address)
|
||||||
|
|
||||||
|
print(sta_status)
|
||||||
|
|
||||||
|
self.assertEqual(int(sta_status["sae_group"]), 19)
|
||||||
|
|
||||||
|
device.disconnect()
|
||||||
|
|
||||||
|
# IWD should:
|
||||||
|
# - Connect, fail with group 20
|
||||||
|
# - Retry, succeed with group 19
|
||||||
|
# - Disconnect
|
||||||
|
# - Connect, try only group 19
|
||||||
|
def test_auto_selection(self):
|
||||||
|
IWD.copy_to_storage("profiles/ssidSAE.psk.default", name="ssidSAE.psk")
|
||||||
|
self.validate_connection(self.wd, self.hostapd, rejected=True)
|
||||||
|
|
||||||
|
self.validate_connection(self.wd, self.hostapd, rejected=False)
|
||||||
|
|
||||||
|
# Try group 19 first
|
||||||
|
def test_default_group_enabled(self):
|
||||||
|
IWD.copy_to_storage("profiles/ssidSAE.psk.default_group", name="ssidSAE.psk")
|
||||||
|
self.validate_connection(self.wd, self.hostapd)
|
||||||
|
|
||||||
|
# Try group 19 first, with H2E
|
||||||
|
def test_default_group_enabled_h2e(self):
|
||||||
|
IWD.copy_to_storage("profiles/ssidSAE-H2E.psk.default_group", name="ssidSAE-H2E.psk")
|
||||||
|
self.validate_connection(self.wd, self.hostapd_h2e)
|
||||||
|
|
||||||
|
# Same as auto-selection but won't retain the default group setting
|
||||||
|
def test_default_group_disabled(self):
|
||||||
|
IWD.copy_to_storage("profiles/ssidSAE.psk.most_secure", name="ssidSAE.psk")
|
||||||
|
self.validate_connection(self.wd, self.hostapd, rejected=True)
|
||||||
|
|
||||||
|
# IWD should then retry but use only group 19
|
||||||
|
self.validate_connection(self.wd, self.hostapd, rejected=True)
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.hostapd.default()
|
||||||
|
self.hostapd.set_value('sae_groups', '19')
|
||||||
|
self.hostapd.set_value('sae_pwe', '0')
|
||||||
|
self.hostapd.reload()
|
||||||
|
self.hostapd.wait_for_event("AP-ENABLED")
|
||||||
|
self.wd = IWD(True)
|
||||||
|
|
||||||
|
self.wd.clear_storage()
|
||||||
|
os.system("ls /tmp/iwd")
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.wd.clear_storage()
|
||||||
|
self.wd = None
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
cls.hostapd = HostapdCLI(config='ssidSAE.conf')
|
||||||
|
cls.hostapd.default()
|
||||||
|
|
||||||
|
cls.hostapd_h2e = HostapdCLI(config='ssidSAE-H2E.conf')
|
||||||
|
cls.hostapd_h2e.default()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
pass
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main(exit=True)
|
||||||
@ -1,7 +1,8 @@
|
|||||||
[SETUP]
|
[SETUP]
|
||||||
num_radios=2
|
num_radios=3
|
||||||
start_iwd=0
|
start_iwd=0
|
||||||
hwsim_medium=yes
|
hwsim_medium=yes
|
||||||
|
|
||||||
[HOSTAPD]
|
[HOSTAPD]
|
||||||
rad0=ssidSAE.conf
|
rad0=ssidSAE.conf
|
||||||
|
rad1=ssidSAE-H2E.conf
|
||||||
|
|||||||
@ -4,3 +4,6 @@
|
|||||||
# hardware, but fails when used in simulated environment with mac80211_hwsim.
|
# hardware, but fails when used in simulated environment with mac80211_hwsim.
|
||||||
# Disable MAC randomization for the tests with hidden networks.
|
# Disable MAC randomization for the tests with hidden networks.
|
||||||
DisableMacAddressRandomization=true
|
DisableMacAddressRandomization=true
|
||||||
|
|
||||||
|
[General]
|
||||||
|
DisablePMKSA=true
|
||||||
|
|||||||
2
autotests/testSAE/profiles/ssidSAE-H2E.psk.default
Normal file
2
autotests/testSAE/profiles/ssidSAE-H2E.psk.default
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[Security]
|
||||||
|
Passphrase=secret123
|
||||||
5
autotests/testSAE/profiles/ssidSAE-H2E.psk.default_group
Normal file
5
autotests/testSAE/profiles/ssidSAE-H2E.psk.default_group
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[Security]
|
||||||
|
Passphrase=secret123
|
||||||
|
|
||||||
|
[Settings]
|
||||||
|
UseDefaultEccGroup=true
|
||||||
2
autotests/testSAE/profiles/ssidSAE.psk.default
Normal file
2
autotests/testSAE/profiles/ssidSAE.psk.default
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[Security]
|
||||||
|
Passphrase=secret123
|
||||||
5
autotests/testSAE/profiles/ssidSAE.psk.default_group
Normal file
5
autotests/testSAE/profiles/ssidSAE.psk.default_group
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[Security]
|
||||||
|
Passphrase=secret123
|
||||||
|
|
||||||
|
[Settings]
|
||||||
|
UseDefaultEccGroup=true
|
||||||
5
autotests/testSAE/profiles/ssidSAE.psk.most_secure
Normal file
5
autotests/testSAE/profiles/ssidSAE.psk.most_secure
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[Security]
|
||||||
|
Passphrase=secret123
|
||||||
|
|
||||||
|
[Settings]
|
||||||
|
UseDefaultEccGroup=false
|
||||||
12
autotests/testSAE/ssidSAE-H2E.conf
Normal file
12
autotests/testSAE/ssidSAE-H2E.conf
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
hw_mode=g
|
||||||
|
channel=1
|
||||||
|
ssid=ssidSAE-H2E
|
||||||
|
|
||||||
|
wpa=2
|
||||||
|
wpa_key_mgmt=SAE
|
||||||
|
wpa_pairwise=CCMP
|
||||||
|
sae_password=secret123
|
||||||
|
sae_password=withidentifier|id=myidentifier
|
||||||
|
sae_groups=19
|
||||||
|
ieee80211w=2
|
||||||
|
sae_pwe=1
|
||||||
@ -6,7 +6,6 @@ wpa=2
|
|||||||
wpa_key_mgmt=SAE
|
wpa_key_mgmt=SAE
|
||||||
wpa_pairwise=CCMP
|
wpa_pairwise=CCMP
|
||||||
sae_password=secret123
|
sae_password=secret123
|
||||||
sae_password=withidentifier|id=myidentifier
|
|
||||||
sae_groups=19
|
sae_groups=19
|
||||||
ieee80211w=2
|
ieee80211w=2
|
||||||
sae_pwe=0
|
sae_pwe=0
|
||||||
|
|||||||
@ -8,11 +8,12 @@ import iwd
|
|||||||
from iwd import IWD
|
from iwd import IWD
|
||||||
from iwd import PSKAgent
|
from iwd import PSKAgent
|
||||||
from iwd import NetworkType
|
from iwd import NetworkType
|
||||||
|
from hostapd import HostapdCLI
|
||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def test_connection_success(self):
|
def test_incorrect_password(self):
|
||||||
wd = IWD(True)
|
wd = IWD(True)
|
||||||
|
|
||||||
psk_agent = PSKAgent("InvalidPassword")
|
psk_agent = PSKAgent("InvalidPassword")
|
||||||
@ -34,6 +35,35 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
wd.unregister_psk_agent(psk_agent)
|
wd.unregister_psk_agent(psk_agent)
|
||||||
|
|
||||||
|
def test_deauth_after_connection(self):
|
||||||
|
wd = IWD(True)
|
||||||
|
hostapd = HostapdCLI(config="ssidWPA2.conf")
|
||||||
|
|
||||||
|
psk_agent = PSKAgent("secret123")
|
||||||
|
wd.register_psk_agent(psk_agent)
|
||||||
|
|
||||||
|
devices = wd.list_devices(1)
|
||||||
|
self.assertIsNotNone(devices)
|
||||||
|
device = devices[0]
|
||||||
|
|
||||||
|
ordered_network = device.get_ordered_network('ssidWPA2')
|
||||||
|
|
||||||
|
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(wait=False)
|
||||||
|
|
||||||
|
device.wait_for_event("authenticating")
|
||||||
|
|
||||||
|
# Trigger a deauth just after authenticating
|
||||||
|
hostapd.deauthenticate(device.address)
|
||||||
|
|
||||||
|
device.wait_for_event("disconnected")
|
||||||
|
|
||||||
|
wd.unregister_psk_agent(psk_agent)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@ -184,8 +184,12 @@ class HostapdCLI(object):
|
|||||||
cmd = self.cmdline + ['wps_pin', 'any', pin]
|
cmd = self.cmdline + ['wps_pin', 'any', pin]
|
||||||
ctx.start_process(cmd).wait()
|
ctx.start_process(cmd).wait()
|
||||||
|
|
||||||
def deauthenticate(self, client_address):
|
def deauthenticate(self, client_address, reason=None, test=None):
|
||||||
cmd = self.cmdline + ['deauthenticate', client_address]
|
cmd = self.cmdline + ['deauthenticate', client_address]
|
||||||
|
|
||||||
|
if reason:
|
||||||
|
cmd.append(f"reason={reason} test={test}")
|
||||||
|
|
||||||
ctx.start_process(cmd).wait()
|
ctx.start_process(cmd).wait()
|
||||||
|
|
||||||
def eapol_reauth(self, client_address):
|
def eapol_reauth(self, client_address):
|
||||||
@ -284,12 +288,14 @@ class HostapdCLI(object):
|
|||||||
cmd = 'RESEND_M3 %s' % address
|
cmd = 'RESEND_M3 %s' % address
|
||||||
self.ctrl_sock.sendall(cmd.encode('utf-8'))
|
self.ctrl_sock.sendall(cmd.encode('utf-8'))
|
||||||
|
|
||||||
def chan_switch(self, channel):
|
def chan_switch(self, channel, wait=True):
|
||||||
if channel > len(chan_freq_map):
|
if channel > len(chan_freq_map):
|
||||||
raise Exception("Only 2.4GHz channels supported for chan_switch")
|
raise Exception("Only 2.4GHz channels supported for chan_switch")
|
||||||
|
|
||||||
cmd = self.cmdline + ['chan_switch', '50', str(chan_freq_map[channel])]
|
cmd = self.cmdline + ['chan_switch', '50', str(chan_freq_map[channel])]
|
||||||
ctx.start_process(cmd).wait()
|
ctx.start_process(cmd).wait()
|
||||||
|
|
||||||
|
if wait:
|
||||||
self.wait_for_event('AP-CSA-FINISHED')
|
self.wait_for_event('AP-CSA-FINISHED')
|
||||||
|
|
||||||
def _get_status(self):
|
def _get_status(self):
|
||||||
@ -306,6 +312,22 @@ class HostapdCLI(object):
|
|||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
def sta_status(self, address):
|
||||||
|
ret = {}
|
||||||
|
|
||||||
|
cmd = self.cmdline + ['sta', address]
|
||||||
|
proc = ctx.start_process(cmd)
|
||||||
|
proc.wait()
|
||||||
|
status = proc.out.strip().split('\n')
|
||||||
|
|
||||||
|
# Pop address
|
||||||
|
status.pop(0)
|
||||||
|
for kv in status:
|
||||||
|
k, v = kv.split('=', 1)
|
||||||
|
ret[k] = v
|
||||||
|
|
||||||
|
return ret
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def bssid(self):
|
def bssid(self):
|
||||||
return self._get_status()['bssid[0]']
|
return self._get_status()['bssid[0]']
|
||||||
@ -348,3 +370,7 @@ class HostapdCLI(object):
|
|||||||
others = [h for h in args if h != hapd]
|
others = [h for h in args if h != hapd]
|
||||||
|
|
||||||
hapd._add_neighbors(*others)
|
hapd._add_neighbors(*others)
|
||||||
|
|
||||||
|
def pmksa_flush(self):
|
||||||
|
cmd = self.cmdline + ['pmksa_flush']
|
||||||
|
ctx.start_process(cmd).wait()
|
||||||
|
|||||||
@ -7,7 +7,10 @@ from weakref import WeakValueDictionary
|
|||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from scapy.all import *
|
from scapy.all import *
|
||||||
|
try:
|
||||||
from scapy.contrib.wpa_eapol import WPA_key
|
from scapy.contrib.wpa_eapol import WPA_key
|
||||||
|
except:
|
||||||
|
from scapy.layers.eap import EAPOL_KEY
|
||||||
|
|
||||||
import iwd
|
import iwd
|
||||||
from config import ctx
|
from config import ctx
|
||||||
@ -444,9 +447,15 @@ class Hwsim(iwd.AsyncOpAbstract):
|
|||||||
|
|
||||||
# NOTE: Expected key_info is 0x008a, with the install flag
|
# NOTE: Expected key_info is 0x008a, with the install flag
|
||||||
# this becomes 0x00ca.
|
# this becomes 0x00ca.
|
||||||
|
try:
|
||||||
eapol = WPA_key( descriptor_type = 2,
|
eapol = WPA_key( descriptor_type = 2,
|
||||||
key_info = 0x00ca, # Includes an invalid install flag!
|
key_info = 0x00ca, # Includes an invalid install flag!
|
||||||
replay_counter = struct.pack(">Q", 100))
|
replay_counter = struct.pack(">Q", 100))
|
||||||
|
except:
|
||||||
|
eapol = EAPOL_KEY( key_descriptor_type = 2,
|
||||||
|
install = 1,
|
||||||
|
key_ack = 1,
|
||||||
|
key_replay_counter = 1)
|
||||||
frame /= LLC()/SNAP()/EAPOL(version="802.1X-2004", type="EAPOL-Key")
|
frame /= LLC()/SNAP()/EAPOL(version="802.1X-2004", type="EAPOL-Key")
|
||||||
frame /= eapol
|
frame /= eapol
|
||||||
|
|
||||||
|
|||||||
@ -112,8 +112,8 @@ class AsyncOpAbstract(object):
|
|||||||
self._is_completed = True
|
self._is_completed = True
|
||||||
self._exception = _convert_dbus_ex(ex)
|
self._exception = _convert_dbus_ex(ex)
|
||||||
|
|
||||||
def _wait_for_async_op(self):
|
def _wait_for_async_op(self, timeout=50):
|
||||||
ctx.non_block_wait(lambda s: s._is_completed, 30, self, exception=None)
|
ctx.non_block_wait(lambda s: s._is_completed, timeout, self, exception=None)
|
||||||
|
|
||||||
self._is_completed = False
|
self._is_completed = False
|
||||||
if self._exception is not None:
|
if self._exception is not None:
|
||||||
@ -280,8 +280,15 @@ class StationDebug(IWDDBusAbstract):
|
|||||||
def autoconnect(self):
|
def autoconnect(self):
|
||||||
return self._properties['AutoConnect']
|
return self._properties['AutoConnect']
|
||||||
|
|
||||||
def connect_bssid(self, address):
|
def connect_bssid(self, address, wait=True):
|
||||||
self._iface.ConnectBssid(dbus.ByteArray.fromhex(address.replace(':', '')))
|
self._iface.ConnectBssid(
|
||||||
|
dbus.ByteArray.fromhex(address.replace(':', '')),
|
||||||
|
reply_handler=self._success,
|
||||||
|
error_handler=self._failure
|
||||||
|
)
|
||||||
|
|
||||||
|
if wait:
|
||||||
|
self._wait_for_async_op()
|
||||||
|
|
||||||
def roam(self, address):
|
def roam(self, address):
|
||||||
self._iface.Roam(dbus.ByteArray.fromhex(address.replace(':', '')))
|
self._iface.Roam(dbus.ByteArray.fromhex(address.replace(':', '')))
|
||||||
@ -299,10 +306,16 @@ class StationDebug(IWDDBusAbstract):
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def clear_events(self):
|
||||||
|
self._events = []
|
||||||
|
|
||||||
def wait_for_event(self, event, timeout=10):
|
def wait_for_event(self, event, timeout=10):
|
||||||
return ctx.non_block_wait(self._poll_event, timeout, event,
|
return ctx.non_block_wait(self._poll_event, timeout, event,
|
||||||
exception=TimeoutError("waiting for event"))
|
exception=TimeoutError("waiting for event"))
|
||||||
|
|
||||||
|
def event_ocurred(self, event):
|
||||||
|
return self._poll_event(event)
|
||||||
|
|
||||||
class DeviceProvisioning(IWDDBusAbstract):
|
class DeviceProvisioning(IWDDBusAbstract):
|
||||||
'''
|
'''
|
||||||
Class represents net.connman.iwd.DeviceProvisioning
|
Class represents net.connman.iwd.DeviceProvisioning
|
||||||
@ -444,13 +457,15 @@ class Device(IWDDBusAbstract):
|
|||||||
self._wps_manager_if = None
|
self._wps_manager_if = None
|
||||||
self._station_if = None
|
self._station_if = None
|
||||||
self._station_props = None
|
self._station_props = None
|
||||||
self._station_debug_obj = None
|
|
||||||
self._dpp_obj = None
|
self._dpp_obj = None
|
||||||
self._sc_dpp_obj = None
|
self._sc_dpp_obj = None
|
||||||
self._ap_obj = None
|
self._ap_obj = None
|
||||||
|
|
||||||
IWDDBusAbstract.__init__(self, *args, **kwargs)
|
IWDDBusAbstract.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
|
self._station_debug_obj = StationDebug(object_path=self._object_path,
|
||||||
|
namespace=self._namespace)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _wps_manager(self):
|
def _wps_manager(self):
|
||||||
if self._wps_manager_if is None:
|
if self._wps_manager_if is None:
|
||||||
@ -590,6 +605,11 @@ class Device(IWDDBusAbstract):
|
|||||||
props = self._station_properties()
|
props = self._station_properties()
|
||||||
return props.get('ConnectedNetwork')
|
return props.get('ConnectedNetwork')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def connected_bss(self):
|
||||||
|
props = self._station_properties()
|
||||||
|
return props.get('ConnectedAccessPoint')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def powered(self):
|
def powered(self):
|
||||||
'''
|
'''
|
||||||
@ -624,6 +644,19 @@ class Device(IWDDBusAbstract):
|
|||||||
self._station_debug._prop_proxy.Set(IWD_STATION_DEBUG_INTERFACE,
|
self._station_debug._prop_proxy.Set(IWD_STATION_DEBUG_INTERFACE,
|
||||||
'AutoConnect', value)
|
'AutoConnect', value)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def affinities(self):
|
||||||
|
return self._station_properties()['Affinities']
|
||||||
|
|
||||||
|
@affinities.setter
|
||||||
|
def affinities(self, values):
|
||||||
|
self._station_properties()
|
||||||
|
self._station_prop_if.Set(
|
||||||
|
IWD_STATION_INTERFACE, 'Affinities',
|
||||||
|
dbus.Array([dbus.ObjectPath(v) for v in values], signature="o"),
|
||||||
|
reply_handler=self._success, error_handler=self._failure)
|
||||||
|
self._wait_for_async_op()
|
||||||
|
|
||||||
def scan(self, wait=True):
|
def scan(self, wait=True):
|
||||||
'''Schedule a network scan.
|
'''Schedule a network scan.
|
||||||
|
|
||||||
@ -844,8 +877,8 @@ class Device(IWDDBusAbstract):
|
|||||||
def stop_adhoc(self):
|
def stop_adhoc(self):
|
||||||
self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode', 'station')
|
self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode', 'station')
|
||||||
|
|
||||||
def connect_bssid(self, address):
|
def connect_bssid(self, address, wait=True):
|
||||||
self._station_debug.connect_bssid(address)
|
self._station_debug.connect_bssid(address, wait=wait)
|
||||||
|
|
||||||
def roam(self, address):
|
def roam(self, address):
|
||||||
self._station_debug.roam(address)
|
self._station_debug.roam(address)
|
||||||
@ -856,6 +889,12 @@ class Device(IWDDBusAbstract):
|
|||||||
def wait_for_event(self, event, timeout=10):
|
def wait_for_event(self, event, timeout=10):
|
||||||
self._station_debug.wait_for_event(event, timeout)
|
self._station_debug.wait_for_event(event, timeout)
|
||||||
|
|
||||||
|
def clear_events(self):
|
||||||
|
self._station_debug.clear_events()
|
||||||
|
|
||||||
|
def event_ocurred(self, event):
|
||||||
|
return self._station_debug.event_ocurred(event)
|
||||||
|
|
||||||
def dpp_start_enrollee(self):
|
def dpp_start_enrollee(self):
|
||||||
ret = self._device_provisioning.start_enrollee()
|
ret = self._device_provisioning.start_enrollee()
|
||||||
|
|
||||||
@ -963,7 +1002,11 @@ class Network(IWDDBusAbstract):
|
|||||||
'''
|
'''
|
||||||
return bool(self._properties['Connected'])
|
return bool(self._properties['Connected'])
|
||||||
|
|
||||||
def connect(self, wait=True):
|
@property
|
||||||
|
def extended_service_set(self):
|
||||||
|
return self._properties['ExtendedServiceSet']
|
||||||
|
|
||||||
|
def connect(self, wait=True, timeout=50, reply_handler=None, error_handler=None):
|
||||||
'''
|
'''
|
||||||
Connect to the network. Request the device implied by the object
|
Connect to the network. Request the device implied by the object
|
||||||
path to connect to specified network.
|
path to connect to specified network.
|
||||||
@ -978,12 +1021,19 @@ class Network(IWDDBusAbstract):
|
|||||||
@rtype: void
|
@rtype: void
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
if not reply_handler:
|
||||||
|
reply_handler = self._success
|
||||||
|
|
||||||
|
if not error_handler:
|
||||||
|
error_handler = self._failure
|
||||||
|
|
||||||
self._iface.Connect(dbus_interface=self._iface_name,
|
self._iface.Connect(dbus_interface=self._iface_name,
|
||||||
reply_handler=self._success,
|
reply_handler=reply_handler,
|
||||||
error_handler=self._failure)
|
error_handler=error_handler,
|
||||||
|
timeout=timeout)
|
||||||
|
|
||||||
if wait:
|
if wait:
|
||||||
self._wait_for_async_op()
|
self._wait_for_async_op(timeout=timeout)
|
||||||
|
|
||||||
def __str__(self, prefix = ''):
|
def __str__(self, prefix = ''):
|
||||||
return prefix + 'Network:\n' \
|
return prefix + 'Network:\n' \
|
||||||
@ -1447,10 +1497,10 @@ class IWD(AsyncOpAbstract):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_in_storage(file_name, file_content, storage_dir=IWD_STORAGE_DIR):
|
def create_in_storage(file_name, file_content, storage_dir=IWD_STORAGE_DIR):
|
||||||
fo = open(storage_dir + '/' + file_name, 'w')
|
f = open(storage_dir + '/' + file_name, 'w')
|
||||||
|
|
||||||
fo.write(file_content)
|
f.write(file_content)
|
||||||
fo.close()
|
f.close()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _ensure_storage_dir_exists(storage_dir):
|
def _ensure_storage_dir_exists(storage_dir):
|
||||||
|
|||||||
@ -237,7 +237,7 @@ class Wpas:
|
|||||||
('' if go_intent is None else ' go_intent=' + str(go_intent)))
|
('' if go_intent is None else ' go_intent=' + str(go_intent)))
|
||||||
self.wait_for_event('OK')
|
self.wait_for_event('OK')
|
||||||
|
|
||||||
# Pre-accept the next GO Negotiation Request from this peer to avoid the extra Respone + Request frames
|
# Pre-accept the next GO Negotiation Request from this peer to avoid the extra Response + Request frames
|
||||||
def p2p_authorize(self, peer, pin=None, go_intent=None):
|
def p2p_authorize(self, peer, pin=None, go_intent=None):
|
||||||
self._rx_data = []
|
self._rx_data = []
|
||||||
self._ctrl_request('P2P_CONNECT ' + peer['p2p_dev_addr'] + ' ' + ('pbc' if pin is None else pin) +
|
self._ctrl_request('P2P_CONNECT ' + peer['p2p_dev_addr'] + ' ' + ('pbc' if pin is None else pin) +
|
||||||
|
|||||||
13
client/ap.c
13
client/ap.c
@ -162,18 +162,27 @@ static const char *get_freq_tostr(const void *data)
|
|||||||
static void update_pairwise(void *data, struct l_dbus_message_iter *variant)
|
static void update_pairwise(void *data, struct l_dbus_message_iter *variant)
|
||||||
{
|
{
|
||||||
struct ap *ap = data;
|
struct ap *ap = data;
|
||||||
|
struct l_dbus_message_iter array;
|
||||||
char *value;
|
char *value;
|
||||||
|
char **strv;
|
||||||
|
|
||||||
|
|
||||||
if (ap->pairwise)
|
if (ap->pairwise)
|
||||||
l_free(ap->pairwise);
|
l_free(ap->pairwise);
|
||||||
|
|
||||||
if (!l_dbus_message_iter_get_variant(variant, "s", &value)) {
|
if (!l_dbus_message_iter_get_variant(variant, "as", &array)) {
|
||||||
ap->pairwise = NULL;
|
ap->pairwise = NULL;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ap->pairwise = l_strdup(value);
|
strv = l_strv_new();
|
||||||
|
|
||||||
|
while (l_dbus_message_iter_next_entry(&array, &value))
|
||||||
|
strv = l_strv_append(strv, value);
|
||||||
|
|
||||||
|
ap->pairwise = l_strjoinv(strv, ' ');
|
||||||
|
l_strv_free(strv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *get_pairwise_tostr(const void *data)
|
static const char *get_pairwise_tostr(const void *data)
|
||||||
|
|||||||
109
client/bss.c
Normal file
109
client/bss.c
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Wireless daemon for Linux
|
||||||
|
*
|
||||||
|
* Copyright (C) 2024, Locus Robotics
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <ell/ell.h>
|
||||||
|
#include "ell/useful.h"
|
||||||
|
|
||||||
|
#include "client/dbus-proxy.h"
|
||||||
|
#include "client/display.h"
|
||||||
|
|
||||||
|
struct bss {
|
||||||
|
char *address;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char *get_address(const void *data)
|
||||||
|
{
|
||||||
|
const struct bss *bss = data;
|
||||||
|
|
||||||
|
return bss->address;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void update_address(void *data, struct l_dbus_message_iter *variant)
|
||||||
|
{
|
||||||
|
struct bss *bss = data;
|
||||||
|
const char *value;
|
||||||
|
|
||||||
|
l_free(bss->address);
|
||||||
|
|
||||||
|
if (!l_dbus_message_iter_get_variant(variant, "s", &value)) {
|
||||||
|
bss->address = NULL;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bss->address = l_strdup(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct proxy_interface_property bss_properties[] = {
|
||||||
|
{ "Address", "s", update_address, get_address },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void *bss_create(void)
|
||||||
|
{
|
||||||
|
return l_new(struct bss, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void bss_destroy(void *data)
|
||||||
|
{
|
||||||
|
struct bss *bss = data;
|
||||||
|
|
||||||
|
l_free(bss->address);
|
||||||
|
l_free(bss);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void bss_display_inline(const char *margin, const void *data)
|
||||||
|
{
|
||||||
|
const struct bss *bss = data;
|
||||||
|
|
||||||
|
display("%s%s\n", margin, bss->address);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct proxy_interface_type_ops ops = {
|
||||||
|
.create = bss_create,
|
||||||
|
.destroy = bss_destroy,
|
||||||
|
.display = bss_display_inline,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct proxy_interface_type bss_interface_type = {
|
||||||
|
.interface = IWD_BSS_INTERFACE,
|
||||||
|
.properties = bss_properties,
|
||||||
|
.ops = &ops,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int bss_interface_init(void)
|
||||||
|
{
|
||||||
|
proxy_interface_type_register(&bss_interface_type);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void bss_interface_exit(void)
|
||||||
|
{
|
||||||
|
proxy_interface_type_unregister(&bss_interface_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
INTERFACE_TYPE(bss_interface_type, bss_interface_init, bss_interface_exit)
|
||||||
@ -47,8 +47,8 @@ static struct l_dbus *dbus;
|
|||||||
static struct l_queue *proxy_interfaces;
|
static struct l_queue *proxy_interfaces;
|
||||||
static struct l_queue *proxy_interface_types;
|
static struct l_queue *proxy_interface_types;
|
||||||
|
|
||||||
void proxy_properties_display(const struct proxy_interface *proxy,
|
void proxy_properties_display_inline(const struct proxy_interface *proxy,
|
||||||
const char *caption, const char *margin,
|
const char *margin,
|
||||||
unsigned int name_column_width,
|
unsigned int name_column_width,
|
||||||
unsigned int value_column_width)
|
unsigned int value_column_width)
|
||||||
{
|
{
|
||||||
@ -59,11 +59,6 @@ void proxy_properties_display(const struct proxy_interface *proxy,
|
|||||||
if (!proxy->type->properties)
|
if (!proxy->type->properties)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
display_table_header(caption, "%s%-*s %-*s %-*s", margin,
|
|
||||||
8, "Settable",
|
|
||||||
name_column_width, "Property",
|
|
||||||
value_column_width, "Value");
|
|
||||||
|
|
||||||
data = proxy_interface_get_data(proxy);
|
data = proxy_interface_get_data(proxy);
|
||||||
properties = proxy->type->properties;
|
properties = proxy->type->properties;
|
||||||
|
|
||||||
@ -82,6 +77,31 @@ void proxy_properties_display(const struct proxy_interface *proxy,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void proxy_properties_display_header(const char *caption, const char *margin,
|
||||||
|
unsigned int name_column_width,
|
||||||
|
unsigned int value_column_width)
|
||||||
|
{
|
||||||
|
display_table_header(caption, "%s%-*s %-*s %-*s", margin,
|
||||||
|
8, "Settable",
|
||||||
|
name_column_width, "Property",
|
||||||
|
value_column_width, "Value");
|
||||||
|
}
|
||||||
|
|
||||||
|
void proxy_properties_display(const struct proxy_interface *proxy,
|
||||||
|
const char *caption, const char *margin,
|
||||||
|
unsigned int name_column_width,
|
||||||
|
unsigned int value_column_width)
|
||||||
|
{
|
||||||
|
if (!proxy->type->properties)
|
||||||
|
return;
|
||||||
|
|
||||||
|
proxy_properties_display_header(caption, margin, name_column_width,
|
||||||
|
value_column_width);
|
||||||
|
|
||||||
|
proxy_properties_display_inline(proxy, margin, name_column_width,
|
||||||
|
value_column_width);
|
||||||
|
}
|
||||||
|
|
||||||
static const void *proxy_interface_property_tostr(
|
static const void *proxy_interface_property_tostr(
|
||||||
const struct proxy_interface *proxy,
|
const struct proxy_interface *proxy,
|
||||||
const char *name)
|
const char *name)
|
||||||
|
|||||||
@ -41,6 +41,7 @@ struct proxy_interface;
|
|||||||
#define IWD_DPP_INTERFACE "net.connman.iwd.DeviceProvisioning"
|
#define IWD_DPP_INTERFACE "net.connman.iwd.DeviceProvisioning"
|
||||||
#define IWD_DPP_PKEX_INTERFACE \
|
#define IWD_DPP_PKEX_INTERFACE \
|
||||||
"net.connman.iwd.SharedCodeDeviceProvisioning"
|
"net.connman.iwd.SharedCodeDeviceProvisioning"
|
||||||
|
#define IWD_BSS_INTERFACE "net.connman.iwd.BasicServiceSet"
|
||||||
|
|
||||||
typedef bool (*proxy_property_match_func_t) (const void *a, const void *b);
|
typedef bool (*proxy_property_match_func_t) (const void *a, const void *b);
|
||||||
|
|
||||||
@ -95,6 +96,13 @@ void proxy_properties_display(const struct proxy_interface *proxy,
|
|||||||
const char *caption, const char *margin,
|
const char *caption, const char *margin,
|
||||||
unsigned int name_column_width,
|
unsigned int name_column_width,
|
||||||
unsigned int value_column_width);
|
unsigned int value_column_width);
|
||||||
|
void proxy_properties_display_inline(const struct proxy_interface *proxy,
|
||||||
|
const char *margin,
|
||||||
|
unsigned int name_column_width,
|
||||||
|
unsigned int value_column_width);
|
||||||
|
void proxy_properties_display_header(const char *caption, const char *margin,
|
||||||
|
unsigned int name_column_width,
|
||||||
|
unsigned int value_column_width);
|
||||||
|
|
||||||
char *proxy_property_str_completion(const struct proxy_interface_type *type,
|
char *proxy_property_str_completion(const struct proxy_interface_type *type,
|
||||||
proxy_property_match_func_t function,
|
proxy_property_match_func_t function,
|
||||||
|
|||||||
@ -93,7 +93,10 @@ static const struct diagnostic_dict_mapping diagnostic_mapping[] = {
|
|||||||
{ "RxMCS", 'y' },
|
{ "RxMCS", 'y' },
|
||||||
{ "TxMCS", 'y' },
|
{ "TxMCS", 'y' },
|
||||||
{ "Frequency", 'u' },
|
{ "Frequency", 'u' },
|
||||||
|
{ "Channel", 'q' },
|
||||||
{ "Security", 's' },
|
{ "Security", 's' },
|
||||||
|
{ "InactiveTime", 'u', "ms" },
|
||||||
|
{ "ConnectedTime", 'u', "s" },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -109,6 +112,7 @@ void diagnostic_display(struct l_dbus_message_iter *dict,
|
|||||||
while (l_dbus_message_iter_next_entry(dict, &key, &variant)) {
|
while (l_dbus_message_iter_next_entry(dict, &key, &variant)) {
|
||||||
const char *s_value;
|
const char *s_value;
|
||||||
uint32_t u_value;
|
uint32_t u_value;
|
||||||
|
uint16_t q_value;
|
||||||
int16_t n_value;
|
int16_t n_value;
|
||||||
uint8_t y_value;
|
uint8_t y_value;
|
||||||
int bytes;
|
int bytes;
|
||||||
@ -145,6 +149,14 @@ void diagnostic_display(struct l_dbus_message_iter *dict,
|
|||||||
bytes = sprintf(display_text, "%u", u_value);
|
bytes = sprintf(display_text, "%u", u_value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'q':
|
||||||
|
if (!l_dbus_message_iter_get_variant(&variant, "q",
|
||||||
|
&q_value))
|
||||||
|
goto parse_error;
|
||||||
|
|
||||||
|
bytes = sprintf(display_text, "%u", q_value);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
if (!l_dbus_message_iter_get_variant(&variant, "n",
|
if (!l_dbus_message_iter_get_variant(&variant, "n",
|
||||||
&n_value))
|
&n_value))
|
||||||
@ -176,5 +188,5 @@ void diagnostic_display(struct l_dbus_message_iter *dict,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
parse_error:
|
parse_error:
|
||||||
display_error("Error parsing dignostics");
|
display_error("Error parsing diagnostics");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -194,7 +194,7 @@ void display_refresh_set_cmd(const char *family, const char *entity,
|
|||||||
|
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
bool needs_quotes = false;
|
bool needs_quotes = false;
|
||||||
char *p = argv[i];
|
char *p;
|
||||||
|
|
||||||
for (p = argv[i]; *p != '\0'; p++) {
|
for (p = argv[i]; *p != '\0'; p++) {
|
||||||
if (*p != ' ')
|
if (*p != ' ')
|
||||||
@ -230,7 +230,8 @@ static void display_refresh_check_feasibility(void)
|
|||||||
{
|
{
|
||||||
const struct winsize ws;
|
const struct winsize ws;
|
||||||
|
|
||||||
ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws);
|
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (ws.ws_col < LINE_LEN - 1) {
|
if (ws.ws_col < LINE_LEN - 1) {
|
||||||
if (display_refresh.enabled) {
|
if (display_refresh.enabled) {
|
||||||
@ -564,8 +565,6 @@ void display_table_row(const char *margin, unsigned int ncolumns, ...)
|
|||||||
str += entry_append(e, str);
|
str += entry_append(e, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
va_end(va);
|
|
||||||
|
|
||||||
display("%s\n", buf);
|
display("%s\n", buf);
|
||||||
str = buf;
|
str = buf;
|
||||||
|
|
||||||
@ -591,6 +590,8 @@ void display_table_row(const char *margin, unsigned int ncolumns, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
va_end(va);
|
||||||
|
|
||||||
for (i = 0; i < ncolumns; i++) {
|
for (i = 0; i < ncolumns; i++) {
|
||||||
if (entries[i].color)
|
if (entries[i].color)
|
||||||
l_free(entries[i].color);
|
l_free(entries[i].color);
|
||||||
|
|||||||
@ -35,6 +35,7 @@ struct network {
|
|||||||
char *identity;
|
char *identity;
|
||||||
char *name;
|
char *name;
|
||||||
char *type;
|
char *type;
|
||||||
|
struct l_queue *bss_list;
|
||||||
const struct proxy_interface *device;
|
const struct proxy_interface *device;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -146,11 +147,58 @@ static void update_type(void *data, struct l_dbus_message_iter *variant)
|
|||||||
network->type = l_strdup(value);
|
network->type = l_strdup(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool match_path(const void *a, const void *user_data)
|
||||||
|
{
|
||||||
|
const char *path1 = a;
|
||||||
|
const char *path2 = user_data;
|
||||||
|
|
||||||
|
return !strcmp(path1, path2);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void update_ess(void *data, struct l_dbus_message_iter *variant)
|
||||||
|
{
|
||||||
|
struct network *network = data;
|
||||||
|
struct l_dbus_message_iter array;
|
||||||
|
const char *path;
|
||||||
|
|
||||||
|
if (!network->bss_list)
|
||||||
|
network->bss_list = l_queue_new();
|
||||||
|
|
||||||
|
if (!l_dbus_message_iter_get_variant(variant, "ao", &array))
|
||||||
|
return;
|
||||||
|
|
||||||
|
while (l_dbus_message_iter_next_entry(&array, &path)) {
|
||||||
|
l_free(l_queue_remove_if(network->bss_list, match_path, path));
|
||||||
|
l_queue_push_head(network->bss_list, l_strdup(path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *get_ess(const void *data)
|
||||||
|
{
|
||||||
|
const struct network *network = data;
|
||||||
|
static char count[10];
|
||||||
|
|
||||||
|
snprintf(count, 10, "Count %u", l_queue_length(network->bss_list));
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct l_queue *network_get_bss_list(
|
||||||
|
const struct proxy_interface *network_proxy)
|
||||||
|
{
|
||||||
|
const struct network *network = proxy_interface_get_data(network_proxy);
|
||||||
|
if (!network)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return network->bss_list;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct proxy_interface_property network_properties[] = {
|
static const struct proxy_interface_property network_properties[] = {
|
||||||
{ "Name", "s", update_name, get_name },
|
{ "Name", "s", update_name, get_name },
|
||||||
{ "Connected", "b", update_connected},
|
{ "Connected", "b", update_connected},
|
||||||
{ "Device", "o", update_device},
|
{ "Device", "o", update_device},
|
||||||
{ "Type", "s", update_type},
|
{ "Type", "s", update_type},
|
||||||
|
{ "ExtendedServiceSet", "ao", update_ess, get_ess },
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -171,7 +219,7 @@ static void network_display_inline(const char *margin, const void *data)
|
|||||||
|
|
||||||
display("%s%s %s %s\n", margin, network->name ? network->name : "",
|
display("%s%s %s %s\n", margin, network->name ? network->name : "",
|
||||||
network->type ? network->type : "",
|
network->type ? network->type : "",
|
||||||
network->connected ? "connected" : "diconnected");
|
network->connected ? "connected" : "disconnected");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *network_create(void)
|
static void *network_create(void)
|
||||||
@ -186,6 +234,7 @@ static void network_destroy(void *data)
|
|||||||
l_free(network->name);
|
l_free(network->name);
|
||||||
l_free(network->type);
|
l_free(network->type);
|
||||||
l_free(network->identity);
|
l_free(network->identity);
|
||||||
|
l_queue_destroy(network->bss_list, l_free);
|
||||||
|
|
||||||
network->device = NULL;
|
network->device = NULL;
|
||||||
|
|
||||||
|
|||||||
@ -37,3 +37,5 @@ char *network_name_completion(const struct proxy_interface *device,
|
|||||||
struct l_queue *network_match_by_device_and_args(
|
struct l_queue *network_match_by_device_and_args(
|
||||||
const struct proxy_interface *device,
|
const struct proxy_interface *device,
|
||||||
const struct network_args *args);
|
const struct network_args *args);
|
||||||
|
struct l_queue *network_get_bss_list(
|
||||||
|
const struct proxy_interface *network_proxy);
|
||||||
|
|||||||
@ -175,7 +175,7 @@ static void display_addresses(const char *device_name)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
have_address = true;
|
have_address = true;
|
||||||
display("%s%*s %-*s%-*s\n", MARGIN, 8, "", 20,
|
display_table_row(MARGIN, 3, 8, "", 20,
|
||||||
"IPv6 address", 47, addrstr);
|
"IPv6 address", 47, addrstr);
|
||||||
} else if (cur->ifa_addr->sa_family == AF_INET) {
|
} else if (cur->ifa_addr->sa_family == AF_INET) {
|
||||||
struct sockaddr_in *si =
|
struct sockaddr_in *si =
|
||||||
@ -283,28 +283,26 @@ static char *connect_cmd_arg_completion(const char *text, int state,
|
|||||||
return network_name_completion(device, text, state);
|
return network_name_completion(device, text, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum cmd_status cmd_connect(const char *device_name,
|
static const struct proxy_interface *find_network(const char *device_name,
|
||||||
char **argv, int argc)
|
const char *name,
|
||||||
|
const char *type)
|
||||||
{
|
{
|
||||||
struct network_args network_args;
|
struct network_args network_args;
|
||||||
struct l_queue *match;
|
struct l_queue *match;
|
||||||
const struct proxy_interface *network_proxy;
|
const struct proxy_interface *network_proxy;
|
||||||
const struct proxy_interface *device_proxy;
|
const struct proxy_interface *device_proxy;
|
||||||
|
|
||||||
if (argc < 1)
|
|
||||||
return CMD_STATUS_INVALID_ARGS;
|
|
||||||
|
|
||||||
device_proxy = device_proxy_find_by_name(device_name);
|
device_proxy = device_proxy_find_by_name(device_name);
|
||||||
if (!device_proxy)
|
if (!device_proxy)
|
||||||
return CMD_STATUS_INVALID_VALUE;
|
return NULL;
|
||||||
|
|
||||||
network_args.name = argv[0];
|
network_args.name = name;
|
||||||
network_args.type = argc >= 2 ? argv[1] : NULL;
|
network_args.type = type;
|
||||||
|
|
||||||
match = network_match_by_device_and_args(device_proxy, &network_args);
|
match = network_match_by_device_and_args(device_proxy, &network_args);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
display("Invalid network name '%s'\n", network_args.name);
|
display("Invalid network name '%s'\n", network_args.name);
|
||||||
return CMD_STATUS_INVALID_VALUE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l_queue_length(match) > 1) {
|
if (l_queue_length(match) > 1) {
|
||||||
@ -315,11 +313,28 @@ static enum cmd_status cmd_connect(const char *device_name,
|
|||||||
|
|
||||||
l_queue_destroy(match, NULL);
|
l_queue_destroy(match, NULL);
|
||||||
|
|
||||||
return CMD_STATUS_INVALID_VALUE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
network_proxy = l_queue_pop_head(match);
|
network_proxy = l_queue_pop_head(match);
|
||||||
l_queue_destroy(match, NULL);
|
l_queue_destroy(match, NULL);
|
||||||
|
|
||||||
|
return network_proxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
static enum cmd_status cmd_connect(const char *device_name,
|
||||||
|
char **argv, int argc)
|
||||||
|
{
|
||||||
|
const struct proxy_interface *network_proxy;
|
||||||
|
|
||||||
|
if (argc < 1)
|
||||||
|
return CMD_STATUS_INVALID_ARGS;
|
||||||
|
|
||||||
|
network_proxy = find_network(device_name, argv[0],
|
||||||
|
argc >= 2 ? argv[1] : NULL);
|
||||||
|
if (!network_proxy)
|
||||||
|
return CMD_STATUS_INVALID_VALUE;
|
||||||
|
|
||||||
network_connect(network_proxy);
|
network_connect(network_proxy);
|
||||||
|
|
||||||
return CMD_STATUS_TRIGGERED;
|
return CMD_STATUS_TRIGGERED;
|
||||||
@ -708,6 +723,55 @@ static enum cmd_status cmd_show(const char *device_name,
|
|||||||
return CMD_STATUS_TRIGGERED;
|
return CMD_STATUS_TRIGGERED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static enum cmd_status cmd_get_bsses(const char *device_name,
|
||||||
|
char **argv, int argc)
|
||||||
|
{
|
||||||
|
const struct proxy_interface *station_i =
|
||||||
|
device_proxy_find(device_name, IWD_STATION_INTERFACE);
|
||||||
|
const struct station *station = proxy_interface_get_data(station_i);
|
||||||
|
struct l_queue *bss_list;
|
||||||
|
const struct l_queue_entry *e;
|
||||||
|
const struct proxy_interface *network_proxy;
|
||||||
|
char header[256];
|
||||||
|
|
||||||
|
if (argc > 0)
|
||||||
|
network_proxy = find_network(device_name, argv[0],
|
||||||
|
argc >= 2 ? argv[1] : NULL);
|
||||||
|
else
|
||||||
|
network_proxy = station->connected_network;
|
||||||
|
|
||||||
|
if (!network_proxy) {
|
||||||
|
display_error("Can't find network");
|
||||||
|
return CMD_STATUS_INVALID_ARGS;
|
||||||
|
}
|
||||||
|
|
||||||
|
bss_list = network_get_bss_list(network_proxy);
|
||||||
|
if (!bss_list) {
|
||||||
|
display_error("No BSS list for network");
|
||||||
|
return CMD_STATUS_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(header, "%s BasicServiceSets", network_get_name(network_proxy));
|
||||||
|
|
||||||
|
proxy_properties_display_header(header, MARGIN, 10, 18);
|
||||||
|
|
||||||
|
for (e = l_queue_get_entries(bss_list); e; e = e->next) {
|
||||||
|
const char *path = e->data;
|
||||||
|
const struct proxy_interface *bss_i = proxy_interface_find(
|
||||||
|
IWD_BSS_INTERFACE, path);
|
||||||
|
|
||||||
|
if (!bss_i)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
display_table_row(MARGIN, 1, strlen(path), path);
|
||||||
|
proxy_properties_display_inline(bss_i, MARGIN, 10, 18);
|
||||||
|
display_table_row(MARGIN, 1, 1, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
return CMD_STATUS_DONE;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct command station_commands[] = {
|
static const struct command station_commands[] = {
|
||||||
{ NULL, "list", NULL, cmd_list, "List devices in Station mode", true },
|
{ NULL, "list", NULL, cmd_list, "List devices in Station mode", true },
|
||||||
{ "<wlan>", "connect",
|
{ "<wlan>", "connect",
|
||||||
@ -732,6 +796,8 @@ static const struct command station_commands[] = {
|
|||||||
"Get hidden APs", true },
|
"Get hidden APs", true },
|
||||||
{ "<wlan>", "scan", NULL, cmd_scan, "Scan for networks" },
|
{ "<wlan>", "scan", NULL, cmd_scan, "Scan for networks" },
|
||||||
{ "<wlan>", "show", NULL, cmd_show, "Show station info", true },
|
{ "<wlan>", "show", NULL, cmd_show, "Show station info", true },
|
||||||
|
{ "<wlan>", "get-bsses", "[network] [security]", cmd_get_bsses,
|
||||||
|
"Get BSS's for a network", true },
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
AC_PREREQ([2.69])
|
AC_PREREQ([2.69])
|
||||||
AC_INIT([iwd],[2.12])
|
AC_INIT([iwd],[3.10])
|
||||||
|
|
||||||
AC_CONFIG_HEADERS(config.h)
|
AC_CONFIG_HEADERS(config.h)
|
||||||
AC_CONFIG_AUX_DIR(build-aux)
|
AC_CONFIG_AUX_DIR(build-aux)
|
||||||
AC_CONFIG_MACRO_DIR(build-aux)
|
AC_CONFIG_MACRO_DIR(build-aux)
|
||||||
|
|
||||||
|
AC_REQUIRE_AUX_FILE([tap-driver.sh])
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([foreign subdir-objects color-tests silent-rules
|
AM_INIT_AUTOMAKE([foreign subdir-objects color-tests silent-rules
|
||||||
tar-pax no-dist-gzip dist-xz])
|
tar-pax no-dist-gzip dist-xz])
|
||||||
|
|
||||||
@ -29,6 +31,7 @@ AC_PROG_CC_GCOV
|
|||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_MKDIR_P
|
AC_PROG_MKDIR_P
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
|
AC_PROG_AWK
|
||||||
|
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
|
|
||||||
@ -44,7 +47,7 @@ AC_ARG_ENABLE(optimization, AS_HELP_STRING([--disable-optimization],
|
|||||||
|
|
||||||
if (test "${enable_optimization}" != "no"); then
|
if (test "${enable_optimization}" != "no"); then
|
||||||
CFLAGS="$CFLAGS -O2"
|
CFLAGS="$CFLAGS -O2"
|
||||||
CFLAGS+=" -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
|
CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],
|
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],
|
||||||
@ -297,7 +300,7 @@ if (test "${enable_external_ell}" = "yes"); then
|
|||||||
test "${enable_monitor}" != "no" ||
|
test "${enable_monitor}" != "no" ||
|
||||||
test "${enable_wired}" = "yes" ||
|
test "${enable_wired}" = "yes" ||
|
||||||
test "${enable_hwsim}" = "yes"); then
|
test "${enable_hwsim}" = "yes"); then
|
||||||
ell_min_version="0.61"
|
ell_min_version="0.77"
|
||||||
else
|
else
|
||||||
ell_min_version="0.5"
|
ell_min_version="0.5"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -31,6 +31,12 @@ Methods array{dict} GetDiagnostics()
|
|||||||
|
|
||||||
TxMCS [optional] - Transmitting MCS index
|
TxMCS [optional] - Transmitting MCS index
|
||||||
|
|
||||||
|
InactiveTime [optional] - Time duration (in ms) for which the STA
|
||||||
|
connected to this BSS is currently inactive.
|
||||||
|
|
||||||
|
ConnectedTime [optional] - Time duration (in s) for which the STA
|
||||||
|
remains connected to this BSS.
|
||||||
|
|
||||||
Possible errors: net.connman.iwd.Failed
|
Possible errors: net.connman.iwd.Failed
|
||||||
net.connman.iwd.NotConnected
|
net.connman.iwd.NotConnected
|
||||||
net.connman.iwd.NotFound
|
net.connman.iwd.NotFound
|
||||||
|
|||||||
10
doc/basic-service-set.txt
Normal file
10
doc/basic-service-set.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
Basic service set hierarchy
|
||||||
|
=================
|
||||||
|
|
||||||
|
Service net.connman.iwd
|
||||||
|
Interface net.connman.iwd.BasicServiceSet
|
||||||
|
Object path /net/connman/iwd/{phy0,phy1,...}/{1,2,...}/Xxx
|
||||||
|
|
||||||
|
Properties string Address [readonly]
|
||||||
|
|
||||||
|
MAC address of BSS
|
||||||
@ -317,6 +317,21 @@ Functions that are static should not be forward-declared. The only exception
|
|||||||
to this rule is if a circular dependency condition exists, and the forward
|
to this rule is if a circular dependency condition exists, and the forward
|
||||||
declaration cannot be avoided.
|
declaration cannot be avoided.
|
||||||
|
|
||||||
|
M18: Use appropriate logging levels
|
||||||
|
===================================
|
||||||
|
An appropriate log level should be used depending on the type of message
|
||||||
|
being logged. Logging is done using the l_log APIs in ELL:
|
||||||
|
|
||||||
|
l_error An unexpected condition occurred. These are generally fatal to the
|
||||||
|
current connection/protocol that is running but not generally to IWD's
|
||||||
|
overall operation.
|
||||||
|
l_warn An unexpected, but non-fatal condition occurred
|
||||||
|
l_notice Should not be used directly. This log level is reserved for special
|
||||||
|
event type notifications which is handled by iwd_notice().
|
||||||
|
l_info Information that is expected during normal operation. l_info's use
|
||||||
|
should be very limited so non-debug logs are concise
|
||||||
|
l_debug General debugging. These can be used relatively freely but should
|
||||||
|
provide some piece of useful information.
|
||||||
|
|
||||||
O1: Shorten the name
|
O1: Shorten the name
|
||||||
====================
|
====================
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user