Update LinkProperties treatment of gateways
A link can have multiple gateways (think ipv4/ipv6 for a trivial example). . bug:3438810 Change-Id: I28c90a6947cd50b82e5ca9a0113148f98b3f4dd8
This commit is contained in:
@@ -1414,13 +1414,13 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
LinkProperties p = nt.getLinkProperties();
|
||||
if (p == null) return;
|
||||
String interfaceName = p.getInterfaceName();
|
||||
InetAddress defaultGatewayAddr = p.getGateway();
|
||||
if (TextUtils.isEmpty(interfaceName)) return;
|
||||
for (InetAddress gateway : p.getGateways()) {
|
||||
|
||||
if ((interfaceName != null) && (defaultGatewayAddr != null )) {
|
||||
if (!NetworkUtils.addDefaultRoute(interfaceName, defaultGatewayAddr) && DBG) {
|
||||
if (!NetworkUtils.addDefaultRoute(interfaceName, gateway) && DBG) {
|
||||
NetworkInfo networkInfo = nt.getNetworkInfo();
|
||||
log("addDefaultRoute for " + networkInfo.getTypeName() +
|
||||
" (" + interfaceName + "), GatewayAddr=" + defaultGatewayAddr);
|
||||
" (" + interfaceName + "), GatewayAddr=" + gateway.getHostAddress());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user