Commit Graph

1760 Commits

Author SHA1 Message Date
Mark Chien
07584931b5 Merge "Disable tryCell when UpstreamMonitor stop" into sc-dev 2021-06-22 07:34:35 +00:00
Mark Chien
2d36831a38 Disable tryCell when UpstreamMonitor stop
tryCell configuration would not be force disabled UpstreamMonitor stop.
If tethering stop with using mobile upstream and swap with SIM fron no
dun to dun supported, dun request would be filed even tethering is not
active.

Bug: 173068192
Test: atest TetheringTests
Original-Change: https://android-review.googlesource.com/1715791
Merged-In: I5505655f52da9fdca2fd43a58e043a9ab727741d
Change-Id: I5505655f52da9fdca2fd43a58e043a9ab727741d
2021-06-22 03:17:53 +00:00
markchien
076ad01a4a Add enable and disable ip serving common functions
This is a op CL which prepare for refactor.

Bug: 185649441
Bug: 189410000
Bug: 178116595

Test: atest TetheringTests
Original-Change: https://android-review.googlesource.com/1730548
Merged-In: I270ff43c01736b9d18bd40a8e88e1379e9e4e863
Change-Id: I270ff43c01736b9d18bd40a8e88e1379e9e4e863
2021-06-22 11:04:02 +08:00
markchien
67bf9b5654 Allow to use ncm function for usb tethering
Adding the configuration to decide using rndis or ncm for usb tethering.
If ncm is configured for TETHEIRNG_USB, then TETHERING_NCM is not
available.

Bug: 162920185
Test: atest TetheringTests
      manul testing usb tethering
Original-Change: https://android-review.googlesource.com/1730541
Merged-In: Ifc7eee2457a950a0e2d1c3cc89a3373a7ad23c9c
Change-Id: Ifc7eee2457a950a0e2d1c3cc89a3373a7ad23c9c
2021-06-22 11:03:11 +08:00
Lorenzo Colitti
175fefc795 Correctly dump IPv4 downstream flows.
The current code does not print these correctly: it prints the
public address twice and then the NAT address. Fix this to print
the src, nat, and dst addresses.

Also dump the output MAC address.

Example output:

    IPv4 Upstream: [inDstMac] iif(iface) src -> nat -> dst [outDstMac] age
      [66:f1:6f:d8:66:0a] 31(31) 192.168.146.173:48594 -> 11(rmnet_data1) 100.100.109.185:48594 -> 8.8.8.8:853 [00:00:00:00:00:00] 32305ms
      [66:f1:6f:d8:66:0a] 31(31) 192.168.146.173:45806 -> 11(rmnet_data1) 100.100.109.185:45806 -> 8.8.4.4:853 [00:00:00:00:00:00] 32305ms
    IPv4 Downstream: [inDstMac] iif(iface) src -> nat -> dst [outDstMac] age
      [00:00:00:00:00:00] 11(rmnet_data1) 8.8.8.8:853 -> 31(31) 100.100.109.185:48594 -> 192.168.146.173:48594 [0e:a8:7f:ba:76:48] 32305ms
      [00:00:00:00:00:00] 11(rmnet_data1) 8.8.4.4:853 -> 31(31) 100.100.109.185:45806 -> 192.168.146.173:45806 [0e:a8:7f:ba:76:48] 32305ms

Test: manual
Bug: 190783768
Original-Change: https://android-review.googlesource.com/1737399
Merged-In: I93a82064c95027c7c63cb30baf8482ecddcbd09d
Change-Id: I93a82064c95027c7c63cb30baf8482ecddcbd09d
2021-06-16 13:25:33 +00:00
Nucca Chen
4425a6147c Improve dumping IPv4 map entries.
1. Dump both upstream and downstream rules.
2. Also dump rule last used time.

