Commit Graph

600 Commits

Author SHA1 Message Date
Junyu Lai
80ccb96458 Merge "No-op Refactoring of startTrackDefaultNetwork" am: 7fecf6a017 am: 784f54eefb
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1697371

Change-Id: Ieda8a53749f35b5585488a1a6bd5e20b7891e75d
2021-05-13 15:06:56 +00:00
Junyu Lai
7fecf6a017 Merge "No-op Refactoring of startTrackDefaultNetwork" 2021-05-13 14:32:00 +00:00
junyulai
b95083ea6a No-op Refactoring of startTrackDefaultNetwork
While the actual part that track default request is inside
UpstreamNetworkMonitor, instead of passing it from Tethering,
move it into counter-part CL and use it from
UpstreamNetworkMonitor.

Since the current code is replaced by registerSystemDefaultCallback
in Android S, implement it inside the api30 shim implementation
to provide an unified interface to tethering.

Test: atest TetheringCoverageTests
Bug: 185952829
Change-Id: Iaf21b6b662aa6aba79c2b75379128b8523f81f02
2021-05-13 14:07:40 +08:00
Lorenzo Colitti
38bf66f05d Remove dead code. am: 2422319cb7 am: 9d288a6904
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1703126

Change-Id: I3913a868982465f304ea5f48da538096dd900641
2021-05-12 10:55:46 +00:00
Lorenzo Colitti
b541f5fdfd Remove mPublicSync. am: 94311aa902 am: c0f1bed8c5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1678387

Change-Id: I8bc28ee7ed0a658e7218a00c82cb038a58c15d00
2021-05-12 10:55:44 +00:00
Lorenzo Colitti
2bea99a840 Make Tethering#dump asynchronous. am: 5f729e14a3 am: c7a163bae8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1678386

Change-Id: I000322644add81eb1bc366cf71e7cd308bcda555
2021-05-12 10:55:43 +00:00
Lorenzo Colitti
2422319cb7 Remove dead code.
Remove a few legacy methods that have no callers.

Test: m
Change-Id: I499e940dc98453194fc528d65a89696471ad8bdd
2021-05-12 17:35:49 +09:00
Lorenzo Colitti
94311aa902 Remove mPublicSync.
This is no longer necessary as all the methods that take it are
running on on the handler thread, either in Tethering itself or
on the state machine thread in IpServer, which runs on the same
thread as Tethering.

Specifically:
- interfaceStatusChanged, interfaceAdded, interfaceRemoved,
  interfaceLinkStateChanged: run from mNetdCallback, which always
  posts them to mHandler.
- setWifiTethering: only called by enableTetheringInternal, which
  is called by the following:
  - startTethering, stopTethering: via lambda posted to mHandler
  - IpServerCallback#requestEnableTethering: called by IpServer
    while processing a command.
- setEthernetTethering: only called by enableTetheringInternal.
- EthernetCallback: runs on mExecutor, which posts to mHandler.
- getLastTetherError: only used by the test. Renamed to
  getLastErrorForTest to ensure no other callers.
- sendTetherStateChangedBroadcast: called only by
  notifyInterfaceStateChange, which is called only by
  - IpServerCallback#updateInterfaceState, which is called only
    by sendInterfaceState, which is called by various IpServer
    state enter methods.
- notifyLinkPropertiesChanged: called only by
  IpServerCallback#updateLinkProperties, which is only called by
  IpServer#sendLinkProperties, which is only called by:
  - Code that processes CMD_IPV6_TETHER_UPDATE
  - IpServer#handleNewPrefixRequest: only called when processing
    CMD_NEW_PREFIX_REQUEST.
  - IpServer#sendInterfaceState (see above)
- handleWifiApAction, handleWifiP2pAction: only called by
  mStateReceiver, which runs on the handler thread
- tether(String, int): called by:
  - tether(String, IIntResultListener): posted to mHandler
  - changeInterfaceState: called by:
    - EthernetCallback (see above)
    - enableWifiIpServingLocked: called by handleWifiApAction and
      handleWifiP2pAction (see above)
    - tetherMatchingInterfaces: only called by handleUsbAction,
      which is run from mStateReceiver on the handler thread.
