mirror of
				https://github.com/Ysurac/openmptcprouter-feeds.git
				synced 2025-03-09 15:40:03 +00:00 
			
		
		
		
	Add 6in4 gateway setting support
This commit is contained in:
		
							parent
							
								
									bd02a525f8
								
							
						
					
					
						commit
						3d2e8d9b85
					
				
					 17 changed files with 1021 additions and 0 deletions
				
			
		
							
								
								
									
										43
									
								
								6in4/Makefile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								6in4/Makefile
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,43 @@
 | 
			
		|||
#
 | 
			
		||||
# Copyright (C) 2010-2015 OpenWrt.org
 | 
			
		||||
#
 | 
			
		||||
# This is free software, licensed under the GNU General Public License v2.
 | 
			
		||||
# See /LICENSE for more information.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
include $(TOPDIR)/rules.mk
 | 
			
		||||
 | 
			
		||||
PKG_NAME:=6in4
 | 
			
		||||
PKG_VERSION:=26
 | 
			
		||||
PKG_RELEASE:=1
 | 
			
		||||
PKG_LICENSE:=GPL-2.0
 | 
			
		||||
 | 
			
		||||
include $(INCLUDE_DIR)/package.mk
 | 
			
		||||
 | 
			
		||||
define Package/6in4
 | 
			
		||||
  SECTION:=net
 | 
			
		||||
  CATEGORY:=Network
 | 
			
		||||
  DEPENDS:=@IPV6 +kmod-sit +uclient-fetch
 | 
			
		||||
  TITLE:=IPv6-in-IPv4 configuration support
 | 
			
		||||
  MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
 | 
			
		||||
  PKGARCH:=all
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/6in4/description
 | 
			
		||||
Provides support for 6in4 tunnels in /etc/config/network.
 | 
			
		||||
Refer to http://wiki.openwrt.org/doc/uci/network for
 | 
			
		||||
configuration details.
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Build/Compile
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Build/Configure
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/6in4/install
 | 
			
		||||
	$(INSTALL_DIR) $(1)/lib/netifd/proto
 | 
			
		||||
	$(INSTALL_BIN) ./files/6in4.sh $(1)/lib/netifd/proto/6in4.sh
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call BuildPackage,6in4))
 | 
			
		||||
							
								
								
									
										149
									
								
								6in4/files/6in4.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										149
									
								
								6in4/files/6in4.sh
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,149 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
# 6in4.sh - IPv6-in-IPv4 tunnel backend
 | 
			
		||||
# Copyright (c) 2010-2015 OpenWrt.org
 | 
			
		||||
 | 
			
		||||
