Tobias Brunner
efbb5e8c57
Ensure thread IDs always start with 1 even if the library is reused
...
Within the Android App the library stays loaded in memory and is just
initialized/deinitialized with each connection, the static thread
counter would continuously increase without this patch.
2012-08-13 11:28:08 +02:00
Tobias Brunner
1fcaa71291
Added a button to the error dialog that allows to view the log file
2012-08-13 11:28:08 +02:00
Tobias Brunner
fbacc6506c
Use major.minor.revision version numbers for Android application
2012-08-13 11:28:08 +02:00
Tobias Brunner
064f4f75c0
Only allow access to log file via explicitly created URIs
...
Since ContentProviders are public and permissions don't seem to work any
other application could access the log file. With this token system
only URIs we explicitly created can be accessed.
2012-08-13 11:27:55 +02:00
Tobias Brunner
6c54c10838
Menu option added that allows users to send the log file
2012-08-13 11:22:21 +02:00
Tobias Brunner
c3afe9d35b
Add ContentProvider to access log file from other applications
2012-08-13 11:22:21 +02:00
Tobias Brunner
ae10e8c458
Watch for changes to the log file so we can reopen it
...
If the log fragment is shown while the daemon starts (which is not the
case at the moment, but maybe later on tablets) the file reader would not
notice that the file got truncated. The same applies if the file is deleted
directly on the file system e.g. with adb shell.
2012-08-13 11:22:21 +02:00
Tobias Brunner
bad119c55a
Add an Activity that shows the log fragment
2012-08-13 11:22:20 +02:00
Tobias Brunner
f9a162a235
Add a fragment that can display charon's log file
...
It continuously reads from the log file in a separate thread while displayed.
2012-08-13 11:22:20 +02:00
Tobias Brunner
658ed96fce
Added special ScrollView with auto-scrolling feature
...
The ability to auto-scroll is disabled as soon as the user manually
scrolls around and re-enable when the user scrolls to the bottom.
2012-08-13 11:22:20 +02:00
Tobias Brunner
fe05f1f05c
Charon logs to a file in the App's data directory
2012-08-13 11:22:20 +02:00
Tobias Brunner
4308ce1cf7
Moved Java to C string conversion function to android_jni header file
2012-08-13 11:22:20 +02:00
Tobias Brunner
6db742e7e5
Log charon version and uname() output, split libcharon and charon initialization
2012-08-13 11:22:20 +02:00
Tobias Brunner
a7c8b166a1
Only call disconnect() from CharonVpnService if we are not already disconnecting
2012-08-13 11:22:20 +02:00
Tobias Brunner
496e096e7b
Load single certificates directly from the KeyStore if we cannot get the read lock
...
This helps when running in the emulator as loading the certificates
takes quite a while there. This way a configured CA certificates is loaded
directly without having to wait for all certificates being cached.
2012-08-13 11:22:19 +02:00
Tobias Brunner
c0fe43f002
Use colors from the Android color palette for the VPN status texts
2012-08-13 11:22:14 +02:00
Tobias Brunner
374f62535f
Localized title for contextual action bar
2012-08-13 11:18:52 +02:00
Tobias Brunner
05427857e2
German translation added
2012-08-13 11:18:52 +02:00
Tobias Brunner
9c0be3ac69
Show MainActiviy if the user clicks 'Configure' in Android's VPN dialog
2012-08-13 11:18:52 +02:00
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
Tobias Brunner
a305419b40
Trusted CA certificates are loaded and cached by a static singleton
2012-08-13 11:00:24 +02:00
Tobias Brunner
40dfe8f1d8
Remove restriction to portrait orientation
2012-08-13 11:00:24 +02:00
Tobias Brunner
3a32ba7111
Use Holo as theme
2012-08-13 11:00:24 +02:00
Tobias Brunner
da9bb5044f
Make click events on the profile list available to the Activity
...
If the Activity this fragment is placed in implements the provided interface
it is notified about clicks on any of the profiles.
2012-08-13 11:00:09 +02:00
Tobias Brunner
c6b736b9f5
Use a contextual action bar to edit and delete selected VPN profiles
2012-08-11 15:10:35 +02:00
Tobias Brunner
a3e2f127dc
Provide a menu with options to save VPN profiles
...
The ID of the updated/inserted profile is sent back to the activity that
started the detail view.
2012-08-11 15:10:35 +02:00
Tobias Brunner
c2e427c287
The list fragment uses a menu to provide an option to add new VPN profiles
2012-08-11 15:10:34 +02:00
Tobias Brunner
56a922b2ed
Added an activity to edit basic VPN profile details
...
Already load existing data based on extra data delivered with the
Intent, no saving and CA certificate handling yet.
2012-08-11 15:10:34 +02:00
Tobias Brunner
0458ac7cbc
Show list fragment in main activity
2012-08-11 15:10:34 +02:00
Tobias Brunner
7329618cc2
Fragment added to list the VPN profiles
2012-08-11 15:10:34 +02:00
Tobias Brunner
03a5a63c03
Added a custom adapter and layout to display VPN profiles in a ListView
2012-08-11 15:10:34 +02:00
Tobias Brunner
d799cbf676
Added class to simplify access to database of VPN profiles
2012-08-11 15:10:33 +02:00
Tobias Brunner
3d9127da61
Added class to move around VPN profiles in the Android App
2012-08-11 15:10:33 +02:00
Tobias Brunner
b17b495f2e
Replaced launcher icon with a more appropriate one
2012-08-11 15:10:33 +02:00
Tobias Brunner
441dde9ee9
Moved main Activity to ui sub-package
...
Also force portrait orientation.
2012-08-08 15:41:04 +02:00
Tobias Brunner
8bf3027643
Moved CharonVpnService to logic sub-package
2012-08-08 15:41:04 +02:00
Tobias Brunner
6f11e94134
Global charonservice_t object added to libandroidbridge
...
This is later used to call Java methods on CharonVpnService via JNI.
2012-08-08 15:41:04 +02:00
Tobias Brunner
f83f65be08
Added functions to attach/detach native threads to the JVM
...
Even though native threads are automatically detached from the JVM with
help of a thread-local destructor it is recommended to detach as soon as
possible as local JNI references are not freed until a thread detaches.
2012-08-08 15:41:04 +02:00
Tobias Brunner
cb887af4cf
Moved JNI helper macros to a separate file
...
Also initialize a reference to the CharonVpnService class during
JNI_OnLoad, which allows us later to call methods from C to Java.
2012-08-08 15:41:03 +02:00
Tobias Brunner
d62d5d7c2e
Use strongSwan logo as icon
...
Due to the transparency and black font this is probably not optimal yet.
2012-08-08 15:41:03 +02:00
Tobias Brunner
b6a071514a
Fixed ip_packet_t if IPv6 is not available
2012-08-08 15:41:03 +02:00
Tobias Brunner
34400edc37
Added utility class to create TUN devices
...
Currently works only on Linux.
2012-08-08 15:41:03 +02:00
Tobias Brunner
a113d7f29b
Added IPsec processor which is responsible for handling in- and outbound packets
...
Two callbacks can be registered that get called when new inbound plaintext and
outbound ESP packets have been processed. Inbound ESP and outbound plaintext
packets can be queued for processing with two other methods.
2012-08-08 15:41:03 +02:00
Tobias Brunner
b37758c41e
Represent the payload of an ESP packet as ip_packet_t instead of a chunk_t
2012-08-08 15:41:03 +02:00
Tobias Brunner
2e1a19136d
IPsec policies can be looked up based on an IP packet
2012-08-08 15:41:03 +02:00
Tobias Brunner
2dd47c2442
ip_packet_t parses the header of IP packets
2012-08-08 15:41:03 +02:00
Tobias Brunner
ed1f0c234f
Order IPsec policies by a pseudo-priority based on the traffic selectors
...
This allows a simple lookup, i.e. just use the first policy that matches
a given IP packet.
2012-08-08 15:41:03 +02:00
Tobias Brunner
f1b4238311
Implemented a checkout/checkin mechanism for IPsec SAs
...
SAs can only be checked out by a single thread and all other threads
block until the SA is checked in again.
2012-08-08 15:41:03 +02:00
Tobias Brunner
7000cf11b1
IPsec policy manager added
...
This version only provides the very simplest management functions.
2012-08-08 15:41:03 +02:00
Tobias Brunner
3b8276b405
Method added to easily compare IPsec policies
2012-08-08 15:41:03 +02:00
Tobias Brunner
9a11bc09bd
Class representing an IPsec policy added
2012-08-08 15:41:03 +02:00