- untether(String): called by:
  - untether(String, IIntResultListener): posted to mHandler
  - changeInterfaceState (see above)
- setUsbTethering: called by:
  - setUsbTethering(boolean, IIntResultListener): posted to mHandler
  - enableTetheringInternal (see above)
- setNcmTethering: called by enableTetheringInternal (see above)
- getTetheredIfaces: called only by TetheringTest. Renamed to
  getTetheredIfacesForTest to ensure no other callers.
- getErroredIfaces: unused, deleted in this CL
- getTetheredIfaces: called by:
  - isTetheringActive: called by onUserRestrictionsChanged, which
    is only called by mStateReceiver
  - TetheringTest
- dump(): changed to run on handler thread
- upstreamWanted: called by
  - TetherModeAliveState#enter
  - TetherModeAliveState#updateUpstreamWanted, which is called
    only by TetherModeAliveState#processMessage.

Test: atest TetheringCoverageTests
Test: enabled/disabled hotspot, USB tethering
Change-Id: Id49d33f027b8df4c97fda480ff239c0ba90bb96a
2021-05-12 17:35:49 +09:00
Lorenzo Colitti
5f729e14a3 Make Tethering#dump asynchronous.
This is in preparation for removing mPublicSync.

Test: m
Test: adb shell dumpsys tethering
Test: atest TetheringTests TetheringIntegrationTests
Change-Id: Ib2c9d0bff23614f76c8e075d32cb03412d3d21f7
2021-05-12 17:35:49 +09:00
Mark Chien
81cb8cf02c Merge "Release mobile request when default upstream is not mobile" am: 07f8a618d2 am: d4b21984e9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1679667

Change-Id: Id1a6fe30e93d175ba8e67bbafa05df7aa6e1f182
2021-04-23 12:23:23 +00:00
Mark Chien
07f8a618d2 Merge "Release mobile request when default upstream is not mobile" 2021-04-23 11:48:36 +00:00
markchien
d5096f504d Release mobile request when default upstream is not mobile
Some OEM may have special mobile data icon show up when non-default
(e.g. DUN) mobile connection connected even wifi is also connected.
So always connected DUN may let user hard to distinguish tethering
upstream in those OEM's devices. Also release unused mobile connection
may safe power.

This CL removes unnecessary code from selectPreferredUpstreamType.
In particular:
    - When a DUN or HIPRI upstream is selected, calling
    registerMobileNetworkRequest is unnecessary. A mobile
    NetworkRequest is always registered unless a non-mobile upstream
    is selected.

    - When a non-mobile upstream is found, releasing the mobile
    NetworkRequest is unnecessary in selectPreferredUpstreamType
    because it will be done by chooseUpstreamType immediately after
    selectPreferredUpstreamType returns.

    - When no upstream is found and cellular upstream is not permitted,
    it is not necessary to release the mobile NetworkRequest. When
    cellular is not permitted, no such NetworkRequest will be filed
    because registerMobileNetworkRequest checks with EntitlementManager
    before actually requesting the network. If cellular becomes the
    upstream and then later becomes not permitted because of an
    entitlement failure, all tethering will be stopped by Settings.

Note: currently legacy upstream selection has two known bugs:
1. If mobile has higher priority than non-mobile network, mobile request
should never be released and always prefer use mobile. But in practice,
mobile request would be released when tethering select non-mobile network
as upstream.
2. If mobile has higher priority than wifi network and default network
is wifi but mobile is still connected, tethering would choose mobile as
upstream because it has higher priority. Mobile disconnecting may not
trigger tethering to switch its upstream to wifi because currnetly
tethering rely on CONNECTIVITY_ACTION broadcast to handle upstream
disconnect.

Bug: 173068192
Test: atest TetheringTests
Change-Id: Id5df58af830cc534ecd79041ddf8a04171047e9b
2021-04-23 16:45:29 +08:00
Lorenzo Colitti
f772ab1c61 Merge "Allow callers of startTethering to choose local-only mode." am: ac9ce08d45 am: af691a13b6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674232

