Commit Graph

1879 Commits

Author SHA1 Message Date
Maciej Żenczykowski
212fa79a4b Merge "ipv4 tethering offload - decrement ttl during forwarding" am: f21f5357e7 am: f54ce8312b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1755049

Change-Id: Idb6f95c96fa7832f4482fb6fc0237bb242ca8794
2021-07-02 21:36:48 +00:00
Maciej Żenczykowski
f21f5357e7 Merge "ipv4 tethering offload - decrement ttl during forwarding" 2021-07-02 21:06:41 +00:00
Maciej Żenczykowski
c29af79e26 ipv4 tethering offload - decrement ttl during forwarding
Bug: 192635131
Test: atest, TreeHugger, flashed on phone, forwarded ipv4 traffic
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I88e5293a54b7867a8e7dd76f6fd8e2a52d31e51a
2021-07-02 11:33:17 +00:00
Nucca Chen
64aab1a2a3 Merge "Dump the protocol of IPv4 offload rule" am: 3746fdd293 am: 68657e4e99
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1753608

Change-Id: I9847a5c00e9e2ca5ccaa0325016c26028c233784
2021-07-01 07:55:27 +00:00
Nucca Chen
3746fdd293 Merge "Dump the protocol of IPv4 offload rule" 2021-07-01 07:27:20 +00:00
Hungming Chen
3004f0d8d9 Dump the protocol of IPv4 offload rule
Print the protocol {tcp, udp} of v4 rules in dumpsys.

Format:
proto [inDstMac] iif(iface) src -> nat -> dst [outDstMac] age
  udp [00:00:00:00:00:00] 14(rmnet0) 74.125.10.156:443
  -> 30(30) 10.254.92.123:60262 -> 192.168.128.240:60262
  [0a:bd:b5:e0:41:53] 96067ms

Bug: 190783768
Test: dumpsys tethering
Change-Id: Idae1042cfb454cc97b9b103587f11bc0700e0787
2021-07-01 11:52:12 +08:00
Remi NGUYEN VAN
4a980eebf5 Merge "Apply jarjar rules on coverage tests" am: d590b30f72 am: 073f6e299a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749680

Change-Id: I80209723541bdfb8f5b08cd5e9cf0e76afa3593e
2021-07-01 01:08:32 +00:00
Remi NGUYEN VAN
d590b30f72 Merge "Apply jarjar rules on coverage tests" 2021-06-30 23:53:57 +00:00
Remi NGUYEN VAN
8ea5ee6d33 Apply jarjar rules on coverage tests
Apply their respective jarjar rules on tethering and general
connectivity tests, then merge both into the coverage tests suite.
This is necessary to ensure that classes covered by tests have names
matching classes used in code.

Also fix IpConnectivityLogTest to use the module utility instead of the
hidden BitUtils, as the test would fail after internal utils are
jarjared.

Bug: 187935317
Test: atest ConnectivityCoverageTests TetheringCoverageTests
Change-Id: Ib95b58dab93f7adebc445b662a6d15db1ce0e7c2
2021-06-30 16:00:26 +09:00
Paul Duffin
f9a0c868c4 Enable tethering to perform its own hidden API processing
Previously, the hidden API encoding of the tethering boot dex jars,
i.e. those dex jars that tethering contributes to the bootclasspath
were done as part of the monolithic hidden API processing. This change
causes the encoding to be done by the tethering's
bootclasspath_fragment.

This change involves the following:
* Addition of the fragments property to the tethering's
  bootclasspath_fragment module to list all the other
  bootclasspath_fragment modules on which this depends.
* Addition of the additional_stubs property to add stubs for APIs that
  are not provided by another bootclasspath_fragment.

The build automatically checks that the hidden API flags which are
computed by tethering and encoded into its boot dex jars match those
that are generated by the monolithic processing so this is guaranteed
to be safe.

Bug: 179354495
Test: m com.android.tethering
      - ensure that the generated APEX is byte-for-byte identical
        before and after these changes.
      m out/soong/hiddenapi/hiddenapi-flags.csv
      - make sure that they are not changed by this.
(cherry picked from b28cb44e4b)

Merged-In: I4d9621325c7fcea5043cbca4c577ba2ac6125c0c
Change-Id: I4d9621325c7fcea5043cbca4c577ba2ac6125c0c
2021-06-30 00:00:41 +01:00
Hungming Chen
a2a34a90d7 Dump the unused IPv4 BPF rule age correctly am: e7dff2f955 am: e9deba21ad
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1751022

