Initiate an SA via native JNI method
[strongswan.git] / src / frontends / android / src / org / strongswan / android / logic / CharonVpnService.java
index 6b45465..54ca247 100644 (file)
@@ -194,6 +194,11 @@ public class CharonVpnService extends VpnService implements Runnable
 
                                                initializeCharon();
                                                Log.i(TAG, "charon started");
 
                                                initializeCharon();
                                                Log.i(TAG, "charon started");
+
+                                               String local_address = getLocalIPv4Address();
+                                               initiate(local_address != null ? local_address : "0.0.0.0",
+                                                                mCurrentProfile.getGateway(), mCurrentProfile.getUsername(),
+                                                                mCurrentProfile.getPassword());
                                        }
                                }
                                catch (InterruptedException ex)
                                        }
                                }
                                catch (InterruptedException ex)
@@ -404,6 +409,12 @@ public class CharonVpnService extends VpnService implements Runnable
        public native void deinitializeCharon();
 
        /**
        public native void deinitializeCharon();
 
        /**
+        * Initiate VPN, provided by libandroidbridge.so
+        */
+       public native void initiate(String local_address, String gateway,
+                                                               String username, String password);
+
+       /**
         * Helper function that retrieves a local IPv4 address.
         *
         * @return string representation of an IPv4 address, or null if none found
         * Helper function that retrieves a local IPv4 address.
         *
         * @return string representation of an IPv4 address, or null if none found