From 0282441f00ee632b87f451979078225dd52031ef Mon Sep 17 00:00:00 2001 From: Paul Oranje Date: Wed, 4 Feb 2015 00:04:04 +0100 Subject: luci-proto-ipv6: add aiccu initial commit --- .../luasrc/model/cbi/admin_network/proto_aiccu.lua | 134 +++++++++++++++++++++ .../luasrc/model/network/proto_aiccu.lua | 49 ++++++++ 2 files changed, 183 insertions(+) create mode 100644 protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua create mode 100644 protocols/luci-proto-ipv6/luasrc/model/network/proto_aiccu.lua (limited to 'protocols/luci-proto-ipv6/luasrc') diff --git a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua new file mode 100644 index 0000000000..5248eddf0c --- /dev/null +++ b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua @@ -0,0 +1,134 @@ +-- Copyright 2015 Paul Oranje +-- Licensed to the public under the Apache License 2.0. + +local map, section, net = ... + +-- config read by /lib/netifd/proto/aiccu.sh +local username, password, protocol, server, tunnelid, ip6prefix, requiretls, nat, heartbeat, + verbose, ntpsynctimeout, ip6addr, sourcerouting, defaultroute + +-- generic parameters +local metric, ttl, mtu + + +username = section:taboption("general", Value, "username", + translate("Server username"), + translate("SIXXS-handle[/Tunnel-ID]")) +username.datatype = "string" + +password = section:taboption("general", Value, "password", + translate("Server password"), + translate("Server password, enter the specific password of the tunnel when the username contains the tunnel ID")) +password.datatype = "string" +password.password = true + + +--[[ SIXXS supports only TIC as tunnel broker protocol, no use setting it. +protocol = section:taboption("general", ListValue, "protocol", + translate("Tunnel broker protocol"), + translate("SIXXS supports TIC only, for static tunnels using IP protocol 41 (RFC4213) use 6in4 instead")) + +protocol:value("tic", "TIC") +protocol:value("tsp", "TSP") +protocol:value("l2tp", "L2TP") +protocol.default = "tic" +protocol.optional = true +--]] + + +server = section:taboption("general", Value, "server", + translate("Tunnel setup server"), + translate("Optional, specify to override default server (tic.sixxs.net)")) +server.datatype = "host" +server.optional = true + + +tunnelid = section:taboption("general", Value, "tunnelid", + translate("Tunnel ID"), + translate("Optional, use when the SIXXS account has more than one tunnel")) +tunnelid.datatype = "string" +tunnelid.optional = true + + +local ip6prefix = section:taboption("general", Value, "ip6prefix", + translate("IPv6 prefix"), + translate("Routed IPv6 prefix for downstream interfaces")) +ip6prefix.datatype = "ip6prefix" +ip6prefix.optional = true + + +requiretls = section:taboption("general", Flag, "requiretls", + translate("Require TLS"), + translate("Connection to server fails when TLS cannot be used")) +requiretls.optional = true +requiretls.default = requiretls.enabled + + +heartbeat = section:taboption("general", Flag, "heartbeat", + translate("Make heartbeats"), + translate("Use when IPv4 address of local WAN may change dynamically, does not apply to static tunnels")) +heartbeat.optional = true +heartbeat.default = heartbeat.enabled + + +nat = section:taboption("general", Flag, "nat", + translate("Behind NAT"), + translate("The tunnel end-point is behind NAT, defaults to disabled and only applies to AYIYA")) +nat.optional = true +nat.default = disabled + + +verbose = section:taboption("advanced", Flag, "verbose", + translate("Verbose"), + translate("Verbose logging by aiccu daemon")) +verbose.optional = true +verbose.default = disabled + + +ntpsynctimeout = section:taboption("advanced", Value, "ntpsynctimeout", + translate("NTP sync time-out"), + translate("Wait for NTP sync that many seconds, seting to 0 disables waiting (optional)")) +ntpsynctimeout.datatype = "uinteger" +ntpsynctimeout.placeholder = "90" +ntpsynctimeout.optional = true + + +ip6addr = section:taboption("advanced", Value, "ip6addr", + translate("Local IPv6 address"), + translate("IPv6 address delegated to the local tunnel endpoint (optional)")) +ip6addr.datatype = "ip6addr" +ip6addr.optional = true + + +defaultroute = section:taboption("advanced", Flag, "defaultroute", + translate("Default route"), + translate("Whether to create an IPv6 default route over the tunnel")) +defaultroute.default = defaultroute.enabled +defaultroute.optional = true + + +sourcerouting = section:taboption("advanced", Flag, "sourcerouting", + translate("Source routing"), + translate("Whether to route only packets from delegated prefixes")) +sourcerouting.default = sourcerouting.enabled +sourcerouting.optional = true + + +metric = section:taboption("advanced", Value, "metric", + translate("Use gateway metric")) +metric.datatype = "uinteger" +metric.placeholder = "0" +metric:depends("defaultroute", defaultroute.enabled) + + +ttl = section:taboption("advanced", Value, "ttl", + translate("Use TTL on tunnel interface")) +ttl.datatype = "range(1,255)" +ttl.placeholder = "64" + + +mtu = section:taboption("advanced", Value, "mtu", + translate("Use MTU on tunnel interface")) +mtu.datatype = "max(9200)" +mtu.placeholder = "1280" + diff --git a/protocols/luci-proto-ipv6/luasrc/model/network/proto_aiccu.lua b/protocols/luci-proto-ipv6/luasrc/model/network/proto_aiccu.lua new file mode 100644 index 0000000000..5896a278ce --- /dev/null +++ b/protocols/luci-proto-ipv6/luasrc/model/network/proto_aiccu.lua @@ -0,0 +1,49 @@ +-- Copyright 2015 Paul Oranje +-- Licensed to the public under GPLv2 + +local netmod = luci.model.network +local interface = luci.model.network.interface + +local proto = netmod:register_protocol("aiccu") + +function proto.get_i18n(self) + return luci.i18n.translate("AICCU (SIXXS)") +end + +function proto.ifname(self) + return "aiccu-" .. self.sid +end + +function proto.get_interface(self) + return interface(self:ifname(), self) +end + +function proto.is_installed(self) + return nixio.fs.access("/lib/netifd/proto/aiccu.sh") +end + +function proto.opkg_package(self) + return "aiccu" +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, ifname) + if self:is_floating() then + return (netmod:ifnameof(ifc) == self:ifname()) + else + return netmod.protocol.contains_interface(self, ifc) + end +end + +netmod:register_pattern_virtual("^aiccu-%%w") -- cgit v1.2.3 From b6e53737642317ade9f47fb4b857c4c9e0711140 Mon Sep 17 00:00:00 2001 From: Paul Oranje Date: Wed, 4 Feb 2015 12:12:59 +0100 Subject: luci-proto-ipv6: set aiccu mtu option range --- .../luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'protocols/luci-proto-ipv6/luasrc') diff --git a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua index 5248eddf0c..0e9fa06c98 100644 --- a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua +++ b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua @@ -129,6 +129,7 @@ ttl.placeholder = "64" mtu = section:taboption("advanced", Value, "mtu", translate("Use MTU on tunnel interface")) -mtu.datatype = "max(9200)" + translate("minimum 1280, maximum 1480")) +mtu.datatype = "range(1280-1480)" mtu.placeholder = "1280" -- cgit v1.2.3 From 42e228097703385373af474a5809c33623d4fe97 Mon Sep 17 00:00:00 2001 From: Paul Oranje Date: Wed, 4 Feb 2015 17:51:25 +0100 Subject: luci-proto-ipv6: fix typo in aiccu mtu range --- .../luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'protocols/luci-proto-ipv6/luasrc') diff --git a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua index 0e9fa06c98..5676639819 100644 --- a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua +++ b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua @@ -130,6 +130,6 @@ ttl.placeholder = "64" mtu = section:taboption("advanced", Value, "mtu", translate("Use MTU on tunnel interface")) translate("minimum 1280, maximum 1480")) -mtu.datatype = "range(1280-1480)" +mtu.datatype = "range(1280,1480)" mtu.placeholder = "1280" -- cgit v1.2.3 From c8fe297dc97d5e830fb20ade49b686950c1dd315 Mon Sep 17 00:00:00 2001 From: Paul Oranje Date: Fri, 6 Feb 2015 12:04:58 +0100 Subject: luci-proto-ipv6: aiccu improvements - option heartbeat as tunnel type (heartbeat or AYIYA) (inspired by idea of openwrt forum user thefRont) - another typo fix in the mtu option --- .../luasrc/model/cbi/admin_network/proto_aiccu.lua | 27 +++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'protocols/luci-proto-ipv6/luasrc') diff --git a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua index 5676639819..c7629cd676 100644 --- a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua +++ b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua @@ -57,18 +57,12 @@ ip6prefix.datatype = "ip6prefix" ip6prefix.optional = true -requiretls = section:taboption("general", Flag, "requiretls", - translate("Require TLS"), - translate("Connection to server fails when TLS cannot be used")) -requiretls.optional = true -requiretls.default = requiretls.enabled - - -heartbeat = section:taboption("general", Flag, "heartbeat", - translate("Make heartbeats"), - translate("Use when IPv4 address of local WAN may change dynamically, does not apply to static tunnels")) -heartbeat.optional = true -heartbeat.default = heartbeat.enabled +heartbeat = s:taboption("general", ListValue, "heartbeat", + translate("Tunnel type"), + translate("Also see Tunneling Comparison on SIXXS")) +heartbeat:value("0", translate("AYIYA")) +heartbeat:value("1", translate("Heartbeat")) +heartbeat.default = "0" nat = section:taboption("general", Flag, "nat", @@ -78,6 +72,13 @@ nat.optional = true nat.default = disabled +requiretls = section:taboption("general", Flag, "requiretls", + translate("Require TLS"), + translate("Connection to server fails when TLS cannot be used")) +requiretls.optional = true +requiretls.default = requiretls.enabled + + verbose = section:taboption("advanced", Flag, "verbose", translate("Verbose"), translate("Verbose logging by aiccu daemon")) @@ -128,7 +129,7 @@ ttl.placeholder = "64" mtu = section:taboption("advanced", Value, "mtu", - translate("Use MTU on tunnel interface")) + translate("Use MTU on tunnel interface"), translate("minimum 1280, maximum 1480")) mtu.datatype = "range(1280,1480)" mtu.placeholder = "1280" -- cgit v1.2.3 From ada0ea2aeae569e1acc48a2d643028a7050ce8f8 Mon Sep 17 00:00:00 2001 From: Paul Oranje Date: Fri, 6 Feb 2015 19:39:56 +0100 Subject: luci-proto-ipv6: aiccu fixed ip6prefix datatype --- .../luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'protocols/luci-proto-ipv6/luasrc') diff --git a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua index c7629cd676..e3ae020f58 100644 --- a/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua +++ b/protocols/luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua @@ -53,7 +53,7 @@ tunnelid.optional = true local ip6prefix = section:taboption("general", Value, "ip6prefix", translate("IPv6 prefix"), translate("Routed IPv6 prefix for downstream interfaces")) -ip6prefix.datatype = "ip6prefix" +ip6prefix.datatype = "ip6addr" ip6prefix.optional = true -- cgit v1.2.3