summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-05-25 07:22:27 +0200
committerGitHub <noreply@github.com>2018-05-25 07:22:27 +0200
commitc181699bf7ac7c3ba39bd50e8db461716c3e8636 (patch)
tree1d6f1c88c11f420772cd639ce39f1df1bea3e9e9 /applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua
parent59d91d8a72829a79d2f876f75ed7706eda195bdf (diff)
parente88a95ca2996beabf1983159c81f168e8de9d54a (diff)
Merge pull request #1481 from TDT-AG/luci-app-openvpn-fixes
luci-app-openvpn: several fixes
Diffstat (limited to 'applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua')
-rw-r--r--applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua
index d2b5d32c0..a6b0e1dd9 100644
--- a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua
+++ b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua
@@ -56,7 +56,7 @@ function s.create(self, name)
luci.cbi.CREATE_PREFIX .. self.config .. "." ..
self.sectiontype .. ".text"
)
- if string.len(name)>3 and not name:match("[^a-zA-Z0-9_]") then
+ if #name > 3 and not name:match("[^a-zA-Z0-9_]") then
uci:section(
"openvpn", "openvpn", name,
uci:get_all( "openvpn_recipes", recipe )
@@ -67,9 +67,11 @@ function s.create(self, name)
uci:save("openvpn")
luci.http.redirect( self.extedit:format(name) )
- else
+ elseif #name > 0 then
self.invalid_cts = true
end
+
+ return 0
end
@@ -103,10 +105,7 @@ function updown.cfgvalue(self, section)
end
function updown.write(self, section, value)
if self.option == "stop" then
- local pid = s.getPID(section)
- if pid ~= nil then
- sys.process.signal(pid,15)
- end
+ luci.sys.call("/etc/init.d/openvpn stop %s" % section)
else
luci.sys.call("/etc/init.d/openvpn start %s" % section)
end
@@ -126,5 +125,8 @@ function proto.cfgvalue(self, section)
return val or "udp"
end
+function m.on_after_commit(self,map)
+ require("luci.sys").call('/etc/init.d/openvpn reload')
+end
return m