modules/admin-full: fix wifi join when "wwan" (or other iface) already exists but...
[project/luci.git] / modules / admin-full / luasrc / model / cbi / admin_network / hosts.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5 Copyright 2010 Jo-Philipp Wich <xm@subsignal.org>
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11         http://www.apache.org/licenses/LICENSE-2.0
12
13 $Id$
14 ]]--
15
16 require("luci.sys")
17 require("luci.util")
18 m = Map("dhcp", translate("Hostnames"))
19
20 s = m:section(TypedSection, "domain", translate("Host entries"))
21 s.addremove = true
22 s.anonymous = true
23 s.template = "cbi/tblsection"
24
25 hn = s:option(Value, "name", translate("Hostname"))
26 hn.datatype = "hostname"
27 hn.rmempty  = true
28
29 ip = s:option(Value, "ip", translate("IP address"))
30 ip.datatype = "ipaddr"
31 ip.rmempty  = true
32
33 for i, dataset in ipairs(luci.sys.net.arptable()) do
34         ip:value(
35                 dataset["IP address"],
36                 "%s (%s)" %{ dataset["IP address"], dataset["HW address"] }
37         )
38 end
39
40 return m