Change-Id: I9c88d0d05c6dbb0bac65b72e8d54df5eb25b4060
2021-04-19 14:51:21 +00:00
Lorenzo Colitti
8a36c297bc Allow callers of startTethering to choose local-only mode.
This is useful for OEMs that want to use RNDIS or NCM as a
local-only link that is directly connected to some other host.
This can be used to implement USB tethering using NCM, which
currently only supports local-only mode.

Bug: 175090447
Test: TetheringIntegrationTests:EthernetTetheringTest#testLocalOnlyTethering
Change-Id: I0ffaa46e4640e5b235340a15d25909106ceb0c07
2021-04-19 20:25:58 +09:00
Treehugger Robot
95587e12d5 Merge "Put tether/untether calls into handler queue" am: 2576c457de am: 0ea3966a88
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1535794

Change-Id: I8525c8f800641defa45ef3e4072e6a7a8ac86c49
2021-04-15 16:04:57 +00:00
Treehugger Robot
2576c457de Merge "Put tether/untether calls into handler queue" 2021-04-15 14:46:25 +00:00
Lorenzo Colitti
ffc11490ca Fix a tethering crash when a 464xlat upstream disconnects. am: a329e8c984 am: dadc2fe3bb
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1671533

Change-Id: Ia7e17399aa5da6bbb84419ef2d840cf14ee70ea9
2021-04-12 16:15:17 +00:00
Lorenzo Colitti
a329e8c984 Fix a tethering crash when a 464xlat upstream disconnects.
When a 464xlat upstream disconnects, onLinkPropertiesChanged is
called after onLost. This breaks an UpstreamNetworkMonitor
assumption that no callback will ever arrive after onLost.

Bug: 173068192
Fix: 185117377
Test: new unit test
Change-Id: I4ff1eca6d5ed1680ff716c71b683891c8a0e5a77
2021-04-12 15:00:24 +00:00
Nucca Chen
79206b9906 Merge "[NFCT.TETHER.11] Test TetherOffloadRule{Add, Remove} and set limit for IPv4" am: 68f6f5fe79 am: f0b3bb6e4e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1563332

Change-Id: I44483470e1213716874dcdb07317f3ddb4c72b9d
2021-04-08 13:30:26 +00:00
Nucca Chen
68f6f5fe79 Merge "[NFCT.TETHER.11] Test TetherOffloadRule{Add, Remove} and set limit for IPv4" 2021-04-08 12:02:15 +00:00
Xiao Ma
d39b5b9888 Apply IPv6 utils struct stuff to build RA packet in the Daemon. am: 3e557d777a am: 7f8ae5c99d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1614996

Change-Id: I640b6995bad3fb111bb4bd3e1b2194dac6aea101
2021-04-08 06:35:33 +00:00
Xiao Ma
3e557d777a Apply IPv6 utils struct stuff to build RA packet in the Daemon.
Traffic log of testSolicitRouterAdvertisement:
fe80::4473:4aff:fecb:7799 > ff02::1: ICMP6, router advertisement, length 88
fe80::1122:3344:5566:7788 > ff02::1: ICMP6, router solicitation, length 16
fe80::4473:4aff:fecb:7799 > fe80::1122:3344:5566:7788: ICMP6, router advertisement, length 88

Bug: 154669942
Test: atest TetheringPrivilegedTests --iterations
Change-Id: I7defb80ef9dd1832c9e04d154e1d06aed9e733dc
2021-04-08 04:50:49 +00:00
Nucca Chen
8841c53701 Merge changes I515be275,Ied159454,I5a29bdd1 am: 8ba40704f3 am: 7cc20e1782
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1662791

Change-Id: Iecd18825990c22add32cdbb16b8ff86a8a06487c
2021-04-07 15:31:05 +00:00
Nucca Chen
8ba40704f3 Merge changes I515be275,Ied159454,I5a29bdd1
* changes:
  bpf_progs - adjust for dstMac addition
  Populate the key destination mac address
  Set the limit whenever any IPv4 or IPv6 rule exists.
2021-04-07 14:08:37 +00:00
Maciej Żenczykowski
cb2064eeff Merge "implement insertOrReplace()" am: 47851fc01b am: 40899ff9e8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1662788