Change-Id: I3704db91381858a88f51972692af78f14e6d2e0c
2021-06-29 16:22:38 +00:00
Hungming Chen
e7dff2f955 Dump the unused IPv4 BPF rule age correctly
Print a dash for the unused "lastUsed" of the rule.

The age should not equal the bootime if the rule has never been
updated the "lastUsed" field.

Format:
[inDstMac] iif(iface) src -> nat -> dst [outDstMac] age
[00:00:00:00:00:00] 14(rmnet0) 140.112.8.116:443
-> 30(30) 10.170.56.233:43720
-> 192.168.45.236:43720 [be:34:40:28:33:5f] -

Test: dumpsys tethering
Change-Id: Ie771becd2f72518cf02a86e5ae228315785752a5
2021-06-29 16:21:49 +08:00
Paul Duffin
65c5f4205b Merge "Enable tethering to perform its own hidden API processing" into sc-dev am: 4c94d16ced
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15106963

Change-Id: Ia64cc9a69cea5a79861a5245447908f302ab4d24
2021-06-29 06:57:03 +00:00
Paul Duffin
4c94d16ced Merge "Enable tethering to perform its own hidden API processing" into sc-dev 2021-06-29 06:43:40 +00:00
Treehugger Robot
897ed3fc3d Merge "Fix OffloadControllerTest on R" am: 767b2180e9 am: 634ad9792d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1748154

Change-Id: I2cd282bf6d7a4638cbb65f20f2ccd886ec113713
2021-06-29 05:24:11 +00:00
Treehugger Robot
767b2180e9 Merge "Fix OffloadControllerTest on R" 2021-06-29 05:02:47 +00:00
Paul Duffin
b28cb44e4b Enable tethering to perform its own hidden API processing
Previously, the hidden API encoding of the tethering boot dex jars,
i.e. those dex jars that tethering contributes to the bootclasspath
were done as part of the monolithic hidden API processing. This change
causes the encoding to be done by the tethering's
bootclasspath_fragment.

This change involves the following:
* Addition of the fragments property to the tethering's
  bootclasspath_fragment module to list all the other
  bootclasspath_fragment modules on which this depends.
* Addition of the additional_stubs property to add stubs for APIs that
  are not provided by another bootclasspath_fragment.
* Moving hidden API flag file entries related to tethering from the
  flag files in frameworks/base/boot/hiddenapi directory into the
  tethering directory with an appropriate OWNERS file to allow them to
  be managed by the Soong and compat team.
* Addition of a PREUPLOAD.cfg hook script to ensure that the flag files
  are sorted.

The build automatically checks that the hidden API flags which are
computed by tethering and encoded into its boot dex jars match those
that are generated by the monolithic processing so this is guaranteed
to be safe.

Bug: 179354495
Test: m com.android.tethering
      - ensure that the generated APEX is byte-for-byte identical
        before and after these changes.
      m out/soong/hiddenapi/hiddenapi-flags.csv
      - make sure that they are not changed by this.
Change-Id: I4d9621325c7fcea5043cbca4c577ba2ac6125c0c
Ignore-AOSP-First: merge conflicts
2021-06-28 23:41:38 +01:00
Treehugger Robot
aad77e7ce4 Merge "Make "dumpsys tethering" print the number of registered callbacks." am: 1e50b3ea24 am: 2d4eb7e18d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749480

Change-Id: Ia2351cde37d919b7dba7b609b556c08533a978ff
2021-06-28 10:15:26 +00:00
Treehugger Robot
1e50b3ea24 Merge "Make "dumpsys tethering" print the number of registered callbacks." 2021-06-28 09:50:04 +00:00
Treehugger Robot
bb8f070cb3 Merge "Remove wigig support from S tethering" am: 0b44491744 am: 8027e83cf1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1744652

Change-Id: I80b9877ef5d0bc21a2bdb31d506214d5823d5dc6
2021-06-28 08:16:56 +00:00
Treehugger Robot
0b44491744 Merge "Remove wigig support from S tethering" 2021-06-28 07:51:07 +00:00
Remi NGUYEN VAN
9f4a31af59 Merge "Fix ConnectivityManagerTest initialization on Q" am: 72f59b3019 am: 82a32e3f4a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1740779

Change-Id: I40abcac7db563480fe3c13fb5e0178d7a3629652
2021-06-28 07:40:27 +00:00
Remi NGUYEN VAN
72f59b3019 Merge "Fix ConnectivityManagerTest initialization on Q" 2021-06-28 07:24:49 +00:00
Mark Chien
4114bb1a2a Merge "Fix and test usb function configuration change" am: 840e2efd7f am: 717c8ff590
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1740778

