Fix bad merge.

Add host route for a default gateway before adding the default route.
Also fixing bug were "already active" condtion of APN failed to
propagate the default gateway info, resulting in a loss of that address.

bug:4175328
Change-Id: I38f9d108693382a43e6605d56ca3963adf4eb6f4
This commit is contained in:
Robert Greenwalt
2011-04-01 14:11:30 -07:00
parent 64802ca780
commit 92d72ca01b
2 changed files with 5 additions and 0 deletions

View File

@@ -247,6 +247,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;
}
@@ -385,6 +388,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

@@ -172,6 +172,7 @@ public abstract class NetworkStateTracker extends Handler {
if (inetAddress == null) {
if (DBG) Log.d(TAG, " Unable to add default route. mDefaultGatewayAddr Error");
} else {
NetworkUtils.addHostRoute(mInterfaceName, inetAddress, null);
if (!NetworkUtils.addDefaultRoute(mInterfaceName, inetAddress) && DBG) {
Log.d(TAG, " Unable to add default route.");
}