Commit Graph

1680 Commits

Author SHA1 Message Date
Hungming Chen
8097f6c9b2 Fix attaching program failure on kernel 5.10 am: 3c94994650 am: dc0ec70f3f am: fdd9f07e20
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1697147

Change-Id: I737e0b73011cae23417fe458473dca7d7b21277e
2021-05-06 08:10:38 +00:00
Hungming Chen
fdd9f07e20 Fix attaching program failure on kernel 5.10 am: 3c94994650 am: dc0ec70f3f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1697147

Change-Id: Ia8e6302907d0115f92cd1186ea626dd1115a131e
2021-05-06 07:30:44 +00:00
Hungming Chen
3c94994650 Fix attaching program failure on kernel 5.10
Attach BPF program may be failed with the netlink error message
"Invalid argument". Per debug kernel trace, it is failed in
comparing the kind name in tc_new_tfilter.

Log:
05-05 19:44:42.329  1073  2332  2332 W tc_new_tfilter:
Specified filter kind does not match existing one

Test: enable usb tethering and check the follows

$ adb shell tc filter show dev <upstream, downstream> ingress
filter protocol ipv6 pref 1 bpf chain 0
filter protocol ipv6 pref 1 bpf chain 0 handle 0x1
prog_offload_schedcls_tether_upstream6_ether:[*fsobj]
direct-action not_in_hw id 3 tag 94ca9b12972fdea8
filter protocol ip pref 2 bpf chain 0
filter protocol ip pref 2 bpf chain 0 handle 0x1
prog_offload_schedcls_tether_upstream4_ether:[*fsobj]
direct-action not_in_hw id 9 tag 992aa9bfd0503457
filter protocol ipv6 pref 1 bpf chain 0
filter protocol ipv6 pref 1 bpf chain 0 handle 0x1
prog_offload_schedcls_tether_downstream6_rawip:[*fsobj]
direct-action not_in_hw id 4 tag 7fb60e556b8f3be7
filter protocol ip pref 2 bpf chain 0
filter protocol ip pref 2 bpf chain 0 handle 0x1
prog_offload_schedcls_tether_downstream4_rawip:[*fsobj]
direct-action not_in_hw id 6 tag e41426095404fb64

Change-Id: I471a2e34c626a3737cbd2754e4d1b3000bcf6ba6
2021-05-06 02:52:07 +00:00
Treehugger Robot
b22fb6c09e Merge "Add native coverage listener to tethering coverage test" am: e6bafe29b0 am: 1c4103c150 am: 659bbf4f24
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1687651

Change-Id: Ifd9f54157ecc1d0f1a109dde05a12b2ef75e07e8
2021-04-27 19:50:31 +00:00
Treehugger Robot
659bbf4f24 Merge "Add native coverage listener to tethering coverage test" am: e6bafe29b0 am: 1c4103c150
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1687651

Change-Id: I2c5465f222c89f65de9fe42272f9ee4cfc971df5
2021-04-27 19:32:38 +00:00
Treehugger Robot
9662233c70 Merge "Add native coverage listener to tethering coverage test" am: e6bafe29b0 am: 1c4103c150
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1687651

Change-Id: Ib128e298c8b695438a562e5cbb092fd04c4746c2
2021-04-27 19:32:29 +00:00
markchien
b23e912805 Add native coverage listener to tethering coverage test
This allows the coverage tests to manually trigger native coverage
collection, as a workaround for collection not being triggered
automatically by the coverage infrastructure.

Bug: 185202279
Test: atest TetheringCoverageTests
Change-Id: I619fc267cf1743dd2218e3dd42546b0d4e9da193
2021-04-27 16:48:25 +00:00
paulhu
90255ef0a7 Add ACCESS_NETWORK_STATE to Tethering CTS
Add ACCESS_NETWORK_STATE to Tethering CTS because tests call to
EthernetManager#isAvailable() which is enforcing permission check
now. Without ACCESS_NETWORK_STATE, some tests will fail by lack
of permission.

