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

This commit is contained in:
Amin Ben Romdhane 2025-11-27 14:13:52 +00:00 committed by IOPSYS Dev
parent ceb5a9f2e4
commit fea9e4de88
No known key found for this signature in database

View file

@ -107,6 +107,63 @@ wait_for_wifi_reload() {
return 1 return 1
} }
###############################################################################
# mark_ap_instances_applied
#
# Description:
# Finalizes newly created WiFi AccessPoint instances in the dmmap WiFi
# configuration.
#
# An AccessPoint instance is considered a *new instance* when the option
# __is_new__ exists and its value is "1".
#
# New instance handling logic:
#
# • The AccessPoint's controller-side section name is obtained from
# the __section_name__ option (e.g., "mapcontroller.xxx" or "wireless.xxx").
#
# • For new instances where __section_name__ begins with "mapcontroller.":
# - Remove __is_new__
# - No additional actions required
#
# • For new instances where __section_name__ begins with "wireless.":
# - Set mapcontroller=0 (indicates mapcontroller reload is not required)
# - Remove __is_new__
#
# • For all other prefixes:
# - Remove __is_new__ only
#
# After all new instances are processed, the dmmap WiFi configuration is committed.
###############################################################################
mark_ap_instances_applied() {
for sec in $(uci -q -c /etc/bbfdm/dmmap show WiFi | grep "=AccessPoint" | cut -d. -f2 | cut -d= -f1); do
is_new=$(uci -q -c /etc/bbfdm/dmmap get WiFi.${sec}.__is_new__)
if [ "${is_new}" = "1" ]; then
config_sec_name=$(uci -q -c /etc/bbfdm/dmmap get WiFi.${sec}.__section_name__)
case "${config_sec_name}" in
mapcontroller.*)
# New mapcontroller AP instance — remove creation flag only
uci -q -c /etc/bbfdm/dmmap delete WiFi.${sec}.__is_new__
;;
wireless.*)
# New wireless AP instance — skip mapcontroller reload
mapcontroller=0
uci -q -c /etc/bbfdm/dmmap delete WiFi.${sec}.__is_new__
;;
*)
# Other AP instance types — remove creation flag only
uci -q -c /etc/bbfdm/dmmap delete WiFi.${sec}.__is_new__
;;
esac
fi
done
uci -q -c /etc/bbfdm/dmmap commit WiFi
}
# Define function to reload mapcontroller # Define function to reload mapcontroller
reload_mapcontroller() { reload_mapcontroller() {
pid=$(pidof mapcontroller) pid=$(pidof mapcontroller)
@ -126,6 +183,9 @@ commit_wireless_config() {
wait_for_wifi_reload wait_for_wifi_reload
} }
# Finalize newly created AP AccessPoint instances
mark_ap_instances_applied
# Apply logic based on flags # Apply logic based on flags
if [ "$mapcontroller" -eq 1 ]; then if [ "$mapcontroller" -eq 1 ]; then
reload_mapcontroller reload_mapcontroller