3 ms·
That seems semitrivial on Android since at least a decade back, you just need to implement it and find all the edge cases, so I guess there is a reason this is
by emj 6y ago
That seems semitrivial on Android since at least a decade back, you just need to implement it and find all the edge cases, so I guess there is a reason this is not done already.
e.g .
one routing table per interface
add rules in global routing table for each new interface that is started:
ip rule add from/to $IP_OF_IFACE/32\
table $UNIQUE_RT_FOR_IFACE
ip route add default via IP_OF_IFACE_GW/32\
dev $IFACE_NAME table $UNIQUE_RT_FOR_IFACE
Then when something changes on the iface that is not defaul; 1. remove old configs for that iface, 2. open a socket on the new ip on that iface to test internet connection. 3. If ok: change default in main routing table to the GW that iface uses.