3
3
:revdate: May 08, 2023
4
4
:lang: en
5
5
6
- *TL;DR* Fiddling with hostad code I have managed to successfully establish WiFi
7
- communication between multiple AP, each of them send and receive traffic from
8
- the other as if they where associated stations, while they are all configured in
9
- AP mode. This P2P like behavior have multiple advantages compared to the usual
6
+ *TL;DR* Fiddling with `hostapd` code I have managed to successfully establish WiFi
7
+ communication between multiple APs. Each of them sends and receives traffic from
8
+ the other as if they were associated _stations_ , even though they are all configured in
9
+ AP mode. This P2P- like behavior has multiple advantages compared to the usual
10
10
setup where one of them is configured as AP and all the others as stations, and
11
11
also compared to Ad-Hoc, WDS, 802.11s, Multi-AP and EasyMesh.
12
- I have named this operanting mode APuP (Access Point Micro Peering).
12
+ I have named this operating mode APuP (Access Point Micro Peering).
13
13
14
14
15
15
== A bit of context
16
16
17
- In community networks we need to maximize the possible paths of communitacions
17
+ In community networks we need to maximize the possible paths of communications
18
18
between nodes. In a classical AP-STA approach it is not possible to guarantee
19
- communication between all possible nodes in all scenarios. As an example if we
20
- have 4 nodes A, B, C and D where A and B sees each other, B and C sees each
21
- other C and D sees each other. With AP-STA mode each radio must operate either
22
- as AP or as STA, each STA must connect to only one AP at once, STA need an AP to
23
- relay communication between thems. In each combination configuring each node
24
- either as AP or STA you will see that some of them will end up not being able to
25
- connect. To overcome this issue in the past adhoc mode was used which solved the
26
- basic connectivity issue, still it\'s implementation wasn\'t high quality and
27
- it\'s design had important flaws, this resulted it in becoming
28
- unmaintained after a few years. Luckly while adhoc was growing outdated 802.11s
29
- emerged, it had a few improvements, still some design choice such as complex
30
- ways to bridge other networks and routing between nodes fossilized into the
31
- standard, increased WiFi drivers complexity became problematic and lastly
32
- determined it\'s silent demisal. New radios drivers and firmwares doesn\'t
33
- support 802.11s well. New WiFi standards doesn\'t bring much improvements to
34
- 802.11s mesh mode, while they do improve a lot AP-STA modes. Still our need of
35
- nodes being able to comunicate to anyone in range is strong. In this context,
36
- looking for a modern solution I started asking myself, is there an hard to
37
- resolve problem that impede AP nodes in sight to talk each other?
38
- Talking about my thinking with Felix Fietkau (nbd), we agreed that it might be
39
- possible for AP nodes to commuicate directly each other, and because AP mode is
40
- what is getting more support and improvements, if we can we just use that on
41
- all nodes with some slight modification so all AP in sight can talk each other,
42
- we could solve this problem that afflict us since WiFi creation.
19
+ communication between all possible nodes in all scenarios. As an example, we might
20
+ have 4 nodes A, B, C and D where A and B see each other, B and C see each
21
+ other, and C and D see each other. With AP-STA mode each radio must operate either
22
+ as AP or as STA, each STA must connect to only one AP at a time, and a STA needs an AP to
23
+ relay communication between them. In each combination, restricting each node
24
+ to be an AP or STA you will see that some of them will end up not being able to
25
+ connect.
26
+
27
+ To overcome this issue in the past, adhoc mode was used which solved the
28
+ basic connectivity issue. However, its implementation wasn\'t high quality and
29
+ its design had important flaws, and it became
30
+ unmaintained after a few years. Luckily while adhoc was growing outdated, 802.11s
31
+ emerged with a few improvements. Its design choices such as complex
32
+ ways to bridge other networks and routing between nodes were fossilized into the
33
+ standard. The increased WiFi driver complexity became problematic and ultimately
34
+ determined its silent demise. New radios drivers and firmware don\'t
35
+ support 802.11s well. Nor do the WiFi standards bring much improvement to
36
+ 802.11s mesh mode, while they do improve a lot AP-STA modes. Our need for
37
+ nodes to communicate to anyone in range remains strong.
38
+
39
+ With this as background, I started asking myself: is there some hard-to-resolve
40
+ problem that impedes AP nodes in sight from talking each other?
41
+ Or is there a simple solution?
42
+
43
+ Talking with Felix Fietkau (nbd), we agreed that it might be
44
+ possible for AP nodes to communicate directly with each other.
45
+ This would be additionally important because AP mode continues to receive
46
+ more support and improvements. If there were some slight modification
47
+ that allowed APs to talk to other "visible" APs,
48
+ we could solve a problem that afflicted us since WiFi creation.
43
49
Felix suggested that this should be possible and with a bit of luck should not
44
- even need kernel and driver modifications, modifing `hostapd` in a way that each
45
- AP adds the other in sight to its station list could be enough and it is indeed
46
- the staring point to start experimenting and see what happens .
50
+ even need kernel and driver modifications: modifying `hostapd` in a way that each
51
+ AP adds other visible APs to its station list could be enough. This was indeed
52
+ the starting point for my experiments .
47
53
48
54
49
55
== Deep diving into hostapd
@@ -161,22 +167,22 @@ checks about _overlapping legacy BSS condition_.
161
167
162
168
== OpenWrt hostapd packaging
163
169
164
- `hostapd` openwrt package is shipped toghether with OpenWrt sources, and it is
170
+ `hostapd` openwrt package is shipped together with OpenWrt sources, and it is
165
171
found at +package/network/services/hostapd/+. In this directory we find
166
- + README.md+ file which show a few interesting methods of the hostapd ubus
167
- interface and + Makefile+ where all the `hostapd` OpenWrt variants like `wpad`
168
- are defined. The + Makefile+ is a bit complex because the variants are a lot
172
+ ` README.md` file which show a few interesting methods of the hostapd ubus
173
+ interface and ` Makefile` where all the `hostapd` OpenWrt variants like `wpad`
174
+ are defined. The ` Makefile` is complex because there are many variants
169
175
depending on which subset of `hostapd` features are enabled, on what SSL/TLS
170
- library is used etc. it is structured to avoid duplicating code and
171
- common options all around that effectlively reduces the size of the `Makefile`
176
+ library is used, etc. The `Makefile` is structured to avoid duplicating code and
177
+ common options all around that effectively reduces the size of the `Makefile`
172
178
and probably ease the work for the maintainer.
173
179
174
- Depending on package variant OpenWrt `hostapd` package + Makefile+ sets multiple
175
- configs with statments like `DRIVER_MAKEOPTS += CONFIG_AP=y` or
176
- `DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_SAE=y` those configurations
177
- doesn 't seems to impact directly in the hostapd C code `#ifdef` but are dealt
178
- within `hostapd` and `wpa_supplicant` sources + Makefile+ which depending on the
179
- passed configs set the proper `CFLAGS`, C source files and output objects files.
180
+ Depending on package variant OpenWrt `hostapd` package ` Makefile` sets multiple
181
+ configs with statements like `DRIVER_MAKEOPTS += CONFIG_AP=y` or
182
+ `DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_SAE=y`. Those configurations
183
+ don 't seem to impact directly in the hostapd C code `#ifdef` but are handled
184
+ within `hostapd` and `wpa_supplicant` sources ` Makefile` which depend on the
185
+ passed configs to set the proper `CFLAGS`, C source files and output objects files.
180
186
181
187
To use our customized `hostapd` source in OpenWrt we use source tree override
182
188
https://forum.archive.openwrt.org/viewtopic.php?id=46916[as explained by Jow]
@@ -199,23 +205,23 @@ To clean and re-build only hostapd package use
199
205
== hostapd modifications
200
206
201
207
To enable WDS AP - AP I have modified `handle_beacon(...)` function defined in
202
- +src/ap/ieee802_11.c+, so when a beacon from another AP is received beside the
203
- usual processing, it checks if the advertised SSID is the same as one advertised
204
- by current istance, if so, information from that beacon is extracted and
205
- adapted to look like station information, and a station entry is populated and
206
- saved into hostapd station list. This modifications should be put into their own
207
- function later.
208
-
209
- To avoid all specific interface created for each AP-AP connection being bridged
210
- automatically by `hostapd` and potentially creating a loop , I have temporarly
211
- disabled bridging in `hostapd_set_wds_sta` defined in +src/ap/ap_drv_ops.c+,
212
- this should become a runtime configuration later.
208
+ +src/ap/ieee802_11.c+, so when a beacon from another AP is received, `hostapd` also
209
+ checks if the advertised SSID is the same as one advertised
210
+ by current instance. If so, information from that beacon is extracted and
211
+ adapted to look like station information, and a station entry is populated
212
+ into the hostapd station list. _These modifications should be put into their own
213
+ function later._
214
+
215
+ To avoid loops from all specific interfaces created for each AP-AP connection
216
+ being bridged automatically by `hostapd`, I have temporarily
217
+ disabled bridging in `hostapd_set_wds_sta` defined in +src/ap/ap_drv_ops.c+.
218
+ _This should become a runtime configuration later._
213
219
214
220
I have also added a compile time config `CONFIG_APUP` in +hostapd/Makefile+ so
215
- this modifications can be easly enabled at compile time.
221
+ these modifications can be easly enabled at compile time.
216
222
217
- I have tested the modifications and after a bunch of round of trial and error
218
- works as expected, with good performances, you can see the + test.sh+ script
223
+ I have tested the modifications and after a round of trial and error, it
224
+ works as expected with good performance. You can see the ` test.sh` script
219
225
which configures four vanilla OpenWrt routers into a working testbed to see how
220
226
to use this.
221
227
@@ -462,13 +468,13 @@ http://www.bradgoodman.com/bittool/
462
468
463
469
== WDS Station interface bridging
464
470
465
- hostapd add WDS STA interfaces to a bridge either the same of plain station
466
- passed with the `bridge` option or to another one passed with the `wds_bridge`,
467
- in our use case this is not ideal as we might want the routing propocols access
468
- directly to the station interface. Moreover in a mesh setup multiple links could
469
- easily cause a bridge loop, that linux simple bridge will be not able to handle
471
+ ` hostapd` adds WDS STA interfaces to a bridge either the same of plain station
472
+ passed with the `bridge` option or to another one passed with the `wds_bridge`.
473
+ In our use case this is not ideal as we might want to give routing protocols access
474
+ directly to the station interface. Moreover in a mesh setup, multiple links could
475
+ easily cause a bridge loop: linux simple bridge will not avoid this
470
476
as is. To disable automatic bridging set `wds_bridge` to an empty string in the
471
- hostapd config file.
477
+ ` hostapd` config file.
472
478
473
479
474
480
== Interesting conversations
@@ -650,7 +656,7 @@ hostapd config file.
650
656
[11:58] <G10h4ck> Great! thanks f00b4r0
651
657
--------------------------------------------------------------------------------
652
658
653
- == Suggested readings
659
+ == Suggested reading
654
660
655
- https://wireless.wiki.kernel.org/en/users/Documentation/hostapd
656
- https://wireless.wiki.kernel.org/en/developers/documentation/glossary
661
+ * https://wireless.wiki.kernel.org/en/users/Documentation/hostapd
662
+ * https://wireless.wiki.kernel.org/en/developers/documentation/glossary
0 commit comments