Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0d69de6 authored by Benedict Wong's avatar Benedict Wong Committed by Automerger Merge Worker
Browse files

Add negotiated DNS servers to VPN config am: 8b9538df am: d2102054 am:...

Add negotiated DNS servers to VPN config am: 8b9538df am: d2102054 am: 8602a7cd am: e578bf85

Change-Id: I3ab72c9cc30508b5e21649b2b990e7271b3a1f55
parents 65eecc16 e578bf85
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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;