Commit Graph
9551 Commits
Author SHA1 Message Date
Tobias Brunner bebe2d397e Keep reporting the error until the user dismisses it
Even when the Activity is closed and later reopened.
2012-08-13 11:18:52 +02:00
Tobias Brunner 264dd8d372 Show an error dialog when errors occur while establishing the VPN 2012-08-13 11:18:51 +02:00
Tobias Brunner 8062f973e1 Show a button to disconnect the VPN once it is established 2012-08-13 11:18:51 +02:00
Tobias Brunner a43bdf9a37 Show current VPN state and profile name
Show modal dialogs while connecting and disconnecting the VPN.
2012-08-13 11:18:51 +02:00
Tobias Brunner e7908526fd Add a fragment to MainActivity which will display the current VPN state
The fragment is bound to the VpnStateService and registered as listener.
2012-08-13 11:18:51 +02:00
Tobias Brunner 9d0f8a3a95 Use a separate (volatile) variable for certificate alias
If a connection is started while certificates are still loading and the
initiation is then canceled a deadlock could result if the daemon is
trying to enumerate the certificates just then.
2012-08-13 11:18:23 +02:00
Tobias Brunner a39a301a12 Don't set the source address on Android 2012-08-13 11:11:37 +02:00
Tobias Brunner 644db4d7c5 Close IKE_SA on Android immediately if setting up CHILD_SA fails 2012-08-13 11:11:20 +02:00
Tobias Brunner 76e55491eb Reduce number of retransmits on Android 2012-08-13 11:09:34 +02:00
Tobias Brunner 2483f6a4e0 Job added which handles plain text packets read from TUN device 2012-08-13 11:09:34 +02:00
Tobias Brunner d9531100fa Added a handler that writes inbound plain text packets to the TUN device 2012-08-13 11:09:34 +02:00
Tobias Brunner 3b3cf0c87a Add simple callbacks to receive/send ESP packets via libipsec/receiver. 2012-08-13 11:09:34 +02:00
Tobias Brunner 30ba2ff777 Add routes based on the installed IPsec policies to the TUN device builder 2012-08-13 11:09:34 +02:00
Tobias Brunner 62e6630b24 Add virtual IP to the TUN device builder
After the CHILD_SA is established we can easily get this address from
the IKE_SA.
2012-08-13 11:09:34 +02:00
Tobias Brunner a2993d7243 Create a TUN device via VpnService.Builder once the CHILD_SA is established 2012-08-13 11:09:34 +02:00
Tobias Brunner 3a05756b42 An Android specific attribute handler installs DNS servers via Builder 2012-08-13 11:09:33 +02:00
Tobias Brunner ae4f1ea180 Native counterpart of VpnService.Builder added, exposed by charonservice 2012-08-13 11:09:33 +02:00
Tobias Brunner 5215d512bf Adapter class added around VpnService.Builder which allows to access it via JNI 2012-08-13 11:00:29 +02:00
Tobias Brunner f12b3ad2c9 Don't print hosts as %any if %+H is used
That is, the plus sign can be used in the format string to force a numeric
string representation of all host_t objects even 0.0.0.0 and :: which
would otherwise be printed as %any and %any6.
2012-08-13 11:00:29 +02:00
Tobias Brunner 495e12aead Add support for '+' in custom format specifiers 2012-08-13 11:00:28 +02:00
Tobias Brunner c6c39c783b Initiate an SA via native JNI method 2012-08-13 11:00:28 +02:00
Tobias Brunner dffee9e2b0 Helper function added that retrieves a local IP address 2012-08-13 11:00:28 +02:00
Tobias Brunner 66211196a7 android_service_t handles initiation of an SA and tracks its progress
Status updates are delivered via charonservice (JNI).
2012-08-13 11:00:28 +02:00
Tobias Brunner 3aa5c609c3 Android specific credential set also provides user credentials 2012-08-13 11:00:28 +02:00
Tobias Brunner 8430e54d83 Added an Android specific credential set that provides CA certificates via JNI 2012-08-13 11:00:28 +02:00
Tobias Brunner 2bec193a1b CharonVpnService provides a function to get trusted certificates via JNI 2012-08-13 11:00:28 +02:00
Tobias Brunner 8c2af60ceb Function added that allows to update VPN state via JNI 2012-08-13 11:00:28 +02:00
Tobias Brunner 1b8877727c Add a function to disconnect any current VPN connection 2012-08-13 11:00:27 +02:00
Tobias Brunner d4f7675199 Implement kernel_ipsec_t.bypass_socket() via JNI and VpnService.protect() 2012-08-13 11:00:27 +02:00
Tobias Brunner 03de55ad98 CharonVpnService binds to VpnStateService and does basic state updates 2012-08-13 11:00:27 +02:00
Tobias Brunner a4f9028e08 CharonVpnService reacts on Intents and properly inits/deinits charon
Charon is initialized with every new connection attempt and
deinitialized when the service is terminated or it receives an empty
Intent (or before starting a new connection).

