radekp / qtmoko

QtExtended, formerly known as Qtopia from TrollTech, discontinued by Nokia
http://qtmoko.org
Other
70 stars 39 forks source link

Handling of default route is broken #102

Open ydirson opened 12 years ago

ydirson commented 12 years ago

/etc/network/interfaces sets a gateway for usb0, which is up at boottime. When a GPRS connection is done, another default route replaces the existing one, and is removed when the connection is terminated. Then there is no default route any more, which is bad.

Indeed, different default can perfectly coexist, and we could even assign them metrics, so the USB default route gets higher precedence than the GPRS one. However, a quick test did not work as expected, probably because usb0 does not go down when unplugged.

And in fact the suppression of the default route is done in a so naive way that we can have surprises:

root@neo:~# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 usb0 0.0.0.0 192.168.0.200 0.0.0.0 UG 0 0 0 usb0 root@neo:~# route add default gw 192.168.0.201 root@neo:~# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 usb0 0.0.0.0 192.168.0.201 0.0.0.0 UG 0 0 0 usb0 0.0.0.0 192.168.0.200 0.0.0.0 UG 0 0 0 usb0 root@neo:~# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 10.64.64.64 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 usb0 0.0.0.0 10.64.64.64 0.0.0.0 UG 0 0 0 ppp0 0.0.0.0 192.168.0.200 0.0.0.0 UG 0 0 0 usb0