Skip to content

Commit ecc33d4

Browse files
author
Robert Greenwalt
committed
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
1 parent 05f14e2 commit ecc33d4

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

core/java/android/net/MobileDataStateTracker.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ public void onReceive(Context context, Intent intent) {
246246
Log.d(TAG, "CONNECTED event did not supply interface name.");
247247
}
248248
mDefaultGatewayAddr = intent.getIntExtra(Phone.DATA_GATEWAY_KEY, 0);
249+
if (mDefaultGatewayAddr == 0) {
250+
Log.d(TAG, "CONNECTED event did not supply a default gateway.");
251+
}
249252
setDetailedState(DetailedState.CONNECTED, reason, apnName);
250253
break;
251254
}
@@ -384,6 +387,7 @@ public boolean reconnect() {
384387
intent.putExtra(Phone.DATA_APN_KEY, mApnName);
385388
intent.putExtra(Phone.DATA_IFACE_NAME_KEY, mInterfaceName);
386389
intent.putExtra(Phone.NETWORK_UNAVAILABLE_KEY, false);
390+
intent.putExtra(Phone.DATA_GATEWAY_KEY, mDefaultGatewayAddr);
387391
if (mStateReceiver != null) mStateReceiver.onReceive(mContext, intent);
388392
break;
389393
case Phone.APN_REQUEST_STARTED:

core/java/android/net/NetworkStateTracker.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ public void addDefaultRoute() {
162162
Log.d(TAG, "addDefaultRoute for " + mNetworkInfo.getTypeName() +
163163
" (" + mInterfaceName + "), GatewayAddr=" + mDefaultGatewayAddr);
164164
}
165+
NetworkUtils.addHostRoute(mInterfaceName, mDefaultGatewayAddr);
165166
NetworkUtils.setDefaultRoute(mInterfaceName, mDefaultGatewayAddr);
166167
}
167168
}

0 commit comments

Comments
 (0)