From 01f98c52c9b64c705b42ba762eb1ed1360aa6684 Mon Sep 17 00:00:00 2001 From: Sukru Senli Date: Thu, 27 Jul 2023 15:09:13 +0200 Subject: [PATCH] map-agent: activate dynamic-backhaul handling only if device is operating in extender mode if AL bridge network uses DHCP as protocol, assume it is extender mode --- .../files/etc/hotplug.d/ethernet/map-dynamic-backhaul | 5 +++-- map-agent/files/etc/init.d/mapagent | 11 ++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/map-agent/files/etc/hotplug.d/ethernet/map-dynamic-backhaul b/map-agent/files/etc/hotplug.d/ethernet/map-dynamic-backhaul index df7c6680a..ff6ddac0d 100755 --- a/map-agent/files/etc/hotplug.d/ethernet/map-dynamic-backhaul +++ b/map-agent/files/etc/hotplug.d/ethernet/map-dynamic-backhaul @@ -11,6 +11,9 @@ al_brnet="${al_bridge:3}" # Exit if the PORT is not member of the AL Bridge [ "$(get_network_of $PORT)" = "$al_brnet" ] || exit 0 +# Exit if the device is not operating in extender/repeater mode +[ "$(uci -q get network.${al_brnet}.proto)" == "dhcp" ] || exit 0 + ############## Dynamic Backhaul Daemon ############## if [ -n "$(which dynbhd)" ]; then pidof dynbhd >/dev/null && exit 0 # dynbhd is managing the links @@ -47,8 +50,6 @@ if [ -n "$wanport" ]; then ######################################################## else #################### DHCP Discovery #################### - [ "$(uci -q get network.${al_brnet}.proto)" == "dhcp" ] || exit 0 - if [ "$LINK" = "up" ]; then brctl delif $al_bridge $PORT diff --git a/map-agent/files/etc/init.d/mapagent b/map-agent/files/etc/init.d/mapagent index 1d15fba5e..3fde596b9 100755 --- a/map-agent/files/etc/init.d/mapagent +++ b/map-agent/files/etc/init.d/mapagent @@ -179,7 +179,16 @@ create_dir() { } start_service() { - [ -f /usr/sbin/dynbhd ] && start_dynbhd_service + if [ -f /usr/sbin/dynbhd ]; then + # Start dynbhd only if the device is operating in extender/repeater mode + al_bridge="$(uci -q get mapagent.agent.al_bridge)" + if [ "${al_bridge:0:3}" = "br-" ]; then + al_brnet="${al_bridge:3}" + if [ "$(uci -q get network.${al_brnet}.proto)" == "dhcp" ]; then + start_dynbhd_service + fi + fi + fi config_load "mapagent" validate_agent_config || return 1;