diff --git a/glorytun-udp/init b/glorytun-udp/init index 8477bcebf..42259caa0 100755 --- a/glorytun-udp/init +++ b/glorytun-udp/init @@ -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 } diff --git a/glorytun/init b/glorytun/init index cbf6056f3..ab7e6933e 100755 --- a/glorytun/init +++ b/glorytun/init @@ -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 $*"