Commit Graph

1980 Commits

Author SHA1 Message Date
Kimberly Kreider
200e42063c Merge "Replace "mts" with "mts-tethering"." 2021-11-01 23:43:53 +00:00
Mark Chien
3a5c822ec1 Merge "Log received wifiP2p intent into dumpsys for debugging" 2021-11-01 08:04:55 +00:00
Chalard Jean
adcec9ebbe Move to f/l/n instead of RouteUtils
Test: TetheringTests
Change-Id: I35b36538463a7fc2f02e142719c898d1694b2d6b
2021-10-29 16:05:46 +09:00
markchien
eb8599c4e3 Log received wifiP2p intent into dumpsys for debugging
Bug: 201480425
Test: m
Change-Id: I527c894eff3c068080995333ab8b372ab2aa38a0
2021-10-29 14:45:14 +08:00
Kimberly Kreider
c5b3f34831 Replace "mts" with "mts-tethering".
Bug: 203466102
Test: build locally and verified contents
Change-Id: I7cccb54c0ad1a3bd8da0bcb7ad6474aa1e734299
2021-10-20 18:16:59 +00:00
Treehugger Robot
5dc1edd9a8 Merge "Dependency update for StateMachine" 2021-10-20 13:43:58 +00:00
Chalard Jean
7949b8c557 Merge "Cleanup shims usage in Tethering" 2021-10-20 13:06:24 +00:00
Chalard Jean
732ebcbc7f Cleanup shims usage in Tethering
Now that S has gone to AOSP, this dependency is no longer
needed. It is, on the contrary, harmful as it prevents us
from adding shims that depend on T APIs in AOSP.

Test: builds
Change-Id: I64f0f394e826e58a9b7e772043bb6008428892e6
2021-10-20 19:44:09 +09:00
Treehugger Robot
f8d1f3d1cd Merge "Unregister the tethering internal callback in finalize" 2021-10-20 08:40:08 +00:00
Treehugger Robot
9d0c5419c9 Merge "Test TetheringManager could be GC after getting connector" 2021-10-20 07:48:10 +00:00
markchien
819e19ea2a Unregister the tethering internal callback in finalize
Bug: 177265744
Bug: 191798390
Bug: 187972579
Test: atest TetheringServiceTest
Change-Id: Ie7f9535b923db5073a59329ead22546a54e6ef47
2021-10-20 06:57:58 +00:00
markchien
e7b4a505aa Test TetheringManager could be GC after getting connector
There is pollingConnector thread which start polling connector if
TetheringManager is created earlier than TetheringService started(during
device boot up). TetheringManager won't be GCed if pollingConnector
thread do not finish its task yet.

Bug: 177265744
Bug: 191798390
Bug: 187972579
Test: atest TetheringServiceTest
Change-Id: Id8c7d10c5172e1d5de460c5311ff9c20261facef
2021-10-20 06:06:04 +00:00
Treehugger Robot
d7d41a73e7 Merge "Fix TetheringManager memory leak" 2021-10-20 03:59:59 +00:00
markchien
1110b725a0 Fix TetheringManager memory leak
TetheringCallbackInteranl is inner class which explicitly reference
TetheringManager object. This causes TetheringManager can't be GC. Using
static nested class which has its own lifecycle and weak reference
TetheringManager object.

Still have a leak inside Tethering that TetheringCallbackInternal is
never unregistered. Currently it rely on binder died to remove the
reference, which usually happen in kill process. If process keep alive,
the TetheringCallbackInternal would not be freed even TetheringManager is
gone. Will have follow CL to fix this.

Bug: 177265744
Bug: 191798390
Bug: 187972579
Test: 1. lunch Settings with ON/OFF tethering, dump java heap.
      2. close Settings and restart Settings again, dump java heap.
      3. Compare java heap between step 1 and step 2.
Change-Id: I0e2a21b7988115098a033a581cd98da8bffe2791
2021-10-14 14:02:11 +08:00
Treehugger Robot
1f3515bb48 Merge "Add Override anntation for TetheringConnector.setPreferTestNetworks" am: 1503bdc297
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1844178

