Fix server vtun numbering (#1013)

This commit is contained in:
Tim Wilkinson 2023-12-12 23:57:36 -08:00 committed by GitHub
parent 188719c321
commit 99a12238c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -539,7 +539,7 @@ if not nixio.fs.stat("/usr/sbin/vtund") then
maxclients = 0
maxservers = 0
end
for dev = 50, 50 + maxclients + maxservers
for dev = 50, 50 + maxclients + maxservers - 1
do
cfg.tun_devices_config = cfg.tun_devices_config ..
string.format("config interface 'tun%d'\n\toption ifname 'tun%d'\n\toption proto 'none'\n\n", dev, dev)
@ -938,7 +938,11 @@ if nixio.fs.access("/etc/config.mesh/olsrd", "r") then
-- add all the tunnel interfaces
if vtunclients + vtunservers + wgclients + wgservers > 0 then
of:write("config Interface\n")
for dev = 50, 50 + vtunclients + vtunservers
for dev = 50, 50 + vtunclients - 1
do
of:write("\tlist interface 'tun" .. dev .. "'\n")
end
for dev = 50 + maxclients, 50 + maxclients + vtunservers - 1
do
of:write("\tlist interface 'tun" .. dev .. "'\n")
end