mesh-vpn-openvpn: only add interface if really enabled
This commit is contained in:
parent
73e74b342d
commit
c3443b0cdd
@ -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')
|
||||||
|
if vpn.enabled then
|
||||||
uci:section('openvpn', 'openvpn', 'mesh_vpn', vpn)
|
uci:section('openvpn', 'openvpn', 'mesh_vpn', vpn)
|
||||||
|
end
|
||||||
|
|
||||||
uci:save('openvpn')
|
uci:save('openvpn')
|
||||||
|
Loading…
Reference in New Issue
Block a user