benjarobbi / get-a-robot-vpnc

Automatically exported from code.google.com/p/get-a-robot-vpnc
1 stars 0 forks source link

keepalives eating battery(?) #112

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
i noticed that my nexus one tends to run out of battery very quickly whenever i 
have get-a-robot-vpnc running. investigation turned out, that even with DPD 
disabled on both sides there is one (unreplied) udp packet send from the mobile 
to the server every 9-10 seconds.

this seems to be triggered by the vpnc client binary. tests on my pc showed, 
that with the attached patch applied the vpnc connection was still stable, but 
traffic only happened once in two minutes. stability issues due to session 
timeouts might be different in mobile networks, but 10s is a very pessimistic 
approach anyway.

sadly this patch is against some vpnc version that ships with ubuntu 10.4. i 
tried to patch the vpnc sources that are shipped with get-a-robot-vpnc but was 
not successful in compiling them (even unpatched, segfaults on android)

so i'd be happy if this project would patch the used vpnc to be more mobile 
device friendly one, or someone could create a vpnc executable that is. or 
someone could point me to the mistakes i made when building vpnc for android 
(see my build process below).

regards,
sven

ps: my attempts of building vpnc for android:

it was my very first try of compiling non-java code for android. so here are 
the steps i figured out, most likely they are not correct, as the result 
segfaults. most of the steps below are solutions to problems i ran into.

- checked out g-a-r-v (get-a-robot-vpnc), installed android ndk
- installed libgcrypt-dev
- created a directory jni in .../apps/g-a-r-v-f/
- linked (-s)  ../../external/* to ./jni
- echo "include $(call all-subdir-makefiles)" > ./jni/Android.mk
- added #include <gcrypt.h> in vpnc/tunip.h
- in vpnc/sysdep.c included if_tun.h from android-ndk (full path)
- copied libc.so and libc.a from the ndk to the location where the buildprocess 
was missing it

after these modifications the ndk-build command finished with some warning 
only. as said before, the result segfaults:

# ./vpnc --debug 2
Enter IPSec gateway address: vpn.example.com
Enter IPSec ID for vpn.example.com: android
Enter IPSec secret for android@vpn.example.com: 
Enter username for vpn.example.com: sven
Enter password for sven@vpn.example.com: 

vpnc version ERSION

S1 init_sockaddr
 [2010-08-20 22:39:23]

S2 make_socket
 [2010-08-20 22:39:24]

S3 setup_tunnel
 [2010-08-20 22:39:24]
[1]   Segmentation fault      ./vpnc --debug 2

Original issue reported on code.google.com by sven.wan...@gmail.com on 20 Aug 2010 at 8:41

Attachments:

GoogleCodeExporter commented 9 years ago
some more info:

the 9-10s keepalive is triggered due to nat-traversal which is default of vpnc. 
rfc suggests these packets on about half the frequency (20s) and client 
configurable[1]. for now i'm using "--dpd-idle 0 --natt-mode none" as 
additianal vpnc flags and make sure i have pings once in 2 minutes for some 
manual keep-alive.

[1] http://tools.ietf.org/html/rfc3948#section-4

Original comment by sven.wan...@gmail.com on 20 Aug 2010 at 11:08