Commit d68d64f0 authored by Max Lv's avatar Max Lv

fix an issue

parent 765bf837
...@@ -274,18 +274,25 @@ class ShadowVpnService extends VpnService { ...@@ -274,18 +274,25 @@ class ShadowVpnService extends VpnService {
}) })
} else { } else {
for (i <- 1 to 254) { for (i <- 1 to 254) {
if (i != 26 && i != 127) {
val addr = i.toString + ".0.0.0" val addr = i.toString + ".0.0.0"
val cidr = addr + "/8" val cidr = addr + "/8"
val net = new SubnetUtils(cidr).getInfo val net = new SubnetUtils(cidr).getInfo
if (!net.isInRange(proxy_address)) { if (!net.isInRange(proxy_address)) {
if (!InetAddress.getByName(addr).isSiteLocalAddress) builder.addRoute(addr, 8) if (!InetAddress.getByName(addr).isSiteLocalAddress) {
builder.addRoute(addr, 8)
}
} else { } else {
for (j <- 0 to 255) { for (j <- 0 to 255) {
val addr = i.toString + "." + j.toString + ".0.0" val subAddr = i.toString + "." + j.toString + ".0.0"
val cidr = addr + "/16" val subCidr = subAddr + "/16"
val net = new SubnetUtils(cidr).getInfo val subNet = new SubnetUtils(subCidr).getInfo
if (!net.isInRange(proxy_address)) { if (!subNet.isInRange(proxy_address)) {
if (!InetAddress.getByName(addr).isSiteLocalAddress) builder.addRoute(addr, 16) if (!InetAddress.getByName(subAddr).isSiteLocalAddress) {
builder.addRoute(subAddr, 16)
}
}
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment