Globally reduce copyright headers
[project/luci.git] / modules / luci-mod-admin-full / luasrc / model / cbi / admin_network / network.lua
1 -- Copyright 2008 Steven Barth <steven@midlink.org>
2 -- Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
3 -- Licensed to the public under the Apache License 2.0.
4
5 local fs = require "nixio.fs"
6
7 m = Map("network", translate("Interfaces"))
8 m.pageaction = false
9 m:section(SimpleSection).template = "admin_network/iface_overview"
10
11 -- Show ATM bridge section if we have the capabilities
12 if fs.access("/usr/sbin/br2684ctl") then
13 atm = m:section(TypedSection, "atm-bridge", translate("ATM Bridges"),
14 translate("ATM bridges expose encapsulated ethernet in AAL5 " ..
15 "connections as virtual Linux network interfaces which can " ..
16 "be used in conjunction with DHCP or PPP to dial into the " ..
17 "provider network."))
18
19 atm.addremove = true
20 atm.anonymous = true
21
22 atm.create = function(self, section)
23 local sid = TypedSection.create(self, section)
24 local max_unit = -1
25
26 m.uci:foreach("network", "atm-bridge",
27 function(s)
28 local u = tonumber(s.unit)
29 if u ~= nil and u > max_unit then
30 max_unit = u
31 end
32 end)
33
34 m.uci:set("network", sid, "unit", max_unit + 1)
35 m.uci:set("network", sid, "atmdev", 0)
36 m.uci:set("network", sid, "encaps", "llc")
37 m.uci:set("network", sid, "payload", "bridged")
38 m.uci:set("network", sid, "vci", 35)
39 m.uci:set("network", sid, "vpi", 8)
40
41 return sid
42 end
43
44 atm:tab("general", translate("General Setup"))
45 atm:tab("advanced", translate("Advanced Settings"))
46
47 vci = atm:taboption("general", Value, "vci", translate("ATM Virtual Channel Identifier (VCI)"))
48 vpi = atm:taboption("general", Value, "vpi", translate("ATM Virtual Path Identifier (VPI)"))
49 encaps = atm:taboption("general", ListValue, "encaps", translate("Encapsulation mode"))
50 encaps:value("llc", translate("LLC"))
51 encaps:value("vc", translate("VC-Mux"))
52
53 atmdev = atm:taboption("advanced", Value, "atmdev", translate("ATM device number"))
54 unit = atm:taboption("advanced", Value, "unit", translate("Bridge unit number"))
55 payload = atm:taboption("advanced", ListValue, "payload", translate("Forwarding mode"))
56 payload:value("bridged", translate("bridged"))
57 payload:value("routed", translate("routed"))
58 m.pageaction = true
59 end
60
61 local network = require "luci.model.network"
62 if network:has_ipv6() then
63 local s = m:section(NamedSection, "globals", "globals", translate("Global network options"))
64 local o = s:option(Value, "ula_prefix", translate("IPv6 ULA-Prefix"))
65 o.datatype = "ip6addr"
66 o.rmempty = true
67 m.pageaction = true
68 end
69
70
71 return m