Change-Id: Ie1f715a7b3ac4d46a25c58e799fb133dfdc55951
2021-10-04 10:00:56 +00:00
Treehugger Robot
1503bdc297 Merge "Add Override anntation for TetheringConnector.setPreferTestNetworks" 2021-10-04 09:50:19 +00:00
markchien
d3e0f2e896 Add Override anntation for TetheringConnector.setPreferTestNetworks
Test: TH
Change-Id: Idfaca3cb59580ffe4ee194466ad2ba8f47d8fac4
2021-10-04 16:14:08 +08:00
William Escande
ea9e22e10b Dependency update for StateMachine
StateMachine was in a custom filegroup in base.
It's now built in stand-alone library in modules-utils.

Bug: 198418216
Tag: #refactor
Test: Build
Merged-In: I7499fad6c4c5076e2bd98f0d9f91c5f243fb1ed2
Change-Id: I7499fad6c4c5076e2bd98f0d9f91c5f243fb1ed2
2021-10-01 17:06:42 +02:00
Mark Chien
05fd386de8 Merge "Use SettingsShim to hide different implementation in shim" 2021-10-01 01:47:00 +00:00
markchien
97ac1a93fa Move runDhcp to TetheringTester am: f320c21120
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1817921

Change-Id: I74d5c4a6c88fb26e35218f05ef468fa125a340d4
2021-09-30 15:00:11 +00:00
markchien
b94c515370 Use SettingsShim to hide different implementation in shim
TetheringService call different Settings API to check write settings
permission between R and S.

Bug: 182211575
Test: install S module to R device and both run mts tests build with S
and R.

Change-Id: I3e7f6525e9776992bd96b17c132b749b12285bbd
Merged-In: I3e7f6525e9776992bd96b17c132b749b12285bbd
2021-09-30 21:42:23 +08:00
markchien
f320c21120 Move runDhcp to TetheringTester
This is a no-op CL which add TetheringTester and move runDhcp related
logic to it.

Test: atest EthernetTetheringTest
Change-Id: Ib1c5647b2bd5a1b27c976450d3aa265aff8f5b70
2021-09-30 12:57:30 +00:00
markchien
7ea99be9d6 Rename mTapPacketReader to mDowntreamReader am: 0bd10760a8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1824633

Change-Id: I1cde888d4502463bbd6d49a3b76f3f8a6d676483
2021-09-30 12:48:20 +00:00
Mark Chien
da862b2a35 Merge "Support set test network to tethering upstream" am: 473d864d20
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1797991

Change-Id: Ifd5c76a943886dfe55e9b68eeb77931dae6fe204
2021-09-30 12:48:15 +00:00
markchien
0bd10760a8 Rename mTapPacketReader to mDowntreamReader
Test: atest EthernetTetheringTest
Change-Id: I2905aba449a2625caf6a82b27b9e43b06191da9f
2021-09-30 12:36:28 +00:00
markchien
2fbd3e72d3 Support set test network to tethering upstream
Test: atest EthernetTetheringTest

Change-Id: Ief2a92bc6c573a6bb75c72b7a0630e5c0accfa73
2021-09-30 10:14:58 +00:00
Treehugger Robot
096498601e Merge "Replace inexact alarm setRepeasting with setExact alarm" am: 507de1cac6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1793479

Change-Id: Ia989bed2395130329ce5946cb7ece91089fc8571
2021-08-30 14:01:49 +00:00
Treehugger Robot
507de1cac6 Merge "Replace inexact alarm setRepeasting with setExact alarm" 2021-08-30 13:42:25 +00:00
Hungming Chen
5dbbd2f132 Refactor the offload permission check and add tests am: b344870ea0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1803422

Change-Id: I857de882e6f613d3bf57d271532f761be10bf988
2021-08-27 05:02:15 +00:00
Hungming Chen
b344870ea0 Refactor the offload permission check and add tests
- Rename the conntrack destination port check function
- Use CollectionUtils.contains to check the denied ports
- Add tests for the streams with ftp and pptp tcp port are
  not able to be offloaded