Test: manual
Bug: 190783768
Original-Change: https://android-review.googlesource.com/1737394
Merged-In: I3fffbf4a5dea68e61349de8b41bea49b8a319f86
Change-Id: I3fffbf4a5dea68e61349de8b41bea49b8a319f86
2021-06-15 08:20:31 +00:00
Treehugger Robot
898d5adb31 Dump underlying BPF traffic stats as well as higher-level stats.
This provides a better way to tell whether traffic is flowing.

Test: manual
Bug: 190783768
Original-Change: https://android-review.googlesource.com/1737393
Merged-In: If557b0a18fc0aea1bf6a65d91547fc1930098ed0
Change-Id: If557b0a18fc0aea1bf6a65d91547fc1930098ed0
2021-06-15 08:19:51 +00:00
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
Treehugger Robot
348d144786 import copy of bpf_net_helpers.h from system/netd/bpf_progs
after this:
  diff system/netd/bpf_progs/bpf_net_helpers.h packages/modules/Connectivity/Tethering/bpf_progs/bpf_net_helpers.h
shows no diff, besides a switch to '#pragma once'
as the include guard.

Test: builds, atest, TreeHugger
Bug: 177884581
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Original-Change: https://android-review.googlesource.com/1733033
Merged-In: Ib943321d46254ba64ce206fb9e3b3414d15e4d45
Change-Id: Ib943321d46254ba64ce206fb9e3b3414d15e4d45
2021-06-10 15:24:19 +00:00
TreeHugger Robot
3ea9a136fa Merge changes Ib8fe719f,Ia8c05780 into sc-dev
* changes:
  Suppress IpServer message logs
  Remove *Locked wording
2021-06-10 14:34:08 +00:00
Remi NGUYEN VAN
c94a1ffd55 Update TetheringTests for new connectivity shims
The stable connectivity shims are updated to now contain S API, so
tethering tests that assumed that compatibility R behavior was used need
to be updated.

To avoid such failures Tethering tests should have a test target using
updated shims (TetheringNextTests), but this was not done in S
timeframe.

Ignore-AOSP-First: topic needs differences in AOSP
Bug: 189581241
Test: atest TetheringTests
Change-Id: Ibc04e64a1e9d82b67aff10d1a6d77f9e6b1bbdfb
2021-06-10 13:44:00 +00:00
markchien
3b3d92ced0 Suppress IpServer message logs
To avoid log flooding, suppress CMD_IPV6_TETHER_UPDATE and
CMD_NEIGHBOR_EVENT message log because they appear frequentlg and
don't have any content which means they are ueseless for debugging.
Also remove logMessage from BaseServingState to fix duplicated
message because all the message already log in TetheredState
and LocalHotspotState which inherit BaseServingState.

Bug: 162920185
Bug: 185649441
Test: atest TetheringCoverageTests
      atest MtsTetheringTestLatestSdk
      atest CtsTetheringTest
Change-Id: Ib8fe719f3c1c4a65e6b5152df5e5adf33aba2079
Merged-In: Ib8fe719f3c1c4a65e6b5152df5e5adf33aba2079
2021-06-10 21:13:44 +08:00
markchien
8409a1c297 Remove *Locked wording
Since tethering run in single thread without any synchronized lock,
remove "Locked" wording from the methods which the use lock before.

Bug: 162920185
Test: atest TetheringCoverageTest
Change-Id: Ia8c057800cab30cdcbacae4db2d706b6427e9861
Merged-In: Ia8c057800cab30cdcbacae4db2d706b6427e9861
2021-06-10 21:13:07 +08:00
TreeHugger Robot
f15137fb9f Merge "Fix TetheringTest crash on eng build" into sc-dev 2021-06-09 07:57:25 +00:00
junyulai
9c5d40beca Fix TetheringTest crash on eng build
startTrackDefaultNetwork was allowed to called multiple times
before even though there is no one actually do it. However,
in the TetheringTest#verifyDefaultNetworkRequestFiled, a
manual invocation is used to ensure that function supports
multiple entrance.

