wifidmd: Update the handling of Multi-AP Mode vendor extension

This commit is contained in:
Amin Ben Romdhane 2025-12-04 14:24:35 +01:00
parent 1d216c4fe6
commit c81b2dc80c
2 changed files with 45 additions and 4 deletions

View file

@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=wifidmd
PKG_VERSION:=1.1.33.9
PKG_VERSION:=1.1.34.0
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)

View file

@ -43,7 +43,9 @@ json_get_var mapcontroller mapcontroller
wireless=${wireless:-0}
mapcontroller=${mapcontroller:-0}
# Define function to reload mapcontroller
# ------------------------------------------------------
# Reload mapcontroller service
# ------------------------------------------------------
reload_mapcontroller() {
pid=$(pidof mapcontroller)
if [ -n "$pid" ]; then
@ -54,12 +56,51 @@ reload_mapcontroller() {
fi
}
# ------------------------------------------------------
# Reload wireless service
# ------------------------------------------------------
reload_wireless() {
log "Reloading wireless config..."
ubus call uci commit '{"config":"wireless"}'
}
# ------------------------------------------------------
# Finalize Access Point instances
# ------------------------------------------------------
finalize_ap_instances() {
DMAP_PATH="uci -q -c /etc/bbfdm/dmmap"
for sec in $($DMAP_PATH show dmmap_wireless | grep "=wifi-iface" | cut -d. -f2 | cut -d= -f1); do
is_new=$($DMAP_PATH get dmmap_wireless.${sec}.__is_new__)
[ "${is_new}" = "1" ] || continue
# Remove the new-instance flag
$DMAP_PATH delete dmmap_wireless.${sec}.__is_new__
# Get the config section name
config_sec_name=$($DMAP_PATH get dmmap_wireless.${sec}.section_name)
[ -z "${config_sec_name}" ] && continue
# Get the config section type
config_sec_type=$(uci -q get wireless.${config_sec_name})
if [ "${config_sec_type}" = "wifi-iface" ]; then
# New wireless AP instance -> skip mapcontroller reload
mapcontroller=0
fi
done
# Commit all changes to dmmap_wireless
$DMAP_PATH commit dmmap_wireless
}
# Finalize newly created AP AccessPoint instances
finalize_ap_instances
# Apply logic based on flags
if [ "$mapcontroller" -eq 1 ]; then
reload_mapcontroller
elif [ "$wireless" -eq 1 ]; then
log "Committing wireless config..."
ubus call uci commit '{"config":"wireless"}'
reload_wireless
else
log "No action needed."
exit 1