Reply
Thread Tools
Posts: 3 | Thanked: 0 times | Joined on Dec 2009
#1
Hi there,
As far As I know, I can't just make echo 1 > /proc/net/ipv4/ip_forward on a N900, as this is not a kernel part, and even if it was, it wouldn't do what I plan to dev, that is IP Raw sockets (I would like osi layer 2 handled by kernel), to act like a router, with some packet rewriting purpose (like the user agent ). I know on linux I would be able to use raw sockets / capture, or using libcap.
What i'm aiming to do is quite simple in fact, selecting an inside interface (can be USB, WiFi, Bluetooh, everything that has an IP connection), capture packets, reinject them to an outside interface (you guessed this is 3g/edge/... interface), with some packet rewriting, the first would be to do PAT but I would allow further rewrite rules...

Well, you I want your advices guys to tell me if you have such experiences using raw sockets or libpcap on maemo/N900.

I already developped in Qt (that's a while, i'm not a developer ), and used Raw ethernet sockets.

the simpliest (for me) would be to use scapy (very simple framework in python to capture/forge packets), but don't know if the maemo python engine will allow socket manipulation.

In advance, thanks of the advices you would give me.

Finally, I guess there's no gcc on maemo and I have to cross compile for arm processors, right ?
 
Posts: 13 | Thanked: 5 times | Joined on Nov 2009
#2
There is another approach to your problem, if you do not want to involve the kernel/iptables even though it is *THE* cleanest solution, you may consider proxies.
Apache with a modules & Squid.

You can create rules to rewrite part of the query or to route it where ever you want. The only drawback is that the client application need to support HTTP proxy and only TCP connection is supported (yes even non web traffic via 'CONNECT')

The second proxy standard is sock v4 or v5 and support UDP traffic. You can install a sockify application on the client end if this one does not support sock.

Rewriting all the packets on the fly using scapy would be the best solution for this even if I would be really interested to know if it's running on the n900.
 
Posts: 3 | Thanked: 0 times | Joined on Dec 2009
#3
Originally Posted by fabien View Post
There is another approach to your problem, if you do not want to involve the kernel/iptables even though it is *THE* cleanest solution, you may consider proxies.
Apache with a modules & Squid.

You can create rules to rewrite part of the query or to route it where ever you want. The only drawback is that the client application need to support HTTP proxy and only TCP connection is supported (yes even non web traffic via 'CONNECT')

The second proxy standard is sock v4 or v5 and support UDP traffic. You can install a sockify application on the client end if this one does not support sock.

Rewriting all the packets on the fly using scapy would be the best solution for this even if I would be really interested to know if it's running on the n900.
Thanks for your advice, however I've heard that there's no ip forwarding kernel module present in N900, or in maemo generally... But I'm not such a lucky guy who already have a N900, so I can't test...
Installing a squid/apache on a phone would be, IMO, a bit tricky, especially I guess it's not compiled for ARM processors, and even if it was, I can use a huge amount a resources, and are you sure this do not involves routing functions ? I mean both side of the proxy won't be on the same subnets...
I'll try scapy if python, libpcap, and libnet are compatible with maemo (but In this case maybe a C Program would do it faster, but anyway there won't be a huge throughput to handle)
 
Reply


 
Forum Jump


All times are GMT. The time now is 02:09.