But with aosp/1697371, startTrackDefaultNetwork is no longer
allowed to be called multiple times, it would lead to log.wtf
and crash system in eng build.

Since the manual invocation of startTrackDefaultNetwork is not
realistic and no longer valid anymore, remove the invocation
that caused the trouble.

Test: atest TetheringCoverageTests
Bug: 188613493
Merged-In: I61f6088783d521fd17ae1e87370842b4239fbe75
Change-Id: I61f6088783d521fd17ae1e87370842b4239fbe75
  (cherry-picked from aosp/1711433)
2021-06-09 01:57:37 +00:00
Anton Hansson
3669599dec Add tethering bootclasspath fragment to its sdk
This subsumes the java_sdk_library in the sdk.

Bug: 188427719
Test: build_mainline_modules.sh
Change-Id: Ib2ebb3893135b4dd91812f1f1b0915540cfd64cb
2021-06-07 15:46:33 +01:00
Nikita Ioffe
8148656efc Merge "Mark tethering apex as compressible" into sc-dev 2021-06-07 11:13:35 +00:00
Chiachang Wang
0acaa74538 Correct the logic for CtsTetheringUtils.isWifiTetheringSupported
The existing isWifiTetheringSupported only check if tethering side
supports wifi tethering or not but not wifi side. A expected
behavior should include both of them, so add the wifi side check
into the helper function. Also update in the existing caller side
due to a new parameter added.

Bug: 186061922
Test: atest MtsTetheringTestLatestSdk
Megred-In: Id69ac1d30ab2bbf23e870193335b139f54672636
Change-Id: Id69ac1d30ab2bbf23e870193335b139f54672636
Ignore-AOSP-First: cherry-pick
2021-06-04 13:29:38 +00:00
TreeHugger Robot
1dc094b2c0 Merge "Fix memory access violation in NetworkStack" into sc-dev 2021-05-31 08:02:13 +00:00
Nikita Ioffe
5f33357348 Mark tethering apex as compressible
Bug: 178713634
Test: presubmit
Change-Id: I621305e47b5b86408a72c622b1e367cd0e75f82c
Merged-In: I621305e47b5b86408a72c622b1e367cd0e75f82c
(cherry picked from commit 31cef5ebe2)
2021-05-27 15:21:33 +01:00
Anton Hansson
89eb55fb8a Include sdk versioning proto in tethering apex
Allows SdkExtensions to inspect its version to decide what the extension
sdk version is on-device.

Bug: 188787081
Test: m com.android.tethering and inspect
Ignore-AOSP-first: internal topic, will cherry-pick after submission
Change-Id: If2d28b02be871594fed1fbb40b7aad284b553afb
2021-05-25 13:01:31 +01:00
Maciej Żenczykowski
365ada7e04 Fix memory access violation in NetworkStack
Fix memory access violation in com_android_networkstack_tethering_BpfUtils.cpp
caused by invalid format string in com_android_networkstack_tethering_BpfUtils_isEthernet.
If rv is not valid, jniThrowException will format a string using
"Unknown hardware address type %s on interface %s". However, rv is an int but here
"%s" is used in fmt string, thus causing access violation of memory.

Use "%d" instead of "%s" for int.

Bug: 188757793
Original-Change: https://android-review.googlesource.com/1715797
Merged-In: I9d8ec0708efd747e24b3b3ffed5336434d4f64a7
Change-Id: I9d8ec0708efd747e24b3b3ffed5336434d4f64a7
2021-05-25 08:01:17 +00:00
Baligh Uddin
2afd0986d3 Merge history of packages/Connectivity
Modified Visibility / Includes for:
- Tethering/common/TetheringLib/Android.bp

Modified License Import for:
- framework/Android.bp
- service/Android.bp
- tests/common/Android.bp
- tests/deflake/Android.bp
- tests/integration/Android.bp
- tests/smoketest/Android.bp
- tests/unit/Android.bp
- tests/unit/jni/Android.bp
Modified Lint mapping for:
- framework/lint-baseline.xml
- service/lint-baseline.xml

