Fix the removal of dns entries.

When switching default networks we should erase any excess dns server entries.  The old code
used the wrong index and didn't erase all of them properly.

Found in conjunction with
bug: 2077628
This commit is contained in:
Robert Greenwalt
2009-08-25 14:00:10 -07:00
parent dbade9d6a0
commit b06324a5c1

View File

@@ -1111,11 +1111,13 @@ public class ConnectivityService extends IConnectivityManager.Stub {
int j = 1;
for (String dns : dnsList) {
if (dns != null && !TextUtils.equals(dns, "0.0.0.0")) {
if (DBG) Log.d(TAG, " adding "+dns);
SystemProperties.set("net.dns" + j++, dns);
}
}
for (int k=j ; k<mNumDnsEntries; k++) {
SystemProperties.set("net.dns" + j, "");
if (DBG) Log.d(TAG, "erasing net.dns" + k);
SystemProperties.set("net.dns" + k, "");
}
mNumDnsEntries = j;
} else {