mirror of https://github.com/ospab/ostp.git
Fix Windows TUN routing loop for SIM modems (0.0.0.0 NextHop)
This commit is contained in:
parent
5fa957830c
commit
36ef6f2d04
|
|
@ -58,8 +58,11 @@ pub async fn run_native_tunnel(
|
||||||
if ($route) {{\n\
|
if ($route) {{\n\
|
||||||
$gw = $route.NextHop\n\
|
$gw = $route.NextHop\n\
|
||||||
$ifIndex = $route.InterfaceIndex\n\
|
$ifIndex = $route.InterfaceIndex\n\
|
||||||
# Route server IP and gateway directly via real interface (bypass TUN)\n\
|
if ($gw -eq '0.0.0.0' -or $gw -eq '::') {{\n\
|
||||||
|
New-NetRoute -DestinationPrefix \"$remote_ip/32\" -InterfaceIndex $ifIndex -RouteMetric 1 -ErrorAction SilentlyContinue\n\
|
||||||
|
}} else {{\n\
|
||||||
New-NetRoute -DestinationPrefix \"$remote_ip/32\" -NextHop $gw -InterfaceIndex $ifIndex -RouteMetric 1 -ErrorAction SilentlyContinue\n\
|
New-NetRoute -DestinationPrefix \"$remote_ip/32\" -NextHop $gw -InterfaceIndex $ifIndex -RouteMetric 1 -ErrorAction SilentlyContinue\n\
|
||||||
|
}}\n\
|
||||||
if ($gw -ne '0.0.0.0') {{\n\
|
if ($gw -ne '0.0.0.0') {{\n\
|
||||||
New-NetRoute -DestinationPrefix \"$gw/32\" -NextHop '0.0.0.0' -InterfaceIndex $ifIndex -RouteMetric 1 -ErrorAction SilentlyContinue\n\
|
New-NetRoute -DestinationPrefix \"$gw/32\" -NextHop '0.0.0.0' -InterfaceIndex $ifIndex -RouteMetric 1 -ErrorAction SilentlyContinue\n\
|
||||||
}}\n\
|
}}\n\
|
||||||
|
|
|
||||||
|
|
@ -93,8 +93,12 @@ pub async fn run_wintun_tunnel(
|
||||||
if ($route) {{\n\
|
if ($route) {{\n\
|
||||||
$gw = $route.NextHop\n\
|
$gw = $route.NextHop\n\
|
||||||
$ifIndex = $route.InterfaceIndex\n\
|
$ifIndex = $route.InterfaceIndex\n\
|
||||||
|
if ($gw -eq '0.0.0.0' -or $gw -eq '::') {{\n\
|
||||||
|
New-NetRoute -DestinationPrefix \"$remote_ip/32\" -InterfaceIndex $ifIndex -RouteMetric 1 -ErrorAction SilentlyContinue\n\
|
||||||
|
}} else {{\n\
|
||||||
New-NetRoute -DestinationPrefix \"$remote_ip/32\" -NextHop $gw -InterfaceIndex $ifIndex -RouteMetric 1 -ErrorAction SilentlyContinue\n\
|
New-NetRoute -DestinationPrefix \"$remote_ip/32\" -NextHop $gw -InterfaceIndex $ifIndex -RouteMetric 1 -ErrorAction SilentlyContinue\n\
|
||||||
}}\n\
|
}}\n\
|
||||||
|
}}\n\
|
||||||
New-NetFirewallRule -DisplayName 'OSTP Tunnel In' -Direction Inbound -Program $exe_path -Action Allow -Enabled True -ErrorAction SilentlyContinue\n\
|
New-NetFirewallRule -DisplayName 'OSTP Tunnel In' -Direction Inbound -Program $exe_path -Action Allow -Enabled True -ErrorAction SilentlyContinue\n\
|
||||||
New-NetFirewallRule -DisplayName 'OSTP Tunnel Out' -Direction Outbound -Program $exe_path -Action Allow -Enabled True -ErrorAction SilentlyContinue\n",
|
New-NetFirewallRule -DisplayName 'OSTP Tunnel Out' -Direction Outbound -Program $exe_path -Action Allow -Enabled True -ErrorAction SilentlyContinue\n",
|
||||||
server_ip_str, current_exe
|
server_ip_str, current_exe
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue