| 1 | --[[ |
|---|
| 2 | LuCI - Lua Configuration Interface |
|---|
| 3 | |
|---|
| 4 | Copyright 2011-2012 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 defaultroute, metric, peerdns, dns |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | server = section:taboption("general", Value, "server", translate("VPN 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 | |
|---|
| 30 | defaultroute = section:taboption("advanced", Flag, "defaultroute", |
|---|
| 31 | translate("Use default gateway"), |
|---|
| 32 | translate("If unchecked, no default route is configured")) |
|---|
| 33 | |
|---|
| 34 | defaultroute.default = defaultroute.enabled |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | metric = section:taboption("advanced", Value, "metric", |
|---|
| 38 | translate("Use gateway metric")) |
|---|
| 39 | |
|---|
| 40 | metric.placeholder = "0" |
|---|
| 41 | metric.datatype = "uinteger" |
|---|
| 42 | metric:depends("defaultroute", defaultroute.enabled) |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | peerdns = section:taboption("advanced", Flag, "peerdns", |
|---|
| 46 | translate("Use DNS servers advertised by peer"), |
|---|
| 47 | translate("If unchecked, the advertised DNS server addresses are ignored")) |
|---|
| 48 | |
|---|
| 49 | peerdns.default = peerdns.enabled |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | dns = section:taboption("advanced", DynamicList, "dns", |
|---|
| 53 | translate("Use custom DNS servers")) |
|---|
| 54 | |
|---|
| 55 | dns:depends("peerdns", "") |
|---|
| 56 | dns.datatype = "ipaddr" |
|---|
| 57 | dns.cast = "string" |
|---|