Fri Sep 16 13:24:55 EDT 2011

OpenVPN on droid2 / verizon running 2.2 (Froyo)

The tun.ko module for 2.2 is missing on the phone.  Get it here[1].

Needs root access on the phone.  I used Z4 root.  Using "adb shell"
with root permissions it's possible to remount the /system share as
rw, so the tun.ko can be copied to /system/lib

# mount
get list of mount points => find the one corresponding to /system

# mount -o remount,rw /dev/block/mmcblk1p21 /system

Then copy the tun.ko module to /system/lib/modules, either directly,
or through the sd card, then copying to /system if it doesn't allow
direct copy.

I had this problem trying to insert the module:

<3>[89176.615234] tun: version magic ' preempt mod_unload ARMv7 ' should be ' preempt mod_unload ARMv7

Apparently insmod can't stript this magic, but it's possible to remove
it by editing the object file.  Using objdump I find this:

$ objdump -j .modinfo tun.ko -s

tun.ko:     file format elf32-little

Contents of section .modinfo:
 0000 616c6961 733d6368 61722d6d 616a6f72  alias=char-major
 0010 2d31302d 32303000 6c696365 6e73653d  -10-200.license=
 0020 47504c00 61757468 6f723d28 43292031  GPL.author=(C) 1
 0030 3939392d 32303034 204d6178 204b7261  999-2004 Max Kra
 0040 736e7961 6e736b79 203c6d61 786b4071  snyansky <maxk@q
 0050 75616c63 6f6d6d2e 636f6d3e 00000000  ualcomm.com>....
 0060 64657363 72697074 696f6e3d 556e6976  description=Univ
 0070 65727361 6c205455 4e2f5441 50206465  ersal TUN/TAP de
 0080 76696365 20647269 76657200 64657065  vice driver.depe
 0090 6e64733d 00000000 7665726d 61676963  nds=....vermagic
 00a0 3d322e36 2e33322e 392d3237 3232302d  =
 00b0 67333238 66353630 20707265 656d7074  g328f560 preempt
 00c0 206d6f64 5f756e6c 6f616420 41524d76   mod_unload ARMv
 00d0 37200000

I tried to edit this out in the binary.  It loaded properly, but
crashed the phone when actually used.

# cat /proc/version
Linux version (xrpk47@il93lnxdroid25) (gcc version 4.4.0 (GCC) ) #1 PREEMPT Mon Nov 15 22:44:13 CST 2010

Maybe need to compile from Motorola source [2]?

Ok, this one[4] from this thread[3] works on the version above.  It
sets up the tunnel connection.

Still a problem: the "ifconfig" on android doesn't work as expected.

Fri Sep 16 15:08:24 2011 PUSH: Received control message: 'PUSH_REPLY,route-gateway,ifconfig'
Fri Sep 16 15:08:24 2011 Options error: Unrecognized option or missing parameter(s) in [PUSH-OPTIONS]:2: ifconfig (2.1.1)

See here [5][6].  If I set it manually it works:

ifconfig tap0 netmask up

 - fix vpn on zni
 - auto load tun.ko ?
 - fix ifconfig stuff | use external script workaround

[1] http://code.google.com/p/get-a-robot-vpnc/downloads/detail?name=tun.ko
[2] http://sourceforge.net/motorola/wiki/Android/
[3] http://code.google.com/p/get-a-robot-vpnc/issues/detail?id=116
[4] http://www.saturnwiki.net/droid_tun_driver/
[5] http://code.google.com/p/android-openvpn-settings/issues/detail?id=26
[6] http://code.google.com/p/android-openvpn-installer/issues/detail?id=2