mesh-vpn-openvpn: only add interface if really enabled

This commit is contained in:
Maciej Krüger 2022-01-16 08:17:44 +01:00 committed by Alexander List
parent 73e74b342d
commit c3443b0cdd

View File

@ -7,7 +7,7 @@ local vpn_core = require 'gluon.mesh-vpn'
local uci = require('simple-uci').cursor() local uci = require('simple-uci').cursor()
-- https://stackoverflow.com/a/4991602/3990041 -- https://stackoverflow.com/a/4991602/3990041
function file_exists(name) local function file_exists(name)
local f=io.open(name,"r") local f=io.open(name,"r")
if f~=nil then io.close(f) return true else return false end if f~=nil then io.close(f) return true else return false end
end end
@ -33,6 +33,8 @@ end
-- TODO: maybe better integration? currently we still listen to openvpn push -- TODO: maybe better integration? currently we still listen to openvpn push
uci:delete('openvpn', 'mesh_vpn') uci:delete('openvpn', 'mesh_vpn')
uci:section('openvpn', 'openvpn', 'mesh_vpn', vpn) if vpn.enabled then
uci:section('openvpn', 'openvpn', 'mesh_vpn', vpn)
end
uci:save('openvpn') uci:save('openvpn')