2 LuCI - Lua Configuration Interface
4 Copyright 2008 Steven Barth <steven@midlink.org>
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
10 http://www.apache.org/licenses/LICENSE-2.0
16 require("luci.model.uci")
21 -- Widget Name Optn. Default(s)
24 { ListValue, "verb", { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 } },
26 { Value, "port", 1194 },
27 { ListValue, "dev_type", { "tun", "tap" } },
28 { Flag, "tun_ipv6", 0 },
30 { Value, "ifconfig", "10.200.200.3 10.200.200.1" },
31 { Value, "server", "10.200.200.0 255.255.255.0" },
32 { Value, "server_bridge", "192.168.1.1 255.255.255.0 192.168.1.128 192.168.1.254" },
33 { Flag, "nobind", 0 },
35 { Flag, "comp_lzo", 0 },
36 { Value, "keepalive", "10 60" },
38 { ListValue, "proto", { "udp", "tcp" } },
40 { Flag, "client", 0 },
41 { Flag, "client_to_client", 0 },
42 { DynamicList, "remote", "vpnserver.example.org" },
44 { FileUpload, "secret", "/etc/openvpn/secret.key 1" },
45 { FileUpload, "pkcs12", "/etc/easy-rsa/keys/some-client.pk12" },
46 { FileUpload, "ca", "/etc/easy-rsa/keys/ca.crt" },
47 { FileUpload, "dh", "/etc/easy-rsa/keys/dh1024.pem" },
48 { FileUpload, "cert", "/etc/easy-rsa/keys/some-client.crt" },
49 { FileUpload, "key", "/etc/easy-rsa/keys/some-client.key" },
53 local m = Map("openvpn")
54 local p = m:section( SimpleSection )
56 p.template = "openvpn/pageswitch"
61 local s = m:section( NamedSection, arg[1], "openvpn" )
63 for _, option in ipairs(basicParams) do
66 translate("openvpn_param_%s" % option[2]),
67 translate("openvpn_param_%s_desc" % option[2])
72 if option[1] == DummyValue then
75 if option[1] == DynamicList then
77 function o.cfgvalue(...)
78 local val = AbstractValue.cfgvalue(...)
79 return ( val and type(val) ~= "table" ) and { val } or val
83 if type(option[3]) == "table" then
84 if o.optional then o:value("", "-- remove --") end
85 for _, v in ipairs(option[3]) do
89 o.default = tostring(option[3][1])
91 o.default = tostring(option[3])
96 if type(option[i]) == "table" then