Commit Graph

988 Commits

Author SHA1 Message Date
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
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
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
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
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
Remi NGUYEN VAN
3dfafbb516 Remove hidden ArrayUtils usage in TetheringTest
Use CollectionUtils instead, which avoids using a hidden API.

Avoiding hidden API usage in tests is good in general, but this also
helps avoid jarjar problems where the com.android.internal.util package
is jarjared to some other package as some of its classes are included
in the module, and ArrayUtils cannot be found in the renamed package.

Bug: 192535368
Test: atest TetheringTest
Change-Id: I54dc8f6429d132a953ab1a674fe349fba4335936
2021-07-28 17:00:20 +09:00
Treehugger Robot
e3e529150f Merge "Add TetheringPrivilegedTests to postsubmit" am: 94ef708b7d am: 6971e4811f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1771186

Change-Id: I644b99720cf5af80c26f0f0ee12c49918f0895ef
2021-07-26 09:15:51 +00:00
Treehugger Robot
94ef708b7d Merge "Add TetheringPrivilegedTests to postsubmit" 2021-07-26 08:50:07 +00:00
markchien
911cf8fecd Add TetheringPrivilegedTests to postsubmit
Also ignore DadProxyTest before S because it is only enabled from S.

To using ignore test rule, replace AndroidJunit with DevSdkIgnoreRunner.
It is fine because the we don't use the test UI (e.g. running test in UI
thread).

Test: atest TetheringPrivilegedTests
Change-Id: I701ee877520f78ded2394adbae1f4d9dd612d700
2021-07-26 02:17:19 +00:00
Xiao Ma
09c0727e9e Import net-utils-device-common-netlink instead of netlink-client.
After moving all netlink-client stuff to frameworks/libs/net/common
and build it as an individual library, deprecate the netlink-client
lib and use net-utils-device-common-netlink instead.

Due to that the package name of netlink lib has changed, also update the
package name used in Tethering and ConnectivityService module.

Bug: 192535368
Test: atest TetheringTests TetheringIntegrationTests
Change-Id: Ic2078caf67a640836d98c5a2e4ca89939adcb896
2021-07-21 09:10:22 +00:00
Treehugger Robot
0305762d6c Merge changes I6e6b40b0,I6a0d93e0,Ie26f6e52 am: 1004c23b35 am: ef7274ca97
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1772430

Change-Id: Ib1c4033e9416f3295529b75ae3e6de8e0e105425
2021-07-20 15:08:39 +00:00
Treehugger Robot
1004c23b35 Merge changes I6e6b40b0,I6a0d93e0,Ie26f6e52
* changes:
  Revert "[CTT-5] Stop update TCP conntrack entry timeout"
  Revert "[CTT-6] Update TCP conntrack entry timeout while adding rules"
  Revert "[CTT-7] Delete the rules while half-closing tcp state entered"
2021-07-20 10:49:18 +00:00
Nucca Chen
199e86dcb3 Revert "[CTT-5] Stop update TCP conntrack entry timeout"
This reverts commit a5c742be69.

Reason for revert:
Stop releasing this commit because it needs more test coverage.

Bug: 190783768
Bug: 192804833
Change-Id: I6e6b40b0f6207ed197d01bfabb616f1afa31fb70
Test: atest TetheringCoverageTests
2021-07-20 08:52:38 +00:00
Nucca Chen
254ba6b235 Revert "[CTT-6] Update TCP conntrack entry timeout while adding rules"
This reverts commit 299a81157c.

Reason for revert:
Stop releasing this commit because it needs more test coverage.

Bug: 190783768
Bug: 192804833
Change-Id: I6a0d93e04814ae73e1ec7d6fd4df19e1d2787207
Test: atest TetheringCoverageTests
2021-07-20 08:50:49 +00:00
Treehugger Robot
ed62eb3a5b Merge "Skip bpf offload if upstream interface is VCN" am: 097d65b0f3 am: 9743c8165e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764307

Change-Id: Id3546b8888439ee9228fb2b5687b117165fdbbd7
2021-07-13 17:45:37 +00:00
Treehugger Robot
097d65b0f3 Merge "Skip bpf offload if upstream interface is VCN" 2021-07-13 17:16:04 +00:00
markchien
7dc1b4da7b Skip bpf offload if upstream interface is VCN
Bpf offload do not support VCN network yet, don't start bpf offload
if the interface is ipsec*.

