Fix Default route after secondary net use.

Backport of honeycomb-mr1 change 103299 adding a host route for the
default gateway before adding the default route.
Also fixing bug where "already active" condition of APN failed to
propagate the default gateway info, result in a loss of that address.

bug:4175328
Change-Id: I4cf8605b259cf40c3631c7ce6cca4c75c1b22651
This commit is contained in:
Robert Greenwalt
2011-03-26 08:32:25 -07:00
parent 05f14e2bcf
commit ecc33d43e9
2 changed files with 5 additions and 0 deletions

View File

@@ -246,6 +246,9 @@ public class MobileDataStateTracker extends NetworkStateTracker {
Log.d(TAG, "CONNECTED event did not supply interface name.");
}
mDefaultGatewayAddr = intent.getIntExtra(Phone.DATA_GATEWAY_KEY, 0);
if (mDefaultGatewayAddr == 0) {
Log.d(TAG, "CONNECTED event did not supply a default gateway.");
}
setDetailedState(DetailedState.CONNECTED, reason, apnName);
break;
}
@@ -384,6 +387,7 @@ public class MobileDataStateTracker extends NetworkStateTracker {
intent.putExtra(Phone.DATA_APN_KEY, mApnName);
intent.putExtra(Phone.DATA_IFACE_NAME_KEY, mInterfaceName);
intent.putExtra(Phone.NETWORK_UNAVAILABLE_KEY, false);
intent.putExtra(Phone.DATA_GATEWAY_KEY, mDefaultGatewayAddr);
if (mStateReceiver != null) mStateReceiver.onReceive(mContext, intent);
break;
case Phone.APN_REQUEST_STARTED:

View File

@@ -162,6 +162,7 @@ public abstract class NetworkStateTracker extends Handler {
Log.d(TAG, "addDefaultRoute for " + mNetworkInfo.getTypeName() +
" (" + mInterfaceName + "), GatewayAddr=" + mDefaultGatewayAddr);
}
NetworkUtils.addHostRoute(mInterfaceName, mDefaultGatewayAddr);
NetworkUtils.setDefaultRoute(mInterfaceName, mDefaultGatewayAddr);
}
}