batman-adv: improve batadv_vlan.sh for LuCI

Apply ap_isolation default value '0' if option ap_isolation is
not present in the batadv_vlan interface configuration.

Default value '0' should be applied for the use case where
"option ap_isolation '1'" was present, is removed, and
'service network reload' is executed.

This is required for proper LuCI integration, because if an option
is set to the default value, LuCI removes the option.

Also take into account $INCLUDE_ONLY as in other /lib/netifd/proto
scripts and as recommended in the guide at:
https://openwrt.org/docs/guide-developer/network-scripting

Signed-off-by: Bastiaan Stougie <wififreedom2026@protonmail.com>
This commit is contained in:
Bastiaan Stougie
2026-03-12 23:45:48 +01:00
parent 44f2d58cbf
commit 9777081ec0
2 changed files with 7 additions and 5 deletions

View File

@@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=batman-adv
PKG_VERSION:=2026.0
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)

View File

@@ -1,8 +1,10 @@
#!/bin/sh
. /lib/functions.sh
. ../netifd-proto.sh
init_proto "$@"
[ -n "$INCLUDE_ONLY" ] || {
. /lib/functions.sh
. ../netifd-proto.sh
init_proto "$@"
}
proto_batadv_vlan_init_config() {
proto_config_add_boolean 'ap_isolation:bool'
@@ -17,7 +19,7 @@ proto_batadv_vlan_setup() {
json_get_vars ap_isolation
[ -n "$ap_isolation" ] && batctl vlan "$iface" ap_isolation "$ap_isolation"
batctl vlan "$iface" ap_isolation "${ap_isolation:-0}"
proto_init_update "$iface" 1
proto_send_update "$config"
}