NIU:
[project/luci.git] / modules / niu / luasrc / model / cbi / niu / network / wandevice.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2009 Steven Barth <steven@midlink.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14
15 local cursor = require "luci.model.uci".inst_state
16 local nw = require "luci.model.network"
17 nw.init(cursor)
18
19 m = Map("network", "Configure Internet Connection")
20 s = m:section(NamedSection, "wan", "interface", "Internet Connection Device")
21 s.anonymous = true
22 s.addremove = false
23
24 l = s:option(ListValue, "_wandev", "Internet Connection via")
25
26 for _, iface in ipairs(nw.get_interfaces()) do
27         if iface:name():find("eth") == 1 then
28                 local net = iface:get_network()
29                 if not net or net:name() == "wan" or os.getenv("LUCI_SYSROOT") then
30                         l:value("ethernet:%s" % iface:name(),
31                                 "Cable / DSL / Ethernet Adapter (%s)" % iface:name())
32                 end
33         end
34 end
35
36 l:value("none", "No Internet Connection")
37
38 return m