From 3e1696510692a815527adf0aefd89f998d78806c Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 22 Feb 2011 09:52:49 +0000 Subject: [PATCH] modules/admin-full: add field validation for hostnames in leases and hosts pages --- .../luasrc/model/cbi/admin_network/dhcpleases.lua | 2 ++ modules/admin-full/luasrc/model/cbi/admin_network/hosts.lua | 6 ++++++ 2 files changed, 8 insertions(+) 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("MAC-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"], -- 2.25.1