zainhom / rowboat

Automatically exported from code.google.com/p/rowboat
0 stars 0 forks source link

VPN failure on rowboat-android #131

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. connect to network via ethernet , wifi or gsrm
2. make sure you can ping the vpn router
3. make a pptp vpn connection

or run from console
mtpd pptp xx.xx.xx.xx 1723 "linkname vpn name xxxxx password xxxx" &

What is the expected output? What do you see instead?
should see a connection made
running logcat we see

I/mtpd    (2343): Using protocol pptp
I/mtpd    (2343): Connecting 192.168.220.238 port 1723
I/mtpd    (2343): Connection established (socket = 10)
D/mtpd    (2343): Sending SCCRQ
D/mtpd    (2343): Received SCCRP -> Sending OCRQ (local = 12339)
I/mtpd    (2343): Tunnel established
D/mtpd    (2343): Received OCRQ (remote = 10255)
I/mtpd    (2343): Session established
I/mtpd    (2343): Creating PPPoX socket
F/mtpd    (2343): Connect() Invalid argument

mtpd dies

What version of the product are you using? On what operating system?
rowboat-gingerbread 2.3.4 Latest GIT Sunday 10/24/2011

Please provide any additional information below.

Added code to pptp.c in external/mtpd
to display sizeof(address)
size of address returned from connect(pppox,
is = 14.

code below

static int create_pppox()
{
    int pppox;
    log_print(INFO, "Creating PPPoX socket");
    pppox = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OPNS);

    if (pppox == -1) {
        log_print(FATAL, "Socket() %s", strerror(errno));
        exit(SYSTEM_ERROR);
    } else {
        struct sockaddr_pppopns address = {
            .sa_family = AF_PPPOX,
            .sa_protocol = PX_PROTO_OPNS,
            .tcp_socket = the_socket,
            .local = local,
            .remote = remote,
        };
        if (connect(pppox, (struct sockaddr *)&address, sizeof(address)) != 0) {
            log_print(FATAL, "Connect() %s", strerror(errno));
            log_print(FATAL, "CONNECT address size %d", sizeof(address);
            exit(SYSTEM_ERROR);
        }
    }
    return pppox;
}

Looks like a problem in connect(pppox,

Original issue reported on code.google.com by markesse...@gmail.com on 24 Oct 2011 at 6:06

GoogleCodeExporter commented 8 years ago
I have found the answer to this problem. This goes all the way back to the 
master branch and was introduced by changes made in 2009 (FROYO)

PX_PROTO_OLAC and PX_PROTO_OPNS in the Bionic / libc /kernel / linux chain do 
not match those in the kernel / include chain!!!

Sloppy Coding and/or checking

TI and/or rowboat if you want help from a very senior special projects engineer 
on patching this code. please email me with instructions to post or submit to 
your GIT:

Please for give my Sloppy comment, but I have coded to the DOD-2167 standard 
all of my carrier.

The Patch is

--------------------------------------------------------------------------------
----

diff --git a/libc/kernel/common/linux/if_pppolac.h 
b/libc/kernel/common/linux/if_pppolac.h
index bf6eba0..f3c8bb1 100644
--- a/libc/kernel/common/linux/if_pppolac.h
+++ b/libc/kernel/common/linux/if_pppolac.h
@@ -15,7 +15,8 @@
 #include <linux/socket.h>
 #include <linux/types.h>

-#define PX_PROTO_OLAC 2
+/* was 2 */
+#define PX_PROTO_OLAC 3

 struct sockaddr_pppolac {
  sa_family_t sa_family;
--------------------------------------------------------------------------------
----

diff --git a/libc/kernel/common/linux/if_pppopns.h 
b/libc/kernel/common/linux/if_pppopns.h
index ac75210..106b4d1 100644
--- a/libc/kernel/common/linux/if_pppopns.h
+++ b/libc/kernel/common/linux/if_pppopns.h
@@ -15,7 +15,8 @@
 #include <linux/socket.h>
 #include <linux/types.h>

-#define PX_PROTO_OPNS 3
+/* was 3 */
+#define PX_PROTO_OPNS 4

 struct sockaddr_pppopns {
  sa_family_t sa_family;

Original comment by markesse...@gmail.com on 4 Nov 2011 at 1:58