wg-installer: allow defining link costs for hotplugs
authorNick Hainke <vincent@systemli.org>
Tue, 11 Jan 2022 11:18:49 +0000 (12:18 +0100)
committerNick Hainke <vincent@systemli.org>
Wed, 12 Jan 2022 17:28:12 +0000 (18:28 +0100)
Add options to set link costs in mesh routing daemons.

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit ee879d37479cf66f8caf8d4354a0aeae3764f0a8)

net/wg-installer/wg-server/config/wgserver.conf
net/wg-installer/wg-server/hotplug.d/99-mesh-babeld
net/wg-installer/wg-server/hotplug.d/99-mesh-olsrd

index 41cafa2881559a5512df6789d4024b2ce7e789c0..d8955ae5cf81eabbf4dea1d047cde1c19b0435b7 100644 (file)
@@ -7,3 +7,9 @@ config server
     option wg_pub '/root/wg.pub'
     option wg_tmp_key '1'
     option timeout_handshake '600'
+
+config babeld_hotplug
+    option rxcost '1024'
+
+config olsrd_hotplug
+    option LinkQualityMult 'default 0.1'
index 4da7caa9145b278bf659bc13d4aebb916c1bb406..1f8646e281e6be14a99570b9f86a35d2d89f4a88 100644 (file)
@@ -14,6 +14,11 @@ fi
 if [ "${ACTION}" == "add" ]; then
        uci add babeld interface
        uci set babeld.@interface[-1].ifname="${INTERFACE}"
+       uci get wgserver.@babeld_hotplug[0].rxcost
+       if [ $? ]; 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
index 1e4be369726a002feefb6f49a0275208672ef611..b5a010b2408baff7c6c23bc578a168287bcad122 100644 (file)
@@ -16,6 +16,11 @@ if [ "${ACTION}" == "add" ]; then
        uci set olsrd.@Interface[-1].ignore=0
        uci set olsrd.@Interface[-1].interface="${INTERFACE}"
        uci set olsrd.@Interface[-1].Mode="ether"
+       uci get wgserver.@olsrd_hotplug[0].LinkQualityMult
+       if [ $? ]; then
+               olsrd_LinkQualityMult="$(uci get wgserver.@olsrd_hotplug[0].LinkQualityMult)"
+               uci set olsrd.@Interface[-1].LinkQualityMult="$olsrd_LinkQualityMult"
+       fi
        uci -c "$(dirname $(realpath /etc/config/olsrd))" commit olsrd
        /etc/init.d/olsrd reload
 fi