Signed-off-by: David Woodhouse <dw...@infradead.org>
---
 contrib/package/luci/Makefile                      |    1 +
 protocols/openconnect/Makefile                     |    2 +
 .../model/cbi/admin_network/proto_openconnect.lua  |   62 +++++++++++++++++++
 .../luasrc/model/network/proto_openconnect.lua     |   63 ++++++++++++++++++++
 4 files changed, 128 insertions(+), 0 deletions(-)
 create mode 100644 protocols/openconnect/Makefile
 create mode 100644 
protocols/openconnect/luasrc/model/cbi/admin_network/proto_openconnect.lua
 create mode 100644 
protocols/openconnect/luasrc/model/network/proto_openconnect.lua

diff --git a/contrib/package/luci/Makefile b/contrib/package/luci/Makefile
index 0f590fe..398ab11 100644
--- a/contrib/package/luci/Makefile
+++ b/contrib/package/luci/Makefile
@@ -214,6 +214,7 @@ endef
 $(eval $(call protocol,core,Support for static/dhcp/none))
 $(eval $(call protocol,ppp,Support for PPP/PPPoE/PPPoA))
 $(eval $(call protocol,pptp,Support for PPtP,+pptp))
+$(eval $(call protocol,openconnect,Support for OpenConnect VPN,+openconnect))
 $(eval $(call protocol,6x4,Support for 6in4/6to4,+6in4 +6to4))
 $(eval $(call protocol,3g,Support for 3G,+comgt))
 $(eval $(call protocol,relay,Support for relayd pseudo 
bridges,+PACKAGE_luci-proto-relay:relayd))
diff --git a/protocols/openconnect/Makefile b/protocols/openconnect/Makefile
new file mode 100644
index 0000000..f7fac77
--- /dev/null
+++ b/protocols/openconnect/Makefile
@@ -0,0 +1,2 @@
+include ../../build/config.mk
+include ../../build/module.mk
diff --git 
a/protocols/openconnect/luasrc/model/cbi/admin_network/proto_openconnect.lua 
b/protocols/openconnect/luasrc/model/cbi/admin_network/proto_openconnect.lua
new file mode 100644
index 0000000..9746c26
--- /dev/null
+++ b/protocols/openconnect/luasrc/model/cbi/admin_network/proto_openconnect.lua
@@ -0,0 +1,62 @@
+--[[
+LuCI - Lua Configuration Interface
+
+Copyright 2011 Jo-Philipp Wich <x...@subsignal.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+]]--
+
+local map, section, net = ...
+
+local server, username, password
+local buffering, defaultroute, metric, peerdns, dns
+
+
+server = section:taboption("general", Value, "server", translate("VPN Server"))
+server.datatype = "host"
+port = section:taboption("general", Value, "port", translate("VPN Server 
port"))
+
+port.placeholder = "443"
+port.datatype    = "port"
+
+cookie = section:taboption("advanced", Value, "cookie", translate("Cookie"))
+cookie.password = true
+
+username = section:taboption("general", Value, "username", 
translate("Username"))
+password = section:taboption("general", Value, "password", 
translate("Password"))
+password.password = true
+--[[
+
+defaultroute = section:taboption("advanced", Flag, "defaultroute",
+       translate("Use default gateway"),
+       translate("If unchecked, no default route is configured"))
+
+defaultroute.default = defaultroute.enabled
+
+
+metric = section:taboption("advanced", Value, "metric",
+       translate("Use gateway metric"))
+
+metric.placeholder = "0"
+metric.datatype    = "uinteger"
+metric:depends("defaultroute", defaultroute.enabled)
+
+
+peerdns = section:taboption("advanced", Flag, "peerdns",
+       translate("Use DNS servers advertised by peer"),
+       translate("If unchecked, the advertised DNS server addresses are 
ignored"))
+
+peerdns.default = peerdns.enabled
+
+
+dns = section:taboption("advanced", DynamicList, "dns",
+       translate("Use custom DNS servers"))
+
+dns:depends("peerdns", "")
+dns.datatype = "ipaddr"
+dns.cast     = "string"
+]]--
diff --git a/protocols/openconnect/luasrc/model/network/proto_openconnect.lua 
b/protocols/openconnect/luasrc/model/network/proto_openconnect.lua
new file mode 100644
index 0000000..55bde0e
--- /dev/null
+++ b/protocols/openconnect/luasrc/model/network/proto_openconnect.lua
@@ -0,0 +1,63 @@
+--[[
+LuCI - Network model - 3G, PPP, PPtP, PPPoE and PPPoA protocol extension
+
+Copyright 2011 Jo-Philipp Wich <x...@subsignal.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+]]--
+
+local netmod = luci.model.network
+local interface = luci.model.network.interface
+local proto = netmod:register_protocol("openconnect")
+
+function proto.get_i18n(self)
+       return luci.i18n.translate("Cisco AnyConnect (openconnect)")
+end
+
+function proto.ifname(self)
+       return "vpn-" .. self.sid
+end
+
+function proto.get_interface(self)
+       return interface(self:ifname(), self)
+end
+
+function proto.opkg_package(self)
+       return "openconnect"
+end
+
+function proto.is_installed(self)
+       return nixio.fs.access("/lib/network/openconnect.sh")
+end
+
+function proto.is_floating(self)
+       return true
+end
+
+function proto.is_virtual(self)
+       return true
+end
+
+function proto.get_interfaces(self)
+       return nil
+end
+
+function proto.contains_interface(self, ifc)
+        return (netmod:ifnameof(ifc) == self:ifname())
+
+end
+
+netmod:register_pattern_virtual("^vpn-%w")
+
+
-- 
1.7.7.6


-- 
dwmw2

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to