2 LuCI - Lua Configuration Interface
4 Copyright 2011 Jo-Philipp Wich <xm@subsignal.org>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
15 local fs = require "nixio.fs"
17 local f = SimpleForm("firewall",
18 translate("Firewall - Custom Rules"),
19 translate("Custom rules allow you to execute arbritary iptables commands \
20 which are not otherwise covered by the firewall framework. \
21 The commands are executed after each firewall restart, right after \
22 the default ruleset has been loaded."))
24 local o = f:field(Value, "_custom")
26 o.template = "cbi/tvalue"
29 function o.cfgvalue(self, section)
30 return fs.readfile("/etc/firewall.user")
33 function o.write(self, section, value)
34 value = value:gsub("\r\n?", "\n")
35 fs.writefile("/etc/firewall.user", value)