Bug: 195914327
Test: atest TetheringCoverageTests
Change-Id: I7e2591bea1f6db46271efb0c30970fb8d4efe1e4
2021-08-26 21:21:05 +08:00
Maciej Żenczykowski
e953144055 Merge "Tethering/bpf_progs/offload - replace all TC_ACT_OK with TC_ACT_PIPE" am: dc8388ca08
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1807971

Change-Id: Iad650917305d67b799d059e4b285af5fd3f54709
2021-08-25 07:37:55 +00:00
Maciej Żenczykowski
dc8388ca08 Merge "Tethering/bpf_progs/offload - replace all TC_ACT_OK with TC_ACT_PIPE" 2021-08-25 07:19:28 +00:00
Maciej Żenczykowski
6e66a36367 Tethering/bpf_progs/offload - replace all TC_ACT_OK with TC_ACT_PIPE
The correct return code to keep on processing any further TC
attached programs is 'TC_ACT_PIPE' and not 'TC_ACT_OK' (which
is terminal).

Without this the ipv6 tether offload program causes termination
of processing and the ipv6 clatd offload program never actually
handles any packets (while tethering is active).

This results in lack of bpf xlat64 offloading for tethered ipv4
traffic on an ipv6-only (cellular) network.

This in turn means incoming TCP packets get GRO'ed, do not get
bpf offloaded, and get delivered to the clat daemon, which
due to them being bigger than the mtu (due to gro) cannot
handle them and discards them.

This results in poor performance, since tcp falls back to 1 mss/mtu
sized packet per rtt.

Tested via tethering a linux laptop on an ipv6-only cellular connection
and downloading the linux kernel from kernel.org via 'wget -6' and 'wget -4'.
Before:
  IPv6: over 2MB/s, observed:
    5805 packets, including 4 sackOK
  IPv4: under 1MB/s, observed:
    9300 packets, including 8 sackOK, 387 sack 1, 501 sack 2, 2310 sack 3
After:
  IPv6: over 7MB/s, observed:
    16702 packets, including 4 sackOK
  IPv4: over 9MB/s, observed:
    32755 packets, including 2 sackOK

Test: builds, TreeHugger, see above
Bug: 195624908
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I623dacb5a37dc689cea34499c3906c11fcaf946c
2021-08-24 23:24:19 +00:00
Lorenzo Colitti
c1256c4cf3 Give EthernetTetheringTest the restricted networks permission. am: 8fbadf4ac5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1807157

Change-Id: I13defb1e00586393e91ca19100cf437482a64090
2021-08-24 08:54:53 +00:00
Lorenzo Colitti
8fbadf4ac5 Give EthernetTetheringTest the restricted networks permission.
This test fails on devices where physical Ethernet interfaces are
available but marked restricted, like cuttlefish.

Bug: 197462993
Test: test-only change
Change-Id: I15c991b2e43e2d5e823dcdcfbd74adfd9b2f6f08
2021-08-24 15:18:54 +09:00
Lorenzo Colitti
b6ea38e832 Merge "bpf: don't offload IPv4 packets with TCP port 21 (ftp) and 1723 (pptp)" am: ad8fb7fce4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1802476

Change-Id: I2ca694a0154b3043092890cfd272e7b86cca3fb5
2021-08-20 03:39:28 +00:00
Lorenzo Colitti
ad8fb7fce4 Merge "bpf: don't offload IPv4 packets with TCP port 21 (ftp) and 1723 (pptp)" 2021-08-20 03:24:09 +00:00
Hungming Chen
bc85178435 bpf: don't offload IPv4 packets with TCP port 21 (ftp) and 1723 (pptp)
Bypass the IPv4 TCP packets with port 21 (ftp) and 1723 (pptp) from
BPF offload because these packets need the netfilter conntrack helper.

