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

Commit 262853bf authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
Browse files

Merge "Vpn: Setup routes." into cm-11.0

parents 9b9df54c 93f9ebe4
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -367,6 +367,16 @@ public class Vpn extends BaseNetworkStateTracker {
            if (jniSetAddresses(interfaze, builder.toString()) < 1) {
                throw new IllegalArgumentException("At least one address must be specified");
            }

            if (config.routes != null) {
                builder = new StringBuilder();
                for (RouteInfo route : config.routes) {
                    String[] split = route.toString().split("->");
                    builder.append(" " + split[0].trim());
                }
                jniSetRoutes(interfaze, builder.toString());
            }

            Connection connection = new Connection();
            if (!mContext.bindServiceAsUser(intent, connection, Context.BIND_AUTO_CREATE,
                        new UserHandle(mUserId))) {
@@ -1096,6 +1106,13 @@ public class Vpn extends BaseNetworkStateTracker {
                }

                // Set the routes.
                StringBuilder builder = new StringBuilder();
                for (RouteInfo route : mConfig.routes) {
                    String[] split = route.toString().split("->");
                    builder.append(" " + split[0].trim());
                }
                jniSetRoutes(mConfig.interfaze, builder.toString());

                long token = Binder.clearCallingIdentity();
                try {
                    mCallback.setMarkedForwarding(mConfig.interfaze);