Change-Id: Iac2ab9a589c878bee92179956df7802ea51c7a3e
2021-06-28 04:39:21 +00:00
Mark Chien
840e2efd7f Merge "Fix and test usb function configuration change" 2021-06-28 04:16:14 +00:00
Lorenzo Colitti
ced68f5993 Make "dumpsys tethering" print the number of registered callbacks.
Test: manual
Bug: 177265744
Change-Id: I07f56459125d5629dcafe5683eecb42d0ef9e2bd
2021-06-28 12:46:37 +09:00
markchien
34f7857b07 Fix and test usb function configuration change
Allow stop TETHERING_NCM no matter ncm is used for TETHERING_USB or
TETHERING_NCM.

Add a test:
1. NCM is started for TETHERING_NCM
2. The config changes to use NCM for TETHERING_USB.
3. Then the config changes to use RNDIS for TETHERING_USB.

Also let some logs not only print in dumpsys, but also in logcat to
easiler debug unit test.

Bug: 185649441
Test: atest TetheringTests
Change-Id: Ia8d76a29646f36941cbb16cd68ae6887100ec8ec
2021-06-28 02:59:33 +00:00
Remi NGUYEN VAN
0d54d7992d Fix ConnectivityManagerTest initialization on Q
The test can't have TetheringManager as an argument to methods or a
field, otherwise the test runner will crash when scanning the class for
tests because TetheringManager did not exist in Q. Although
testFactoryReset is already skipped on Q, the test runner would fail
at initialization time, before starting the run.

Use CtsTetheringUtils instead. This ensures that TetheringManager does
not have method signatures or members that reference classes that do not
exist on Q, so the test runner can scan the class successfully before
starting the run.

Bug: 188851796
Test: atest ConnectivityManagerTest on Q
Change-Id: I87488d0f23628a1ef2d7af0242513fcc5401d598
2021-06-28 11:24:27 +09:00
Remi NGUYEN VAN
9207702d66 Fix OffloadControllerTest on R
Data warning is not supported on R, and the notifyWarningOrLimitReached
callback also only exists in S.

Bug: 182962001
Test: atest OffloadControllerTest
Change-Id: I4914240967bba341f16e505acd29b80b90ab8569
2021-06-28 10:15:57 +09:00
Remi NGUYEN VAN
59be04dcca Merge "Improve TestConnectivityManager readability" am: 883df67f3f am: 265ec28e25
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1733779

Change-Id: Ic81a3604724855233dffc4e989bcee69feb8d91c
2021-06-28 00:13:10 +00:00
Remi NGUYEN VAN
883df67f3f Merge "Improve TestConnectivityManager readability" 2021-06-27 23:47:45 +00:00
Nucca Chen
fadd7b7a33 Refresh conntrack entry timeout
Needed because the BPF maps offloads IPv4 traffic. The kernel can't
trace the offloaded traffic to keep the conntrack entry.

Bug: 190783768
Test: atest TetheringCoverageTests
Original-Change: https://android-review.googlesource.com/1566871
Merged-In: Idbcf686c9b2124b192944156ac5111be741744fb
Change-Id: Idbcf686c9b2124b192944156ac5111be741744fb
2021-06-26 08:48:52 +00:00
Nucca Chen
01785d7eff Clear IPv4 offload rules when tethering stopped
The condition for deleting IPv4 forwarding rules.
1. When the tethering client has gone, deletes the client and its
   rules.
2. When the upstream has gone, deletes all rules.
3. When the upstream has changed, deletes all rules.

Test: atest TetheringCoverageTests and check IPv4 offload rules
via dumpsys tethering in the following test cases.

Bug: 190783768

Test cases:
a. Loss upstream interface while tethering
  1. Enable WIFI tethering
  2. Disable upstream interface
  3. Check the rules are removed.
b. Loss downstream interfaces while tethering
  1. Enable WIFI tethering
  2. Enable BT tethering
  3. Disable BT tethering
  4. Check the BT tether rules are removed.
  5. Disable WIFI tethering
  6. Check the WIFI tether rules are removed.
c. Switch upstream interface while tethering
  1. Enable WIFI tethering
  2. Enable BT tethering
  3. Switch upstream interface from cellular to wifi.
  4. Check all rules are removed.
d. Enable NAT failure (manual)

Log:
The rule deletion in each case.
- IpServer#stopIPv4: case b and case d.
- BpfCoordinator#updateUpstreamNetworkState: case a and case c.

Test case a
06-23 09:58:59.245  [...] Tethering: [BpfCoordinator]
    updateUpstreamNetworkState tetherOffloadRule4Clear wlan2