Bug: 195914327
Test: manual test as the follows
1. Connect to ftp.slackware.com with port 21 in active mode.
2. Check the PORT command success.
   Command:  PORT 192,168,62,128,174,17
   Response: 200 PORT command successful.
3. Download a file.

Change-Id: I8e3b8d9323eb0e572f20c74442b55d4ee95abc2f
2021-08-19 14:29:25 +00:00
Xin Li
3ec4468fb7 Merge sc-dev-plus-aosp-without-vendor@7634622
Merged-In: I5a33f959c8ae5a34584f57508f392038e44062e7
Change-Id: Ib4e5e75ee8bbe19806bdc2f69590d164fb75774b
2021-08-14 06:31:05 +00:00
markchien
932df54493 Use SdkLevel util instead of explicitly checking the version
There are IpServerTest test case fail because the code check the wrong
code name for T pre-release builds.

Bug: 194812819
Test: atest TetheringTests

Change-Id: I73bf58c60b6e790fe0060b60c023c10f5d8cbfa8
2021-08-12 07:08:34 +00:00
markchien
52158b1d47 Replace inexact alarm setRepeasting with setExact alarm
Use exact alarm to fix entilement recheck delay problem while device
asleep.

Bug: 195370891
Test: atest TehteringTests
Change-Id: I409e603bf2b990657551e1140b50f69640c328d8
2021-08-12 13:32:54 +08:00
Xiao Ma
f29e0435a9 Merge "Import net-utils-device-common-netlink instead of netlink-client." am: 609e71a46c am: dd7e9e8800
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1753303

Change-Id: I4fb162f20f5816de1ee1b784cb39533362b34677
2021-08-04 07:56:23 +00:00
Xiao Ma
609e71a46c Merge "Import net-utils-device-common-netlink instead of netlink-client." 2021-08-04 07:27:18 +00:00
Nucca Chen
e17f852861 Merge "Throw an errno exception when open BPF map failed" am: 22d5336279 am: 84c87a49b1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1772440

Change-Id: Ib933a28d7ad5504def71e012a83b9080048fa37e
2021-08-03 09:00:34 +00:00
Nucca Chen
22d5336279 Merge "Throw an errno exception when open BPF map failed" 2021-08-03 08:38:42 +00:00
Hungming Chen
1257e9bfff Throw an errno exception when open BPF map failed
Needed because an invalid file descriptor should notify the caller to
stop using the object.

Bug: 190523685

Test: atest BpfMaptest
Change-Id: I70fb08b54b1c0caa4be4e3f07b59bf4f2397f39d
2021-08-03 08:38:16 +00:00
Remi NGUYEN VAN
96019d9353 Merge "Do not apply jarjar rules on intermediate libs" am: c1e68abd6f am: 4972bf1971
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1778569

Change-Id: I4bf35535002bc1ec90913a941923f9c6e0a1c72b
2021-08-03 08:19:31 +00:00
Remi NGUYEN VAN
c1e68abd6f Merge "Do not apply jarjar rules on intermediate libs" 2021-08-03 07:50:29 +00:00
Remi NGUYEN VAN
0015f04ec7 Do not apply jarjar rules on intermediate libs
Using jarjar on intermediate libraries causes issues when they are
combined with other libraries that use different jarjar rules, as the
resulting binary may contain multiple incompatible copies of the
classes. Instead, jarjar should be used on the final artifact, after
combining the libraries.

Ensure NetworkStackJarJarRules is not applied on intermediate libraries
like TetheringIntegrationTestsLib, but instead apply it on
TetheringIntegrationTests or CtsTetheringTest.

Bug: 192535368
Test: atest TetheringCoverageTests TetheringIntegrationTests \
          CtsTetheringTest
Change-Id: I248a533651984de81f676336c0e74e3788610bbb
2021-08-02 19:13:09 +09:00
Remi NGUYEN VAN
6a0a33dcf3 Remove hidden ArrayUtils usage in TetheringTest am: 3dfafbb516 am: 53b6370ec6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1779756

Change-Id: I715be738618531ae541db589255129149cf4b306
2021-07-29 07:40:07 +00:00