diff --git a/mptcp/files/usr/share/omr/post-tracking.d/post-tracking b/mptcp/files/usr/share/omr/post-tracking.d/post-tracking index e2467a66f..72ea623eb 100755 --- a/mptcp/files/usr/share/omr/post-tracking.d/post-tracking +++ b/mptcp/files/usr/share/omr/post-tracking.d/post-tracking @@ -124,8 +124,8 @@ set_server_all_routes() { routesintf="" config_load network config_foreach set_routes_intf interface - [ -n "$routesintf" ] && [ "$(echo $routesintf | grep $OMR_TRACKER_DEVICE_GATEWAY)" != "" ] && { - _log "Set server $server default route $serverip $routesintf" + [ -n "$routesintf" ] && [ "$(echo $routesintf | grep $OMR_TRACKER_DEVICE_GATEWAY | grep $OMR_TRACKER_DEVICE)" != "" ] && { + _log "Set server $server ($serverip) default route $serverip $routesintf" ip route replace $serverip scope global $routesintf } fi @@ -250,6 +250,15 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ]; then if [ -n "$OMR_TRACKER_DEVICE_IP" ]; then glorytun-udp path $OMR_TRACKER_DEVICE_IP dev tun0 down > /dev/null 2>&1 fi + if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" = "1" ]; then + VPN_BASE_INTF="$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.baseintf)" + VPN_BASE_INTF_IP=$(ubus call network.interface.$VPN_BASE_INTF status | jsonfilter -e '@["ipv4-address"][0].address' | tr -d "\n") + uci -q batch <<-EOF >/dev/null + set openvpn.$VPN_BASE_INTF.local=$VPN_BASE_INTF_IP + commit openvpn + EOF + /etc/init.d/openvpn restart $VPN_BASE_INTF + fi config_load openmptcprouter config_foreach del_server_route server #if [ "$(uci -q get openmptcprouter.settings.master)" = "balancing" ]; then @@ -473,28 +482,28 @@ if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($( fi [ -n "$ipaddr" ] && { # Check if we can get a IPv6 address, if yes enable RA else disable - local check_ipv6_website="$(uci -q get openmptcprouter.settings.check_ipv6_website)" - [ -z "$check_ipv6_website" ] && check_ipv6_website="http://ipv6.openmptcprouter.com/" - local ip6addr="$(curl -s -6 -m 2 $check_ipv6_website)" - [ -z "$ip6addr" ] && { - local ip6addr="$(curl -s -6 -m 2 http://ifconfig.co/)" - } - if [ "$(uci -q get openmptcprouter.settings.ipv6_disable)" = "0" ]; then - if [ -n "$ip6addr" ] && [ "$(uci -q get dhcp.lan.ra_default)" != 1 ]; then - _log "Enable IPv6 RA" - uci -q set dhcp.lan.ra=server - uci -q set dhcp.lan.ra_default=1 - uci -q set dhcp.lan.dhcpv6=server - /etc/init.d/odhcpd start > /dev/null 2>&1 - /etc/init.d/odhcpd enable > /dev/null 2>&1 - elif [ -z "$ip6addr" ] && [ "$(uci -q set dhcp.lan.ra_default)" = 1 ]; then - _log "Disable IPv6 RA" - uci -q delete dhcp.lan.ra - uci -q delete dhcp.lan.dhcpv6 - /etc/init.d/odhcpd start > /dev/null 2>&1 - /etc/init.d/odhcpd enable > /dev/null 2>&1 - fi - fi + #local check_ipv6_website="$(uci -q get openmptcprouter.settings.check_ipv6_website)" + #[ -z "$check_ipv6_website" ] && check_ipv6_website="http://ipv6.openmptcprouter.com/" + #local ip6addr="$(curl -s -6 -m 2 $check_ipv6_website)" + #[ -z "$ip6addr" ] && { + # local ip6addr="$(curl -s -6 -m 2 http://ifconfig.co/)" + #} + #if [ "$(uci -q get openmptcprouter.settings.ipv6_disable)" = "0" ]; then + # if [ -n "$ip6addr" ] && [ "$(uci -q get dhcp.lan.ra_default)" != 1 ]; then + # _log "Enable IPv6 RA" + # uci -q set dhcp.lan.ra=server + # uci -q set dhcp.lan.ra_default=1 + # uci -q set dhcp.lan.dhcpv6=server + # /etc/init.d/odhcpd start > /dev/null 2>&1 + # /etc/init.d/odhcpd enable > /dev/null 2>&1 + # elif [ -z "$ip6addr" ] && [ "$(uci -q set dhcp.lan.ra_default)" = 1 ]; then + # _log "Disable IPv6 RA" + # uci -q delete dhcp.lan.ra + # uci -q delete dhcp.lan.dhcpv6 + # /etc/init.d/odhcpd start > /dev/null 2>&1 + # /etc/init.d/odhcpd enable > /dev/null 2>&1 + # fi + #fi if [ "$(uci -q get openmptcprouter.settings.external_check)" != "0" ]; then local asn="$(wget -4 -qO- -T 4 http://api.iptoasn.com/v1/as/ip/$ipaddr | jsonfilter -q -e '@.as_description')" [ -z "$asn" ] && {