Bug: 191178945
Test: atest TetheringTests
Change-Id: I1ad8cededddec42f45b08aaa31d583c548d105f0
2021-07-13 15:35:31 +00:00
Nucca Chen
523e11ef67 Merge "[CTT-6] Update TCP conntrack entry timeout while adding rules" am: db30678605 am: f22f935082
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760692

Change-Id: I759b26fa36116578c84fd6c226725ece3fbe5b7c
2021-07-13 12:31:16 +00:00
Nucca Chen
709d91215f Merge "[CTT-5] Stop update TCP conntrack entry timeout" am: 69ccea4839 am: 23e3eadde5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760691

Change-Id: Idf2680669d1c881f3d1846f379f5a8163c4ac274
2021-07-13 12:31:10 +00:00
Nucca Chen
db30678605 Merge "[CTT-6] Update TCP conntrack entry timeout while adding rules" 2021-07-13 12:07:05 +00:00
Nucca Chen
69ccea4839 Merge "[CTT-5] Stop update TCP conntrack entry timeout" 2021-07-13 12:06:55 +00:00
Hungming Chen
299a81157c [CTT-6] Update TCP conntrack entry timeout while adding rules
Needed because a payload data packet may have gone through
non-offload path, before we added offload rules, and that this
may result in in-kernel conntrack state being in ESTABLISHED
but pending ACK (ie. UNACKED) state. But the in-kernel conntrack
might never see the ACK because we just added offload rules.
As such after adding the rules we need to force the timeout back
to the normal ESTABLISHED timeout of 5 days.

Issue: the timeout is set to unacknowledged 300s (countdwon to 298s)
$ adb shell cat /proc/net/nf_conntrack
ipv4     2 tcp      6 298 ESTABLISHED src=192.168.244.128
dst=140.112.8.116 sport=45694 dport=443 ..

Test: atest TetheringCoverageTests
Manual check:
$ adb shell cat /proc/net/nf_conntrack
ipv4     2 tcp      6 431988 ESTABLISHED src=192.168.40.162
dst=140.112.8.116 sport=40774 dport=443 ..

Bug: 190783768
Bug: 192804833

Change-Id: I8c34e85e26c9d976e5e2b85473db75ff46d8abd4
2021-07-13 14:28:30 +08:00
Hungming Chen
a5c742be69 [CTT-5] Stop update TCP conntrack entry timeout
This is a preparation for only update the tcp timeout while
adding rules. Also add slack time for updating UDP timeout
interval.

Bug: 190783768
Bug: 192804833

Test: atest TetheringCoverageTests
Change-Id: I3151b531e6581e257f3cfa39ad2fcf1650358b3d
2021-07-13 14:26:58 +08:00
Maciej Żenczykowski
954c8d383e Merge "[CTT-1] Rename conntrack related function, variable and constant" am: 2c2eccac73 am: d85fc83e41
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1762185

Change-Id: Ie0b8eee8dd649432835ef89369d3ac2e6166d8da
2021-07-13 02:44:53 +00:00
Maciej Żenczykowski
2c2eccac73 Merge "[CTT-1] Rename conntrack related function, variable and constant" 2021-07-13 02:09:00 +00:00
Hungming Chen
378bdbc2ef [CTT-1] Rename conntrack related function, variable and constant
Bug: 190783768
Bug: 192804833
Test: atest TetheringCoverageTests

Change-Id: Ib7ba480138b8aa8c6f8dffaa97787bac74a3972e
2021-07-11 15:04:37 +08:00
Lorenzo Colitti
25423d4f5e Merge "Load ncm regexs config to tetherableUsbRegexs if isUsingNcm=true" am: 844ca1290e am: 51f5f61742
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1755176

Change-Id: Iceb3d25f31da76f4f12115a7ceabd68a81faebfa
2021-07-06 04:04:42 +00:00
Lorenzo Colitti
86d7e6bbb4 Merge "Enable and disable usb IpServer according to ACTION_USB_STATE" am: d479e694f0 am: 736df2cb2f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1731453

Change-Id: I334710d0bbbe18a769a79fb58d10a558dd8f7b37
2021-07-06 04:04:36 +00:00
Lorenzo Colitti
844ca1290e Merge "Load ncm regexs config to tetherableUsbRegexs if isUsingNcm=true" 2021-07-06 03:39:31 +00:00
Lorenzo Colitti
d479e694f0 Merge "Enable and disable usb IpServer according to ACTION_USB_STATE" 2021-07-06 03:39:15 +00:00