[Desire Android Development] melethron:
EDIT: The Problem with the "ps" command described below only happens with "newer" Versions of BusyBox. The modified Version works with BusyBox 1.17.1 (confirmed) and most likely with 1.17.0 since they changed "ps" in 1.17.0 (quote from changelog: "ps: fix non-DESKTOP option handling code"). If you have installed an older Version of BusyBox or an older Version is included in your ROM you can get "VPNC Connections" from the market or the developer page. The market Version works with Busybox 1.16 (confirmed) and maybe with older Versions. If you run the original Program or my modified apk with a other Version of Busybox than 1.17.1 or 1.16 it would be nice if you tell me which version works so i can update this posting.

(To check your "BusyBox" Version use adb (command: adb shell busybox) or a Terminal emulator (command: busybox) )

Original posting:

Hey,

First of all i hope its right to post this here and not in "Themes and App" forum. Since i modified the VPN Connections App to work with LeeDroid ROM i think this should be the right subforum since it is a ROM specific APP.

"Prolog"

After messing around with the "VPN Connection app" (get-a-robot-vpnc) i got it working with LeeDroid 2.1/2.1a Rom by editing some code. Since i have almost no idea of coding i'll tell what i modfied (i took some code from the Issue List of google code of get-a-robot-vpnc).

But First:

Min Requirement:

-HTC Desire (rooted)

-LeeDroid 2.1/2.1a ROM

-Knowing what you are doing!

---or----

FroYo Rom with:

-HTC Desire (rooted)

-Busybox (Same Version as in LeeDroid)

-tun.ko (same Version as in LeeDroid)

-Knowing what you are doing!

Why did you edit the code?

1. The App didn't recognize a working connection. After connecting the app tells you that the connection failed, although the vpnc process is running. This is because the "ps" Version of busybox (the one coming with LeeDroid - dont know which version this is atm) isnt compatible with the 0.99 release of VPN connections. (Compare to Issue 122 ) The app checks a working connection with this command:

ps | grep 'vpnc$'

If i try this though adb shell i dont get any output even if vnc is running. But by using this:

ps | grep '[v]pnc --script'

I get an output like this (PID might be different):

6727 0 0:00 /data/data/org.codeandroid.vpnc_frontend/files/vpnc --script /data/data/org.codeandroid.vpnc_frontend/files/vpnc-script --no-detach

After editing this part of the code the app recognizes the working connection correctly.

2. Even if vpnc is running properly i still didn't get the IP of the VPN Network (checked with "http://www.whatismyip.com"). This has something to do with IP Tables. After i used this command in "adb shell" (as mentioned inIssue 114, Issue 124 and the LeeDroid Rom thread):

su
ip ru del table wifi

i got the ip of my Network.

So i changed the vpnc-script coming with the svn revision 140 to this: http://code.google.com/p/get-a-robo...script&token=69c1649b4f4dfa8358813b317d7eda24

I dont knwo if this is still a problem with the ip tables fix for OpenVPN coming with LeeDroid 2.1a (or with the MOD for 2.1) since i didn't try it with that. The modified code works with or without the mod for wifi and gprs so there was no need for me to try it without the changes.

Exact Steps of how i edited the code

As I said i can't code (at least i understand the "ps | grep" command ;) ) and i didnt work with Eclipse or the SDK before (i only used the adb tool). All i did was to include availaible code from the Issue list and created an apk. You can do this yourself following the steps.

1. Have a working Eclipse (mine is 3.5) with SDK Tools for Android and "Google APIs Plattform 2.2 API Level 8). Check here how to install.

2. Download the svn from here

3. Open (svn root dir)/packages/apps/get-a-robot-vpn-fronted/ with eclipse. Do this by making a "New Android Project" and select "create project from existing source". Project name should be changed to "get-a-robot-vpn-frontend" to apply the patch.

4. If you have the following Error in the Problems you might remove it (worked fine for me):

DialogInterface.OnClickListener(){} must override a superclass method VPNC.java /VPNC2/src/org/codeandroid/vpnc_frontend line 541 Java Problem

As I said: I have no idea of coding and since its code from the original app i just ignored this error. Some who knows what this does might wanna change it or report it to the Issue List .

5. Apply this patch (1.) or this patch (2.). Do this by rightclicking on the Project -> Team -> Apply Patch.

The first patch changes the "ps grep" AND gives you a Notification icon (if notification is enabled in the Options) for a RUNNING connection (not only for disconnects like in the original app).

The second patch only changes the "ps grep". Since its only one line of code you can edit it also by yourself.

6. Modify the "vpnc-script" (/assets/vpnc-script) accordingly to/replace with this version:

This lets the vpnc script do the "ip ru del table wifi/gprs" for you.

7. Export as apk and install it.

8. ???????

9 Profit

Other ROMS than LeeDroid.

I didn't try this (yet) with any other ROM. According to Issue 124 the "ip ru del table wifi/gprs" is an Issue with all FroYo Roms, but i have no idea about the "ps" version of busybox. You can try the following before using my vpnc.apk or building your own:

1. Get the official apk (http://code.google.com/p/get-a-robot-vpnc/downloads/list) (V 0.99) and install it.

2. Create a New VPN Connection.

3. Connect. (dosn't matter if the app tells you the connection failed)

4. Use the following command in "adb shell":

ps | grep '[v]pnc --script'

If you get an output this version should work for you. If not then the original version may already work and you arent reading this.

5. Use the following command in adb shell (for either wifi of gprs):

ip ru del table wifi

---or----

ip ru del table gprs

6. Check your IP to see you are connected through the VPN.

If you get an output in 4. and your IP is correct after doin step 5 this apk should work for you. If you dont get any output on step 4 you might wanna find out what version of "ps" your busybox is using and change the "grep" command accordingly (someone who has more idea of linux then me might be able to help you).

Epilog

I tested the App on Leedroid 2.1 and fresh installed (wipe) 2.1a and it worked as intended. If you try it on an other ROM some feedback would be nice.

Have Fun

melethron

Attachment: The App

YOU SHOULD KNOW WHAT YOU DO BY INSTALLING THIS! I GIVE NO WARRANTY! BEST WOULD BE TO BUILD THE APK YOURSELF ACCORDING TO THIS POST!

http://dl.dropbox.com/u/11091326/Android/vpnc.apk

http://rapidshare.com/files/420985331/vpnc.apk.html