diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-02-22 09:52:49 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-02-22 09:52:49 +0000 |
commit | 3e1696510692a815527adf0aefd89f998d78806c (patch) | |
tree | 4204444669c6ae872d65b51377120eccdf50a803 | |
parent | 02a67572f8cbbcbbea7be0b5d4f8125415d896bc (diff) |
modules/admin-full: add field validation for hostnames in leases and hosts pages
-rw-r--r-- | modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua | 2 | ||||
-rw-r--r-- | modules/admin-full/luasrc/model/cbi/admin_network/hosts.lua | 6 |
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 3f631b38b9..e0e65e5e4d 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 fa8b217de4..c791a57d0f 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"], |