Change-Id: Ia4fe20d67bacf5e3e0fa424aeacf1d113db02fdc
2021-04-06 09:17:40 +00:00
Maciej Żenczykowski
47851fc01b Merge "implement insertOrReplace()" 2021-04-06 08:17:42 +00:00
Lorenzo Colitti
505a805d70 Fix a race condition in upstream selection. am: 491999292b am: bf8a7b622d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1662400

Change-Id: I62d575655a0f4880f0f2c2a793bf9eb1ca9295dc
2021-04-06 04:42:40 +00:00
Maciej Żenczykowski
a36ea6fb19 implement insertOrReplace()
Test: atest com.android.networkstack.tethering.BpfMapTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4a40898f03293d6d79b57c35f743271c669a8ea7
2021-04-06 04:38:46 +00:00
Lorenzo Colitti
491999292b Fix a race condition in upstream selection.
Current upstream selection code suffers from a race where if the
CONNECTIVITY_ACTION broadcast for a given network switch is
received and processed before the NetworkCallbacks for that
network switch, upstream selection just re-selects the same
upstream it had before. The incorrect upstream persists until
another CONNECTIVITY_ACTION is received.

Fix this by defining a new EVENT_DEFAULT_SWITCHED message code
communicated from UpstreamNetworkMonitor to Tethering, and send
that whenever the default network switches.

The message is sent in onLinkPropertiesChanged, because the
tethering code stores all information about networks in an
UpstreamNetworkState structure that contains Network,
LinkProperties and NetworkCapabilities. When a network switch
occurs, onLinkPropertiesChanged always follows onAvailable and
onCapabilitiesChanged, and thus marks the first point in time
when all the information is available.

This CL tries not to change existing codepaths too much, but
it does move the update of mDefaultInternetNetwork from
onCapabilitiesChanged to onLinkPropertiesChanged. This should
not be a problem because the only thing that reads
mDefaultInternetNetwork is getCurrentPreferredUpstream, which,
in the case of a default network switch, will be run by the
onLinkPropertiesChanged which will immediately follow.

Bug: 173068192
Test: changes to existing unit tests show bug is fixed
Change-Id: Ic9196bc92892811b25bda463ffd839ee5c19d294
2021-04-05 22:52:13 +09:00
Lorenzo Colitti
cf257bb217 Dump the input destination MAC address for IPv4 flows. am: e9bc8c9db7 am: a16ca88456
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1662403

Change-Id: I6725ba6f2d2fb07b05f85ac1cacd2ea22e6a5d84
2021-04-02 10:01:25 +00:00
Lorenzo Colitti
e9bc8c9db7 Dump the input destination MAC address for IPv4 flows.
This is needed for forwarding to work, so it should be dumped.

New output:

  Forwarding rules:
    29(29) -> 14(rmnet2) 86dd 00:00:00:00:00:00 00:00:00:00:00:00
    [ap_br_wlan2]: iif(iface) oif(iface) v6addr srcmac dstmac
      14(rmnet2) 29(ap_br_wlan2) 2001:240:2423:13fa:3c21:e35a:6a59:ff8a da:17:fd:70:3d:14 26:5b:b2:ee:bc:ba
    IPv4: [inDstMac] iif(iface) src -> nat -> dst
      [da:17:fd:70:3d:14] 29(29) 192.168.222.151:39208 -> 14(rmnet2) 100.102.14.231:39208 -> 172.217.175.3:80
      [da:17:fd:70:3d:14] 29(29) 192.168.222.151:47386 -> 14(rmnet2) 100.102.14.231:47386 -> 216.58.197.196:443

Also add a call to getHostAddress() to remove the / on IPv6
forwarding rules.

Test: manual
Change-Id: I347ea5a3fd88c51f1fae0c76c75dfa30c68a55ad
2021-04-02 05:42:22 +00:00
Aaron Huang
985a17dfae Merge "Update import class of TAG_SYSTEM_NEIGHBOR" am: 5316e1ff18 am: 9c3cfaa9b8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1626079

