Also count link-local addresses as local

This commit is contained in:
Cameron Gutman 2017-12-27 22:41:21 -08:00
parent d833933aaa
commit cd06559c66

View File

@ -511,7 +511,8 @@ public class ComputerManagerService extends Service {
// This will tend to be wrong for IPv6 but falling back to // This will tend to be wrong for IPv6 but falling back to
// remote will be fine in that case. For IPv4, it should be // remote will be fine in that case. For IPv4, it should be
// pretty accurate due to NAT prevalence. // pretty accurate due to NAT prevalence.
return InetAddress.getByName(str).isSiteLocalAddress(); InetAddress addr = InetAddress.getByName(str);
return addr.isSiteLocalAddress() || addr.isLinkLocalAddress();
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
e.printStackTrace(); e.printStackTrace();
return false; return false;