[ -n "$INCLUDE_ONLY" ] || {
 | 
			
		||||
	. /lib/functions.sh
 | 
			
		||||
	. /lib/functions/network.sh
 | 
			
		||||
	. ../netifd-proto.sh
 | 
			
		||||
	init_proto "$@"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
proto_6in4_update() {
 | 
			
		||||
	sh -c '
 | 
			
		||||
		timeout=5
 | 
			
		||||
 | 
			
		||||
		(while [ $((timeout--)) -gt 0 ]; do
 | 
			
		||||
			sleep 1
 | 
			
		||||
			kill -0 $$ || exit 0
 | 
			
		||||
		done; kill -9 $$) 2>/dev/null &
 | 
			
		||||
 | 
			
		||||
		exec "$@"
 | 
			
		||||
	' "$1" "$@"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
proto_6in4_add_prefix() {
 | 
			
		||||
	append "$3" "$1"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
proto_6in4_setup() {
 | 
			
		||||
	local cfg="$1"
 | 
			
		||||
	local iface="$2"
 | 
			
		||||
	local link="6in4-$cfg"
 | 
			
		||||
 | 
			
		||||
	local mtu ttl tos ipaddr peeraddr ip6addr ip6prefix ip6prefixes tunlink tunnelid username password updatekey gateway
 | 
			
		||||
	json_get_vars mtu ttl tos ipaddr peeraddr ip6addr tunlink tunnelid username password updatekey gateway
 | 
			
		||||
	json_for_each_item proto_6in4_add_prefix ip6prefix ip6prefixes
 | 
			
		||||
 | 
			
		||||
	[ -z "$peeraddr" ] && {
 | 
			
		||||
		proto_notify_error "$cfg" "MISSING_ADDRESS"
 | 
			
		||||
		proto_block_restart "$cfg"
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	( proto_add_host_dependency "$cfg" "$peeraddr" "$tunlink" )
 | 
			
		||||
 | 
			
		||||
	[ -z "$ipaddr" ] && {
 | 
			
		||||
		local wanif="$tunlink"
 | 
			
		||||
		if [ -z "$wanif" ] && ! network_find_wan wanif; then
 | 
			
		||||
			proto_notify_error "$cfg" "NO_WAN_LINK"
 | 
			
		||||
			return
 | 
			
		||||
		fi
 | 
			
		||||
 | 
			
		||||
		if ! network_get_ipaddr ipaddr "$wanif"; then
 | 
			
		||||
			proto_notify_error "$cfg" "NO_WAN_LINK"
 | 
			
		||||
			return
 | 
			
		||||
		fi
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	proto_init_update "$link" 1
 | 
			
		||||
 | 
			
		||||
	[ -n "$ip6addr" ] && {
 | 
			
		||||
		local local6="${ip6addr%%/*}"
 | 
			
		||||
		local mask6="${ip6addr##*/}"
 | 
			
		||||
		[[ "$local6" = "$mask6" ]] && mask6=
 | 
			
		||||
		proto_add_ipv6_address "$local6" "$mask6"
 | 
			
		||||
		proto_add_ipv6_route "::" 0 "" "" "" "$local6/$mask6"
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	[ -n "$gateway" ] && {
 | 
			
		||||
		proto_add_ipv6_route "::" 0 "$gateway"
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for ip6prefix in $ip6prefixes; do
 | 
			
		||||
		proto_add_ipv6_prefix "$ip6prefix"
 | 
			
		||||
		proto_add_ipv6_route "::" 0 "" "" "" "$ip6prefix"
 | 
			
		||||
	done
 | 
			
		||||
 | 
			
		||||
	proto_add_tunnel
 | 
			
		||||
	json_add_string mode sit
 | 
			
		||||
	json_add_int mtu "${mtu:-1280}"
 | 
			
		||||
	json_add_int ttl "${ttl:-64}"
 | 
			
		||||
	[ -n "$tos" ] && json_add_string tos "$tos"
 | 
			
		||||
	json_add_string local "$ipaddr"
 | 
			
		||||
	json_add_string remote "$peeraddr"
 | 
			
		||||
	[ -n "$tunlink" ] && json_add_string link "$tunlink"
 | 
			
		||||
	proto_close_tunnel
 | 
			
		||||
 | 
			
		||||
	proto_send_update "$cfg"
 | 
			
		||||
 | 
			
		||||
	[ -n "$tunnelid" -a -n "$username" -a \( -n "$password" -o -n "$updatekey" \) ] && {
 | 
			
		||||
		[ -n "$updatekey" ] && password="$updatekey"
 | 
			
		||||
 | 
			
		||||
		local http="http"
 | 
			
		||||
		local urlget="uclient-fetch"
 | 
			
		||||
		local urlget_opts="-qO-"
 | 
			
		||||
		local ca_path="${SSL_CERT_DIR:-/etc/ssl/certs}"
 | 
			
		||||
 | 
			
		||||
		[ -f /lib/libustream-ssl.so ] && http=https
 | 
			
		||||
		[ "$http" = "https" -a -z "$(find $ca_path -name "*.0" 2>/dev/null)" ] && {
 | 
			
		||||
			urlget_opts="$urlget_opts --no-check-certificate"
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		local url="$http://ipv4.tunnelbroker.net/nic/update?hostname=$tunnelid"
 | 
			
		||||
		local try=0
 | 
			
		||||
		local max=3
 | 
			
		||||
 | 
			
		||||
		(
 | 
			
		||||
			set -o pipefail
 | 
			
		||||
			while [ $((++try)) -le $max ]; do
 | 
			
		||||
				if proto_6in4_update $urlget $urlget_opts --user="$username" --password="$password" "$url" 2>&1 | \
 | 
			
		||||
					sed -e 's,^Killed$,timeout,' -e "s,^,update $try/$max: ," | \
 | 
			
		||||
					logger -t "$link";
 | 
			
		||||
				then
 | 
			
		||||
					logger -t "$link" "updated"
 | 
			
		||||
					return 0
 | 
			
		||||
				fi
 | 
			
		||||
				sleep 5
 | 
			
		||||
			done
 | 
			
		||||
			logger -t "$link" "update failed"
 | 
			
		||||
		)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
proto_6in4_teardown() {
 | 
			
		||||
	local cfg="$1"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
proto_6in4_init_config() {
 | 
			
		||||
	no_device=1
 | 
			
		||||
	available=1
 | 
			
		||||
 | 
			
		||||
	proto_config_add_string "ipaddr"
 | 
			
		||||
	proto_config_add_string "ip6addr"
 | 
			
		||||
	proto_config_add_array "ip6prefix"
 | 
			
		||||
	proto_config_add_string "peeraddr"
 | 
			
		||||
	proto_config_add_string "tunlink"
 | 
			
		||||
	proto_config_add_string "tunnelid"
 | 
			
		||||
	proto_config_add_string "username"
 | 
			
		||||
	proto_config_add_string "password"
 | 
			
		||||
	proto_config_add_string "updatekey"
 | 
			
		||||
	proto_config_add_string "gateway"
 | 
			
		||||
	proto_config_add_int "mtu"
 | 
			
		||||
	proto_config_add_int "ttl"
 | 
			
		||||
	proto_config_add_string "tos"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
[ -n "$INCLUDE_ONLY" ] || {
 | 
			
		||||
	add_protocol 6in4
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										17
									
								
								luci-proto-ipv6/Makefile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								luci-proto-ipv6/Makefile
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
#
 | 
			
		||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
 | 
			
		||||
# Copyright (C) 2018 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
 | 
			
		||||
#
 | 
			
		||||
# This is free software, licensed under the Apache License, Version 2.0 .
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
include $(TOPDIR)/rules.mk
 | 
			
		||||
 | 
			
		||||
LUCI_TITLE:=Support for DHCPv6/6in4/6to4/6rd/DS-Lite/aiccu
 | 
			
		||||
LUCI_DEPENDS:=
 | 
			
		||||
 | 
			
		||||
PKG_LICENSE:=Apache-2.0
 | 
			
		||||
 | 
			
		||||
include ../../luci.mk
 | 
			
		||||
 | 
			
		||||
# call BuildPackage - OpenWrt buildroot signature
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
-- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
 | 
			
		||||
-- Copyright 2013 Steven Barth <steven@midlink.org>
 | 
			
		||||
-- Licensed to the public under the Apache License 2.0.
 | 
			
		||||
 | 
			
		||||
local map, section, net = ...
 | 
			
		||||
local tunlink, defaultroute, metric, mtu
 | 
			
		||||
 | 
			
		||||
section:taboption("general", Value, "ip6prefix",
 | 
			
		||||
	translate("NAT64 Prefix"), translate("Leave empty to autodetect"))
 | 
			
		||||
 | 
			
		||||
tunlink = section:taboption("advanced", DynamicList, "tunlink", translate("Tunnel Link"))
 | 
			
		||||
tunlink.template = "cbi/network_netlist"
 | 
			
		||||
tunlink.nocreate = true
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
defaultroute = section:taboption("advanced", Flag, "defaultroute",
 | 
			
		||||
	translate("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)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
mtu = section:taboption("advanced", Value, "mtu", translate("Use MTU on tunnel interface"))
 | 
			
		||||
mtu.placeholder = "1280"
 | 
			
		||||
mtu.datatype    = "max(9200)"
 | 
			
		||||
							
								
								
									
										104
									
								
								luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_6in4.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										104
									
								
								luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_6in4.lua
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,104 @@
 | 
			
		|||
-- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
 | 
			
		||||
-- Licensed to the public under the Apache License 2.0.
 | 
			
		||||
 | 
			
		||||
local map, section, net = ...
 | 
			
		||||
 | 
			
		||||
local ipaddr, peeraddr, ip6addr, tunnelid, username, password
 | 
			
		||||
local defaultroute, metric, ttl, mtu
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ipaddr = s:taboption("general", Value, "ipaddr",
 | 
			
		||||
	translate("Local IPv4 address"),
 | 
			
		||||
	translate("Leave empty to use the current WAN address"))
 | 
			
		||||
 | 
			
		||||
ipaddr.datatype = "ip4addr"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
peeraddr = s:taboption("general", Value, "peeraddr",
 | 
			
		||||
	translate("Remote IPv4 address"),
 | 
			
		||||
	translate("This is usually the address of the nearest PoP operated by the tunnel broker"))
 | 
			
		||||
 | 
			
		||||
peeraddr.rmempty  = false
 | 
			
		||||
peeraddr.datatype = "ip4addr"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ip6addr = s:taboption("general", Value, "ip6addr",
 | 
			
		||||
	translate("Local IPv6 address"),
 | 
			
		||||
	translate("This is the local endpoint address assigned by the tunnel broker, it usually ends with <code>...:2/64</code>"))
 | 
			
		||||
 | 
			
		||||
ip6addr.datatype = "ip6addr"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
local ip6prefix = s:taboption("general", Value, "ip6prefix",
 | 
			
		||||
	translate("IPv6 routed prefix"),
 | 
			
		||||
	translate("This is the prefix routed to you by the tunnel broker for use by clients"))
 | 
			
		||||
 | 
			
		||||
ip6prefix.datatype = "ip6addr"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
local update = section:taboption("general", Flag, "_update",
 | 
			
		||||
	translate("Dynamic tunnel"),
 | 
			
		||||
	translate("Enable HE.net dynamic endpoint update"))
 | 
			
		||||
 | 
			
		||||
update.enabled  = "1"
 | 
			
		||||
update.disabled = "0"
 | 
			
		||||
 | 
			
		||||
function update.write() end
 | 
			
		||||
function update.remove() end
 | 
			
		||||
function update.cfgvalue(self, section)
 | 
			
		||||
	return (tonumber(m:get(section, "tunnelid")) ~= nil)
 | 
			
		||||
		and self.enabled or self.disabled
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
tunnelid = section:taboption("general", Value, "tunnelid", translate("Tunnel ID"))
 | 
			
		||||
tunnelid.datatype = "uinteger"
 | 
			
		||||
tunnelid:depends("_update", update.enabled)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
username = section:taboption("general", Value, "username",
 | 
			
		||||
	translate("HE.net username"),
 | 
			
		||||
	translate("This is the plain username for logging into the account"))
 | 
			
		||||
 | 
			
		||||
username:depends("_update", update.enabled)
 | 
			
		||||
username.validate = function(self, val, sid)
 | 
			
		||||
	if type(val) == "string" and #val == 32 and val:match("^[a-fA-F0-9]+$") then
 | 
			
		||||
		return nil, translate("The HE.net endpoint update configuration changed, you must now use the plain username instead of the user ID!")
 | 
			
		||||
	end
 | 
			
		||||
	return val
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
password = section:taboption("general", Value, "password",
 | 
			
		||||
	translate("HE.net password"),
 | 
			
		||||
	translate("This is either the \"Update Key\" configured for the tunnel or the account password if no update key has been configured"))
 | 
			
		||||
 | 
			
		||||
password.password = true
 | 
			
		||||
password:depends("_update", update.enabled)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
gateway = section:taboption("advanced", Value, "gateway",translate("Gateway"))
 | 
			
		||||
 | 
			
		||||
defaultroute = section:taboption("advanced", Flag, "defaultroute",
 | 
			
		||||
	translate("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)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ttl = section:taboption("advanced", Value, "ttl", translate("Use TTL on tunnel interface"))
 | 
			
		||||
ttl.placeholder = "64"
 | 
			
		||||
ttl.datatype    = "range(1,255)"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
mtu = section:taboption("advanced", Value, "mtu", translate("Use MTU on tunnel interface"))
 | 
			
		||||
mtu.placeholder = "1280"
 | 
			
		||||
mtu.datatype    = "max(9200)"
 | 
			
		||||
							
								
								
									
										72
									
								
								luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_6rd.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_6rd.lua
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,72 @@
 | 
			
		|||
-- Copyright 2011-2012 Jo-Philipp Wich <jow@openwrt.org>
 | 
			
		||||
-- Licensed to the public under the Apache License 2.0.
 | 
			
		||||
 | 
			
		||||
local map, section, net = ...
 | 
			
		||||
 | 
			
		||||
local ipaddr, peeraddr, ip6addr, tunnelid, username, password
 | 
			
		||||
local defaultroute, metric, ttl, mtu
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ipaddr = s:taboption("general", Value, "ipaddr",
 | 
			
		||||
	translate("Local IPv4 address"),
 | 
			
		||||
	translate("Leave empty to use the current WAN address"))
 | 
			
		||||
 | 
			
		||||
ipaddr.datatype = "ip4addr"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
peeraddr = s:taboption("general", Value, "peeraddr",
 | 
			
		||||
	translate("Remote IPv4 address"),
 | 
			
		||||
	translate("This IPv4 address of the relay"))
 | 
			
		||||
 | 
			
		||||
peeraddr.rmempty  = false
 | 
			
		||||
peeraddr.datatype = "ip4addr"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ip6addr = s:taboption("general", Value, "ip6prefix",
 | 
			
		||||
	translate("IPv6 prefix"),
 | 
			
		||||
	translate("The IPv6 prefix assigned to the provider, usually ends with <code>::</code>"))
 | 
			
		||||
 | 
			
		||||
ip6addr.rmempty  = false
 | 
			
		||||
ip6addr.datatype = "ip6addr"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ip6prefixlen = s:taboption("general", Value, "ip6prefixlen",
 | 
			
		||||
	translate("IPv6 prefix length"),
 | 
			
		||||
	translate("The length of the IPv6 prefix in bits"))
 | 
			
		||||
 | 
			
		||||
ip6prefixlen.placeholder = "16"
 | 
			
		||||
ip6prefixlen.datatype    = "range(0,128)"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ip6prefixlen = s:taboption("general", Value, "ip4prefixlen",
 | 
			
		||||
	translate("IPv4 prefix length"),
 | 
			
		||||
	translate("The length of the IPv4 prefix in bits, the remainder is used in the IPv6 addresses."))
 | 
			
		||||
 | 
			
		||||
ip6prefixlen.placeholder = "0"
 | 
			
		||||
ip6prefixlen.datatype    = "range(0,32)"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
defaultroute = section:taboption("advanced", Flag, "defaultroute",
 | 
			
		||||
	translate("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)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ttl = section:taboption("advanced", Value, "ttl", translate("Use TTL on tunnel interface"))
 | 
			
		||||
ttl.placeholder = "64"
 | 
			
		||||
ttl.datatype    = "range(1,255)"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
mtu = section:taboption("advanced", Value, "mtu", translate("Use MTU on tunnel interface"))
 | 
			
		||||
mtu.placeholder = "1280"
 | 
			
		||||
mtu.datatype    = "max(9200)"
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
-- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
 | 
			
		||||
-- Licensed to the public under the Apache License 2.0.
 | 
			
		||||
 | 
			
		||||
local map, section, net = ...
 | 
			
		||||
 | 
			
		||||
local ipaddr, defaultroute, metric, ttl, mtu
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ipaddr = section:taboption("general", Value, "ipaddr",
 | 
			
		||||
	translate("Local IPv4 address"),
 | 
			
		||||
	translate("Leave empty to use the current WAN address"))
 | 
			
		||||
 | 
			
		||||
ipaddr.datatype = "ip4addr"
 | 
			
		||||
 | 
			
		||||
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)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ttl = section:taboption("advanced", Value, "ttl", translate("Use TTL on tunnel interface"))
 | 
			
		||||
ttl.placeholder = "64"
 | 
			
		||||
ttl.datatype    = "range(1,255)"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
mtu = section:taboption("advanced", Value, "mtu", translate("Use MTU on tunnel interface"))
 | 
			
		||||
mtu.placeholder = "1280"
 | 
			
		||||
mtu.datatype    = "max(9200)"
 | 
			
		||||
							
								
								
									
										136
									
								
								luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										136
									
								
								luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_aiccu.lua
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,136 @@
 | 
			
		|||
-- Copyright 2015 Paul Oranje <por@xs4all.nl>
 | 
			
		||||
-- 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(0)"
 | 
			
		||||
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 = "ip6addr"
 | 
			
		||||
ip6prefix.optional = true
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
heartbeat = s:taboption("general", ListValue, "heartbeat",
 | 
			
		||||
        translate("Tunnel type"),
 | 
			
		||||
	translate("Also see <a href=\"https://www.sixxs.net/faq/connectivity/?faq=comparison\">Tunneling Comparison</a> on SIXXS"))
 | 
			
		||||
heartbeat:value("0", translate("AYIYA"))
 | 
			
		||||
heartbeat:value("1", translate("Heartbeat"))
 | 
			
		||||
heartbeat.default = "0"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
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 = nat.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.disabled
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
verbose = section:taboption("advanced", Flag, "verbose",
 | 
			
		||||
	translate("Verbose"),
 | 
			
		||||
	translate("Verbose logging by aiccu daemon"))
 | 
			
		||||
verbose.optional = true
 | 
			
		||||
verbose.default = verbose.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"),
 | 
			
		||||
        translate("minimum 1280, maximum 1480"))
 | 
			
		||||
mtu.datatype = "range(1280,1480)"
 | 
			
		||||
mtu.placeholder = "1280"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,58 @@
 | 
			
		|||
-- Copyright 2013 Steven Barth <steven@midlink.org>
 | 
			
		||||
-- Licensed to the public under the Apache License 2.0.
 | 
			
		||||
 | 
			
		||||
local map, section, net = ...
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
local o = section:taboption("general", ListValue, "reqaddress",
 | 
			
		||||
	translate("Request IPv6-address"))
 | 
			
		||||
o:value("try")
 | 
			
		||||
o:value("force")
 | 
			
		||||
o:value("none", "disabled")
 | 
			
		||||
o.default = "try"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
o = section:taboption("general", Value, "reqprefix",
 | 
			
		||||
	translate("Request IPv6-prefix of length"))
 | 
			
		||||
o:value("auto", translate("Automatic"))
 | 
			
		||||
o:value("no", translate("disabled"))
 | 
			
		||||
o:value("48")
 | 
			
		||||
o:value("52")
 | 
			
		||||
o:value("56")
 | 
			
		||||
o:value("60")
 | 
			
		||||
o:value("64")
 | 
			
		||||
o.default = "auto"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
o = section:taboption("advanced", Flag, "defaultroute",
 | 
			
		||||
	translate("Use default gateway"),
 | 
			
		||||
	translate("If unchecked, no default route is configured"))
 | 
			
		||||
o.default = o.enabled
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
o = section:taboption("advanced", Flag, "peerdns",
 | 
			
		||||
	translate("Use DNS servers advertised by peer"),
 | 
			
		||||
	translate("If unchecked, the advertised DNS server addresses are ignored"))
 | 
			
		||||
o.default = o.enabled
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
o = section:taboption("advanced", Value, "ip6prefix",
 | 
			
		||||
	translate("Custom delegated IPv6-prefix"))
 | 
			
		||||
o.dataype = "ip6addr"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
o = section:taboption("advanced", DynamicList, "dns",
 | 
			
		||||
	translate("Use custom DNS servers"))
 | 
			
		||||
o:depends("peerdns", "")
 | 
			
		||||
o.datatype = "list(ip6addr)"
 | 
			
		||||
o.cast     = "string"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
o = section:taboption("advanced", Value, "clientid",
 | 
			
		||||
	translate("Client ID to send when requesting DHCP"))
 | 
			
		||||
 | 
			
		||||
luci.tools.proto.opt_macaddr(section, ifc, translate("Override MAC address"))
 | 
			
		||||
 | 
			
		||||
o = section:taboption("advanced", Value, "mtu", translate("Override MTU"))
 | 
			
		||||
o.placeholder = "1500"
 | 
			
		||||
o.datatype    = "max(9200)"
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,53 @@
 | 
			
		|||
-- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
 | 
			
		||||
-- Copyright 2013 Steven Barth <steven@midlink.org>
 | 
			
		||||
-- Licensed to the public under the Apache License 2.0.
 | 
			
		||||
 | 
			
		||||
local map, section, net = ...
 | 
			
		||||
 | 
			
		||||
local peeraddr, ip6addr
 | 
			
		||||
local tunlink, defaultroute, metric, ttl, mtu
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
peeraddr = section:taboption("general", Value, "peeraddr",
 | 
			
		||||
	translate("DS-Lite AFTR address"))
 | 
			
		||||
 | 
			
		||||
peeraddr.rmempty  = false
 | 
			
		||||
peeraddr.datatype = "or(hostname,ip6addr)"
 | 
			
		||||
 | 
			
		||||
ip6addr = section:taboption("general", Value, "ip6addr",
 | 
			
		||||
	translate("Local IPv6 address"),
 | 
			
		||||
	translate("Leave empty to use the current WAN address"))
 | 
			
		||||
 | 
			
		||||
ip6addr.datatype = "ip6addr"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
tunlink = section:taboption("advanced", DynamicList, "tunlink", translate("Tunnel Link"))
 | 
			
		||||
tunlink.template = "cbi/network_netlist"
 | 
			
		||||
tunlink.nocreate = true
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
defaultroute = section:taboption("advanced", Flag, "defaultroute",
 | 
			
		||||
	translate("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)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ttl = section:taboption("advanced", Value, "ttl", translate("Use TTL on tunnel interface"))
 | 
			
		||||
ttl.placeholder = "64"
 | 
			
		||||
ttl.datatype    = "range(1,255)"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
mtu = section:taboption("advanced", Value, "mtu", translate("Use MTU on tunnel interface"))
 | 
			
		||||
mtu.placeholder = "1280"
 | 
			
		||||
mtu.datatype    = "max(9200)"
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
-- Copyright 2013 Steven Barth <steven@midlink.org>
 | 
			
		||||
-- Licensed to the public under the Apache License 2.0.
 | 
			
		||||
 | 
			
		||||
local map, section, net = ...
 | 
			
		||||
 | 
			
		||||
local mode = section:taboption("general", ListValue, "mode", translate("Category"))
 | 
			
		||||
mode:value("auto", translate("Automatic"))
 | 
			
		||||
mode:value("external", translate("External"))
 | 
			
		||||
mode:value("internal", translate("Internal"))
 | 
			
		||||
mode:value("leaf", translate("Leaf"))
 | 
			
		||||
mode:value("guest", translate("Guest"))
 | 
			
		||||
mode:value("adhoc", translate("Ad-Hoc"))
 | 
			
		||||
mode:value("hybrid", translate("Hybrid"))
 | 
			
		||||
mode.default = "auto"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
local plen = section:taboption("advanced", Value, "ip6assign", translate("IPv6 assignment length"),
 | 
			
		||||
	translate("Assign a part of given length of every public IPv6-prefix to this interface"))
 | 
			
		||||
plen.datatype = "max(128)"
 | 
			
		||||
plen.default = "64"
 | 
			
		||||
 | 
			
		||||
section:taboption("advanced", Value, "link_id", translate("IPv6 assignment hint"),
 | 
			
		||||
	translate("Assign prefix parts using this hexadecimal subprefix ID for this interface."))
 | 
			
		||||
 | 
			
		||||
plen = section:taboption("advanced", Value, "ip4assign", translate("IPv4 assignment length"))
 | 
			
		||||
plen.datatype = "max(32)"
 | 
			
		||||
plen.default = "24"
 | 
			
		||||
 | 
			
		||||
local o = section:taboption("advanced", Value, "dnsname", translate("DNS-Label / FQDN"))
 | 
			
		||||
o.default = map.name
 | 
			
		||||
 | 
			
		||||
luci.tools.proto.opt_macaddr(section, ifc, translate("Override MAC address"))
 | 
			
		||||
 | 
			
		||||
o = section:taboption("advanced", Value, "mtu", translate("Override MTU"))
 | 
			
		||||
o.placeholder = "1500"
 | 
			
		||||
o.datatype    = "max(9200)"
 | 
			
		||||
							
								
								
									
										88
									
								
								luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_map.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										88
									
								
								luci-proto-ipv6/luasrc/model/cbi/admin_network/proto_map.lua
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,88 @@
 | 
			
		|||
-- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
 | 
			
		||||
-- Copyright 2013 Steven Barth <steven@midlink.org>
 | 
			
		||||
-- Licensed to the public under the Apache License 2.0.
 | 
			
		||||
 | 
			
		||||
local map, section, net = ...
 | 
			
		||||
 | 
			
		||||
local peeraddr, ip6addr
 | 
			
		||||
local tunlink, defaultroute, metric, ttl, mtu
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
maptype = section:taboption("general", ListValue, "type", translate("Type"))
 | 
			
		||||
maptype:value("map-e", "MAP-E")
 | 
			
		||||
maptype:value("map-t", "MAP-T")
 | 
			
		||||
maptype:value("lw4o6", "LW4over6")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
peeraddr = section:taboption("general", Value, "peeraddr",
 | 
			
		||||
	translate("BR / DMR / AFTR"))
 | 
			
		||||
 | 
			
		||||
peeraddr.rmempty  = false
 | 
			
		||||
peeraddr.datatype = "ip6addr"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ipaddr = section:taboption("general", Value, "ipaddr",
 | 
			
		||||
	translate("IPv4 prefix"))
 | 
			
		||||
ipaddr.datatype = "ip4addr"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ip4prefixlen = s:taboption("general", Value, "ip4prefixlen",
 | 
			
		||||
        translate("IPv4 prefix length"),
 | 
			
		||||
        translate("The length of the IPv4 prefix in bits, the remainder is used in the IPv6 addresses."))
 | 
			
		||||
 | 
			
		||||
ip4prefixlen.placeholder = "32"
 | 
			
		||||
ip4prefixlen.datatype    = "range(0,32)"
 | 
			
		||||
 | 
			
		||||
ip6addr = s:taboption("general", Value, "ip6prefix",
 | 
			
		||||
        translate("IPv6 prefix"),
 | 
			
		||||
        translate("The IPv6 prefix assigned to the provider, usually ends with <code>::</code>"))
 | 
			
		||||
 | 
			
		||||
ip6addr.rmempty  = false
 | 
			
		||||
ip6addr.datatype = "ip6addr"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ip6prefixlen = s:taboption("general", Value, "ip6prefixlen",
 | 
			
		||||
        translate("IPv6 prefix length"),
 | 
			
		||||
        translate("The length of the IPv6 prefix in bits"))
 | 
			
		||||
 | 
			
		||||
ip6prefixlen.placeholder = "16"
 | 
			
		||||
ip6prefixlen.datatype    = "range(0,64)"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
s:taboption("general", Value, "ealen",
 | 
			
		||||
	translate("EA-bits length")).datatype = "range(0,48)"
 | 
			
		||||
 | 
			
		||||
s:taboption("general", Value, "psidlen",
 | 
			
		||||
	translate("PSID-bits length")).datatype = "range(0,16)"
 | 
			
		||||
 | 
			
		||||
s:taboption("general", Value, "offset",
 | 
			
		||||
	translate("PSID offset")).datatype = "range(0,16)"
 | 
			
		||||
 | 
			
		||||
tunlink = section:taboption("advanced", DynamicList, "tunlink", translate("Tunnel Link"))
 | 
			
		||||
tunlink.template = "cbi/network_netlist"
 | 
			
		||||
tunlink.nocreate = true
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
defaultroute = section:taboption("advanced", Flag, "defaultroute",
 | 
			
		||||
	translate("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)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ttl = section:taboption("advanced", Value, "ttl", translate("Use TTL on tunnel interface"))
 | 
			
		||||
ttl.placeholder = "64"
 | 
			
		||||
ttl.datatype    = "range(1,255)"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
mtu = section:taboption("advanced", Value, "mtu", translate("Use MTU on tunnel interface"))
 | 
			
		||||
mtu.placeholder = "1280"
 | 
			
		||||
mtu.datatype    = "max(9200)"
 | 
			
		||||
							
								
								
									
										63
									
								
								luci-proto-ipv6/luasrc/model/network/proto_4x6.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								luci-proto-ipv6/luasrc/model/network/proto_4x6.lua
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,63 @@
 | 
			
		|||
-- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
 | 
			
		||||
-- Copyright 2013 Steven Barth <steven@midlink.org>
 | 
			
		||||
-- Licensed to the public under the Apache License 2.0.
 | 
			
		||||
 | 
			
		||||
local netmod = luci.model.network
 | 
			
		||||
 | 
			
		||||
local _, p
 | 
			
		||||
for _, p in ipairs({"dslite", "map", "464xlat"}) do
 | 
			
		||||
 | 
			
		||||
	local proto = netmod:register_protocol(p)
 | 
			
		||||
 | 
			
		||||
	function proto.get_i18n(self)
 | 
			
		||||
		if p == "dslite" then
 | 
			
		||||
			return luci.i18n.translate("Dual-Stack Lite (RFC6333)")
 | 
			
		||||
		elseif p == "map" then
 | 
			
		||||
			return luci.i18n.translate("MAP / LW4over6")
 | 
			
		||||
		elseif p == "464xlat" then
 | 
			
		||||
			return luci.i18n.translate("464XLAT (CLAT)")
 | 
			
		||||
		end
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	function proto.ifname(self)
 | 
			
		||||
		return p .. "-" .. self.sid
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	function proto.opkg_package(self)
 | 
			
		||||
		if p == "dslite" then
 | 
			
		||||
			return "ds-lite"
 | 
			
		||||
		elseif p == "map" then
 | 
			
		||||
			return "map-t"
 | 
			
		||||
		elseif p == "464xlat" then
 | 
			
		||||
			return "464xlat"
 | 
			
		||||
		end
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	function proto.is_installed(self)
 | 
			
		||||
		return nixio.fs.access("/lib/netifd/proto/" .. p .. ".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, ifname)
 | 
			
		||||
		return (netmod:ifnameof(ifc) == self:ifname())
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	if p == "dslite" then
 | 
			
		||||
		netmod:register_pattern_virtual("^ds%-%w")
 | 
			
		||||
	elseif p == "map" then
 | 
			
		||||
		netmod:register_pattern_virtual("^map%-%w")
 | 
			
		||||
	elseif p == "464xlat" then
 | 
			
		||||
		netmod:register_pattern_virtual("^464%-%w")
 | 
			
		||||
	end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										50
									
								
								luci-proto-ipv6/luasrc/model/network/proto_6x4.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								luci-proto-ipv6/luasrc/model/network/proto_6x4.lua
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,50 @@
 | 
			
		|||
-- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
 | 
			
		||||
-- Licensed to the public under the Apache License 2.0.
 | 
			
		||||
 | 
			
		||||
local netmod = luci.model.network
 | 
			
		||||
 | 
			
		||||
local _, p
 | 
			
		||||
for _, p in ipairs({"6in4", "6to4", "6rd"}) do
 | 
			
		||||
 | 
			
		||||
	local proto = netmod:register_protocol(p)
 | 
			
		||||
 | 
			
		||||
	function proto.get_i18n(self)
 | 
			
		||||
		if p == "6in4" then
 | 
			
		||||
			return luci.i18n.translate("IPv6-in-IPv4 (RFC4213)")
 | 
			
		||||
		elseif p == "6to4" then
 | 
			
		||||
			return luci.i18n.translate("IPv6-over-IPv4 (6to4)")
 | 
			
		||||
		elseif p == "6rd" then
 | 
			
		||||
			return luci.i18n.translate("IPv6-over-IPv4 (6rd)")
 | 
			
		||||
		end
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	function proto.ifname(self)
 | 
			
		||||
		return p .. "-" .. self.sid
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	function proto.opkg_package(self)
 | 
			
		||||
		return p
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	function proto.is_installed(self)
 | 
			
		||||
		return nixio.fs.access("/lib/netifd/proto/" .. p .. ".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, ifname)
 | 
			
		||||
		return (netmod:ifnameof(ifc) == self:ifname())
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	netmod:register_pattern_virtual("^%s%%-%%w" % p)
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										49
									
								
								luci-proto-ipv6/luasrc/model/network/proto_aiccu.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								luci-proto-ipv6/luasrc/model/network/proto_aiccu.lua
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,49 @@
 | 
			
		|||
-- Copyright 2015 Paul Oranje <por@xs4all.nl>
 | 
			
		||||
-- 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")
 | 
			
		||||
							
								
								
									
										16
									
								
								luci-proto-ipv6/luasrc/model/network/proto_dhcpv6.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								luci-proto-ipv6/luasrc/model/network/proto_dhcpv6.lua
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
-- Copyright 2013 Jo-Philipp Wich <jow@openwrt.org>
 | 
			
		||||
-- Licensed to the public under the Apache License 2.0.
 | 
			
		||||
 | 
			
		||||
local proto = luci.model.network:register_protocol("dhcpv6")
 | 
			
		||||
 | 
			
		||||
function proto.get_i18n(self)
 | 
			
		||||
	return luci.i18n.translate("DHCPv6 client")
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function proto.is_installed(self)
 | 
			
		||||
	return nixio.fs.access("/lib/netifd/proto/dhcpv6.sh")
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function proto.opkg_package(self)
 | 
			
		||||
	return "odhcp6c"
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										16
									
								
								luci-proto-ipv6/luasrc/model/network/proto_hnet.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								luci-proto-ipv6/luasrc/model/network/proto_hnet.lua
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
-- Copyright 2014 Steven Barth <steven@midlink.org>
 | 
			
		||||
-- Licensed to the public under the Apache License 2.0.
 | 
			
		||||
 | 
			
		||||
local proto = luci.model.network:register_protocol("hnet")
 | 
			
		||||
 | 
			
		||||
function proto.get_i18n(self)
 | 
			
		||||
	return luci.i18n.translate("Automatic Homenet (HNCP)")
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function proto.is_installed(self)
 | 
			
		||||
	return nixio.fs.access("/lib/netifd/proto/hnet.sh")
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function proto.opkg_package(self)
 | 
			
		||||
	return "hnet-full"
 | 
			
		||||
end
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue