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 )
uci:save("openvpn")
luci.http.redirect( self.extedit:format(name) )
- else
+ elseif #name > 0 then
self.invalid_cts = true
end
+
+ return 0
end
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
return val or "udp"
end
+function m.on_after_commit(self,map)
+ require("luci.sys").call('/etc/init.d/openvpn reload')
+end
return m