luci-app-openvpn: add missing proto param for ipv6
authorFlorian Eckert <fe@dev.tdt.de>
Mon, 14 Oct 2019 08:44:25 +0000 (10:44 +0200)
committerFlorian Eckert <fe@dev.tdt.de>
Wed, 23 Oct 2019 07:18:39 +0000 (09:18 +0200)
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
(cherry picked from commit 18037444b57104a0a62f6c1c16f308ee2dd81a36)
Update commit to apply cleanly

applications/luci-app-openvpn/luasrc/model/cbi/openvpn-basic.lua

index 483860c8e93ec8ef866cc99df3a0add9fc82b221..5bc1bd2aa0837b50360f729c3b71a84bc0204af3 100644 (file)
@@ -21,8 +21,6 @@ local basicParams = {
 
        { Value,"keepalive","10 60", translate("Helper directive to simplify the expression of --ping and --ping-restart in server mode configurations") },
 
-       { ListValue,"proto",{ "udp", "tcp-client", "tcp-server" }, translate("Use protocol") },
-
        { Flag,"client",0, translate("Configure client mode") },
        { Flag,"client_to_client",0, translate("Allow client-to-client traffic") },
        { DynamicList,"remote","vpnserver.example.org", translate("Remote host name or ip address") },
@@ -36,6 +34,20 @@ local basicParams = {
        { FileUpload,"key","/etc/easy-rsa/keys/some-client.key", translate("Local private key") },
 }
 
+local has_ipv6 = fs.access("/proc/net/ipv6_route")
+if has_ipv6 then
+       table.insert( basicParams, { ListValue,
+               "proto",
+               { "udp", "tcp-client", "tcp-server", "udp6", "tcp6-client", "tcp6-server" },
+               translate("Use protocol")
+       })
+else
+       table.insert( basicParams, { ListValue,
+               "proto",
+               { "udp", "tcp-client", "tcp-server" },
+               translate("Use protocol")
+       })
+end
 
 local m = Map("openvpn")
 local p = m:section( SimpleSection )