Bug: 174573778
Test: CtsTetheringTest
Change-Id: I735d98527c14c12fb0f2df536cda25fdd84152f1
Ignore-AOSP-First: Security vulnerability issue should not fix on
                   aosp branch.
2021-04-26 06:57:46 +00:00
Mark Chien
4534e88bc1 Merge "Release mobile request when default upstream is not mobile" am: 07f8a618d2 am: d4b21984e9 am: 81cb8cf02c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1679667

Change-Id: I2f5ee699fd85d5f3cad3331718a3c332a392ea67
2021-04-23 12:45:01 +00: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
2827638c7e 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: I6fabfeed5609677c1f5045d66c344ad33f181669
2021-04-23 12:23:18 +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
Junyu Lai
e5ca854bb6 Merge changes from topic "sp32" into sc-dev
* changes:
  [SP32] Try to get 1.1 OffloadControl hardware if available
  [SP32.3] No-op refactoring of OffloadControllerTest
2021-04-21 01:45:15 +00:00
junyulai
184d458181 [SP32] Try to get 1.1 OffloadControl hardware if available
This is a no-op change that try to use 1.1 HAL if available.
Otherwise, fallback to 1.0 HAL. The change also provides version
information for subsequent patches to determine what to do for
specific version.

Test: atest TetheringTests
Bug: 149467454
Ignore-AOSP-First: avoid long automerger delay
Change-Id: I6a3ce877cdff2496087b97b191a9bfd5b0792827
2021-04-20 17:34:11 +08:00
junyulai
36aa3f237c [SP32.3] No-op refactoring of OffloadControllerTest
This is necessary change for minimize the code size when
repeatedly restarting OffloadController in subsequent
patches.

Test: atest TetheringTests
Bug: 149467454
Ignore-AOSP-First: avoid long automerger delay
Change-Id: I0b02d01cd8749d81c9d020dee7fdb4f80e18ae98
2021-04-20 11:26:10 +08:00
Lorenzo Colitti
ffdc597a11 Merge "Allow callers of startTethering to choose local-only mode." am: ac9ce08d45 am: af691a13b6 am: f772ab1c61
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674232

Change-Id: I308835fd656b7c61d04f04b816babd0e2031df89
2021-04-19 15:21:56 +00: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
45e5965e2f 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: If54ea1076b0a3f51b1b6eea77f6941186a229b51
2021-04-19 14:51:13 +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
f15ac35316 Merge "Put tether/untether calls into handler queue" am: 2576c457de am: 0ea3966a88 am: 95587e12d5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1535794

Change-Id: I7f3be74f5315e4f21f01ea5e2fb67c6200e92707
2021-04-15 16:31:43 +00: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
c54b165f05 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: If849ee52573b9cf0d5edd7fc81e2f285bd067305
2021-04-15 16:04:42 +00:00
Treehugger Robot
2576c457de Merge "Put tether/untether calls into handler queue" 2021-04-15 14:46:25 +00:00
Remi NGUYEN VAN
00ca0671b4 Fix proguard rules for Struct in NetworkStack am: 9a82bbf368 am: 9aaeab539b am: 237561ebdf
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674688

Change-Id: Id9ea41e2831af5a01e3088dc1d3feca89946c926
2021-04-14 06:11:59 +00:00
Remi NGUYEN VAN
237561ebdf Fix proguard rules for Struct in NetworkStack am: 9a82bbf368 am: 9aaeab539b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674688

Change-Id: I722885350e2514dbf7af5c58602e6b94bd876ff8
2021-04-14 05:45:19 +00:00
Remi NGUYEN VAN
54024858a6 Fix proguard rules for Struct in NetworkStack am: 9a82bbf368 am: 9aaeab539b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674688

