diff options
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java | 6 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java b/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java index 9c8cf363..da53831b 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java +++ b/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java @@ -5,11 +5,13 @@ package de.blinkt.openvpn.core; +import android.annotation.TargetApi; import android.net.IpPrefix; +import android.os.Build; import androidx.annotation.NonNull; -import java.lang.reflect.Array; +import java.lang.annotation.Target; import java.math.BigInteger; import java.net.Inet4Address; import java.net.Inet6Address; @@ -132,6 +134,7 @@ public class NetworkSpace { } + @NonNull @Override public String toString() { //String in = included ? "+" : "-"; @@ -210,6 +213,7 @@ public class NetworkSpace { } + @TargetApi(Build.VERSION_CODES.TIRAMISU) public IpPrefix getPrefix() throws UnknownHostException { if (isV4){ /* add 0x01 00 00 00 00, so that all representations are 5 byte otherwise diff --git a/main/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java b/main/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java index 67cdb243..f104d3b0 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java +++ b/main/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java @@ -56,11 +56,7 @@ public class NetworkUtils { else ipaddress = new NetworkSpace.IpAddress(new CIDRIP(la.getAddress().getHostAddress(), la.getPrefixLength()), true); - try { - nets.add(ipaddress.getPrefix().toString()); - } catch (UnknownHostException ia) { - VpnStatus.logError("getLocalNetworks error: " + ipaddress + " " + ia.getLocalizedMessage()); - } + nets.add(ipaddress.toString()); } } } |