Add negotiated DNS servers to VPN config
This change plumbs the DNS servers through from the
IkeSessionConfiguration. Previously the getInternalDnsServer() was not
implemented.
Bug: 152242520
Test: FrameworksNetTests passing
Change-Id: Icd80b3688de2a39e222a4501787f8c54951c2ba0
Merged-In: Icd80b3688de2a39e222a4501787f8c54951c2ba0
(cherry picked from commit bd2763d977)
This commit is contained in:
@@ -2248,12 +2248,16 @@ public class Vpn {
|
||||
final String interfaceName = mTunnelIface.getInterfaceName();
|
||||
final int maxMtu = mProfile.getMaxMtu();
|
||||
final List<LinkAddress> internalAddresses = childConfig.getInternalAddresses();
|
||||
final List<String> dnsAddrStrings = new ArrayList<>();
|
||||
|
||||
final Collection<RouteInfo> newRoutes = VpnIkev2Utils.getRoutesFromTrafficSelectors(
|
||||
childConfig.getOutboundTrafficSelectors());
|
||||
for (final LinkAddress address : internalAddresses) {
|
||||
mTunnelIface.addAddress(address.getAddress(), address.getPrefixLength());
|
||||
}
|
||||
for (InetAddress addr : childConfig.getInternalDnsServers()) {
|
||||
dnsAddrStrings.add(addr.getHostAddress());
|
||||
}
|
||||
|
||||
final NetworkAgent networkAgent;
|
||||
final LinkProperties lp;
|
||||
@@ -2269,7 +2273,9 @@ public class Vpn {
|
||||
mConfig.routes.clear();
|
||||
mConfig.routes.addAll(newRoutes);
|
||||
|
||||
// TODO: Add DNS servers from negotiation
|
||||
if (mConfig.dnsServers == null) mConfig.dnsServers = new ArrayList<>();
|
||||
mConfig.dnsServers.clear();
|
||||
mConfig.dnsServers.addAll(dnsAddrStrings);
|
||||
|
||||
networkAgent = mNetworkAgent;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user