|
21 | 21 | autoRefreshLocations: true, |
22 | 22 | autoConnectOnStartup: false, |
23 | 23 | autoReconnectOnDrop: false, |
24 | | - favoriteLocationIsos: [] |
| 24 | + favoriteLocationIsos: [], |
| 25 | + bypassMultiRouteCheck: false |
25 | 26 | }) |
26 | 27 |
|
27 | 28 | property string adguardBinary: defaults.adguardBinary |
|
34 | 35 | property bool autoConnectOnStartup: defaults.autoConnectOnStartup |
35 | 36 | property bool autoReconnectOnDrop: defaults.autoReconnectOnDrop |
36 | 37 | property var favoriteLocationIsos: defaults.favoriteLocationIsos |
| 38 | + property bool bypassMultiRouteCheck: defaults.bypassMultiRouteCheck |
37 | 39 | property bool startupAutoConnectAttempted: false |
38 | 40 | property bool suppressReconnectOnce: false |
39 | 41 |
|
@@ -159,6 +161,7 @@ Item { |
159 | 161 | autoConnectOnStartup = asBool(load("autoConnectOnStartup", defaults.autoConnectOnStartup), defaults.autoConnectOnStartup); |
160 | 162 | autoReconnectOnDrop = asBool(load("autoReconnectOnDrop", defaults.autoReconnectOnDrop), defaults.autoReconnectOnDrop); |
161 | 163 | favoriteLocationIsos = normalizeFavoriteLocationIsos(load("favoriteLocationIsos", defaults.favoriteLocationIsos)); |
| 164 | + bypassMultiRouteCheck = asBool(load("bypassMultiRouteCheck", defaults.bypassMultiRouteCheck), defaults.bypassMultiRouteCheck); |
162 | 165 |
|
163 | 166 | restartTimers(); |
164 | 167 | checkCliAvailability(); |
@@ -796,8 +799,10 @@ Item { |
796 | 799 | ;; |
797 | 800 | esac |
798 | 801 |
|
799 | | - if [ "${tunPreflightRequired ? "1" : "0"}" = "1" ] && command -v ip >/dev/null 2>&1; then |
800 | | - DEFAULT_ROUTE_COUNT="$(ip -o route show to default | wc -l | tr -d ' ')" |
| 802 | + if [ "${tunPreflightRequired ? "1" : "0"}" = "1" ] && [ "${bypassMultiRouteCheck ? "1" : "0"}" = "0" ] && command -v ip >/dev/null 2>&1; then |
| 803 | + _ROUTES="$(ip -o route show to default)" |
| 804 | + _MIN_MET="$(printf '%s\n' "$_ROUTES" | awk '{m="0"; for(i=1;i<=NF;i++){if($i=="metric"){m=$(i+1);break}}; print m+0}' | sort -n | head -1)" |
| 805 | + DEFAULT_ROUTE_COUNT="$(printf '%s\n' "$_ROUTES" | awk -v minm="$_MIN_MET" '{iface=""; m="0"; for(i=1;i<=NF;i++){if($i=="dev") iface=$(i+1); if($i=="metric") m=$(i+1)}; if(iface~/^(lo$|docker|veth|br-|virbr|dummy)/) next; if(m+0==minm+0) print}' | wc -l | tr -d ' ')" |
801 | 806 | if [ "\${DEFAULT_ROUTE_COUNT:-0}" -gt 1 ]; then |
802 | 807 | printf 'multi-default' |
803 | 808 | exit 44 |
|
0 commit comments