1 -- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
2 -- Licensed to the public under the Apache License 2.0.
4 local fs = require "nixio.fs"
6 local f = SimpleForm("firewall",
7 translate("Firewall - Custom Rules"),
8 translate("Custom rules allow you to execute arbritary iptables commands \
9 which are not otherwise covered by the firewall framework. \
10 The commands are executed after each firewall restart, right after \
11 the default ruleset has been loaded."))
13 local o = f:field(Value, "_custom")
15 o.template = "cbi/tvalue"
18 function o.cfgvalue(self, section)
19 return fs.readfile("/etc/firewall.user")
22 function o.write(self, section, value)
23 value = value:gsub("\r\n?", "\n")
24 fs.writefile("/etc/firewall.user", value)