BUG: 186628461
TEST: TH
Merged-In: Ie82d0fb34bda77543e31c82660c6f315efa87f62
Change-Id: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
2021-05-24 04:40:14 +00:00
Mark Chien
fcda6f1131 Merge "Test tethered callback with TetheringInterface" into sc-dev 2021-05-21 16:04:47 +00:00
markchien
2aa768a7e9 Fix tethering unit test fail in R am: 6cee9c5e04
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14660570

Change-Id: I357e2e93204fb67119e7ec81bcf9020b73912d88
2021-05-20 09:17:20 +00:00
markchien
82f99f95b7 Test tethered callback with TetheringInterface
The old callback only report interface list, new callback could provide
the mapping of interface and type. Replace old callback usage in cts
with new callback and check whether old callback could get the correct
interface list by comparing the result between old and new callback.

Bug: 162920185
Bug: 152203943
Test: atest CtsTetheringTest on S
      atest CtsTetheringTestLatestSdk on R
      atest MtsTetheringTestLatestSdk on S and R
Ignore-AOSP-First: Its dependences CL is not in aosp currently.

Change-Id: I2a0b8c43fb340c3eaed7f0f90464199222a24280
2021-05-20 09:02:39 +00:00
markchien
6cee9c5e04 Fix tethering unit test fail in R
The change aosp/1708088 break tethering unit test in R.

Bug: 187946226
Test: atest TetheringTests in R and S
Change-Id: I4eb4b757f6d7cd3458964c81310dcf0687a4f091
Merged-In: I4eb4b757f6d7cd3458964c81310dcf0687a4f091
2021-05-20 14:52:01 +08:00
Mark Chien
53fcccd8da Merge "Add the tethering type to TetheringEventCallback methods" into sc-dev 2021-05-18 14:48:27 +00:00
markchien
9935dbe03e Add the tethering type to TetheringEventCallback methods
Before this change, tethering always report a list of tethered
interfaces and the caller need to use each tethering type's interface
regex to matching tethered list to manual implement the mapping of
tethering type and interface. This change allow caller to get rid of
tethering interface regex.

Bug: 162920185
Bug: 152203943
Test: atest CtsTetheringTest on S
Ignore-AOSP-First: Currently aosp would automerge to mainlne-prod, merge
to sc-dev first to avoid adding new API to mainline-prod

CTS-Coverage-Bug: I already add cts test(ag/14622456), but Lint
still complaint because my cts is under packages/modules/Connectivity/
but it only check whether CL touching platform/cts
Change-Id: I91bcccd676d109c1b974497ac29bd366a41b8899
2021-05-18 14:47:43 +00:00
Artur Satayev
f8a1897b29 Merge "Add bootclasspath_fragment." into sc-dev 2021-05-18 14:06:03 +00:00
Mark Chien
e66481b436 Merge "Check whether feature is enabled by compare with apex version" am: 84a8a13a92 am: c59d6fa12d am: 2d577ad3d2
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1708088

Change-Id: Ifcc571196e302245816b663155bc57aabdef542b
2021-05-18 10:16:47 +00:00
Mark Chien
2d577ad3d2 Merge "Check whether feature is enabled by compare with apex version" am: 84a8a13a92 am: c59d6fa12d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1708088

Change-Id: Id993424e895917267ac5ffa43ab3362169c1d37c
2021-05-18 09:56:00 +00:00
Mark Chien
84a8a13a92 Merge "Check whether feature is enabled by compare with apex version" 2021-05-18 03:09:20 +00:00
Aaron Huang
985e1e337d Merge "Add required permission to Tethering" into sc-dev 2021-05-17 14:15:54 +00:00
TreeHugger Robot
4547356487 Merge "Use SettingsShim to hide different implementation in shim" into sc-dev 2021-05-15 06:27:38 +00:00
Mark Chien
540f0d3ce3 Merge "Test mts against last stable api level" am: a59a146b36 am: 9015e276aa am: 726b814899
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1686012

