android_packages_modules_Co.../Tethering
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Lorenzo Colitti beb7d92cbc Don't send onLinkPropertiesChanged after onLost for 464xlat.
Currently, when a network that uses 464xlat is torn down,
NetworkCallbacks will receive onLinkPropertiesChanged after
onLost. This is confusing and incorrect.

The incorrect callback is sent because handleLinkProperties
checks that the netId of the agent still exists, not that the
NetworkAgent is still registered. This is normally correct,
because the NetworkAgent is removed from mNetworkAgentInfos and
the netId are removed from mNetworkForNetId by the same method,
disconnectAndDestroyNetwork.

In this specific case it's not correct, because the call to
handleUpdateLinkProperties is from disconnectAndDestroyNetwork
itself via nai.clatd.update and calls Nat464Xlat#stop.

No other callers of handleUpdateLinkProperties are affected
because:

- EVENT_NETWORK_PROPERTIES_CHANGED is called only by
  maybeHandleNetworkAgentMessage, which first checks that the
  NetworkAgent is registered.
- handlePrivateDnsSettingsChanged only looks at registered
  NetworkAgents (it loops over mNetworkAgentInfos).
- handlePrivateDnsValidationUpdate, handleNat64PrefixEvent and
  handleCapportApiDataUpdate call getNetworkAgentInfoForNetId,
  which will correctly determine that the agent is no longer
  registered, since they run on the handler thread and thus
  cannot run at the same time as disconnectAndDestroyNetwork.

The existing code contains a check for the netId being current.
This is intended to ensure that an update from a NetworkAgent
cannot affect another agent with the same Network. This extra
check is not necessary, because code running on the handler
thread can never observe a NetworkAgent in mNetworkAgentInfos
unless mNetworkForNetId maps that NetworkAgent's Network to that
NetworkAgent. This is because mNetworkForNetId is updated by the
same methods as mNetworkAgentInfos, and those updates occur on
the handler thread. So all code on the handler thread will see
those two as consistent.

Bug: 176496580
Test: atest FrameworksNetTests CtsNetTestCases HostsideVpnTests
Original-Change: https://android-review.googlesource.com/1727829
Merged-In: I944f4c6ad36206bdccd85a6ea7ef71324a29c685
Change-Id: I944f4c6ad36206bdccd85a6ea7ef71324a29c685
2021-06-11 13:46:33 +00:00
..
apex Mark tethering apex as compressible 2021-05-27 15:21:33 +01:00
apishim bpf: Add interface index to BPF devmap 2021-05-12 19:57:18 +08:00
bpf_progs import copy of bpf_net_helpers.h from system/netd/bpf_progs 2021-06-10 15:24:19 +00:00
common/TetheringLib Merge history of packages/Connectivity 2021-05-24 04:40:14 +00:00
jni Fix memory access violation in NetworkStack 2021-05-25 08:01:17 +00:00
res Merge "wifi: Add bridged pre-fix for tethering interface" am: 7e9e19c1ea am: 8f9ffbb097 am: 46116ca234 2021-01-18 02:57:22 +00:00
src Don't send onLinkPropertiesChanged after onLost for 464xlat. 2021-06-11 13:46:33 +00:00
tests Update TetheringTests for new connectivity shims 2021-06-10 13:44:00 +00:00
Android.bp Add tethering bootclasspath fragment to its sdk 2021-06-07 15:46:33 +01:00
AndroidManifest.xml Update language to comply with Android's inclusive language guidance 2020-08-07 05:40:26 +00:00
AndroidManifest_InProcess.xml Change tethering file structure to respect its package name 2020-04-14 12:25:03 +00:00
AndroidManifestBase.xml Add usesCleartextTraffic to Tethering 2020-08-19 08:56:10 +00:00
jarjar-rules.txt Update sources of Tethering module since it is renamed 2021-03-11 07:36:55 +00:00
OWNERS Revert "Add OWNERS block to prevent the tree from mooving during migration." 2020-11-05 03:16:29 +00:00
proguard.flags Fix proguard rules for Struct in NetworkStack 2021-04-14 01:30:59 +00:00
TEST_MAPPING Move TetheringTests to presubmit 2020-06-10 02:33:37 +00:00