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:
@@ -247,6 +247,9 @@ public class MobileDataStateTracker extends NetworkStateTracker {
|
|||||||
Log.d(TAG, "CONNECTED event did not supply interface name.");
|
Log.d(TAG, "CONNECTED event did not supply interface name.");
|
||||||
}
|
}
|
||||||
mDefaultGatewayAddr = intent.getIntExtra(Phone.DATA_GATEWAY_KEY, 0);
|
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);
|
setDetailedState(DetailedState.CONNECTED, reason, apnName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -385,6 +388,7 @@ public class MobileDataStateTracker extends NetworkStateTracker {
|
|||||||
intent.putExtra(Phone.DATA_APN_KEY, mApnName);
|
intent.putExtra(Phone.DATA_APN_KEY, mApnName);
|
||||||
intent.putExtra(Phone.DATA_IFACE_NAME_KEY, mInterfaceName);
|
intent.putExtra(Phone.DATA_IFACE_NAME_KEY, mInterfaceName);
|
||||||
intent.putExtra(Phone.NETWORK_UNAVAILABLE_KEY, false);
|
intent.putExtra(Phone.NETWORK_UNAVAILABLE_KEY, false);
|
||||||
|
intent.putExtra(Phone.DATA_GATEWAY_KEY, mDefaultGatewayAddr);
|
||||||
if (mStateReceiver != null) mStateReceiver.onReceive(mContext, intent);
|
if (mStateReceiver != null) mStateReceiver.onReceive(mContext, intent);
|
||||||
break;
|
break;
|
||||||
case Phone.APN_REQUEST_STARTED:
|
case Phone.APN_REQUEST_STARTED:
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ public abstract class NetworkStateTracker extends Handler {
|
|||||||
if (inetAddress == null) {
|
if (inetAddress == null) {
|
||||||
if (DBG) Log.d(TAG, " Unable to add default route. mDefaultGatewayAddr Error");
|
if (DBG) Log.d(TAG, " Unable to add default route. mDefaultGatewayAddr Error");
|
||||||
} else {
|
} else {
|
||||||
|
NetworkUtils.addHostRoute(mInterfaceName, inetAddress, null);
|
||||||
if (!NetworkUtils.addDefaultRoute(mInterfaceName, inetAddress) && DBG) {
|
if (!NetworkUtils.addDefaultRoute(mInterfaceName, inetAddress) && DBG) {
|
||||||
Log.d(TAG, " Unable to add default route.");
|
Log.d(TAG, " Unable to add default route.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user