Test case b
06-07 22:17:51.886  [..] Tethering: [bt-pan] cleanupUpstream bt-pan
06-07 22:17:51.888  [..] Tethering: [bt-pan] stopIPv4 bt-pan
06-07 22:18:23.769  [..] Tethering: [wlan2] cleanupUpstream wlan2
06-07 22:18:23.772  [..] Tethering: [wlan2] stopIPv4 wlan2

Test case c
06-08 11:11:48.277  [..] Tethering: [BpfCoordinator]
    updateUpstreamNetworkState tetherOffloadRule4Clear bt-pan
06-08 11:11:48.396  [..] Tethering: [BpfCoordinator]
    updateUpstreamNetworkState tetherOffloadRule4Clear wlan2
06-08 11:11:48.579  [..] Tethering: [wlan2] cleanupUpstreamInterface
    wlan2
06-08 11:11:48.808  [..] Tethering: [bt-pan] cleanupUpstreamInterface
    bt-pan

Enabling NAT failure
06-08 13:04:18.117  [..] Tethering: [wlan2] Exception enabling NAT [..]
06-08 13:04:18.234  [..] Tethering: [wlan2] cleanupUpstream wlan2
06-08 13:04:18.246  [..] Tethering: [wlan2] stopIPv4 wlan2

Original-Change: https://android-review.googlesource.com/1579873
Merged-In: Id505a3deb277bbe0f44403234d8ca8bbf01eec80
Change-Id: Id505a3deb277bbe0f44403234d8ca8bbf01eec80
2021-06-26 08:45:39 +00:00
Nucca Chen
2791e3fe11 Merge "Refresh conntrack entry timeout" am: a569410667 am: a729b103ff
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1566871

Change-Id: I5508b5b47d17c01d2ce95fb30d9dfc14e279f932
2021-06-25 18:55:47 +00:00
Nucca Chen
8516b3f120 Merge "Clear IPv4 offload rules when tethering stopped" am: 7238b31c15 am: 70504b2f6b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1579873

Change-Id: Ibfea3e14e0e06a59c3b29534ab5ffbf4d4bd2148
2021-06-25 18:55:09 +00:00
Nucca Chen
a569410667 Merge "Refresh conntrack entry timeout" 2021-06-25 18:34:22 +00:00
Nucca Chen
7238b31c15 Merge "Clear IPv4 offload rules when tethering stopped" 2021-06-25 17:56:21 +00:00
Remi NGUYEN VAN
86b39c8c34 Merge "Update TetheringTests for new connectivity shims" 2021-06-25 05:42:14 +00:00
markchien
8f9705126a Remove wigig support from S tethering
Bug: 176520801
Test: atest TetheringTests
Change-Id: Id0bf02c01419e0c69a1d0b6a41789826538444d3
2021-06-25 00:31:43 +08:00
junyulai
991433d8c8 [SP35] Pass data warning to tethering offload
This is supported by:
  1. Utilize the new API from both NetworkStatsProvider
     and IOffloadControl to send data warning quota to hardware.
     And pass the warning reached notification back to NPMS.
  2. Disable software solution introduced in R release for
     V1.1+ hardware, since now we can fully offload data warning
     and limit notification to hardware.

Test: atest TetheringTests
Fix: 149467454
Merged-In: Ie49461694d77ab7f25a549433b01b5b0167bd489
Change-Id: Ie49461694d77ab7f25a549433b01b5b0167bd489
  (cherry-picked from ag/13981692)
2021-06-24 08:33:28 +00:00
junyulai
da52dab266 [SP34] Adapt onSetWarningAndLimit
This is a no-op change that just adapt new API from
NetworkStatsProvider to get warning and limit bytes at the same
time. This change also stores them locally for subsequent
patches to set warning bytes to hardware.

Test: Will be included in the subsequent patch.
Bug: 149467454
Merged-In: Iec01cb01fd1ce481ce0bd736762baddde1e38084
Change-Id: Iec01cb01fd1ce481ce0bd736762baddde1e38084
  (cherry-picked from ag/13981691)
2021-06-24 08:33:28 +00:00
junyulai
37a7e620b4 [SP33] Adapt ITetheringOffloadCallback V1.1
This is a no-op change that redirect both V1.0 and V1.1 callback
events to the same handling function. Since the V1.1 callback
is extended from V1.0 callback, we can safely use V1.1
callback for both V1.0 and V1.1 control.

The change also provides interface for subsequent
OffloadController changes to set warning and limit at the
same time.

