Commit Graph

47146 Commits

Author SHA1 Message Date
Lucas Lin
ba61dca57c Merge "Rename redactNetworkCapabilitiesForPackage and update its javadoc" 2022-03-14 08:05:08 +00:00
Frank Li
3f5703df80 Merge "[DU09-3]Modify the NetworkStatsCollection Builder API" 2022-03-14 02:36:08 +00:00
Nucca Chen
3938102448 Merge changes I5af6ce96,Ibc1f6813
* changes:
  Refactor make{Tether4Key, Tether4Value ConntrackEvent} helper
  BpfCoordinatorTest: refactor upstream and downstream setup functions
2022-03-11 18:05:14 +00:00
Mark Chien
98502b78bc Merge "Use U32 from shared library" 2022-03-10 16:27:33 +00:00
Aaron Huang
23f5e54efa Merge "Add test coverage for NetworkStats.Bucket#getRoaming()" 2022-03-10 12:14:10 +00:00
Remi NGUYEN VAN
2aae895972 Merge "Add DisableConfigSyncTargetPreparer to CTS/MTS" 2022-03-10 09:34:00 +00:00
Ross Yeh
422c7dd460 Merge "cts: Re-launch the desired activity after screen-on on TVs." 2022-03-10 01:13:37 +00:00
Patrick Rohr
6758a5dfff Merge "Add test for EthernetNetworkUpdateRequest" 2022-03-09 09:16:29 +00:00
Aaron Huang
fdbe9847a9 Add test coverage for NetworkStats.Bucket#getRoaming()
Bug: 217771804
Test: CtsNetTestCases
Change-Id: I16778488540476c2d1e77378a020c548eb894f0a
Merged-In: I16778488540476c2d1e77378a020c548eb894f0a
2022-03-09 08:42:40 +00:00
markchien
22c1a3aa1f Use U32 from shared library
There is U32 added in frameworks/libs/net. Use shared one to avoid
duplicated code.

Bug: 215095957
Test: m
Change-Id: I861bc2f65ea947a908de2ec83e9b137d3342c8ce
2022-03-09 15:05:16 +08:00
Mark Chien
cc29690fc1 Merge "Split updateMeteredNetwork{Allow, Deny}List into add and remove" 2022-03-09 05:00:58 +00:00
markchien
e46042b833 Split updateMeteredNetwork{Allow, Deny}List into add and remove
Split the updateXXX methods into an addXXX and removeXXX instead of using
a boolean parameter to indicate whether the uid should be added or removed

Bug: 218494748
Test: atest FrameworksNetTests
Change-Id: I868cf35c8f51b25d8719e618c6c48a5cd642da7f
2022-03-09 11:17:27 +08:00
Remi NGUYEN VAN
a3f45ecdff Merge changes from topic "start_nearby_cp"
* changes:
  Add try/catch, shim in Nearby initialization
  Add stub NearbyService
  Start Nearby from Connectivity ServiceInitializer
2022-03-09 01:39:50 +00:00
Patrick Rohr
30d33f4ee3 Add test for EthernetNetworkUpdateRequest
Test: atest EthernetNetworkUpdateRequest
Change-Id: I2aeacca81f07cf2d73814d20fc9e63e9f1a65843
2022-03-08 16:29:43 +01:00
Remi NGUYEN VAN
46d7ddb725 Add try/catch, shim in Nearby initialization
The try/catch allows using a stub NearbyService on branches that do not
support it yet.

Also update Context.NEARBY_SERVICE to ConstantsShim to be compatible
with all branches.

