diff --git a/files/etc/uci-defaults/90_aredn_default_tunnels b/files/etc/uci-defaults/90_aredn_default_tunnels
index 59a3f72f..806830b8 100755
--- a/files/etc/uci-defaults/90_aredn_default_tunnels
+++ b/files/etc/uci-defaults/90_aredn_default_tunnels
@@ -3,6 +3,7 @@ if [ "$(/sbin/uci -c /etc/config.mesh -q get aredn.@tunnel[0])" != "tunnel" ]; t
/sbin/uci -c /etc/config.mesh -q add aredn tunnel
/sbin/uci -c /etc/config.mesh -q set aredn.@tunnel[0].maxclients=10
/sbin/uci -c /etc/config.mesh -q set aredn.@tunnel[0].maxservers=10
+ /sbin/uci -c /etc/config.mesh -q set aredn.@tunnel[0].weight=1
/sbin/uci -c /etc/config.mesh -q commit aredn
fi
clients=$(/sbin/uci -c /etc/config.mesh -q get aredn.@tunnel[0].maxclients)
@@ -22,3 +23,9 @@ config interface 'tun$tun'
__EOT__
done
fi
+
+# Default tunnel weight to 1 (perfect RF)
+if [ "$(/sbin/uci -c /etc/config.mesh -q get aredn.@tunnel[0].weight)" = "" ]; then
+ /sbin/uci -c /etc/config.mesh -q set aredn.@tunnel[0].weight=1
+ /sbin/uci -c /etc/config.mesh -q commit aredn
+fi
diff --git a/files/www/cgi-bin/advancedconfig b/files/www/cgi-bin/advancedconfig
index 616aae89..947a07ae 100755
--- a/files/www/cgi-bin/advancedconfig
+++ b/files/www/cgi-bin/advancedconfig
@@ -263,6 +263,14 @@ local settings = {
precallback = "restrictTunnelLimitToValidRange()",
postcallback = "adjustTunnelInterfaceCount()"
},
+ {
+ category = "Tunnel Options",
+ key = "aredn.@tunnel[0].weight",
+ type = "string",
+ desc = "Tunnel Weight specifies the cost of using a tunnel. The higher the number, the less likely a tunnel is used.
aredn.@tunnel[0].weighy",
+ default = "1",
+ needreboot= true
+ },
{
category = "Tunnel Options",
key = "aredn.@tunnel[0].wanonly",