mirror of
https://github.com/emanuele-f/PCAPdroid.git
synced 2026-06-05 21:04:28 +08:00
Fix IPv6 addresses rejected in Android 9 and below
Due to this bug, IPv6 could not be used for rules or in the intent-based API
This commit is contained in:
parent
a6d231bd25
commit
ddba6ae1a6
@ -1636,7 +1636,7 @@ public class Utils {
|
||||
|
||||
// from bouncycastle
|
||||
private static boolean isValidIPv6(String address) {
|
||||
if (address.length() == 0)
|
||||
if (address.isEmpty())
|
||||
return false;
|
||||
|
||||
char firstChar = address.charAt(0);
|
||||
@ -1712,10 +1712,8 @@ public class Utils {
|
||||
public static boolean validateIpAddress(String value) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||
return (InetAddresses.isNumericAddress(value));
|
||||
else {
|
||||
Matcher matcher = Patterns.IP_ADDRESS.matcher(value);
|
||||
return(matcher.matches());
|
||||
}
|
||||
else
|
||||
return validateIpv4Address(value) || isValidIPv6(value);
|
||||
}
|
||||
|
||||
public static boolean validateHostOrIp(String value) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user