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

Commit 93f9ebe4 authored by Brian Beloshapka's avatar Brian Beloshapka
Browse files

Vpn: Setup routes.

Change-Id: Ia00467fbc4324ca5f6dab6e0ff2609cd5de9a423
parent 6df4db04
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);