Change-Id: I11f5bf7f264d48d6ad0dab63aace39fc85251cf0
2021-04-01 16:45:13 +00:00
Aaron Huang
5316e1ff18 Merge "Update import class of TAG_SYSTEM_NEIGHBOR" 2021-04-01 15:59:39 +00:00
Hungming Chen
8078b9abfa [NFCT.TETHER.11] Test TetherOffloadRule{Add, Remove} and set limit for IPv4
Add a unit test to verify that BPF coordinator access downstream4
and upstream4 map while the conntrack event was received.

Verify shim API for IPv4:
- tetherOffloadRuleAdd
- tetherOffloadRuleRemove
- tetherOffloadGetAndClearStats
- tetherOffloadSetInterfaceQuota
- isAnyIpv4RuleOnUpstream

Test: atest TetheringCoverageTests

Change-Id: Ia57f07990d8750fd6ff67d7f4a18aa610336024a
2021-04-01 18:30:47 +08:00
Hungming Chen
9b8c60629f Populate the key destination mac address
Required because XDP offload needs input interface mac address
to be a part of the key. The mac address is used for checking
packets which are received from exceped input interface.

Test: atest TetheringCoverageTests, TetheringPrivilegedTests
Change-Id: Ied159454b516c0d70efe0a85744d1bb606892f2d
2021-04-01 18:30:43 +08:00
Lorenzo Colitti
dc6715c6f8 Set the limit whenever any IPv4 or IPv6 rule exists.
Currently, BpfCoordinator only sets the data limit on a given
upstream whenever the first IPv6 rule is created on that
upstream, and clears it whenever the last rule is deleted on that
upstream. It never does this when adding or removing IPv4 rules.

This makes it impossible to offload traffic on IPv4-only
networks.

Fix this by setting the limit when IPv4 rules are created or
deleted as well.

Test: atest TetheringCoverageTests
Manual tests as the follows
Test {add, clear} limit with IPv6-only network [OK]
Test {add} limit with IPv4-only upstream [OK]

TODO:
Test {clear} limit with IPv4-only network. blocked by aosp/1579873
because the IPv4 rules have never deleted.

Change-Id: I5a29bdd18e564318759f617023163e23fb5a3ed0
2021-04-01 18:30:43 +08:00
Lorenzo Colitti
ef85c9dcc4 Make Tethering file NetworkRequests only if needed. am: 2bcde0fd97 am: cce64f0dd7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1556199

Change-Id: Id07332dfcdd7f3430a67fc7a7dcade4139c7c4ab
2021-04-01 08:39:16 +00:00
Lorenzo Colitti
ce664ec1cf Expose upstream requirements to UpstreamNetworkMonitor. am: 0e7e32ab2c am: 9dcd8587ed
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1556198

Change-Id: I285334ac1096dcbd3102961f4d9bd7f44f2dcded
2021-04-01 08:39:15 +00:00
Lorenzo Colitti
2bcde0fd97 Make Tethering file NetworkRequests only if needed.
Currently, Tethering files NetworkRequests even when
config_tether_upstream_automatic is enabled. This is incorrect:
when the automatic upstream selection is enabled, the tethering
upstream should always follow the default network and there is
no need to file any requests.

These requests are harmful when tethering is not using cellular
as its upstream, because:

- If the device does not use mobile data always on, the request
  causes the cellular network to be brought up, causing power
  draw.
- Even if the device does use mobile data always on, the request
  causes the cellular network to come to the foreground, which
  allows all apps to access it, causing potential data usage.

Amend the existing testGetCurrentPreferredUpstream to cover these
changes, by making that test case always set automatic upstream
mode. This does not result in any loss of meaningful test
coverage, because getCurrentPreferredUpstream is only ever called
when chooseUpstreamAutomatically is enabled.

Bug: 173068192
Test: atest TetheringTests
Change-Id: I068a5338699a3ed04f24f97f785ea89ff5890e50
2021-03-31 19:27:17 +09:00
Lorenzo Colitti
0e7e32ab2c Expose upstream requirements to UpstreamNetworkMonitor.
UpstreamNetworkMonitor is the part of tethering that files
NetworkRequests for upstream netwoks, but it currently does not
know all the requirements for upstream selection. For example, it
does not know whether automatic upstream selection is in use.
This forces the upstream selection code to be split between
UpstreamNetworkMonitor and Tethering. This makes it difficult to
follow.

