summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-02-22 09:52:49 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-02-22 09:52:49 +0000
commit3e1696510692a815527adf0aefd89f998d78806c (patch)
tree4204444669c6ae872d65b51377120eccdf50a803 /modules
parent02a67572f8cbbcbbea7be0b5d4f8125415d896bc (diff)
modules/admin-full: add field validation for hostnames in leases and hosts pages
Diffstat (limited to 'modules')
-rw-r--r--modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua2
-rw-r--r--modules/admin-full/luasrc/model/cbi/admin_network/hosts.lua6
2 files changed, 8 insertions, 0 deletions
diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua b/modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua
index 3f631b38b..e0e65e5e4 100644
--- a/modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua
+++ b/modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua
@@ -31,6 +31,8 @@ s.anonymous = true
s.template = "cbi/tblsection"
name = s:option(Value, "name", translate("Hostname"))
+name.datatype = "hostname"
+name.rmempty = true
mac = s:option(Value, "mac", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address"))
mac.datatype = "macaddr"
diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/hosts.lua b/modules/admin-full/luasrc/model/cbi/admin_network/hosts.lua
index fa8b217de..c791a57d0 100644
--- a/modules/admin-full/luasrc/model/cbi/admin_network/hosts.lua
+++ b/modules/admin-full/luasrc/model/cbi/admin_network/hosts.lua
@@ -23,7 +23,13 @@ s.anonymous = true
s.template = "cbi/tblsection"
hn = s:option(Value, "name", translate("Hostname"))
+hn.datatype = "hostname"
+hn.rmempty = true
+
ip = s:option(Value, "ip", translate("IP address"))
+ip.datatype = "ipaddr"
+ip.rmempty = true
+
for i, dataset in ipairs(luci.sys.net.arptable()) do
ip:value(
dataset["IP address"],