A separate thread is used to handle the connection attempts, this thread
acts as main thread for charon.
2012-08-13 11:00:27 +02:00
Tobias Brunner d1220566ef Service added that keeps track of VPN state and notifies listeners about changes
It is ensured that listeners are notified only from the main thread.
2012-08-13 11:00:27 +02:00
Tobias Brunner 175088517f Add an Android specific kernel_ipsec_t implementation
This is pretty much a proxy class that delegates everything (that is
currently supported) to libipsec.
2012-08-13 11:00:27 +02:00
Tobias Brunner 24447cf49f Add an Android specific kernel_net_t implementation
This currently provides only no-ops and is just added because a
kernel-net implementation is required and kernel-netlink can't be used
at the moment.
2012-08-13 11:00:27 +02:00
Tobias Brunner 6e04147743 Clone the current VPN profile before updating the password
Storing the password on the original object would be problematic in case
the user mistypes the password (no prompt would be shown the second time).

An alternative would be to just return the ID of the selected profile
and then fetch it from the database.
2012-08-13 11:00:26 +02:00
Tobias Brunner 8d4eea5325 Allow VpnProfile objects to be cloned 2012-08-13 11:00:26 +02:00
Tobias Brunner b1340aa129 Prompt the user for a password if none is configured in the VPN profile 2012-08-13 11:00:26 +02:00
Tobias Brunner fcb5448017 Allow selection of a CA certificate for a VPN profile
This solution is just temporary as it really is not that user-friendly
to select CA certificates with a Spinner widget.
2012-08-13 11:00:26 +02:00
Tobias Brunner 8db37772f5 Simplified asynchronous loading of CA certificates in MainActivity 2012-08-13 11:00:26 +02:00
Tobias Brunner b21979f12f Added simple adapter for trusted certificates (to be used with a Spinner widget) 2012-08-13 11:00:26 +02:00
Tobias Brunner 529c8c88a3 Keep a global reference to the CharonVpnService object in charonservice 2012-08-13 11:00:26 +02:00
Tobias Brunner a304874319 Add signal handler for fatal signals to libandroidbridge 2012-08-13 11:00:26 +02:00
Tobias Brunner d200749424 Set default log level in libandroidbridge 2012-08-13 11:00:25 +02:00
Tobias Brunner 6316b50280 Renamed main Activity (shorter name in Launcher) 2012-08-13 11:00:25 +02:00
Tobias Brunner 0b362ed837 MainActivity starts CharonVpnService if a VpnProfile is clicked in the list
This is done by implementing the OnVpnProfileSelectedListener interface
provided by VpnProfileListFragment.
2012-08-13 11:00:25 +02:00
Tobias Brunner c8b942a1e2 Menu option added to reload cached CA certificates
This might be required if the user installs a new CA certificate.
2012-08-13 11:00:25 +02:00
Tobias Brunner 9756cf22f2 Show progress bar in ActionBar while loading cached CA certificates 2012-08-13 11:00:25 +02:00
Tobias Brunner 19567a5e3a Helper function added to handle Java exceptions in native code 2012-08-13 11:00:25 +02:00
Tobias Brunner 95e9a12c28 Don't attach to actual Java threads (or already attached ones)
We check this by trying to retrieve a JNIEnv object from the JVM,
if one is returned the current thread is not native (created from Java)
or the thread is already attached.
2012-08-13 11:00:25 +02:00
Tobias Brunner 5afb1e3c45 Initially load CA certificates when the main Activity is created 2012-08-13 11:00:24 +02:00