Bug: 189355156
Test: boots
Change-Id: I7db0035b0d9ada79f00d6ef1ac5b54b2e98489d0
2022-03-08 10:33:32 +00:00
Xin Li
e6953d54a5 Merge "Merge Android 12L" 2022-03-08 06:55:42 +00:00
Treehugger Robot
5635d505e0 Merge "Remove ConnectivityManager swapActiveStatsMap API" 2022-03-08 06:31:23 +00:00
Maciej Żenczykowski
984c39992c Merge changes Id5f5bdfc,I67b9f30b
* changes:
  [CLATJ#32] ClatCoordinator: untag clat raw socket
  [CLATJ#31] ClatCoordinator: tag raw socket to uid AID_CLAT
2022-03-08 00:47:17 +00:00
Maciej Żenczykowski
70d1026b6d Merge "BpfHandler: only allow to tag INET/INET6 socket" 2022-03-08 00:44:59 +00:00
Xin Li
f08c6c060f Merge Android 12L
Bug: 222710654
Merged-In: I03636e6b8b4dc200fcb039b99190759bc7d5e776
Change-Id: Ib9fccbbe6b6ace0a4ecddc8b84f7244e465b83b6
2022-03-08 00:19:47 +00:00
Gurpreet Singh
3acad24476 Merge "Using common apex_defaults for com.android.tethering module." am: 6802eadef5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2007756

Change-Id: I03636e6b8b4dc200fcb039b99190759bc7d5e776
2022-03-07 17:56:53 +00:00
Gurpreet Singh
6802eadef5 Merge "Using common apex_defaults for com.android.tethering module." 2022-03-07 17:32:37 +00:00
Treehugger Robot
23037308c6 Merge "Don't attempt to enable rate-limiting before T." am: 33f4e14073
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2010337

Change-Id: If26026f57421c51eb34f38c82229fd524b734299
2022-03-07 16:17:40 +00:00
Treehugger Robot
33f4e14073 Merge "Don't attempt to enable rate-limiting before T." 2022-03-07 15:51:32 +00:00
Mark Chien
1e048b4432 Merge "Remove dead code in BpfNetMaps." am: e06458378d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2008696

Change-Id: I1d44c652972e43f6598fcb231bdc538e3836a046
2022-03-07 15:44:27 +00:00
Mark Chien
e06458378d Merge "Remove dead code in BpfNetMaps." 2022-03-07 15:19:25 +00:00
Lorenzo Colitti
f79dcecf9b Don't attempt to enable rate-limiting before T.
Rate-limiting cannot work because the BPF program is in the
mainline version of netd.c, which is placed into net_shared
and thus cannot run pre-T.

Disable it entirely to ensure no impact on S.

Test: atest ConnectivityCoverageTests:com.android.server.ConnectivityServiceTest on AOSP
Test: atest ConnectivityCoverageTests:com.android.server.ConnectivityServiceTest on S
Change-Id: I47521a100f8287ecdece25e810db8f3cade46778
2022-03-07 12:21:40 +00:00
Treehugger Robot
b9c6d49a6f Merge "API review: Addional documentation for QosFilter" am: 3b45bca306
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2008676

Change-Id: I8882c865b00a530b1dd14d1f698a3413b9ccd177
2022-03-07 09:55:50 +00:00
Treehugger Robot
1e60378519 Merge "BpfHandler: only allow to tag udp/tcp socket" am: ca2c473781
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2009295

Change-Id: I0bd5824c5afada42f68fece2a83593a01a3edfb2
2022-03-07 09:55:37 +00:00
Treehugger Robot
3b45bca306 Merge "API review: Addional documentation for QosFilter" 2022-03-07 09:45:13 +00:00
Treehugger Robot
ca2c473781 Merge "BpfHandler: only allow to tag udp/tcp socket" 2022-03-07 09:31:33 +00:00
Frank
349fadfa52 [DU09-3]Modify the NetworkStatsCollection Builder API
1. Adding the bucketDuration with unit as bucketDurationmillis
2. make the Key class be final
3. The Key set parameter be marked with an IntDef

Bug: 220153505
Test: atest NetworkStatsCollectionTest
Change-Id: I8919ed595c2d339e8a5c0fc163b3c40edb4a2ad8
2022-03-07 16:31:26 +08:00
Hungming Chen
bcc0f5b14f BpfHandler: only allow to tag INET/INET6 socket
This is a follow up commit for the family validation {INET, INET6}.
The protocol validation {TCP, UDP} has been added in previous
commit.

The TrafficController socket destroy listener only monitors
on the group {INET_TCP, INET_UDP, INET6_TCP, INET6_UDP}.
Tagging listener unsupported socket causes that the tag can't
be removed from tag map automatically. Eventually, the tag map
run out of space because of dead tag entries.

See TrafficController::makeSkDestroyListener in
packages/modules/Connectivity/service/native/TrafficController.cpp

Also address the comments from previous commit.
- Remove the useless else-statment in tagSocket protocol validation.
- Make the socket cookie query and test into one line in
  BpfHandlerTest#TestTagSocketWithUnsupportedProtocol

Bug: 223094609
Test: atest BpfHandlerTest
Change-Id: I0f571fc00caa01c86399f0dbb593e8a40ad94bbd
2022-03-07 16:04:32 +08:00
Hungming Chen
478c0eb21c BpfHandler: only allow to tag udp/tcp socket
The TrafficController socket destroy listener only monitors
on the group {INET_TCP, INET_UDP, INET6_TCP, INET6_UDP}.
Tagging listener unsupported socket causes that the tag can't
be removed from tag map automatically. Eventually, the tag map
run out of space because of dead tag entries.

See TrafficController::makeSkDestroyListener in
packages/modules/Connectivity/service/native/TrafficController.cpp

Bug: 223094609
Test: atest BpfHandlerTest
Change-Id: Icc19b7c9f37fef498b89f43e44767f6b9e931a5a
2022-03-07 16:03:05 +08:00
sewookseo
4aac074872 API review: Addional documentation for QosFilter
Improve API document for matchecLocalAddress & matchesRemoteAddress

Bug: 188798655
Test: Build
Change-Id: Ic74e34469677364d3b1aa1fbf802f12c66b22461
2022-03-07 06:56:11 +00:00
Mark Chien
c4b5faefaf Merge "Make isTetheringSupported respect all tethering downstreams" am: 8dcc3000fd
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1938694

Change-Id: Ic5f106a611a729fd63af2710bb9354be447641fd
2022-03-07 06:17:57 +00:00
Mark Chien
8dcc3000fd Merge "Make isTetheringSupported respect all tethering downstreams" 2022-03-07 05:56:20 +00:00
Lorenzo Colitti
82244fd16c Remove dead code in BpfNetMaps.
Most of the methods in BpfNetMaps are only used on T+ devices,
where BpfNetMaps never calls into netd. Remove the code in these
methods that calls into netd, because that code can never run.
The code was only written in the first place because it was
necessary when TrafficController had not yet moved to mainline.

The list of methods is:
- addNaughtyApp
- removeNaughtyApp
- addNiceApp
- removeNiceApp
- setChildChain
- replaceUidChain
- setUidRule

Test: treehugger
Change-Id: Ie7d210be2f7983178f5aa550370b9476de66e988
2022-03-07 12:56:18 +08:00
markchien
49e944cc1c Remove ConnectivityManager swapActiveStatsMap API
swapActiveStatsMap is temporary added for the NetworkStatsFactory to
call BpfNetMaps#swapActiveStatsMap in tethering mainline module. Now
NetworkStatsFactory already be mainlined, calling BpfNetMaps#swapActiveStatsMap
directly.

Bug: 218494448
Test: atest ConnectivityCoverageTests
      atest FrameworksNetTests
Change-Id: I3358e4ac5fb7ed0964273afdbccd1b4128ca7645
2022-03-07 12:25:47 +08:00
Hungming Chen
1c257cdb8d [CLATJ#32] ClatCoordinator: untag clat raw socket
Untag clat raw socket while stopping clatd.

Bug: 218407445
Test: atest FrameworksNetTests
Test: connect and disconnect to/from IPv6 only network
Check dumpsys tag map and logging for tagging/untagging socket
03-04 16:29:17.247  1330  1714 I jniClatCoordinator: tag uid AID_CLAT to socket fd 420, cookie 16524
03-04 16:29:31.343  1330  1714 I jniClatCoordinator: untag socket cookie 16524

Change-Id: Id5f5bdfc97a15abfa1a49b06dcb3c2c25743c74f
2022-03-07 11:38:40 +08:00
Hungming Chen
89d12060e1 [CLATJ#31] ClatCoordinator: tag raw socket to uid AID_CLAT
Tag socket as uid AID_CLAT to avoid duplicated data usage counting by
bpf program.

Test: atest FrameworksNetTests
Test: check dumpsys for tag mapping and check logging for socket cookie

$ adb shell dumpsys connectivity trafficcontroller
  mCookieTagMap:
    cookie=28831 tag=0x0 uid=1029

03-02 22:43:13.201  1719  1921 I jniClatCoordinator: tag uid AID_CLAT to socket fd 609, cookie 28831
03-02 22:43:13.217  5496  5496 I clatd   : tunnel.write_fd6 609, cookie 28831, flags 0x0 (debug only)

Bug: 218407445
Change-Id: I67b9f30b143e791ddf59d5627e068ec3107e3328
2022-03-07 11:37:41 +08:00
markchien
259d5c08a8 Make isTetheringSupported respect all tethering downstreams
Currently if wifi, usb and bluetooth tethering is not supported,
isTetheringSupported would return false. Then ethernet, ncm tethering
and wifi p2p would also not be supported anymore. Make
isTetheringSupported respect all tethering downstreams after T.

Also remove redundant code:
1. tethering always has upstream configuration, checking whether has
upstream configuration for isTetheringSupported is useless.
2. Remove TetheringDependencies#isTetheringSupported because it don't
have any caller.

Test: atest TetheringTests
Change-Id: I3db5ce410c064d37c9e9e704fce2a2b68705834e
2022-03-07 10:55:51 +08:00
Maciej Żenczykowski
a7fc743155 Merge "[CLATJ#30] Not allow tagSocket() to tag with uid AID_CLAT" am: edf80c2da8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1991617

Change-Id: I0c084313f7865c4b883e3c740b0cdb447c79d8bf
2022-03-05 08:51:05 +00:00
Maciej Żenczykowski
c6a4f658a8 Merge "[CLATJ#29] Remove the throwaway sockets for dup2 fds" am: 171db11c5f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2005551

Change-Id: I4fa687a08f32b1f4413cda18825b08f38c22db08
2022-03-05 08:50:54 +00:00
Maciej Żenczykowski
ef0b4884d0 Merge changes from topic "dedup-interfaceparams" am: a63535bfd1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2007154

Change-Id: I7bd8c3a2ef89d0f358d6002d87dd08d6cd818691
2022-03-05 08:50:34 +00:00
Maciej Żenczykowski
edf80c2da8 Merge "[CLATJ#30] Not allow tagSocket() to tag with uid AID_CLAT" 2022-03-05 08:33:33 +00:00
Maciej Żenczykowski
171db11c5f Merge "[CLATJ#29] Remove the throwaway sockets for dup2 fds" 2022-03-05 08:32:47 +00:00
Maciej Żenczykowski
a63535bfd1 Merge changes from topic "dedup-interfaceparams"
* changes:
  Remove unused InterfaceParams jarjar rule
  Deduplicate InterfaceParams
2022-03-05 08:23:55 +00:00
Remi NGUYEN VAN
e96e7c4de4 Add stub NearbyService
The stub allows building the module before NearbyService is fully
implemented in all branches.

Bug: 189355156
Test: m
Merged-In: I7e280495f1eefada0939dad2ce7f47f45885ad66
Change-Id: I5c0c7f7a58946e0ff0902a17ca1dc33863519cf9
2022-03-04 15:34:46 -08:00
Remi NGUYEN VAN
5906c8b290 Start Nearby from Connectivity ServiceInitializer
On T+, start and register Nearby services from the initializer, and send
proper callbacks.

Bug: 189355156
Test: Booted, service started
Merged-In: I7e280495f1eefada0939dad2ce7f47f45885ad66
Change-Id: Ieca032c80cb37e424d07c500257a844c8418fe3e
2022-03-04 15:34:41 -08:00