1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Update glorytun init to use interface set

This commit is contained in:
Ycarus 2018-07-01 20:21:02 +02:00
parent 95385a77a7
commit 4c722c3e8a
2 changed files with 24 additions and 3 deletions

View file

@ -34,7 +34,7 @@ validate_section() {
}
start_instance() {
local enable key host port dev listener proto bind bindport mtu mtuauto chacha20
local enable key host port listener proto bind bindport mtu mtuauto chacha20 dev
validate_section "${1}" || {
_err "validation failed"
@ -53,7 +53,8 @@ start_instance() {
key=""
if [ "$(uci -q get network.omrvpn)" != "" ]; then
uci -q set network.omrvpn.ifname=tun0
uci -q set network.omrvpn.ifname=$dev
uci -q commit
fi
_log "starting ${PROG_NAME} ${1} instance $*"
@ -78,9 +79,28 @@ start_instance() {
procd_set_param stderr 1
procd_close_instance
#config_load network
#config_foreach add_glorytun_path interface
}
add_glorytun_path() {
case "$1" in
loopback|lan|if0|*tun*|ifb*) return ;;
esac
local multipath
network_get_ipaddr ipaddr "$1"
config_get multipath "$1" multipath "off"
case "$multipath" in
master|on) glorytun-udp path "$ipaddr" dev $dev up ;;
backup) glorytun-udp path "$ipaddr" dev $dev backup ;;
*) glorytun-udp path "$ipaddr" dev $dev down ;;
esac
}
start_service() {
local dev
config_load glorytun
config_foreach start_instance glorytun
}

View file

@ -50,7 +50,8 @@ start_instance() {
key=""
if [ "$(uci -q get network.omrvpn)" != "" ]; then
uci -q set network.omrvpn.ifname=tun0
uci -q set network.omrvpn.ifname=${dev}
uci -q commit network
fi
_log "starting ${PROG_NAME} ${1} instance $*"