Skip to content

Commit ee32e4d

Browse files
committed
Initial support for APuP in libremesh
APuP WiFi is now usable and testeable in LiMe Some part of the code have workaround to OpenWrt ubus and netifd current bugs/limitations and will be modified once upstream limitations are solved To use APuP just set 'apup' as LiMe wifi mode as an example using the followings commands ``` uci del lime-community.wifi.modes uci add_list lime-community.wifi.modes=apup uci commit lime-config reboot ```
1 parent 07c8616 commit ee32e4d

File tree

17 files changed

+442
-74
lines changed

17 files changed

+442
-74
lines changed

packages/lime-curtigghio/test.sh

Lines changed: 122 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,32 @@ dax2Ipll="fe80::aa63:7dff:fe2e:97d8%$cIface"
4141
hlk1Ipll="169.254.145.20"
4242
hlk2Ipll="169.254.145.22"
4343

44+
youhuaIpll="fe80::d65f:25ff:feeb:63d8%$cIface"
45+
4446
source "${KCONFIG_UTILS_DIR}/kconfig-utils.sh"
4547

46-
function fTestConf()
48+
function fHostapdSourceTreeOverride()
4749
{
48-
kconfig_set CONFIG_DEVEL
49-
kconfig_set CONFIG_SRC_TREE_OVERRIDE
50-
5150
local mHostapdGitSrc="$OPENWRT_BUILD_DIR/package/network/services/hostapd/git-src"
5251
rm -f "$mHostapdGitSrc"
5352
ln -s "${HOSTAPD_REPO_DIR}/.git" "$mHostapdGitSrc"
53+
}
5454

55+
function fNetifdSourceTreeOverride()
56+
{
5557
local mNetifdGitSrc="$OPENWRT_BUILD_DIR/package/network/config/netifd/git-src"
5658
rm -f "$mNetifdGitSrc"
5759
ln -s "$NETIFD_REPO_DIR/.git" "$mNetifdGitSrc"
60+
}
61+
62+
function fTestConf()
63+
{
64+
kconfig_set CONFIG_DEVEL
65+
kconfig_set CONFIG_SRC_TREE_OVERRIDE
66+
67+
# fHostapdSourceTreeOverride
68+
69+
fNetifdSourceTreeOverride
5870

5971
kconfig_set CONFIG_PACKAGE_iperf3
6072

@@ -93,6 +105,34 @@ function fBuildDapX()
93105
popd
94106
}
95107

