mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add MLVPN package
This commit is contained in:
parent
a20b172cd8
commit
cf95f2d836
5 changed files with 185 additions and 0 deletions
61
mlvpn/Makefile
Normal file
61
mlvpn/Makefile
Normal file
|
@ -0,0 +1,61 @@
|
|||
#
|
||||
# Copyright (C) 2017 Zhong Jianxin <azuwis@gmail.com>
|
||||
# Copyright (C) 2018 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mlvpn
|
||||
PKG_VERSION:=6f13423b
|
||||
#PKG_VERSION:=238ae265
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/zehome/MLVPN.git
|
||||
PKG_SOURCE_VERSION:=6f13423b8108f46edb9f230deee20e3741abe64c
|
||||
PKG_SOURCE_DATE:=2017-09-01
|
||||
#PKG_SOURCE_URL:=https://github.com/markfoodyburton/MLVPN.git
|
||||
#PKG_SOURCE_VERSION:=238ae26563740390f3e1eb0e2c83a7d0dc4e920f
|
||||
#PKG_SOURCE_DATE:=2018-05-31
|
||||
|
||||
PKG_LICENSE:=BSD-2-Clause
|
||||
PKG_MAINTAINER:=Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/mlvpn
|
||||
TITLE:=Multi-Link Virtual Public Network
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
URL:=https://zehome.github.io/MLVPN/
|
||||
SUBMENU:=VPN
|
||||
MENU:=1
|
||||
DEPENDS:=+kmod-tun +libev +libpcap +libsodium
|
||||
endef
|
||||
|
||||
define Package/mlvpn/description
|
||||
Multi-Link Virtual Public Network
|
||||
Bond your internet links to increase bandwidth (unlimited).
|
||||
Secure your internet connection by actively monitoring your links and removing the faulty ones, without loosing your TCP connections.
|
||||
Secure your internet connection to the aggregation server using strong cryptography.
|
||||
Scriptable automation and monitoring.
|
||||
endef
|
||||
|
||||
define Package/mlvpn/conffiles
|
||||
/etc/config/mlvpn
|
||||
endef
|
||||
|
||||
define Package/mlvpn/install
|
||||
$(INSTALL_DIR) $(1)
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/mlvpn $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,mlvpn))
|
10
mlvpn/files/etc/config/mlvpn
Normal file
10
mlvpn/files/etc/config/mlvpn
Normal file
|
@ -0,0 +1,10 @@
|
|||
config mlvpn 'general'
|
||||
option enable '0'
|
||||
option password '*****'
|
||||
option timeout '30'
|
||||
option reorder_buffer_size '64'
|
||||
option loss_tolerence '50'
|
||||
option mode 'client'
|
||||
option remotehost '128.128.128.128'
|
||||
option firstremoteport '65201'
|
||||
option interface_name 'mlvpn0'
|
73
mlvpn/files/etc/init.d/mlvpn
Executable file
73
mlvpn/files/etc/init.d/mlvpn
Executable file
|
@ -0,0 +1,73 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=88
|
||||
USE_PROCD=1
|
||||
|
||||
validate_section() {
|
||||
uci_validate_section mlvpn mlvpn ${1} \
|
||||
'enable:bool:0' \
|
||||
'timeout:uinteger:30' \
|
||||
'mode:string:client' \
|
||||
'password:string' \
|
||||
'reorder_buffer_size:uinteger:64' \
|
||||
'loss_tolerence:uinteger:30' \
|
||||
'interface_name:string:mlvpn0' \
|
||||
'remotehost:host' \
|
||||
'firstremoteport:port:65201'
|
||||
}
|
||||
|
||||
interface_settings() {
|
||||
local mode
|
||||
local config="$1"
|
||||
id=$(($id+1))
|
||||
config_get mode "$config" multipath "off"
|
||||
[ "$mode" = "off" ] && return 1
|
||||
count=$(($count+1))
|
||||
port=$((firstremoteport+count))
|
||||
cat >> /tmp/etc/${interface_name}.conf <<-EOF
|
||||
|
||||
[${id}]
|
||||
remotehost = "${remotehost}"
|
||||
remoteport = "${port}"
|
||||
EOF
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enable timeout mode password reorder_buffer_size interface_name remotehost firstremoteport loss_tolerence
|
||||
validate_section "general" || {
|
||||
_err "validation failed"
|
||||
return 1
|
||||
}
|
||||
|
||||
[ "${enable}" = "1" ] || return 1
|
||||
|
||||
if [ "$(uci -q get network.omrvpn)" != "" ]; then
|
||||
uci -q set network.omrvpn.ifname=mlvpn0
|
||||
fi
|
||||
|
||||
cat > /tmp/etc/${interface_name}.conf <<-EOF
|
||||
[general]
|
||||
tuntap = "tun"
|
||||
mode = "${mode}"
|
||||
interface_name = "${interface_name}"
|
||||
timeout = ${timeout}
|
||||
reorder_buffer_size = ${reorder_buffer_size}
|
||||
loss_tolerence = ${loss_tolerence}
|
||||
password = "${password}"
|
||||
EOF
|
||||
local count=0 id=0
|
||||
config_load network
|
||||
config_foreach interface_settings interface
|
||||
|
||||
chmod 0600 "/tmp/etc/${interface_name}.conf"
|
||||
procd_open_instance
|
||||
procd_set_param command /usr/sbin/mlvpn --config "/tmp/etc/${interface_name}.conf" --user nobody
|
||||
procd_set_param file "/tmp/etc/${interface_name}.conf"
|
||||
procd_set_param reload_signal SIGHUP
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger mlvpn network
|
||||
}
|
30
mlvpn/files/etc/uci-defaults/4100-mlvpn
Normal file
30
mlvpn/files/etc/uci-defaults/4100-mlvpn
Normal file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@mlvpn[-1]
|
||||
add ucitrack mlvpn
|
||||
set ucitrack.@mlvpn[-1].init=mlvpn
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
if [ "$(uci -q get network.omrvpn)" = "" ] && [ "$(uci -q get network.mlvpn)" = "" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete network.mlvpn=interface
|
||||
set network.mlvpn=interface
|
||||
set network.mlvpn.ifname=mlvpn0
|
||||
set network.mlvpn.proto=dhcp
|
||||
set network.mlvpn.ip4table=vpn
|
||||
set network.mlvpn.multipath=off
|
||||
set network.mlvpn.leasetime=12h
|
||||
set network.mlvpn.mtu=1440
|
||||
commit network
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ "$(uci get firewall.@zone[2].network | grep omrvpn)" = "" ] && [ "$(uci get firewall.@zone[2].network | grep mlvpn)" = "" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
add_list firewall.@zone[2].network='mlvpn'
|
||||
EOF
|
||||
fi
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
11
mlvpn/patches/010-musl-fix.patch
Normal file
11
mlvpn/patches/010-musl-fix.patch
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- a/src/privsep.c
|
||||
+++ b/src/privsep.c
|
||||
@@ -778,7 +778,7 @@ sig_got_chld(int sig)
|
||||
pid_t pid;
|
||||
|
||||
do {
|
||||
- pid = waitpid(WAIT_ANY, NULL, WNOHANG);
|
||||
+ pid = waitpid(-1, NULL, WNOHANG);
|
||||
if (pid == child_pid && cur_state < STATE_QUIT)
|
||||
cur_state = STATE_QUIT;
|
||||
} while (pid > 0 || (pid == -1 && errno == EINTR));
|
Loading…
Add table
Add a link
Reference in a new issue