464xlat: use a gatewayed route, not point-to-point
Various applications such as Skype and our legacy VPN code do not understand routes pointed directly at point-to-point interfaces and require a default gateway IPv4 address in order to function. Grudgingly accept that routes without default gateways Are Hard and use gatewayed routes instead. This causes routing to go from: default dev clat4 scope link to: default via 192.0.0.4 dev clat4 scope link 192.0.0.4 dev clat4 scope link and those apps now work. Bug: 9597256 Bug: 9597516 Change-Id: I7b7890873802d3cb99affd6eb70b8ab75e7a2cf6
This commit is contained in:
@@ -147,17 +147,24 @@ public class Nat464Xlat extends BaseNetworkObserver {
|
|||||||
" added, mIsRunning = " + mIsRunning + " -> true");
|
" added, mIsRunning = " + mIsRunning + " -> true");
|
||||||
mIsRunning = true;
|
mIsRunning = true;
|
||||||
|
|
||||||
// Get the network configuration of the clat interface, store it
|
// Create the LinkProperties for the clat interface by fetching the
|
||||||
// in our link properties, and stack it on top of the interface
|
// IPv4 address for the interface and adding an IPv4 default route,
|
||||||
// it's running on.
|
// then stack the LinkProperties on top of the link it's running on.
|
||||||
|
// Although the clat interface is a point-to-point tunnel, we don't
|
||||||
|
// point the route directly at the interface because some apps don't
|
||||||
|
// understand routes without gateways (see, e.g., http://b/9597256
|
||||||
|
// http://b/9597516). Instead, set the next hop of the route to the
|
||||||
|
// clat IPv4 address itself (for those apps, it doesn't matter what
|
||||||
|
// the IP of the gateway is, only that there is one).
|
||||||
try {
|
try {
|
||||||
InterfaceConfiguration config = mNMService.getInterfaceConfig(iface);
|
InterfaceConfiguration config = mNMService.getInterfaceConfig(iface);
|
||||||
|
LinkAddress clatAddress = config.getLinkAddress();
|
||||||
mLP.clear();
|
mLP.clear();
|
||||||
mLP.setInterfaceName(iface);
|
mLP.setInterfaceName(iface);
|
||||||
RouteInfo ipv4Default = new RouteInfo(new LinkAddress(Inet4Address.ANY, 0), null,
|
RouteInfo ipv4Default = new RouteInfo(new LinkAddress(Inet4Address.ANY, 0),
|
||||||
iface);
|
clatAddress.getAddress(), iface);
|
||||||
mLP.addRoute(ipv4Default);
|
mLP.addRoute(ipv4Default);
|
||||||
mLP.addLinkAddress(config.getLinkAddress());
|
mLP.addLinkAddress(clatAddress);
|
||||||
mTracker.addStackedLink(mLP);
|
mTracker.addStackedLink(mLP);
|
||||||
Slog.i(TAG, "Adding stacked link. tracker LP: " +
|
Slog.i(TAG, "Adding stacked link. tracker LP: " +
|
||||||
mTracker.getLinkProperties());
|
mTracker.getLinkProperties());
|
||||||
|
|||||||
Reference in New Issue
Block a user