This CL ensures that all information about upstream requirements
(DUN required, automatic upstream selection, tryCell) is passed
to UpstreamNetworkMonitor so it can be aware of it.

This CL also removes the ability for UpstreamNetworkMonitor's
callers to call registerMobileNetworkRequest or
releaseMobileNetworkRequest. In a future CL, this will be
automatically done by UpstreamNetworkMonitor depending on the
upstream requirements.

This CL is a no-op refactoring with no behaviour changes.

Bug: 173068192
Test: atest TetheringTests
Change-Id: I174f765c616e0dbe2aa493c12613e6131cff0666
2021-03-31 19:27:17 +09:00
Maciej Żenczykowski
cfd48295b3 Merge changes Ibe325714,I44f3dc9e am: 63be468bf4 am: 3828871130
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1644628

Change-Id: I456582e52c4991fb5e1c53e772ef14621d5434d6
2021-03-18 22:42:04 +00:00
Maciej Żenczykowski
af1f314cbd change PRIO_CLAT into a comment
Test: atest, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I44f3dc9e3a3462f275a04ed5601370f664b985a2
2021-03-18 02:33:56 -07:00
Aaron Huang
e931b159dd Update import class of TAG_SYSTEM_NEIGHBOR
TrafficStatsConstants.TAG_SYSTEM_NEIGHBOR is moved to
NetworkStackConstants so update the import class name for it.

Bug: 182349970
Test: FrameworksNetTests
      NetworkStackTests
      TetheringTests
Change-Id: I8fcd2772ed873d318233d3029184e4352245d4cd
Merged-In: I8fcd2772ed873d318233d3029184e4352245d4cd
2021-03-17 14:03:07 +08:00
Treehugger Robot
cf31e5cbe4 Merge "Do not start conntrack event monitor when running on R" am: c162fc297f am: de2d7bef3b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1639703

Change-Id: Iaebb922ecd5a62eb548f0ed6fede51c0ae8618a3
2021-03-16 09:05:49 +00:00
Treehugger Robot
c162fc297f Merge "Do not start conntrack event monitor when running on R" 2021-03-16 08:03:46 +00:00
Hungming Chen
23ee901e76 Do not start conntrack event monitor when running on R
Starting conntrack event monitor on R devices is unnecessary because
no code uses them.

Bug: 177884581
Test: atest TetheringCoverageTests
Change-Id: I036cb8e29b32a4e220da9a52849b978a6ab821e4
2021-03-16 14:18:32 +08:00
Lorenzo Colitti
b0f7c1ce6a Merge "Do not open BPF maps when running on R." am: d12f867cb0 am: 9bcb23851b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1635300

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Idf409e9d933b5a92e90597bcc3d8e9f16fa17b70
2021-03-15 14:25:29 +00:00
Lorenzo Colitti
3c228f4923 Do not open BPF maps when running on R.
Opening the maps on R devices is unnecessary (because no code
uses them) and unsafe (because the maps might actually be in a
different format than expected by the module).

Always return null when opening the maps, so the code will safely
fall back to using netd for anything.

This only affects dump(). The production code never opens the
maps except via the shim, and only the S shim opens the maps.
Also check isAtLeastS in dumpCounters, because it opens the map
directly.

Bug: 177884581
Test: builds, boots, "dumpsys tethering" shows expected output
Change-Id: I5884490a5cc40fc529a12100ae5baaeae6a18f30
2021-03-15 10:44:53 +00:00
Maciej Żenczykowski
f0424798ce Merge changes from topic "attach_bpfprog_in_mainline" am: 3357388742 am: 5254c0c243
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1607973

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I041c6fbd65444d1a01387038e0dfabb6b33944ba
2021-03-12 01:37:01 +00:00
Hungming Chen
5af3ee5da0 [NFCT.TETHER.14] Clear the BPF maps in BpfCoordinator ctor am: 499d3cac73 am: 129077bd58
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1623669

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6d09c8f877c717670cf2e1462ec0146b1a0106dd
2021-03-12 01:37:00 +00:00