From bab9c12e20f545ec7aff559d18be8364a3d1c725 Mon Sep 17 00:00:00 2001 From: Martin Schiller Date: Tue, 19 Dec 2017 09:53:19 +0100 Subject: luci-app-openvpn: use initscript to stop instances Signed-off-by: Martin Schiller --- applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'applications/luci-app-openvpn/luasrc') diff --git a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua index 719145b887..6433229f69 100644 --- a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua +++ b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua @@ -103,10 +103,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 -- cgit v1.2.3 From 7c643558a32e330ccb667f95ac8b6626fc86458d Mon Sep 17 00:00:00 2001 From: Martin Schiller Date: Tue, 19 Dec 2017 09:54:09 +0100 Subject: luci-app-openvpn: fix validity check for new instance input field Signed-off-by: Martin Schiller --- applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'applications/luci-app-openvpn/luasrc') diff --git a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua index 6433229f69..d5e0019eb7 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 -- cgit v1.2.3 From e88a95ca2996beabf1983159c81f168e8de9d54a Mon Sep 17 00:00:00 2001 From: Martin Schiller Date: Tue, 19 Dec 2017 09:56:03 +0100 Subject: luci-app-openvpn: run '/etc/init.d/openvpn reload' after commit Signed-off-by: Martin Schiller --- applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'applications/luci-app-openvpn/luasrc') diff --git a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua index d5e0019eb7..45d916d727 100644 --- a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua +++ b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua @@ -125,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 -- cgit v1.2.3