From 79555229c8dbddb8f97e0f0177a047d49e839a85 Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Fri, 15 Mar 2013 10:48:46 -0700 Subject: [PATCH 1/3] Don't update routes if Dhcp fails. bug:8377625 Change-Id: I11d2c29728078813bfb1245cc46e8cce2b307a2c --- core/jni/android_net_NetUtils.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/jni/android_net_NetUtils.cpp b/core/jni/android_net_NetUtils.cpp index f5f22b2d2a..faae11ec3b 100644 --- a/core/jni/android_net_NetUtils.cpp +++ b/core/jni/android_net_NetUtils.cpp @@ -136,6 +136,10 @@ static jboolean android_net_utils_runDhcpCommon(JNIEnv* env, jobject clazz, jstr result = ::dhcp_do_request(nameStr, ipaddr, gateway, &prefixLength, dns, server, &lease, vendorInfo, domains); } + if (result != 0) { + ALOGD("dhcp_do_request failed"); + } + env->ReleaseStringUTFChars(ifname, nameStr); if (result == 0) { env->CallVoidMethod(dhcpResults, dhcpResultsFieldIds.clear); From 189a9e0ae9552f69e27dec86a953ca42b332fb95 Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Thu, 23 May 2013 18:33:06 -0700 Subject: [PATCH 2/3] Use the old interface when resetting connections The new one is often null when disconnected, so using the new fails. In other situations, it's the connections on the old network we want to reset anyway, so the old code when it would work would also do the wrong thing (unless new iface == old iface). bug:9112928 Change-Id: I1fcae89cc3aa9d712e516e7c97cece0b89869bd9 --- services/java/com/android/server/ConnectivityService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 3e19094bba..37a8cb85c0 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -2261,9 +2261,8 @@ public class ConnectivityService extends IConnectivityManager.Stub { boolean resetDns = updateRoutes(newLp, curLp, mNetConfigs[netType].isDefault()); if (resetMask != 0 || resetDns) { - LinkProperties linkProperties = mNetTrackers[netType].getLinkProperties(); - if (linkProperties != null) { - for (String iface : linkProperties.getAllInterfaceNames()) { + if (curLp != null) { + for (String iface : curLp.getAllInterfaceNames()) { if (TextUtils.isEmpty(iface) == false) { if (resetMask != 0) { if (DBG) log("resetConnections(" + iface + ", " + resetMask + ")"); @@ -2285,6 +2284,8 @@ public class ConnectivityService extends IConnectivityManager.Stub { if (DBG) loge("Exception resetting dns cache: " + e); } } + } else { + loge("Can't reset connection for type "+netType); } } } From 3ef153324c06e826903f6d4171d8e435cfb3790c Mon Sep 17 00:00:00 2001 From: Wink Saville Date: Tue, 2 Jul 2013 10:55:14 -0700 Subject: [PATCH 3/3] Fix NPE if mobile is not supported in checkMobileProvisioning. Bug: 9664438 Change-Id: If0c4938956a80e8d6a21a968aa771d0d8f546b3c --- .../java/com/android/server/ConnectivityService.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 9e9253a0f3..e7dd3b79e3 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -3553,6 +3553,16 @@ public class ConnectivityService extends IConnectivityManager.Stub { timeOutMs = CheckMp.MAX_TIMEOUT_MS; } + // Check that mobile networks are supported + if (!isNetworkSupported(ConnectivityManager.TYPE_MOBILE) + || !isNetworkSupported(ConnectivityManager.TYPE_MOBILE_HIPRI)) { + log("checkMobileProvisioning: X no mobile network"); + if (resultReceiver != null) { + resultReceiver.send(ConnectivityManager.CMP_RESULT_CODE_NO_CONNECTION, null); + } + return timeOutMs; + } + final long token = Binder.clearCallingIdentity(); try { CheckMp checkMp = new CheckMp(mContext, this);