broadcom fmac ap mode testing - how to set iwd as dhcp server?
by KeithG
Group,
I noticed that the latest patches posted for iwd appeared to addres the
broadcom fmac in ap mode. I compiled the latest from git and tried it out.
It will make a connection. Big improvement from before. This is a log of
the connection on my RPi running iwctl in ap mode. I am connecting from a
dell laptop.
# iwmon
Wireless monitor ver 1.11
Created interface nlmon
> Event: New Station (0x13) len 168
1611882622.696232
Interface Index: 3 (0x00000003)
MAC Address 60:F2:62:AE:70:FE
Generation: 9 (0x00000009)
Station Info: len 0
Information Elements: len 129
SSID: RuneAudioAP1
52 75 6e 65 41 75 64 69 6f 41 50 31 RuneAudioAP1
Supported rates:
1.0(B) 2.0(B) 5.5(B) 11.0(B) 6.0 9.0 12.0 18.0 Mbit/s
82 84 8b 96 0c 12 18 24 .......$
Tag 33: len 2
00 0f ..
Tag 36: len 50
24 01 28 01 2c 01 30 01 34 01 38 01 3c 01 40 01
$.(.,.0.4.8.<.@.
64 01 68 01 6c 01 70 01 74 01 78 01 7c 01 80 01
d.h.l.p.t.x.|...
84 01 88 01 8c 01 90 01 95 01 99 01 9d 01 a1 01
................
a5 01 ..
RSN:
Group Data Cipher Suite: len 4
CCMP (00:0f:ac) suite 04
Pairwise Cipher Suite: len 4
CCMP (00:0f:ac) suite 04
AKM Suite: len 4
PSK; RSNA PSK (00:0f:ac) suite 02
RSN capabilities: bits 2 - 3: 1 replay counter per PTKSA
RSN capabilities: bits 4 - 5: 1 replay counter per GTKSA
01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f
................
ac 02 00 00 00 00 ......
Extended supported rates:
24.0 36.0 48.0 54.0 Mbit/s
30 48 60 6c 0H`l
RM Enabled Capabilities: len 5
Enabled: bit 1: Neighbor Report
Enabled: bit 4: Beacon Passive Measurement
Enabled: bit 5: Beacon Active Measurement
Enabled: bit 6: Beacon Table Measurement
Operating Channel Max Measurement Duration: 0
Non-Operating Channel Max Measurement Duration: 0
Measurement Pilot Capability: 0
72 00 00 00 00 r....
Extended yCapabilities: len 10
Capability: bit 2: Extended channel switching
Capability: bit 19: BSS transition
Capability: bit 22: Multiple BSSID
Capability: bit 23: Timing measurement
Capability: bit 31: Interworking
Capability: bit 32: QoS Map
Capability: bit 46: WNM- Notification
04 00 c8 80 01 40 00 00 00 00 .....@....
< Request: Set Station (0x12) len 32 [ack]
1611882622.696372
Interface Index: 3 (0x00000003)
MAC Address 60:F2:62:AE:70:FE
Station Flags 2: len 8
Mask: 0x00000002
Authorized
Set: 0x00000000
> Response: Set Station (0x12) len 4 [root]
1611882622.697255
Status: Success (0)
< Request: New Key (0x0b) len 48 [ack]
1611882622.697359
Interface Index: 3 (0x00000003)
Key: len 36
14 00 01 00 c4 79 49 79 56 8f 90 f3 d7 9a be 73 .....yIyV......s
8a ba 6e 6f 08 00 03 00 04 ac 0f 00 05 00 02 00 ..no............
01 00 00 00 ....
> Response: New Key (0x0b) len 4 [0x100]
1611882622.698943
Status: Success (0)
< Request: Set Key (0x0a) len 32 [ack]
1611882622.699011
Interface Index: 3 (0x00000003)
Key: len 20
05 00 02 00 01 00 00 00 04 00 05 00 08 00 08 80 ................
04 00 02 00 ....
> Response: Set Key (0x0a) len 4 [0x100]
1611882622.699725
Status: Success (0)
< Request: Get Key (0x09) len 16 [ack]
1611882622.699782
Interface Index: 3 (0x00000003)
Key Index: 1 (0x01)
> Result: New Key (0x0b) len 44
1611882622.700248
Interface Index: 3 (0x00000003)
Key Index: 1 (0x01)
Key Cipher: BIP (00:0f:ac) suite 06
Key: len 16
08 00 03 00 06 ac 0f 00 05 00 02 00 01 00 00 00 ................
< PAE: len 121
0.700570
Interface Index: 3
EAPoL: len 121
Protocol Version: 2 (802.1X-2004)
Type: 3 (Key)
Length: 117
Descriptor Type: 2
Key MIC: false
Secure: false
Error: false
Request: false
Encrypted Key Data: false
SMK Message: false
Key Descriptor Version: 2 (02)
Key Type: true
Install: false
Key ACK: true
Key Length: 16
Key Replay Counter: 1
Key NONCE
47 6e 2d 93 73 84 22 f1 1c 6a 5d 3d 95 e4 9b 74
Gn-.s."..j]=...t
5d f8 d5 48 06 7a e8 49 2e 44 98 98 59 c7 92 00
]..H.z.I.D..Y...
Key IV
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Key RSC
00 00 00 00 00 00 00 00 ........
Key MIC Data
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Key Data: len 22
Vendor specific: len 20
IEEE 802.11 (00:0f:ac) type: 04
PMKID KDE
00 0f ac 04 54 72 65 62 5c 4b e4 40 60 01 9c e8
....Treb\K.@`...
5f 33 0f 78 _3.x
02 03 00 75 02 00 8a 00 10 00 00 00 00 00 00 00 ...u............
01 47 6e 2d 93 73 84 22 f1 1c 6a 5d 3d 95 e4 9b .Gn-.s."..j]=...
74 5d f8 d5 48 06 7a e8 49 2e 44 98 98 59 c7 92 t]..H.z.I.D..Y..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 16 dd 14 00 0f ac 04 54 72 65 62 5c 4b e4 .........Treb\K.
40 60 01 9c e8 5f 33 0f 78 @`..._3.x
> Response: Get Key (0x09) len 4 [0x100]
0.700267
Status: Success (0)
> PAE: len 123
0.707588
Interface Index: 3
EAPoL: len 123
Protocol Version: 1 (802.1X-2001)
Type: 3 (Key)
Length: 119
Descriptor Type: 2
Key MIC: true
Secure: false
Error: false
Request: false
Encrypted Key Data: false
SMK Message: false
Key Descriptor Version: 2 (02)
Key Type: true
Install: false
Key ACK: false
Key Length: 0
Key Replay Counter: 1
Key NONCE
29 7a a9 c3 84 c6 ed 06 c0 00 75 68 57 3d 16 78
)z........uhW=.x
d4 3e 1e 62 1d 48 5d c6 01 da a0 8f 7f 16 b3 cd
.>.b.H].........
Key IV
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Key RSC
00 00 00 00 00 00 00 00 ........
Key MIC Data
cf aa 34 82 65 28 93 a7 62 c2 0a b4 e0 d9 dd 59
..4.e(..b......Y
Key Data: len 24
RSN:
Group Data Cipher Suite: len 4
CCMP (00:0f:ac) suite 04
Pairwise Cipher Suite: len 4
CCMP (00:0f:ac) suite 04
AKM Suite: len 4
PSK; RSNA PSK (00:0f:ac) suite 02
RSN capabilities: bits 2 - 3: 1 replay counter per PTKSA
RSN capabilities: bits 4 - 5: 1 replay counter per GTKSA
01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f
................
ac 02 00 00 00 00 ......
01 03 00 77 02 01 0a 00 00 00 00 00 00 00 00 00 ...w............
01 29 7a a9 c3 84 c6 ed 06 c0 00 75 68 57 3d 16 .)z........uhW=.
78 d4 3e 1e 62 1d 48 5d c6 01 da a0 8f 7f 16 b3 x.>.b.H]........
cd 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 cf aa 34 82 65 28 93 a7 62 c2 0a b4 e0 d9 dd ...4.e(..b......
59 00 18 30 16 01 00 00 0f ac 04 01 00 00 0f ac Y..0............
04 01 00 00 0f ac 02 00 00 00 00 ...........
< PAE: len 155
0.708697
Interface Index: 3
EAPoL: len 155
Protocol Version: 2 (802.1X-2004)
Type: 3 (Key)
Length: 151
Descriptor Type: 2
Key MIC: true
Secure: true
Error: false
Request: false
Encrypted Key Data: true
SMK Message: false
Key Descriptor Version: 2 (02)
Key Type: true
Install: true
Key ACK: true
Key Length: 16
Key Replay Counter: 2
Key NONCE
47 6e 2d 93 73 84 22 f1 1c 6a 5d 3d 95 e4 9b 74
Gn-.s."..j]=...t
5d f8 d5 48 06 7a e8 49 2e 44 98 98 59 c7 92 00
]..H.z.I.D..Y...
Key IV
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Key RSC
00 00 00 00 00 00 00 00 ........
Key MIC Data
6e b0 eb f8 83 f8 20 31 ad b8 96 df bf 7f 8f 75 n.....
1.......u
Key Data: len 56
cd d7 94 40 e2 7d 9e 63 dc f3 fa b1 3e f4 c7 3a
...@.}.c....>..:
ec 81 46 6a a9 ea 6e b3 ed 22 d7 81 f7 cf 60 fc
..Fj..n.."....`.
64 31 d2 9e 1b 44 da 7a 50 ff 05 aa 25 51 2f 8e
d1...D.zP...%Q/.
f5 d2 d4 96 b4 65 d3 41 .....e.A
02 03 00 97 02 13 ca 00 10 00 00 00 00 00 00 00 ................
02 47 6e 2d 93 73 84 22 f1 1c 6a 5d 3d 95 e4 9b .Gn-.s."..j]=...
74 5d f8 d5 48 06 7a e8 49 2e 44 98 98 59 c7 92 t]..H.z.I.D..Y..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 6e b0 eb f8 83 f8 20 31 ad b8 96 df bf 7f 8f .n..... 1.......
75 00 38 cd d7 94 40 e2 7d 9e 63 dc f3 fa b1 3e u.8...@.}.c....>
f4 c7 3a ec 81 46 6a a9 ea 6e b3 ed 22 d7 81 f7 ..:..Fj..n.."...
cf 60 fc 64 31 d2 9e 1b 44 da 7a 50 ff 05 aa 25 .`.d1...D.zP...%
51 2f 8e f5 d2 d4 96 b4 65 d3 41 Q/......e.A
> PAE: len 99
0.717237
Interface Index: 3
EAPoL: len 99
Protocol Version: 1 (802.1X-2001)
Type: 3 (Key)
Length: 95
Descriptor Type: 2
Key MIC: true
Secure: true
Error: false
Request: false
Encrypted Key Data: false
SMK Message: false
Key Descriptor Version: 2 (02)
Key Type: true
Install: false
Key ACK: false
Key Length: 0
Key Replay Counter: 2
Key NONCE
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Key IV
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Key RSC
00 00 00 00 00 00 00 00 ........
Key MIC Data
58 61 8f 4a fb 79 4e a5 58 36 31 0e b7 71 c3 4f
Xa.J.yN.X61..q.O
Key Data: len 0
01 03 00 5f 02 03 0a 00 00 00 00 00 00 00 00 00 ..._............
02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 58 61 8f 4a fb 79 4e a5 58 36 31 0e b7 71 c3 .Xa.J.yN.X61..q.
4f 00 00 O..
< Request: New Key (0x0b) len 56 [ack]
0.717527
Key Data: len 16
ab aa cd 37 2e ef 97 7f 15 f8 72 a5 90 2c c0 20 ...7......r..,.
Key Cipher: CCMP (00:0f:ac) suite 04
MAC Address 60:F2:62:AE:70:FE
Key Index: 0 (0x00)
Interface Index: 3 (0x00000003)
> Response: New Key (0x0b) len 4 [0x100]
0.718200
Status: Success (0)
< Request: Set Station (0x12) len 32 [ack]
0.718256
Interface Index: 3 (0x00000003)
MAC Address 60:F2:62:AE:70:FE
Station Flags 2: len 8
Mask: 0x00000002
Authorized
Set: 0x00000002
Authorized
> Response: Set Station (0x12) len 4 [root]
0.718608
Status: Success (0)
< RTNL: Set Link (0x13) len 32 [request,ack]
0.718663
Flags: 5 (0x005)
Sequence number: 8 (0x00000008)
Port ID: 81225
> RTNL: New Link (0x10) len 1308
0.718871
Flags: 0 (0x000)
Sequence number: 0 (0x00000000)
Port ID: 0
IFLA Family: Unknown
IFLA Type: 1
IFLA Index: 3
IFLA ChangeMask: 0
IFLA Flags: (0x1043) [up,broadcast,running,multicast]
IfName (len:6): wlan0
Txqlen: 1000 (0x000003e8)
OperState: up (6)
LinkMode: userspace controlled (1)
MTU: 1500 (0x000005dc)
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 1
Qdisc (len:9): fq_codel
Reserved: len 4
Reserved: len 1
Reserved: len 4
Reserved: len 4
Map: len 32
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Interface Address: b8:27:eb:52:cc:d0
Broadcast Address: ff:ff:ff:ff:ff:ff
Reserved: len 192
Stats: len 96
7c 10 22 00 f1 7f 03 00 5a a1 b5 16 db b9 57 03
|.".....Z.....W.
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
45 f2 1e 00 00 00 00 00 00 00 00 00 00 00 00 00
E...............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Reserved: len 8
Reserved: len 756
> RTNL: New Link (0x10) len 1308
0.718888
Flags: 0 (0x000)
Sequence number: 0 (0x00000000)
Port ID: 0
IFLA Family: Unknown
IFLA Type: 1
IFLA Index: 3
IFLA ChangeMask: 0
IFLA Flags: (0x1043) [up,broadcast,running,multicast]
IfName (len:6): wlan0
Txqlen: 1000 (0x000003e8)
OperState: up (6)
LinkMode: userspace controlled (1)
MTU: 1500 (0x000005dc)
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 1
Qdisc (len:9): fq_codel
Reserved: len 4
Reserved: len 1
Reserved: len 4
Reserved: len 4
Map: len 32
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Interface Address: b8:27:eb:52:cc:d0
Broadcast Address: ff:ff:ff:ff:ff:ff
Reserved: len 192
Stats: len 96
7c 10 22 00 f1 7f 03 00 5a a1 b5 16 db b9 57 03
|.".....Z.....W.
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
45 f2 1e 00 00 00 00 00 00 00 00 00 00 00 00 00
E...............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Reserved: len 8
Reserved: len 756
> RTNL: New Link (0x10) len 1308
0.718896
Flags: 0 (0x000)
Sequence number: 0 (0x00000000)
Port ID: 0
IFLA Family: Unknown
IFLA Type: 1
IFLA Index: 3
IFLA ChangeMask: 0
IFLA Flags: (0x1043) [up,broadcast,running,multicast]
IfName (len:6): wlan0
Txqlen: 1000 (0x000003e8)
OperState: up (6)
LinkMode: userspace controlled (1)
MTU: 1500 (0x000005dc)
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 4
Reserved: len 1
Qdisc (len:9): fq_codel
Reserved: len 4
Reserved: len 1
Reserved: len 4
Reserved: len 4
Map: len 32
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Interface Address: b8:27:eb:52:cc:d0
Broadcast Address: ff:ff:ff:ff:ff:ff
Reserved: len 192
Stats: len 96
7c 10 22 00 f1 7f 03 00 5a a1 b5 16 db b9 57 03
|.".....Z.....W.
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
45 f2 1e 00 00 00 00 00 00 00 00 00 00 00 00 00
E...............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
Reserved: len 8
Reserved: len 756
> RTNL: Error (0x02) len 20 [0x100]
0.718926
Flags: 256 (0x100)
Sequence number: 8 (0x00000008)
Port ID: 81225
ACK: 0
Still gives an RTNL error but I do not kow what that means. And once
connected, I could not disconnect and reconnect without restarting the ap.
I would get an immediate dsiconnect and iwmon shows:
> Event: Del Station (0x14) len 32
474.439927
Interface Index: 3 (0x00000003)
MAC Address 60:F2:62:AE:70:FE
Generation: 0 (0x00000000)
Station Info: len 0
When I restart the AP from iwct, I can connect again.
What I do not yet know how to do, though, is assign an ip address to the ap
and then have it be a dhcp server to serve out a dhcp address to the
connecting computer. I found this online and took a stab, but it did not
assign an address, though the computer did 'attach'.
How do you set it up for iwd to be a dhcp server? If iwd cannot do it, can
I use dhcpd? dnsmasq? I have found very little info in my searches.
Thanks for this! It will help with adoption of iwd in the RPi community.
1 year, 3 months
[PATCH 1/5] ap: Set the group cipher when sending START_AP
by Andrew Zaborowski
Seems this overlooked because an initial version of ap.c didn't have
group traffic support. This doesn't fix some brcmfmac problems where it
silently overrides the group cipher in the beacon frames though.
---
src/ap.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/ap.c b/src/ap.c
index ce639907..c4715696 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -2108,7 +2108,8 @@ static struct l_genl_msg *ap_build_cmd_start_ap(struct ap_state *ap)
uint32_t ifindex = netdev_get_ifindex(ap->netdev);
struct wiphy *wiphy = netdev_get_wiphy(ap->netdev);
uint32_t hidden_ssid = NL80211_HIDDEN_SSID_NOT_IN_USE;
- uint32_t nl_ciphers = ie_rsn_cipher_suite_to_cipher(ap->ciphers);
+ uint32_t group_nl_cipher =
+ ie_rsn_cipher_suite_to_cipher(ap->group_cipher);
uint32_t nl_akm = CRYPTO_AKM_PSK;
uint32_t wpa_version = NL80211_WPA_VERSION_2;
uint32_t auth_type = NL80211_AUTHTYPE_OPEN_SYSTEM;
@@ -2148,6 +2149,8 @@ static struct l_genl_msg *ap_build_cmd_start_ap(struct ap_state *ap)
&hidden_ssid);
l_genl_msg_append_attr(cmd, NL80211_ATTR_CIPHER_SUITES_PAIRWISE, 4,
&nl_ciphers);
+ l_genl_msg_append_attr(cmd, NL80211_ATTR_CIPHER_SUITE_GROUP, 4,
+ &group_nl_cipher);
l_genl_msg_append_attr(cmd, NL80211_ATTR_WPA_VERSIONS, 4, &wpa_version);
l_genl_msg_append_attr(cmd, NL80211_ATTR_AKM_SUITES, 4, &nl_akm);
l_genl_msg_append_attr(cmd, NL80211_ATTR_AUTH_TYPE, 4, &auth_type);
--
2.20.1
1 year, 3 months
[PATCH v3] auto-t: add test for stopping periodic roam retries
by Alvin Šipraga
---
v2 -> v3:
- Removed unnecessary waits
---
autotests/testRoamRetry/stop_retry_test.py | 131 +++++++++++++++++++++
1 file changed, 131 insertions(+)
create mode 100644 autotests/testRoamRetry/stop_retry_test.py
diff --git a/autotests/testRoamRetry/stop_retry_test.py b/autotests/testRoamRetry/stop_retry_test.py
new file mode 100644
index 00000000..a2729d6c
--- /dev/null
+++ b/autotests/testRoamRetry/stop_retry_test.py
@@ -0,0 +1,131 @@
+#!/usr/bin/python3
+
+import unittest
+import sys
+
+sys.path.append('../util')
+import iwd
+from iwd import IWD
+from iwd import PSKAgent
+from iwd import NetworkType
+
+import testutil
+
+from hostapd import HostapdCLI
+from hwsim import Hwsim
+
+class Test(unittest.TestCase):
+ # Test that we do not periodically retry roaming if the transision looks
+ # like this: LOW [roam] [new bss] HIGH.
+ def test_stop_retry(self):
+ hwsim = Hwsim()
+
+ bss_hostapd = [ HostapdCLI(config='ssid1.conf'),
+ HostapdCLI(config='ssid2.conf') ]
+ bss_radio = [ hwsim.get_radio('rad0'),
+ hwsim.get_radio('rad1') ]
+
+ rule0 = hwsim.rules.create()
+ rule0.source = bss_radio[0].addresses[0]
+ rule0.bidirectional = True
+
+ rule1 = hwsim.rules.create()
+ rule1.source = bss_radio[1].addresses[0]
+ rule1.bidirectional = True
+
+ # Fill in the neighbor AP tables in both BSSes. By default each
+ # instance knows only about current BSS, even inside one hostapd
+ # process.
+ # Roaming still works without the neighbor AP table but neighbor
+ # reports have to be disabled in the .conf files
+ bss0_nr = ''.join(bss_radio[0].addresses[0].split(':')) + \
+ '8f0000005101060603000000'
+ bss1_nr = ''.join(bss_radio[1].addresses[0].split(':')) + \
+ '8f0000005102060603000000'
+
+ bss_hostapd[0].set_neighbor(bss_radio[1].addresses[0], 'TestRoamRetry',
+ bss1_nr)
+ bss_hostapd[1].set_neighbor(bss_radio[0].addresses[0], 'TestRoamRetry',
+ bss0_nr)
+
+ # Start in the vicinity of BSS 0, check that iwd connects to BSS 0
+ rule0.signal = -2000
+ rule1.signal = -5000
+
+ wd = IWD()
+
+ psk_agent = PSKAgent("secret123")
+ wd.register_psk_agent(psk_agent)
+
+ devices = wd.list_devices(1)
+ device = devices[0]
+
+ condition = 'not obj.scanning'
+ wd.wait_for_object_condition(device, condition)
+
+ device.scan()
+
+ condition = 'not obj.scanning'
+ wd.wait_for_object_condition(device, condition)
+
+ ordered_network = device.get_ordered_network('TestRoamRetry')
+
+ self.assertEqual(ordered_network.type, NetworkType.psk)
+
+ condition = 'not obj.connected'
+ wd.wait_for_object_condition(ordered_network.network_object, condition)
+
+ ordered_network.network_object.connect()
+
+ condition = 'obj.state == DeviceState.connected'
+ wd.wait_for_object_condition(device, condition)
+
+ self.assertTrue(bss_hostapd[0].list_sta())
+ self.assertFalse(bss_hostapd[1].list_sta())
+
+ # Now push the signal below the RSSI threshold and check that iwd
+ # connects to BSS 1
+ rule0.signal = -8000
+
+ condition = 'obj.state == DeviceState.roaming'
+ wd.wait_for_object_condition(device, condition)
+
+ # Check that iwd is on BSS 1 once out of roaming state and doesn't
+ # go through 'disconnected', 'autoconnect', 'connecting' in between
+ condition = 'obj.state != DeviceState.roaming'
+ wd.wait_for_object_condition(device, condition)
+
+ self.assertEqual(device.state, iwd.DeviceState.connected)
+ self.assertTrue(bss_hostapd[1].list_sta())
+
+ # Now make sure that we don't roam anymore. In order to catch this via
+ # DeviceState, a suitable roaming target needs to be available. So jack
+ # up the RSSI of BSS 0 again. The retry interval is 60 seconds, so we
+ # should have roamed within that timeframe. Wait just a little longer
+ # to account for the slowness of the autotest environment.
+ rule0.signal = -2000
+
+ condition = 'obj.state == DeviceState.roaming'
+ self.assertRaises(TimeoutError, wd.wait_for_object_condition, device,
+ condition, max_wait=70)
+
+ device.disconnect()
+
+ condition = 'not obj.connected'
+ wd.wait_for_object_condition(ordered_network.network_object, condition)
+
+ wd.unregister_psk_agent(psk_agent)
+
+ rule0.remove()
+ rule1.remove()
+
+ @classmethod
+ def setUpClass(cls):
+ pass
+
+ @classmethod
+ def tearDownClass(cls):
+ IWD.clear_storage()
+
+if __name__ == '__main__':
+ unittest.main(exit=True)
--
2.29.2
1 year, 3 months
[PATCH v4] knownnetworks: sanitize known_network.freq on load
by James Prestwood
An invalid known_network.freq file containing several UUID
groups which have the same 'name' key results in memory leaks
in IWD. This is because the file is loaded and the group's
are iterated without detecting duplicates. This leads to the
same network_info's known_frequencies being set/overridden
multiple times.
To fix this we just check if the network_info already has a
UUID set. If so remove the stale entry.
There may be other old, invalid, or stale entries from previous
versions of IWD, or a user misconfiguring the file. These will
now also be removed during load.
---
src/knownnetworks.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
v4:
* Fixed a few memory leak issues
diff --git a/src/knownnetworks.c b/src/knownnetworks.c
index 53cfc30f..674feca0 100644
--- a/src/knownnetworks.c
+++ b/src/knownnetworks.c
@@ -910,29 +910,38 @@ static int known_network_frequencies_load(void)
const char *path = l_settings_get_value(known_freqs, groups[i],
"name");
if (!path)
- continue;
+ goto invalid_entry;
info = find_network_info_from_path(path);
if (!info)
- continue;
+ goto invalid_entry;
+
+ if (info->has_uuid)
+ goto invalid_entry;
freq_list = l_settings_get_string(known_freqs, groups[i],
"list");
if (!freq_list)
- continue;
+ goto invalid_entry;
known_frequencies = known_frequencies_from_string(freq_list);
+ l_free(freq_list);
+
if (!known_frequencies)
- goto next;
+ goto invalid_entry;
- if (!l_uuid_from_string(groups[i], uuid))
- goto next;
+ if (!l_uuid_from_string(groups[i], uuid)) {
+ l_queue_destroy(known_frequencies, l_free);
+ goto invalid_entry;
+ }
network_info_set_uuid(info, uuid);
info->known_frequencies = known_frequencies;
-next:
- l_free(freq_list);
+ continue;
+
+invalid_entry:
+ l_settings_remove_group(known_freqs, groups[i]);
}
l_strv_free(groups);
--
2.26.2
1 year, 3 months
[PATCH v3] knownnetworks: sanitize known_network.freq on load
by James Prestwood
An invalid known_network.freq file containing several UUID
groups which have the same 'name' key results in memory leaks
in IWD. This is because the file is loaded and the group's
are iterated without detecting duplicates. This leads to the
same network_info's known_frequencies being set/overridden
multiple times.
To fix this we just check if the network_info already has a
UUID set. If so remove the stale entry.
There may be other old, invalid, or stale entries from previous
versions of IWD, or a user misconfiguring the file. These will
now also be removed during load.
---
src/knownnetworks.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
v3:
* Forgot to send 'v2' on last patch
* Added removal of ALL invalid entries rather than only
network duplicates.
diff --git a/src/knownnetworks.c b/src/knownnetworks.c
index 53cfc30f..a61d31e7 100644
--- a/src/knownnetworks.c
+++ b/src/knownnetworks.c
@@ -910,29 +910,36 @@ static int known_network_frequencies_load(void)
const char *path = l_settings_get_value(known_freqs, groups[i],
"name");
if (!path)
- continue;
+ goto invalid_entry;
info = find_network_info_from_path(path);
if (!info)
- continue;
+ goto invalid_entry;
+
+ if (info->has_uuid)
+ goto invalid_entry;
freq_list = l_settings_get_string(known_freqs, groups[i],
"list");
if (!freq_list)
- continue;
+ goto invalid_entry;
known_frequencies = known_frequencies_from_string(freq_list);
if (!known_frequencies)
- goto next;
+ goto invalid_entry;
if (!l_uuid_from_string(groups[i], uuid))
- goto next;
+ goto invalid_entry;
network_info_set_uuid(info, uuid);
info->known_frequencies = known_frequencies;
-next:
l_free(freq_list);
+
+ continue;
+
+invalid_entry:
+ l_settings_remove_group(known_freqs, groups[i]);
}
l_strv_free(groups);
--
2.26.2
1 year, 3 months
[PATCH] station: fix leak on parse_neighbor_report
by James Prestwood
---
src/station.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/station.c b/src/station.c
index 55368472..14a3d171 100644
--- a/src/station.c
+++ b/src/station.c
@@ -1998,8 +1998,11 @@ static void parse_neighbor_report(struct station *station,
scan_freq_set_add(freq_set_no_md, current_freq);
*set = freq_set_no_md;
scan_freq_set_free(freq_set_md);
- } else
+ } else {
+ scan_freq_set_free(freq_set_no_md);
+ scan_freq_set_free(freq_set_md);
*set = NULL;
+ }
}
static void station_neighbor_report_cb(struct netdev *netdev, int err,
--
2.26.2
1 year, 3 months
[PATCH] knownnetworks: sanitize known_network.freq on load
by James Prestwood
An invalid known_network.freq file containing several UUID
groups which have the same 'name' key results in memory leaks
in IWD. This is because the file is loaded and the group's
are iterated without detecting duplicates. This leads to the
same network_info's known_frequencies being set/overridden
multiple times.
To fix this we just check if the network_info already has a
UUID set. If so remove the stale entry.
---
src/knownnetworks.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/knownnetworks.c b/src/knownnetworks.c
index 53cfc30f..32beae84 100644
--- a/src/knownnetworks.c
+++ b/src/knownnetworks.c
@@ -916,6 +916,11 @@ static int known_network_frequencies_load(void)
if (!info)
continue;
+ if (info->has_uuid) {
+ l_settings_remove_group(known_freqs, groups[i]);
+ continue;
+ }
+
freq_list = l_settings_get_string(known_freqs, groups[i],
"list");
if (!freq_list)
--
2.26.2
1 year, 3 months
[PATCH] knownnetworks: sanitize known_network.freq on load
by James Prestwood
An invalid known_network.freq file containing several UUID
groups which have the same 'name' key results in memory leaks
in IWD. This is because the file is loaded and the group's
are iterated without any verification that the UUID matches
whatever provisioning file we have on disk. This leads to the
same network_info's known_frequencies being set/overridden
multiple times.
To fix this the UUID/group is verified after we lookup the
network_info. If it does not match the stale entry is removed
and synced to disk.
---
src/knownnetworks.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/knownnetworks.c b/src/knownnetworks.c
index 53cfc30f..9a6d8aad 100644
--- a/src/knownnetworks.c
+++ b/src/knownnetworks.c
@@ -889,6 +889,21 @@ static struct network_info *find_network_info_from_path(const char *path)
return search.info;
}
+static bool verify_network_uuid(struct network_info *info,
+ const char *uuid_check)
+{
+ char uuid_str[37];
+ const uint8_t *uuid = network_info_get_uuid(info);
+
+ if (!l_uuid_to_string(uuid, uuid_str, sizeof(uuid_str)))
+ return false;
+
+ if (!strcmp(uuid_str, uuid_check))
+ return true;
+
+ return false;
+}
+
static int known_network_frequencies_load(void)
{
char **groups;
@@ -916,6 +931,12 @@ static int known_network_frequencies_load(void)
if (!info)
continue;
+ if (!verify_network_uuid(info, groups[i])) {
+ l_settings_remove_group(known_freqs, groups[i]);
+ known_network_frequency_sync(info);
+ continue;
+ }
+
freq_list = l_settings_get_string(known_freqs, groups[i],
"list");
if (!freq_list)
--
2.26.2
1 year, 3 months
[PATCH] ap: fix off by one error
by James Prestwood
The RSN element was not being allocated properly which caused
an invalid read in some cases.
---
src/ap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ap.c b/src/ap.c
index e695a67e..ce639907 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -2212,7 +2212,7 @@ static bool ap_parse_new_station_ies(const void *data, uint16_t len,
goto parse_error;
rsn = l_memdup(ie_tlv_iter_get_data(&iter) - 2,
- ie_tlv_iter_get_length(&iter) + 1);
+ ie_tlv_iter_get_length(&iter) + 2);
break;
case IE_TYPE_EXTENDED_SUPPORTED_RATES:
if (ap_parse_supported_rates(&iter, &rates) < 0)
--
2.26.2
1 year, 3 months
[PATCH 1/2] ap: rename ap_parse_ie to be more descriptive
by James Prestwood
This is only used for NEW_STATION parsing so name appropriately
---
src/ap.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/ap.c b/src/ap.c
index 7ff15097..0b96e2ab 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -2197,8 +2197,9 @@ error:
ap_start_failed(ap);
}
-static bool ap_parse_ie(const void *data, uint16_t len, uint8_t **rsn_out,
- struct l_uintset **rates_out)
+static bool ap_parse_new_station_ies(const void *data, uint16_t len,
+ uint8_t **rsn_out,
+ struct l_uintset **rates_out)
{
struct ie_tlv_iter iter;
uint8_t *rsn = NULL;
@@ -2255,7 +2256,8 @@ static void ap_handle_new_station(struct ap_state *ap, struct l_genl_msg *msg)
while (l_genl_attr_next(&attr, &type, &len, &data)) {
switch (type) {
case NL80211_ATTR_IE:
- if (!ap_parse_ie(data, len, &assoc_rsne, &rates))
+ if (!ap_parse_new_station_ies(data, len, &assoc_rsne,
+ &rates))
return;
break;
case NL80211_ATTR_MAC:
--
2.26.2
1 year, 3 months