add IPv6 and MTU override for L2TP
[project/luci.git] / protocols / ppp / luasrc / model / cbi / admin_network / proto_l2tp.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2011 Jo-Philipp Wich <xm@subsignal.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
13 local map, section, net = ...
14
15 local server, username, password
16 local ipv6, defaultroute, metric, peerdns, dns, mtu
17
18
19 server = section:taboption("general", Value, "server", translate("L2TP Server"))
20 server.datatype = "host"
21
22
23 username = section:taboption("general", Value, "username", translate("PAP/CHAP username"))
24
25
26 password = section:taboption("general", Value, "password", translate("PAP/CHAP password"))
27 password.password = true
28
29 if luci.model.network:has_ipv6() then
30
31         ipv6 = section:taboption("advanced", Flag, "ipv6",
32                 translate("Enable IPv6 negotiation on the PPP link"))
33
34         ipv6.default = ipv6.disabled
35
36 end
37
38 defaultroute = section:taboption("advanced", Flag, "defaultroute",
39         translate("Use default gateway"),
40         translate("If unchecked, no default route is configured"))
41
42 defaultroute.default = defaultroute.enabled
43
44
45 metric = section:taboption("advanced", Value, "metric",
46         translate("Use gateway metric"))
47
48 metric.placeholder = "0"
49 metric.datatype    = "uinteger"
50 metric:depends("defaultroute", defaultroute.enabled)
51
52
53 peerdns = section:taboption("advanced", Flag, "peerdns",
54         translate("Use DNS servers advertised by peer"),
55         translate("If unchecked, the advertised DNS server addresses are ignored"))
56
57 peerdns.default = peerdns.enabled
58
59
60 dns = section:taboption("advanced", DynamicList, "dns",
61         translate("Use custom DNS servers"))
62
63 dns:depends("peerdns", "")
64 dns.datatype = "ipaddr"
65 dns.cast     = "string"
66
67 mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU"))
68 mtu.placeholder = "1500"
69 mtu.datatype    = "max(1500)"