Browse Source

wg-installer: use babeld add_interface function

With commit 385200443554 ("babeld: add add_interface function") babeld
has a new ubus function allowing to dynamically add an interface.

Before the add_interface function, we were required to reload babeld.
The reload influenced the babeld routing. However, the remove part is
still missing and will be added at a later stage.

Signed-off-by: Nick Hainke <vincent@systemli.org>
lilik-openwrt-22.03
Nick Hainke 3 years ago
parent
commit
40b87aac95
2 changed files with 2 additions and 22 deletions
  1. +1
    -1
      net/wg-installer/Makefile
  2. +1
    -21
      net/wg-installer/wg-server/hotplug.d/99-mesh-babeld

+ 1
- 1
net/wg-installer/Makefile View File

@ -57,7 +57,7 @@ endef
define Package/wg-installer-server-hotplug-babeld define Package/wg-installer-server-hotplug-babeld
$(call Package/wg-installer-server) $(call Package/wg-installer-server)
DEPENDS:=wg-installer-server +coreutils-realpath
DEPENDS:=wg-installer-server
endef endef
define Package/wg-installer-server-hotplug-babeld/install define Package/wg-installer-server-hotplug-babeld/install


+ 1
- 21
net/wg-installer/wg-server/hotplug.d/99-mesh-babeld View File

@ -12,25 +12,5 @@ if [ "${slicedint}" != "wg_" ]; then
fi fi
if [ "${ACTION}" = "add" ]; then if [ "${ACTION}" = "add" ]; then
uci add babeld interface
uci set babeld.@interface[-1].ifname="${INTERFACE}"
uci get wgserver.@babeld_hotplug[0].rxcost
if [ $? -eq 0 ]; then
babeld_rxcost="$(uci get wgserver.@babeld_hotplug[0].rxcost)"
uci set babeld.@interface[-1].rxcost="$babeld_rxcost"
fi
uci -c "$(dirname "$(realpath /etc/config/babeld)")" commit babeld
/etc/init.d/babeld reload
fi
if [ "${ACTION}" = "remove" ]; then
i=0
while uci get babeld.@interface[$i] &> /dev/null ; do
if [ "$(uci get babeld.@interface[$i].ifname)" = "${INTERFACE}" ]; then
uci delete babeld.@interface[$i]
fi
i=$((i+1));
done
uci -c "$(dirname "$(realpath /etc/config/babeld)")" commit babeld
/etc/init.d/babeld reload
ubus call babeld add_interface '{"ifname":'\""$INTERFACE"\"'}'
fi fi

Loading…
Cancel
Save