diff options
| author | 2013-03-22 09:45:51 +0000 | |
|---|---|---|
| committer | 2013-03-22 09:45:53 +0000 | |
| commit | 31453e5a2b5150a18c41b8bebd85223615ad8849 (patch) | |
| tree | 395f3d4d6698578b9157d4bf905903f12da851e4 | |
| parent | 32b9f6258d052c8c334ae348322fed9ba032a09f (diff) | |
| parent | 4aa9bcf414282e4bdd10900832baaeaa349bda50 (diff) | |
Merge "Reset connections on all stacked interfaces." into jb-mr2-dev
| -rw-r--r-- | core/java/android/net/LinkProperties.java | 9 | ||||
| -rw-r--r-- | services/java/com/android/server/ConnectivityService.java | 39 |
2 files changed, 29 insertions, 19 deletions
diff --git a/core/java/android/net/LinkProperties.java b/core/java/android/net/LinkProperties.java index 4457a2284469..e5227548b564 100644 --- a/core/java/android/net/LinkProperties.java +++ b/core/java/android/net/LinkProperties.java @@ -119,6 +119,15 @@ public class LinkProperties implements Parcelable { return mIfaceName; } + public Collection<String> getAllInterfaceNames() { + Collection interfaceNames = new ArrayList<String>(mStackedLinks.size() + 1); + interfaceNames.add(new String(mIfaceName)); + for (LinkProperties stacked: mStackedLinks.values()) { + interfaceNames.addAll(stacked.getAllInterfaceNames()); + } + return interfaceNames; + } + public Collection<InetAddress> getAddresses() { Collection<InetAddress> addresses = new ArrayList<InetAddress>(); for (LinkAddress linkAddress : mLinkAddresses) { diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 72d249aa283c..6dcb4034e500 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -2256,26 +2256,27 @@ public class ConnectivityService extends IConnectivityManager.Stub { if (resetMask != 0 || resetDns) { LinkProperties linkProperties = mNetTrackers[netType].getLinkProperties(); if (linkProperties != null) { - String iface = linkProperties.getInterfaceName(); - if (TextUtils.isEmpty(iface) == false) { - if (resetMask != 0) { - if (DBG) log("resetConnections(" + iface + ", " + resetMask + ")"); - NetworkUtils.resetConnections(iface, resetMask); - - // Tell VPN the interface is down. It is a temporary - // but effective fix to make VPN aware of the change. - if ((resetMask & NetworkUtils.RESET_IPV4_ADDRESSES) != 0) { - mVpn.interfaceStatusChanged(iface, false); + for (String iface : linkProperties.getAllInterfaceNames()) { + if (TextUtils.isEmpty(iface) == false) { + if (resetMask != 0) { + if (DBG) log("resetConnections(" + iface + ", " + resetMask + ")"); + NetworkUtils.resetConnections(iface, resetMask); + + // Tell VPN the interface is down. It is a temporary + // but effective fix to make VPN aware of the change. + if ((resetMask & NetworkUtils.RESET_IPV4_ADDRESSES) != 0) { + mVpn.interfaceStatusChanged(iface, false); + } } - } - if (resetDns) { - flushVmDnsCache(); - if (VDBG) log("resetting DNS cache for " + iface); - try { - mNetd.flushInterfaceDnsCache(iface); - } catch (Exception e) { - // never crash - catch them all - if (DBG) loge("Exception resetting dns cache: " + e); + if (resetDns) { + flushVmDnsCache(); + if (VDBG) log("resetting DNS cache for " + iface); + try { + mNetd.flushInterfaceDnsCache(iface); + } catch (Exception e) { + // never crash - catch them all + if (DBG) loge("Exception resetting dns cache: " + e); + } } } } |