mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add MLVPN interface
This commit is contained in:
parent
8d5452c810
commit
c9a0334afe
7 changed files with 121 additions and 12 deletions
|
@ -5,6 +5,6 @@ config mlvpn 'general'
|
|||
option reorder_buffer_size '64'
|
||||
option loss_tolerence '50'
|
||||
option mode 'client'
|
||||
option remotehost '128.128.128.128'
|
||||
option firstremoteport '65201'
|
||||
option host '128.128.128.128'
|
||||
option firstport '65201'
|
||||
option interface_name 'mlvpn0'
|
||||
|
|
|
@ -12,28 +12,28 @@ validate_section() {
|
|||
'reorder_buffer_size:uinteger:64' \
|
||||
'loss_tolerence:uinteger:30' \
|
||||
'interface_name:string:mlvpn0' \
|
||||
'remotehost:host' \
|
||||
'firstremoteport:port:65201'
|
||||
'host:host' \
|
||||
'firstport:port'
|
||||
}
|
||||
|
||||
interface_settings() {
|
||||
local mode
|
||||
interface_multipath_settings() {
|
||||
local mode port
|
||||
local config="$1"
|
||||
id=$(($id+1))
|
||||
config_get mode "$config" multipath "off"
|
||||
[ "$mode" = "off" ] && return 1
|
||||
count=$(($count+1))
|
||||
port=$((firstremoteport+count))
|
||||
port=$((firstport+count))
|
||||
cat >> /tmp/etc/${interface_name}.conf <<-EOF
|
||||
|
||||
[${id}]
|
||||
remotehost = "${remotehost}"
|
||||
remotehost = "${host}"
|
||||
remoteport = "${port}"
|
||||
EOF
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enable timeout mode password reorder_buffer_size interface_name remotehost firstremoteport loss_tolerence
|
||||
local enable timeout mode password reorder_buffer_size interface_name host firstport loss_tolerence
|
||||
validate_section "general" || {
|
||||
_err "validation failed"
|
||||
return 1
|
||||
|
@ -55,9 +55,10 @@ start_service() {
|
|||
loss_tolerence = ${loss_tolerence}
|
||||
password = "${password}"
|
||||
EOF
|
||||
|
||||
local count=0 id=0
|
||||
config_load network
|
||||
config_foreach interface_settings interface
|
||||
config_foreach interface_multipath_settings interface
|
||||
|
||||
chmod 0600 "/tmp/etc/${interface_name}.conf"
|
||||
procd_open_instance
|
||||
|
|
|
@ -21,9 +21,9 @@ if [ "$(uci -q get network.omrvpn)" = "" ] && [ "$(uci -q get network.mlvpn)" =
|
|||
EOF
|
||||
fi
|
||||
|
||||
if [ "$(uci get firewall.@zone[2].network | grep omrvpn)" = "" ] && [ "$(uci get firewall.@zone[2].network | grep mlvpn)" = "" ]; then
|
||||
if [ "$(uci get firewall.zone_vpn.network | grep omrvpn)" = "" ] && [ "$(uci get firewall.zone_vpn.network | grep mlvpn)" = "" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
add_list firewall.@zone[2].network='mlvpn'
|
||||
add_list firewall.zone_vpn.network='mlvpn'
|
||||
EOF
|
||||
fi
|
||||
rm -f /tmp/luci-indexcache
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue