Loading core/java/android/net/NetworkStateTracker.java +16 −8 Original line number Diff line number Diff line Loading @@ -123,8 +123,10 @@ public abstract class NetworkStateTracker extends Handler { } public void addPrivateDnsRoutes() { if (DBG) Log.d(TAG, "addPrivateDnsRoutes for " + this + if (DBG) { Log.d(TAG, "addPrivateDnsRoutes for " + this + "(" + mInterfaceName + ") - mPrivateDnsRouteSet = "+mPrivateDnsRouteSet); } if (mInterfaceName != null && !mPrivateDnsRouteSet) { for (String addrString : getNameServers()) { int addr = NetworkUtils.lookupHost(addrString); Loading @@ -138,30 +140,36 @@ public abstract class NetworkStateTracker extends Handler { } public void removePrivateDnsRoutes() { if (DBG) Log.d(TAG, "removePrivateDnsRoutes for " + this + "(" + mInterfaceName + ")"); // TODO - we should do this explicitly but the NetUtils api doesnt // support this yet - must remove all. No worse than before if (mInterfaceName != null && mPrivateDnsRouteSet) { if (DBG) { Log.d(TAG, "removePrivateDnsRoutes for " + mNetworkInfo.getTypeName() + " (" + mInterfaceName + ")"); } NetworkUtils.removeHostRoutes(mInterfaceName); mPrivateDnsRouteSet = false; } } public void addDefaultRoute() { if (DBG) Log.d(TAG, "addDefaultRoute for " + this + "(" + mInterfaceName + "), GatewayAddr=" + mDefaultGatewayAddr); if ((mInterfaceName != null) && (mDefaultGatewayAddr != 0) && mDefaultRouteSet == false) { if (DBG) { Log.d(TAG, "addDefaultRoute for " + mNetworkInfo.getTypeName() + " (" + mInterfaceName + "), GatewayAddr=" + mDefaultGatewayAddr); } NetworkUtils.setDefaultRoute(mInterfaceName, mDefaultGatewayAddr); mDefaultRouteSet = true; } } public void removeDefaultRoute() { if (DBG) Log.d(TAG, "removeDefaultRoute for " + this + "(" + mInterfaceName + ")"); if (mInterfaceName != null && mDefaultRouteSet == true) { if (DBG) { Log.d(TAG, "removeDefaultRoute for " + mNetworkInfo.getTypeName() + " (" + mInterfaceName + ")"); } NetworkUtils.removeDefaultRoute(mInterfaceName); mDefaultRouteSet = false; } Loading services/java/com/android/server/ConnectivityService.java +9 −8 Original line number Diff line number Diff line Loading @@ -765,8 +765,11 @@ public class ConnectivityService extends IConnectivityManager.Stub { */ private void handleDisconnect(NetworkInfo info) { if (DBG) Log.v(TAG, "Handle DISCONNECT for " + info.getTypeName()); int prevNetType = info.getType(); if (DBG) { Log.v(TAG, "Handle DISCONNECT for " + info.getTypeName() + (mNetAttributes[prevNetType].isDefault() ? ", a default network" : "")); } mNetTrackers[prevNetType].setTeardownRequested(false); /* Loading Loading @@ -806,7 +809,6 @@ public class ConnectivityService extends IConnectivityManager.Stub { */ NetworkStateTracker newNet = null; if (mNetAttributes[prevNetType].isDefault()) { if (DBG) Log.d(TAG, "disconnecting a default network"); if (mActiveDefaultNetwork == prevNetType) { mActiveDefaultNetwork = -1; } Loading Loading @@ -1051,7 +1053,6 @@ public class ConnectivityService extends IConnectivityManager.Stub { * table entries exist. */ private void handleConnectivityChange() { if (DBG) Log.d(TAG, "handleConnectivityChange"); /* * If a non-default network is enabled, add the host routes that * will allow it's DNS servers to be accessed. Only Loading Loading @@ -1147,21 +1148,21 @@ public class ConnectivityService extends IConnectivityManager.Stub { } private void handleDnsConfigurationChange() { if (DBG) Log.d(TAG, "handleDnsConfig Change"); // add default net's dns entries for (int x = mPriorityList.length-1; x>= 0; x--) { int netType = mPriorityList[x]; NetworkStateTracker nt = mNetTrackers[netType]; if (DBG) Log.d(TAG, " checking " + nt); if (nt != null && nt.getNetworkInfo().isConnected() && !nt.isTeardownRequested()) { if (DBG) Log.d(TAG, " connected"); String[] dnsList = nt.getNameServers(); if (mNetAttributes[netType].isDefault()) { int j = 1; for (String dns : dnsList) { if (dns != null && !TextUtils.equals(dns, "0.0.0.0")) { if (DBG) Log.d(TAG, " adding "+dns); if (DBG) { Log.d(TAG, "adding dns " + dns + " for " + nt.getNetworkInfo().getTypeName()); } SystemProperties.set("net.dns" + j++, dns); } } Loading Loading
core/java/android/net/NetworkStateTracker.java +16 −8 Original line number Diff line number Diff line Loading @@ -123,8 +123,10 @@ public abstract class NetworkStateTracker extends Handler { } public void addPrivateDnsRoutes() { if (DBG) Log.d(TAG, "addPrivateDnsRoutes for " + this + if (DBG) { Log.d(TAG, "addPrivateDnsRoutes for " + this + "(" + mInterfaceName + ") - mPrivateDnsRouteSet = "+mPrivateDnsRouteSet); } if (mInterfaceName != null && !mPrivateDnsRouteSet) { for (String addrString : getNameServers()) { int addr = NetworkUtils.lookupHost(addrString); Loading @@ -138,30 +140,36 @@ public abstract class NetworkStateTracker extends Handler { } public void removePrivateDnsRoutes() { if (DBG) Log.d(TAG, "removePrivateDnsRoutes for " + this + "(" + mInterfaceName + ")"); // TODO - we should do this explicitly but the NetUtils api doesnt // support this yet - must remove all. No worse than before if (mInterfaceName != null && mPrivateDnsRouteSet) { if (DBG) { Log.d(TAG, "removePrivateDnsRoutes for " + mNetworkInfo.getTypeName() + " (" + mInterfaceName + ")"); } NetworkUtils.removeHostRoutes(mInterfaceName); mPrivateDnsRouteSet = false; } } public void addDefaultRoute() { if (DBG) Log.d(TAG, "addDefaultRoute for " + this + "(" + mInterfaceName + "), GatewayAddr=" + mDefaultGatewayAddr); if ((mInterfaceName != null) && (mDefaultGatewayAddr != 0) && mDefaultRouteSet == false) { if (DBG) { Log.d(TAG, "addDefaultRoute for " + mNetworkInfo.getTypeName() + " (" + mInterfaceName + "), GatewayAddr=" + mDefaultGatewayAddr); } NetworkUtils.setDefaultRoute(mInterfaceName, mDefaultGatewayAddr); mDefaultRouteSet = true; } } public void removeDefaultRoute() { if (DBG) Log.d(TAG, "removeDefaultRoute for " + this + "(" + mInterfaceName + ")"); if (mInterfaceName != null && mDefaultRouteSet == true) { if (DBG) { Log.d(TAG, "removeDefaultRoute for " + mNetworkInfo.getTypeName() + " (" + mInterfaceName + ")"); } NetworkUtils.removeDefaultRoute(mInterfaceName); mDefaultRouteSet = false; } Loading
services/java/com/android/server/ConnectivityService.java +9 −8 Original line number Diff line number Diff line Loading @@ -765,8 +765,11 @@ public class ConnectivityService extends IConnectivityManager.Stub { */ private void handleDisconnect(NetworkInfo info) { if (DBG) Log.v(TAG, "Handle DISCONNECT for " + info.getTypeName()); int prevNetType = info.getType(); if (DBG) { Log.v(TAG, "Handle DISCONNECT for " + info.getTypeName() + (mNetAttributes[prevNetType].isDefault() ? ", a default network" : "")); } mNetTrackers[prevNetType].setTeardownRequested(false); /* Loading Loading @@ -806,7 +809,6 @@ public class ConnectivityService extends IConnectivityManager.Stub { */ NetworkStateTracker newNet = null; if (mNetAttributes[prevNetType].isDefault()) { if (DBG) Log.d(TAG, "disconnecting a default network"); if (mActiveDefaultNetwork == prevNetType) { mActiveDefaultNetwork = -1; } Loading Loading @@ -1051,7 +1053,6 @@ public class ConnectivityService extends IConnectivityManager.Stub { * table entries exist. */ private void handleConnectivityChange() { if (DBG) Log.d(TAG, "handleConnectivityChange"); /* * If a non-default network is enabled, add the host routes that * will allow it's DNS servers to be accessed. Only Loading Loading @@ -1147,21 +1148,21 @@ public class ConnectivityService extends IConnectivityManager.Stub { } private void handleDnsConfigurationChange() { if (DBG) Log.d(TAG, "handleDnsConfig Change"); // add default net's dns entries for (int x = mPriorityList.length-1; x>= 0; x--) { int netType = mPriorityList[x]; NetworkStateTracker nt = mNetTrackers[netType]; if (DBG) Log.d(TAG, " checking " + nt); if (nt != null && nt.getNetworkInfo().isConnected() && !nt.isTeardownRequested()) { if (DBG) Log.d(TAG, " connected"); String[] dnsList = nt.getNameServers(); if (mNetAttributes[netType].isDefault()) { int j = 1; for (String dns : dnsList) { if (dns != null && !TextUtils.equals(dns, "0.0.0.0")) { if (DBG) Log.d(TAG, " adding "+dns); if (DBG) { Log.d(TAG, "adding dns " + dns + " for " + nt.getNetworkInfo().getTypeName()); } SystemProperties.set("net.dns" + j++, dns); } } Loading