Change-Id: I9d2d08b9c9397c247e2afd54b25a21631233c585
2021-05-14 10:26:06 +00:00
Mark Chien
726b814899 Merge "Test mts against last stable api level" am: a59a146b36 am: 9015e276aa
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1686012

Change-Id: I34e9a66e7d603fe71c5ee1591787344e245b70ac
2021-05-14 10:03:22 +00:00
Mark Chien
a59a146b36 Merge "Test mts against last stable api level" 2021-05-14 09:00:11 +00:00
markchien
a3ef48117f Check whether feature is enabled by compare with apex version
Replace the isFeatureEnabled function which is check with apex version.

Bug: 187946226
Test: Set device config flag and check the result
Change-Id: Iba44a01e2fdd0698dcb338ea4a8fe8147cbaa7dd
2021-05-14 16:56:33 +08:00
Nucca Chen
1ed7317a2f Merge "bpf: Add interface index to BPF devmap" am: aa10ddfa6f am: 72bd34e343 am: 76cc470496
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1703125

Change-Id: I5669ff227f761da71d8ad12cf7e0a228b3621d81
2021-05-14 03:25:05 +00:00
Nucca Chen
76cc470496 Merge "bpf: Add interface index to BPF devmap" am: aa10ddfa6f am: 72bd34e343
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1703125

Change-Id: I8ed82b1f5b8fa35e398c6d8c3bc928a03ee6318c
2021-05-14 03:01:16 +00:00
Junyu Lai
d1c8af2783 Merge "[SP32.3] No-op refactoring of OffloadControllerTest" am: 4ec15d5d71 am: b8c3c59504
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1683006

Change-Id: I436b4a50f672bf6ea84b41efc973135b41b20f5e
2021-05-14 03:01:10 +00:00
Nucca Chen
aa10ddfa6f Merge "bpf: Add interface index to BPF devmap" 2021-05-14 02:45:38 +00:00
Junyu Lai
4ec15d5d71 Merge "[SP32.3] No-op refactoring of OffloadControllerTest" 2021-05-14 02:18:12 +00:00
Mark Chien
ec738f3e36 Merge "Revert "Add ACCESS_NETWORK_STATE to Tethering CTS"" into sc-dev 2021-05-13 17:45:31 +00:00
Mark Chien
0d18d18252 Revert "Add ACCESS_NETWORK_STATE to Tethering CTS"
This reverts commit 90255ef0a7.

Reason for revert: this change break TetheringCoverageTests which test whether guard with proper permission (ACCESS_NETWORK_STATE). Instead of adding permission to test, use runAsShell with ACCESS_NETWORK_STATE: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1699426/1/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java

Bug: 187371740

Change-Id: Id8f27dce237ab34c1a735ce4678e661a6113377e
2021-05-13 17:44:05 +00:00
TreeHugger Robot
4959976b6f Merge "Fix MtsTetheringTest fail to access hidden tethering api problem" into sc-dev 2021-05-13 17:31:01 +00:00
Mark Chien
b88f9f0575 Merge "Fix some TetheringCoverageTest failure" am: 08b89743de am: bf74c05038 am: 3d4f367a25
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1699426

Change-Id: Id89d14377c2df4055d7a701129449a68007d40f1
2021-05-13 16:45:01 +00:00
Mark Chien
3d4f367a25 Merge "Fix some TetheringCoverageTest failure" am: 08b89743de am: bf74c05038
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1699426

Change-Id: I8d522afdf7e1b9ec26fbd4f491f7b95e9ccfecc6
2021-05-13 16:22:01 +00:00
TreeHugger Robot
3345125c08 Merge changes from topic "sp31" into sc-dev
* changes:
  [SP35] Pass data warning to tethering offload
  [SP34] Adapt onSetWarningAndLimit
2021-05-13 15:52:59 +00:00