Change-Id: I815875d909142ae2b1d860a3009daeafad23ab8c
2021-04-14 05:45:19 +00:00
Remi NGUYEN VAN
9a82bbf368 Fix proguard rules for Struct in NetworkStack
All members of the Struct class need to be kept, not just the constructor.

Change-Id: I8705234eb2608c0dfe324c517b8885a93271b6c2
Test: m
2021-04-14 01:30:59 +00:00
Lorenzo Colitti
a5c6a21b79 Fix a tethering crash when a 464xlat upstream disconnects. am: a329e8c984 am: dadc2fe3bb am: ffc11490ca
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1671533

Change-Id: I1b6408bd3274425de53f04afeaa9b3e79c16c99c
2021-04-12 17:03:54 +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
0a250d57b5 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: I7fa106c720d267c407ea1b9a94b1af8eb02aa1dd
2021-04-12 16:15:06 +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
bb68871e68 Merge "[NFCT.TETHER.11] Test TetherOffloadRule{Add, Remove} and set limit for IPv4" am: 68f6f5fe79 am: f0b3bb6e4e am: e37b9272f4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1563332

Change-Id: Ic2ba2e4a30ab135ead6d8bf359df7a541e51f11a
2021-04-08 14:18:02 +00:00
Nucca Chen
e37b9272f4 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: I56c1250280473dd1e10693c9cae65e6d2e5e808d
2021-04-08 13:30:30 +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
73add1d174 Apply IPv6 utils struct stuff to build RA packet in the Daemon. am: 3e557d777a am: 7f8ae5c99d am: d39b5b9888
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1614996

Change-Id: I9e78b118bb2afdf36fbe28285a927b5d92d9daf6
2021-04-08 07:21:29 +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
5d0cec9328 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: I00b6312bc87f1958c1dae5f99584f93a12f75eae
2021-04-08 06:35:25 +00:00
Treehugger Robot
3a47a9b55c Merge "Improve RouterAdvertisementDaemonTest." am: 662237f2f8 am: 3b2ad2b764 am: 5efb849dcf
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669025

Change-Id: I210eeb02010c89d3ef37cd79ca4b46e518ebb579
2021-04-08 05:34:19 +00:00
Treehugger Robot
b8aa244e11 Merge "Improve RouterAdvertisementDaemonTest." am: 662237f2f8 am: 3b2ad2b764
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669025

Change-Id: Ica070f535e0599b7729469a518ff550d273fc77a
2021-04-08 05:07:44 +00:00
Treehugger Robot
5efb849dcf Merge "Improve RouterAdvertisementDaemonTest." am: 662237f2f8 am: 3b2ad2b764
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669025

Change-Id: Ifcf397852832cb8e1550b4a3b933c9872f93cc50
2021-04-08 05:07:35 +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
Treehugger Robot
662237f2f8 Merge "Improve RouterAdvertisementDaemonTest." 2021-04-08 04:07:14 +00:00
Xiao Ma
597d253f18 Improve RouterAdvertisementDaemonTest.
Add separate testing for unicast and multicast RAs.
Make the test more realistic by:
- Enabling forwarding. This ensures that the daemon actually
  receives the RS.
- Adding a link-local route. This ensures that the daemon is
  actually able to send a unicast response.

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

Change-Id: I0d9473b7401bb8c6dac2c4c9d9b1f8d7f8723b19
2021-04-07 15:58:29 +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
77ab55f55b Merge changes I515be275,Ied159454,I5a29bdd1 am: 8ba40704f3 am: 7cc20e1782
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1662791

Change-Id: Ie340d743f8de13fcac7c360dd47f64d75b65123e
2021-04-07 15:30:54 +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
4a3d91fdcb bpf offload - make sure bpf code can access packet headers am: 8e69ec111f am: 3129be7a3b am: 4cfddb344c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1622559

Change-Id: I29df9c0df46fd67203e50d30c3ae70eaa43cfeab
2021-04-07 02:46:50 +00:00