108+
function fBuildYouhua()
109+
{
110+
pushd "$OPENWRT_BUILD_DIR"
111+
112+
./scripts/feeds update -a
113+
./scripts/feeds install -a
114+
115+
# Prepare firmware for D-Link DAP-X1860
116+
echo "" > "$KCONFIG_CONFIG_PATH"
117+
kconfig_init_register
118+
119+
kconfig_set CONFIG_TARGET_ramips
120+
kconfig_set CONFIG_TARGET_ramips_mt7621
121+
kconfig_set CONFIG_TARGET_ramips_mt7621_DEVICE_youhua_wr1200js
122+
make defconfig
123+
124+
fTestConf
125+
make defconfig
126+
127+
kconfig_check
128+
kconfig_wipe_register
129+
130+
clean_hostapd
131+
132+
make -j $(($(nproc)-1))
133+
popd
134+
}
135+
96136
function fBuildHlk()
97137
{
98138
pushd "$OPENWRT_BUILD_DIR"
@@ -166,18 +206,22 @@ function dWait()
166206

167207
function wait_all()
168208
{
169-
dWait ${hlk1Ipll}
170-
dWait ${hlk2Ipll}
171-
return
209+
# dWait ${youhuaIpll}
210+
# dWait ${dax1Ipll}
211+
# return
172212

173-
dWait ${dax1Ipll}
174-
dWait ${dax2Ipll}
175-
return
213+
# dWait ${hlk1Ipll}
214+
# dWait ${hlk2Ipll}
215+
# return
216+
217+
# dWait ${dax1Ipll}
218+
# dWait ${dax2Ipll}
219+
# return
176220

177221
dWait ${verdeIP}
178-
dWait ${neroIP}
179-
dWait ${bluIP}
180-
dWait ${bianco43IP}
222+
# dWait ${neroIP}
223+
# dWait ${bluIP}
224+
# dWait ${bianco43IP}
181225
}
182226

183227
function dConf()
@@ -223,59 +267,68 @@ EOF
223267

224268
function conf_all()
225269
{
226-
dConf ${hlk1Ipll} "OpenWrt-Hlk1" "169.254.145.20"
227-
dConf ${hlk2Ipll} "OpenWrt-Hlk2" "169.254.145.22"
228-
return
270+
# dConf ${youhuaIpll} "OpenWrt-Youhua" "192.168.1.24"
271+
# dConf ${dax1Ipll} "OpenWrt-Dax1" "192.168.1.16"
272+
# return
273+
274+
# dConf ${hlk1Ipll} "OpenWrt-Hlk1" "169.254.145.20"
275+
# dConf ${hlk2Ipll} "OpenWrt-Hlk2" "169.254.145.22"
276+
# return
229277

230-
dConf ${dax1Ipll} "OpenWrt-Dax1" "192.168.1.16"
231-
dConf ${dax2Ipll} "OpenWrt-Dax2" "192.168.1.18"
232-
return
278+
# dConf ${dax1Ipll} "OpenWrt-Dax1" "192.168.1.16"
279+
# dConf ${dax2Ipll} "OpenWrt-Dax2" "192.168.1.18"
280+
# return
233281

234282
dConf ${verdeIP} "OpenWrt-Verde" "192.168.1.4"
235-
dConf ${neroIP} "OpenWrt-nero" "192.168.1.10"
236-
dConf ${bluIP} "OpenWrt-blu" "192.168.1.8"
237-
dConf ${bianco43IP} "OpenWrt-bianco43" "192.168.1.12"
283+
# dConf ${neroIP} "OpenWrt-nero" "192.168.1.10"
284+
# dConf ${bluIP} "OpenWrt-blu" "192.168.1.8"
285+
# dConf ${bianco43IP} "OpenWrt-bianco43" "192.168.1.12"
238286
}
239287

240288
function flash_all()
241289
{
242-
dflash ${hlk1Ipll} "${OPENWRT_BUILD_DIR}/bin/targets/ramips/mt7621/openwrt-ramips-mt7621-hilink_hlk-7621a-evb-squashfs-sysupgrade.bin"
243-
dflash ${hlk2Ipll} "${OPENWRT_BUILD_DIR}/bin/targets/ramips/mt7621/openwrt-ramips-mt7621-hilink_hlk-7621a-evb-squashfs-sysupgrade.bin"
290+
# dflash ${hlk1Ipll} "${OPENWRT_BUILD_DIR}/bin/targets/ramips/mt7621/openwrt-ramips-mt7621-hilink_hlk-7621a-evb-squashfs-sysupgrade.bin"
291+
# dflash ${hlk2Ipll} "${OPENWRT_BUILD_DIR}/bin/targets/ramips/mt7621/openwrt-ramips-mt7621-hilink_hlk-7621a-evb-squashfs-sysupgrade.bin"
244292

245293
# dflash ${dax1Ipll} "${OPENWRT_BUILD_DIR}/bin/targets/ramips/mt7621/openwrt-ramips-mt7621-dlink_dap-x1860-a1-squashfs-sysupgrade.bin"
246294
# dflash ${dax2Ipll} "${OPENWRT_BUILD_DIR}/bin/targets/ramips/mt7621/openwrt-ramips-mt7621-dlink_dap-x1860-a1-squashfs-sysupgrade.bin"
247295

248-
# dflash ${verdeIP} "${OPENWRT_BUILD_DIR}/bin/targets/ath79/generic/openwrt-ath79-generic-tplink_tl-wdr3600-v1-squashfs-sysupgrade.bin"
296+
dflash ${verdeIP} "${OPENWRT_BUILD_DIR}/bin/targets/ath79/generic/openwrt-ath79-generic-tplink_tl-wdr3600-v1-squashfs-sysupgrade.bin"
249297
# dflash ${neroIP} "${OPENWRT_BUILD_DIR}/bin/targets/ath79/generic/openwrt-ath79-generic-tplink_tl-wdr3600-v1-squashfs-sysupgrade.bin"
250298
# dflash ${bluIP} "${OPENWRT_BUILD_DIR}/bin/targets/ath79/generic/openwrt-ath79-generic-tplink_tl-wdr3600-v1-squashfs-sysupgrade.bin"
251299
# dflash ${bianco43IP} "${OPENWRT_BUILD_DIR}/bin/targets/ath79/generic/openwrt-ath79-generic-tplink_tl-wdr4300-v1-squashfs-sysupgrade.bin"
252300

301+
# dflash ${youhuaIpll} "${OPENWRT_BUILD_DIR}/bin/targets/ramips/mt7621/openwrt-ramips-mt7621-youhua_wr1200js-squashfs-sysupgrade.bin"
302+
253303
wait_all
254304

255305
conf_all
256306

257-
ssh root@${hlk1Ipll} reboot
258-
ssh root@${hlk2Ipll} reboot
259-
260-
return
307+
# ssh root@${hlk1Ipll} reboot
308+
# ssh root@${hlk2Ipll} reboot
261309

262-
263-
ssh root@${dax1Ipll} reboot
264-
ssh root@${dax2Ipll} reboot
265-
266-
return
310+
# ssh root@${dax1Ipll} reboot
311+
# ssh root@${dax2Ipll} reboot
267312

268313
ssh root@${verdeIP} reboot
269-
ssh root@${neroIP} reboot
270-
ssh root@${bluIP} reboot
271-
ssh root@${bianco43IP} reboot
314+
# ssh root@${neroIP} reboot
315+
# ssh root@${bluIP} reboot
316+
# ssh root@${bianco43IP} reboot
317+
318+
# ssh root@${youhuaIpll} reboot
272319
}
273320

274321
function dev_packages_paths()
275322
{
276-
echo package/network/config/netifd \
277-
package/network/config/wifi-scripts \
278-
package/network/services/hostapd
323+
echo package/feeds/libremesh/lime-system \
324+
package/feeds/libremesh/lime-proto-batadv \
325+
package/feeds/libremesh/lime-proto-babeld
326+
327+
# package/feeds/libremesh/lime-proto-anygw
328+
329+
# echo package/network/config/netifd
330+
# package/network/config/wifi-scripts \
331+
# package/network/services/hostapd
279332
}
280333

281334
function clean_packages()
@@ -313,11 +366,10 @@ function upgrade_packages()
313366

314367
local mInstalls=""
315368

316-
for mPackageName in \
317-
netifd \
318-
hostapd-common wpad-basic-mbedtls wifi-scripts ; do
369+
for mPackageName in $(dev_packages_paths) ; do
370+
mPackageName="$(basename "$mPackageName")"
319371

320-
local mPkgPath="$(ls "$OPENWRT_BUILD_DIR/bin/packages/$dPkgArch/base/$mPackageName"*.ipk)"
372+
local mPkgPath="$(ls "$OPENWRT_BUILD_DIR/bin/packages/$dPkgArch/"*"/$mPackageName"*.ipk | head -n 1)"
321373
scp -O "$mPkgPath" root@[${dAddress}]:/tmp/
322374

323375
mInstalls="$mInstalls \"/tmp/$(basename $mPkgPath)\""
@@ -328,16 +380,18 @@ function upgrade_packages()
328380

329381
function upgrade_packages_all()
330382
{
331-
upgrade_packages ${hlk1Ipll}
332-
upgrade_packages ${hlk2Ipll}
383+
# upgrade_packages ${hlk1Ipll}
384+
# upgrade_packages ${hlk2Ipll}
385+
386+
# upgrade_packages ${dax1Ipll}
387+
# upgrade_packages ${dax2Ipll}
333388

334-
# upgrade_hostapd ${dax1Ipll}
335-
# upgrade_hostapd ${dax2Ipll}
389+
upgrade_packages $verdeIP mips_24kc
390+
# upgrade_packages ${neroIP} mips_24kc
391+
# upgrade_packages $bluIP mips_24kc
392+
# upgrade_packages ${bianco43IP} mips_24kc
336393

337-
# upgrade_hostapd $verdeIP
338-
# upgrade_hostapd ${neroIP}
339-
# upgrade_hostapd $bluIP
340-
# upgrade_hostapd ${bianco43IP}
394+
# upgrade_packages ${youhuaIpll}
341395

342396
sleep 5s
343397

@@ -370,17 +424,17 @@ function dTestUbusDev()
370424
{
371425
local dAddress="$1"
372426

373-
ssh root@${dAddress} reboot ; sleep 10
427+
# ssh root@${dAddress} reboot ; sleep 10
374428

375-
dWait ${dAddress}
429+
# dWait ${dAddress}
376430

377431
ssh root@${dAddress} << REMOTE_HOST_EOS
378-
ubus call network add_dynamic_device '{"name":"nomestru", "type":"8021ad", "ifname":"wlan0.peer1", "vid":"47"}'
379-
ubus call network add_dynamic '{"name":"ifstru", "proto":"static", "auto":1, "device":"nomestru", "ipaddr":"169.254.145.20", "netmask":"255.255.255.255"}'
380-
ubus call network.interface.ifstru up
381-
ubus call network.device status '{"name":"nomestru"}'
432+
ubus call network add_dynamic_device '{"name":"wlan0_peer1_47", "type":"8021ad", "ifname":"wlan0.peer1", "vid":"47"}'
433+
ubus call network add_dynamic '{"name":"wlan0_peer1_47", "proto":"static", "auto":1, "device":"nomestru", "ipaddr":"169.254.145.20", "netmask":"255.255.255.255"}'
434+
ubus call network.interface.wlan0_peer1_47 up
435+
ubus call network.device status '{"name":"wlan0_peer1_47"}'
382436
383-
ip address show nomestru
437+
ip address show wlan0_peer1_47
384438
REMOTE_HOST_EOS
385439
}
386440

@@ -422,17 +476,23 @@ function DO_NOT_CALL_prepareHostapdChangesForSubmission()
422476
}
423477

424478
#fBuildDapX
479+
#fBuildYouhua
480+
425481
#fBuildHlk
426482

427483
#flash_all
428484

429-
#build_packages
430-
#upgrade_packages_all
485+
build_packages
486+
upgrade_packages_all
431487

432-
dTestUbusDev ${hlk1Ipll}
488+
#dTestUbusDev ${youhuaIpll}
489+
#dTestUbusDev ${hlk1Ipll}
433490

434491
#conf_all
435492

493+
#dTestUbusDev ${verdeIP}
494+
495+
436496
#dTestMulticast ${dax1Ipll}
437497
#dTestMulticast ${dax2Ipll}
438498

packages/lime-proto-anygw/files/usr/lib/lua/lime/proto/anygw.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,6 @@ protocol direct {
139139
return base_conf
140140
end
141141

142+
function anygw.runOnDevice(linuxDev, args) end
143+
142144
return anygw

packages/lime-proto-babeld/files/usr/lib/lua/lime/proto/babeld.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,18 @@ function babeld.setup_interface(ifname, args)
129129
uci:save("babeld")
130130
end
131131

132+
function babeld.runOnDevice(linuxDev, args)
133+
utils.log("lime.proto.babeld.runOnDevice(%s, ...)", linuxDev)
134+
135+
local vlanId = args[2] or 17
136+
local vlanProto = args[3] or "8021ad"
137+
138+
local vlanDev = network.createVlan(linuxDev, vlanId, vlanProto)
139+
network.createStatic(vlanDev)
140+
141+
local libubus = require("ubus")
142+
local ubus = libubus.connect()
143+
ubus:call('babeld', 'add_interface', { ifname = vlanDev })
144+
end
145+
132146
return babeld

packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,42 @@ function batadv.setup_interface(ifname, args)
9999
uci:save("network")
100100
end
101101

102+
function batadv.runOnDevice(linuxDev, args)
103+
args = args or {}
104+
local vlanId = args[2] or "%N1"
105+
local vlanProto = args[3] or "8021ad"
106+
107+
utils.log("lime.proto.batadv.runOnDevice(%s, ...)", linuxDev)
108+
109+
110+
local mtu = 1532
111+
112+
if not tonumber(vlanId) then
113+
vlanId = 29 + (utils.applyNetTemplate10(vlanId) - 13) % 256
114+
end
115+
116+
local devName = network.createVlan(linuxDev, vlanId, vlanProto)
117+
local ifName = network.limeIfNamePrefix..linuxDev .. "_batadv"
118+
119+
local ifaceConf = {
120+
name = ifName,
121+
proto = "batadv_hardif",
122+
auto = "1",
123+
device = devName,
124+
master = "bat0"
125+
}
126+
127+
local libubus = require("ubus");
128+
local ubus = libubus.connect()
129+
ubus:call('network', 'add_dynamic', ifaceConf)
130+
ubus:call('network.interface.'..ifName, 'up', {})
131+
132+
133+
--! TODO: as of today ubus silently fails to properly setting up a linux network
134+
--! device for batman ADV usage dinamycally work around it by using
135+
--! shell commands instead
136+
network.createStatic(devName)
137+
utils.unsafe_shell("batctl if add "..devName)
138+
end
102139

103140
return batadv

packages/lime-system/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ LIME_DESCRIPTION:=$(LIME_ID) $(LIME_RELEASE) $(LIME_CODENAME) ($(LIME_BRANCH) re
2323
include $(INCLUDE_DIR)/package.mk
2424

2525
define Package/$(PKG_NAME)
26-
TITLE:=libremesh system files
26+
TITLE:=LibreMesh system core
2727
CATEGORY:=LibreMesh
2828
MAINTAINER:=Gioacchino Mazzurco <gio@eigenlab.org>
2929
URL:=http://libremesh.org
@@ -32,7 +32,8 @@ define Package/$(PKG_NAME)
3232
endef
3333

3434
define Package/$(PKG_NAME)/description
35-
Basic system files for LiMe node
35+
LibreMesh is a modular meta-firmare this package provide the core of it
36+
which articulates all LiMe modules around it
3637
endef
3738

3839
define Build/Compile

packages/lime-system/files/etc/config/lime-defaults

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ config lime wifi
5959
option apname_ssid 'LibreMesh.org/%H'
6060
option adhoc_ssid 'LiMe'
6161
option adhoc_bssid 'ca:fe:00:c0:ff:ee'
62+
option apup_ssid 'LibreMesh.org'
6263
option ieee80211s_mesh_fwding '0'
6364
option ieee80211s_mesh_id 'LiMe'
6465
option unstuck_interval '10'

0 commit comments

Comments
 (0)