diff options
author | Yuyang Huang <yuyanghuang@google.com> | 2024-04-19 17:29:18 +0900 |
---|---|---|
committer | Yuyang Huang <yuyanghuang@google.com> | 2024-04-24 13:38:41 +0900 |
commit | 65c9f5d77f5b8c0fc4a9568a9dd582349c72e820 (patch) | |
tree | 9e4416760f08ad53566542df580e1aff160c4ea5 | |
parent | f908feb504b2b94328093d2b266f9704ccfd8e4c (diff) | |
download | NetworkStack-65c9f5d77f5b8c0fc4a9568a9dd582349c72e820.tar.gz |
Clean up the onClatInterfaceStateUpdate() in IpClient
* Remove the unnecessary comment.
* Remove the redundant mClatInterfaceExists in IpClientLinkObserver and
use mHasClatInterface in IpClient to handle the duplicated event.
Test: TH
Change-Id: I81794e97d6850d09847bec9a59d248b60db5bb3f
-rw-r--r-- | src/android/net/ip/IpClient.java | 7 | ||||
-rw-r--r-- | src/android/net/ip/IpClientLinkObserver.java | 7 |
2 files changed, 4 insertions, 10 deletions
diff --git a/src/android/net/ip/IpClient.java b/src/android/net/ip/IpClient.java index 92be9c1a..780f952b 100644 --- a/src/android/net/ip/IpClient.java +++ b/src/android/net/ip/IpClient.java @@ -991,10 +991,11 @@ public class IpClient extends StateMachine { @Override public void onClatInterfaceStateUpdate(boolean add) { - // TODO: when clat interface was removed, consider sending a message to - // the IpClient main StateMachine thread, in case "NDO enabled" state - // becomes tied to more things that 464xlat operation. getHandler().post(() -> { + if (mHasClatInterface == add) return; + // Clat interface information is spliced into LinkProperties by + // ConnectivityService, so it cannot be added to the LinkProperties + // here as those propagate back to ConnectivityService. mCallback.setNeighborDiscoveryOffload(add ? false : true); mHasClatInterface = add; if (mApfFilter != null) { diff --git a/src/android/net/ip/IpClientLinkObserver.java b/src/android/net/ip/IpClientLinkObserver.java index 624143bd..8f2856ff 100644 --- a/src/android/net/ip/IpClientLinkObserver.java +++ b/src/android/net/ip/IpClientLinkObserver.java @@ -159,7 +159,6 @@ public class IpClientLinkObserver { private final NetworkInformationShim mShim; private final AlarmManager.OnAlarmListener mExpirePref64Alarm; - private boolean mClatInterfaceExists; private long mNat64PrefixExpiry; /** @@ -515,17 +514,11 @@ public class IpClientLinkObserver { private void updateClatInterfaceLinkState(@Nullable final String ifname, short nlMsgType) { switch (nlMsgType) { case NetlinkConstants.RTM_NEWLINK: - if (mClatInterfaceExists) break; - maybeLog("clatInterfaceAdded", ifname); mCallback.onClatInterfaceStateUpdate(true /* add interface */); - mClatInterfaceExists = true; break; case NetlinkConstants.RTM_DELLINK: - if (!mClatInterfaceExists) break; - maybeLog("clatInterfaceRemoved", ifname); mCallback.onClatInterfaceStateUpdate(false /* remove interface */); - mClatInterfaceExists = false; break; default: |