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

Commit a31929ff authored by Benedict Wong's avatar Benedict Wong Committed by Gerrit Code Review
Browse files

Merge "Add negotiated DNS servers to VPN config"

parents 35f668b1 bd2763d9
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;