Test: atest TetheringTests
Bug: 149467454
Merged-In: I6505a04de8c57357dd1fa9ce898c13395e497816
Change-Id: I6505a04de8c57357dd1fa9ce898c13395e497816
  (cherry-picked from ag/13973147)
2021-06-24 08:33:28 +00:00
Remi NGUYEN VAN
2e0f0da0b7 Improve TestConnectivityManager readability
Remove NetworkCallbackInfo to use Handler directly, and separate
registerSystemDefaultNetworkCallback from requestNetwork.

Also verify that requestNetwork is only used with a default-like network
request on R, as S should be using registerSystemDefaultNetworkCallback.

Test: atest TetheringTests
Bug: 189581241
Change-Id: If6b9124b2d795b9db1e85256c694d0120c852542
2021-06-24 17:17:54 +09:00
Remi NGUYEN VAN
11e5cf0b0b 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.

Bug: 189581241
Test: atest TetheringTests
Merged-In: Ibc04e64a1e9d82b67aff10d1a6d77f9e6b1bbdfb
Change-Id: Ibc04e64a1e9d82b67aff10d1a6d77f9e6b1bbdfb
2021-06-24 17:17:54 +09:00
Hungming Chen
c27ec7c4a2 Refresh conntrack entry timeout
Needed because the BPF maps offloads IPv4 traffic. The kernel can't
trace the offloaded traffic to keep the conntrack entry.

Bug: 190783768
Test: atest TetheringCoverageTests
Change-Id: Idbcf686c9b2124b192944156ac5111be741744fb
2021-06-23 15:41:30 +08:00
Hungming Chen
a6e7869646 Clear IPv4 offload rules when tethering stopped
The condition for deleting IPv4 forwarding rules.
1. When the tethering client has gone, deletes the client and its
   rules.
2. When the upstream has gone, deletes all rules.
3. When the upstream has changed, deletes all rules.

Test: atest TetheringCoverageTests and check IPv4 offload rules
via dumpsys tethering in the following test cases.

Bug: 190783768

Test cases:
a. Loss upstream interface while tethering
  1. Enable WIFI tethering
  2. Disable upstream interface
  3. Check the rules are removed.
b. Loss downstream interfaces while tethering
  1. Enable WIFI tethering
  2. Enable BT tethering
  3. Disable BT tethering
  4. Check the BT tether rules are removed.
  5. Disable WIFI tethering
  6. Check the WIFI tether rules are removed.
c. Switch upstream interface while tethering
  1. Enable WIFI tethering
  2. Enable BT tethering
  3. Switch upstream interface from cellular to wifi.
  4. Check all rules are removed.
d. Enable NAT failure (manual)

Log:
The rule deletion in each case.
- IpServer#stopIPv4: case b and case d.
- BpfCoordinator#updateUpstreamNetworkState: case a and case c.

Test case a
06-23 09:58:59.245  [...] Tethering: [BpfCoordinator]
    updateUpstreamNetworkState tetherOffloadRule4Clear wlan2

Test case b
06-07 22:17:51.886  [..] Tethering: [bt-pan] cleanupUpstream bt-pan
06-07 22:17:51.888  [..] Tethering: [bt-pan] stopIPv4 bt-pan
06-07 22:18:23.769  [..] Tethering: [wlan2] cleanupUpstream wlan2
06-07 22:18:23.772  [..] Tethering: [wlan2] stopIPv4 wlan2

Test case c
06-08 11:11:48.277  [..] Tethering: [BpfCoordinator]
    updateUpstreamNetworkState tetherOffloadRule4Clear bt-pan
06-08 11:11:48.396  [..] Tethering: [BpfCoordinator]
    updateUpstreamNetworkState tetherOffloadRule4Clear wlan2
06-08 11:11:48.579  [..] Tethering: [wlan2] cleanupUpstreamInterface
    wlan2
06-08 11:11:48.808  [..] Tethering: [bt-pan] cleanupUpstreamInterface
    bt-pan

Enabling NAT failure
06-08 13:04:18.117  [..] Tethering: [wlan2] Exception enabling NAT [..]
06-08 13:04:18.234  [..] Tethering: [wlan2] cleanupUpstream wlan2
06-08 13:04:18.246  [..] Tethering: [wlan2] stopIPv4 wlan2

Change-Id: Id505a3deb277bbe0f44403234d8ca8bbf01eec80
2021-06-23 15:41:27 +08:00
Junyu Lai
69bc4fede1 Merge "[SP32] Try to get 1.1 OffloadControl hardware if available" 2021-06-22 20:31:18 +00:00
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