View Single Post
allnameswereout's Avatar
Posts: 3,397 | Thanked: 1,212 times | Joined on Jul 2008 @ Netherlands
#77
h
Originally Posted by cpitchford View Post
IPv6 is very unlikely to be a problem since I doubt that all handsets that support MMS support ipv6, but thought I should point it out!
Are there any phones which use IPv6 native? AFAIK not. Anyway...

I'll try to explain my thinking behind using netfilter.

wlan0 192.168.1.10/24 default gw 192.168.1.1

Now we connect to the MMS APN..

pppX 192.168.1.200 <=> 192.168.1.50
MMSC: 195.92.248.7

It *could* happen..
first problem. If the device is currently talking to 192.168.1.200 or 192.168.1.50 via WLAN, those two IP addresses are now present on two interfaces..
Ok...

Lets say the user is connected to GPRS and has a default route to there. Then, the user comes home and connects to WLAN which tells it to add a default route to WLAN. You can then do 2 things: you can either keep the original route or you can replace it. What will happen is that the WLAN gets priority over the GPRS. If you then want to use GPRS then you fire up PPP which will give you IPv4/32 PPP local, IPv4/32 PPP remote, and IPv4/32 PPP gw. The gw you add to be routed over PPP interface. If there is already a /32 routed as gw then you give your own gw priority over that one. Because it works in the order they're added you delete current, then add your own, and add the one deleted again although I believe iproute2 can handle this more elegant its not part of Maemo 5. Because the MMSC_IP will match default route you must add a route source MMSC_IP/32 destination IPv4/32 PPP gw. Then we do business with MMSC. Afterwards, you shut down the PPP interface everything will be as before you used PPP interface. The very same principle applies to your example!

If the device is talking to www.orange.co.uk (which happens to have the same IP as the MMSC) which route does it use?
Because you're either changing the route and changing it back again or deleting the route, adding the one we want to use for MMSC, and then adding the one we just deleted the current connection to IPv4 address which happens to be same as MMSC_IP will be temporarily routed over the PPP interface to the MMSC.

in your example, what if the mmsc is 192.168.1.1?
Same as above. Default route changes temporarily to be used over PPP interface, and current connections to gw 192.168.1.1 will not work anymore. That means everything would be routed to MMSC. But we can make some sanity checks against this. Its unlikely this happens btw.

What if it clashes with a local wlan address?
The PPP /32 comes first before the WLAN /24. If there are connections to this WLAN address they'll be disconnected and sent to an IP address binded to PPP interface.

what if the mmsc has the same IP address as wlan0?
Bring wlan0 temporarily down.

what if the ppp interface obtains an IP address that matches a local wlan IP or host?
The PPP /32 comes first before the WLAN /24. If there are connections to this WLAN address they'll be disconnected and sent to an IP address binded to PPP interface.

For all of 3 cases sanity check is needed and in all of 3 cases this happens in a split second because the MMS is max 300 kB which will be downloaded quickly over GPRS. You could use ARP for sanity checks.

Overlaps are very bad.. I think this idea might solve many overlap problems..
Collisions happen, simple as that. There is always a chance they happen when you play with privately assigned IPv4 over several interfaces.

If we use the ipt_ROUTE module, we can direct traffic out of specific interface based on ipt matching.. which is fairly good..
Well right now we use dev option in route:

[...]

dev If force the route to be associated with the specified device, as the kernel will otherwise try to determine the device on its own (by checking already existing routes and device specifications, and where the route is added to). In most normal networks you won't need this.

[...]
Which will work in almost all cases.

The vital thing here is to avoid clashes and since home networks use rfc1918 and operators use rfc1918 the chances are real.
Yes, true, but always existed, and happens too e.g. with VPN or even in the case of GPRS and WLAN. If this happens customers will be pissed. But the chance this happens is small.

If you're scared it happens, and inappropriate traffic passes, you can use pass-filter in PPPD to only allow MMSC_service which has certain characteristics such as source IPv4 and source port. One could even use add 127.0.0.2 to lo and only allow 127.0.0.2 to pass. Really, these collisions sometimes unfortunately happen and that sucks but it happens. And even if you want to prevent them there is no need for IPT or experimental IPT options although what you state does work.
__________________
Goosfraba! All text written by allnameswereout is public domain unless stated otherwise. Thank you for sharing your output!
 

The Following User Says Thank You to allnameswereout For This Useful Post: