diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/android/net/dhcp/DhcpClient.java | 14 | ||||
-rw-r--r-- | src/android/net/util/NetworkStackUtils.java | 3 | ||||
-rw-r--r-- | src/com/android/server/NetworkObserverRegistry.java | 5 |
3 files changed, 20 insertions, 2 deletions
diff --git a/src/android/net/dhcp/DhcpClient.java b/src/android/net/dhcp/DhcpClient.java index 64adc0d..be44519 100644 --- a/src/android/net/dhcp/DhcpClient.java +++ b/src/android/net/dhcp/DhcpClient.java @@ -45,6 +45,7 @@ import static com.android.server.util.NetworkStackConstants.IPV4_ADDR_ANY; import android.content.Context; import android.net.DhcpResults; +import android.net.InetAddresses; import android.net.TrafficStats; import android.net.ip.IpClient; import android.net.metrics.DhcpClientEvent; @@ -66,6 +67,7 @@ import com.android.internal.util.MessageUtils; import com.android.internal.util.State; import com.android.internal.util.StateMachine; import com.android.internal.util.WakeupMessage; +import com.android.networkstack.R; import java.io.FileDescriptor; import java.io.IOException; @@ -498,6 +500,18 @@ public class DhcpClient extends StateMachine { private void acceptDhcpResults(DhcpResults results, String msg) { mDhcpLease = results; + if (mDhcpLease.dnsServers.isEmpty()) { + // supplement customized dns servers + String[] dnsServersList = + mContext.getResources().getStringArray(R.array.config_default_dns_servers); + for (final String dnsServer : dnsServersList) { + try { + mDhcpLease.dnsServers.add(InetAddresses.parseNumericAddress(dnsServer)); + } catch (IllegalArgumentException e) { + Log.e(TAG, "Invalid default DNS server: " + dnsServer, e); + } + } + } mOffer = null; Log.d(TAG, msg + " lease: " + mDhcpLease); notifySuccess(); diff --git a/src/android/net/util/NetworkStackUtils.java b/src/android/net/util/NetworkStackUtils.java index fa8f65e..547f04d 100644 --- a/src/android/net/util/NetworkStackUtils.java +++ b/src/android/net/util/NetworkStackUtils.java @@ -94,8 +94,7 @@ public class NetworkStackUtils { * Look up the value of a property for a particular namespace from {@link DeviceConfig}. * @param namespace The namespace containing the property to look up. * @param name The name of the property to look up. - * @param defaultValue The value to return if the property does not exist or has no non-null - * value. + * @param defaultValue The value to return if the property does not exist or has no valid value. * @return the corresponding value, or defaultValue if none exists. */ @Nullable diff --git a/src/com/android/server/NetworkObserverRegistry.java b/src/com/android/server/NetworkObserverRegistry.java index 6fb4b0d..afe166b 100644 --- a/src/com/android/server/NetworkObserverRegistry.java +++ b/src/com/android/server/NetworkObserverRegistry.java @@ -181,4 +181,9 @@ public class NetworkObserverRegistry extends INetdUnsolicitedEventListener.Stub @Override public void onStrictCleartextDetected(int uid, String hex) {} + + @Override + public int getInterfaceVersion() { + return INetdUnsolicitedEventListener.VERSION; + } } |