diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 42be756..812c1eb 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -28,6 +28,7 @@
 import android.net.IConnectivityManager;
 import android.net.LinkAddress;
 import android.net.LinkProperties;
+import android.net.LinkProperties.CompareAddressesResult;
 import android.net.MobileDataStateTracker;
 import android.net.NetworkConfig;
 import android.net.NetworkInfo;
@@ -61,6 +62,7 @@
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.net.Inet6Address;
 import java.net.InetAddress;
 import java.net.Inet4Address;
 import java.net.UnknownHostException;
@@ -76,6 +78,7 @@
 public class ConnectivityService extends IConnectivityManager.Stub {
 
     private static final boolean DBG = true;
+    private static final boolean VDBG = true;
     private static final String TAG = "ConnectivityService";
 
     // how long to wait before switching back to a radio's default network
@@ -99,6 +102,11 @@
     private NetworkStateTracker mNetTrackers[];
 
     /**
+     * The link properties that define the current links
+     */
+    private LinkProperties mCurrentLinkProperties[];
+
+    /**
      * A per Net list of the PID's that requested access to the net
      * used both as a refcount and for per-PID DNS selection
      */
@@ -302,6 +310,7 @@
 
         mNetTrackers = new NetworkStateTracker[
                 ConnectivityManager.MAX_NETWORK_TYPE+1];
+        mCurrentLinkProperties = new LinkProperties[ConnectivityManager.MAX_NETWORK_TYPE+1];
 
         mNetworkPreference = getPersistedNetworkPreference();
 
@@ -442,6 +451,7 @@
                         mNetConfigs[netType].radio);
                 continue;
             }
+            mCurrentLinkProperties[netType] = mNetTrackers[netType].getLinkProperties();
         }
 
         mTethering = new Tethering(mContext, mHandler.getLooper());
@@ -1409,6 +1419,8 @@
      * right routing table entries exist.
      */
     private void handleConnectivityChange(int netType, boolean doReset) {
+        int resetMask = doReset ? NetworkUtils.RESET_ALL_ADDRESSES : 0;
+
         /*
          * If a non-default network is enabled, add the host routes that
          * will allow it's DNS servers to be accessed.
@@ -1416,6 +1428,45 @@
         handleDnsConfigurationChange(netType);
 
         if (mNetTrackers[netType].getNetworkInfo().isConnected()) {
+            LinkProperties newLp = mNetTrackers[netType].getLinkProperties();
+            LinkProperties curLp = mCurrentLinkProperties[netType];
+            mCurrentLinkProperties[netType] = newLp;
+            if (VDBG) {
+                log("handleConnectivityChange: changed linkProperty[" + netType + "]:" +
+                        " doReset=" + doReset + " resetMask=" + resetMask +
+                        "\n   curLp=" + curLp +
+                        "\n   newLp=" + newLp);
+            }
+
+            if (curLp.isIdenticalInterfaceName(newLp)) {
+                CompareAddressesResult car = curLp.compareAddresses(newLp);
+                if ((car.removed.size() != 0) || (car.added.size() != 0)) {
+                    for (LinkAddress linkAddr : car.removed) {
+                        if (linkAddr.getAddress() instanceof Inet4Address) {
+                            resetMask |= NetworkUtils.RESET_IPV4_ADDRESSES;
+                        }
+                        if (linkAddr.getAddress() instanceof Inet6Address) {
+                            resetMask |= NetworkUtils.RESET_IPV6_ADDRESSES;
+                        }
+                    }
+                    if (DBG) {
+                        log("handleConnectivityChange: addresses changed" +
+                                " linkProperty[" + netType + "]:" + " resetMask=" + resetMask +
+                                "\n   car=" + car);
+                    }
+                } else {
+                    if (DBG) {
+                        log("handleConnectivityChange: address are the same reset per doReset" +
+                               " linkProperty[" + netType + "]:" +
+                               " resetMask=" + resetMask);
+                    }
+                }
+            } else {
+                resetMask = NetworkUtils.RESET_ALL_ADDRESSES;
+                log("handleConnectivityChange: interface not not equivalent reset both" +
+                        " linkProperty[" + netType + "]:" +
+                        " resetMask=" + resetMask);
+            }
             if (mNetConfigs[netType].isDefault()) {
                 handleApplyDefaultProxy(netType);
                 addDefaultRoute(mNetTrackers[netType]);
@@ -1430,15 +1481,13 @@
             }
         }
 
-        if (doReset) {
+        if (doReset || resetMask != 0) {
             LinkProperties linkProperties = mNetTrackers[netType].getLinkProperties();
             if (linkProperties != null) {
                 String iface = linkProperties.getInterfaceName();
                 if (TextUtils.isEmpty(iface) == false) {
-                    if (DBG) {
-                        log("resetConnections(" + iface + ", NetworkUtils.RESET_ALL_ADDRESSES)");
-                    }
-                    NetworkUtils.resetConnections(iface, NetworkUtils.RESET_ALL_ADDRESSES);
+                    if (DBG) log("resetConnections(" + iface + ", " + resetMask + ")");
+                    NetworkUtils.resetConnections(iface, resetMask);
                 }
             }
         }
