Here is the latest iteration of my JNI/Android patch series. V2->V3 changes: Add protect_socket callback to allow binding VPN connection sockets to a non-VPNed interface Specify reconnect_{timeout,interval} in openconnect_mainloop() arguments Use select() to sleep during reconnect, to remain responsive to aborts via cancel_fd Improve error handling in JNI init() function Make a few of the Java callbacks optional Add "android" and "ios" OS types + CSD support Fixes for a couple of miscellaneous problems reported on the list This passes CheckJNI, and there is a somewhat-functional ICS+ Android app posted at: https://github.com/cernekee/ics-openvpn/commits/master The following changes since commit 3444f811ae91d77b0bad07ed7b4de61d635bb940: Set SO_SNDBUF on DTLS socket and handle -EAGAIN on it (2013-10-03 06:20:35 -0700) are available in the git repository at: git://github.com/cernekee/openconnect.git jni-v3 for you to fetch changes up to 27553af70470d73c11596d4aa046ff0bb04f53ec: auth: Add new group_select argument to xmlpost_initial_req() (2013-10-13 12:07:21 -0700) ---------------------------------------------------------------- Kevin Cernekee (36): Clear peer_addr if aborting XML POST changes the hostname library: Remove declaration for nonexistent openconnect_get_vpn_name() auth: Hack around const warnings Introduce new helper functions for cancel_fd checking library: Add new openconnect_setup_cancel_pipe() call Move signal handling out of mainloop mainloop: Convert vpn_mainloop() into a library function main: Introduce xstrdup() function tun: Export setup_tun() functionality Move vpninfo default settings into library library: Check for failed allocations in openconnect_vpninfo_new() dtls: Export setup_dtls() function cstp: Export make_cstp_connection() library: Move the mainloop guts into libopenconnect library: Update openconnect.pc.in tun, cstp: Don't exit() on failure library: Free zlib state cstp: Clean up split include/exclude/DNS lists when freeing vpninfo library: Add get/set functions for servercert, ifname, reqmtu library: Export VPN IP information to callers library: Add protect_socket callback library: Add support for mobile headers library: Add openconnect_set_xmlpost() to support different CSD modes library: Update changelog and bump minor version main: Add openconnect_vpninfo_free() on a couple of exit paths buildsys: Allow overriding -W flags acinclude: Add AX_JNI_INCLUDE_DIR macro JNI: Initial commit of C wrapper functions JNI: Initial commit of Java library + example program android: Bump gmp up to version 5.1.2 android: Enable JNI in build android: Add libstoken to build android: Add liboath to build android: Honor $TMPDIR when writing CSD script auth: Fix comment in parse_form() auth: Add new group_select argument to xmlpost_initial_req() .gitignore | 1 + Makefile.am | 25 +- acinclude.m4 | 125 +++ android/0001-Remove-call-to-mlockall.patch | 33 + ...-fflush-freadahead-fseeko-Fix-for-Android.patch | 43 + android/Makefile | 107 ++- auth.c | 32 +- configure.ac | 48 +- cstp.c | 136 +-- dtls.c | 18 +- gnutls.c | 36 +- http.c | 41 +- java/.gitignore | 2 + java/README | 22 + java/build.xml | 33 + java/src/com/example/LibTest.java | 207 +++++ .../infradead/libopenconnect/LibOpenConnect.java | 250 +++++ jni.c | 975 ++++++++++++++++++++ libopenconnect.map.in | 19 + library.c | 106 ++- main.c | 149 ++- mainloop.c | 31 +- openconnect-internal.h | 74 +- openconnect.h | 80 +- openconnect.pc.in | 2 +- openssl.c | 36 +- ssl.c | 10 +- tun.c | 187 ++-- 28 files changed, 2456 insertions(+), 372 deletions(-) create mode 100644 android/0001-Remove-call-to-mlockall.patch create mode 100644 android/0001-fflush-freadahead-fseeko-Fix-for-Android.patch create mode 100644 java/.gitignore create mode 100644 java/README create mode 100644 java/build.xml create mode 100644 java/src/com/example/LibTest.java create mode 100644 java/src/org/infradead/libopenconnect/LibOpenConnect.java create mode 100644 jni.c