[maemo-developers] [maemo-developers] Fake IAP connection or how to use local web applications

From: Tomi Ollila tomi.ollila at guru.guru-group.fi
Date: Sat Feb 3 14:53:05 EET 2007
"Gustavo Sverzut Barbieri" <barbieri at gmail.com> writes:

> On 2/1/07, Marius Gedminas <marius at pov.lt> wrote:
>> >
>> > Yep, the point is that looks like Dummy is not accepted as connection
>> > type. So you are supposed to enable wi-fi if you wish to connect to
>> >
> As willian said, the problem still remain... we're fixing the problem
> in the wrong area.
> Maemo is broken: it traps "socket()" calls instead of "connect()", why?

There might be some other reason than this: I do not know any program
timeouting socket() call (everyone just calls socket() and expects it to 
return quickly). connect() (blocking or non-blocking) is expected to return
in a short while or an error message is printed out (firefox does this, for

I've been wondering how to go around this, like:

1) would it be possible to make replacement LD_PRELOAD library that wraps
   connect() instead (and would that work...) ...and bind() too.

2) in some cases, just writing a shell wrapper that unsets LD_PRELOAD
   before loading other program might be useful

3) In (C) programs that needs both to avoid this wrapping (for example
   bind()ing socket to on some port). but then needing that
   wrapping (connect()ing to internet to do some work) could probably try

     int (*sys_socket)(int, int, int);
     int s;
     void * handle = dlopen("/lib/libc.so.6", RTLD_LAZY);
     if (!handle)
        sys_socket = dlsym(handle "socket");
        if (dlerror())
     s = sys_socket(AF_INET, SOCK_STREAM, 0);

Some of these might work... or then not. I'll be trying
cases 2 and 3 in (near?) future; 2 when launching web browser
and 3 when starting program web browser will connect to.

> Gustavo Sverzut Barbieri


More information about the maemo-developers mailing list