Commit graph

57,201 commits

Message SHA1
Remove unuseful program status dump in TrafficController
netd makes sure netd can open all bpf programs at startup and exit if it
fails.
So, program status is always OK if netd starts successflly.

Bug: 241787285
Bug: 217624062
Test: atest TrafficControllerTest, dumpsys connectivityservice
trafficcontroller

Change-Id: Ida29dcbb2612e84f7030389050e2a3d2830c73ff

Motomu Utsumi   commited 2022-08-12 09:05:42 +00:00
1e4d24993e
Revert bpf map status dump in TrafficController
status dump was removed in aosp/2167962 and aosp/2165825.
But TrafficController still open these maps in init and hold them, so
dump should show the status of them.

Bug: 217624062
Bug: 241787285
Test: atest TrafficControllerTest, dumpsys connectivityservice
trafficcontroller

Change-Id: Icc1f255a619b22174abb2a7d323b7e3c4d42909f

Motomu Utsumi   commited 2022-08-12 09:05:37 +00:00
f3e5a28485
Merge "Remove qtaguid support from native"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-08-11 11:16:48 +00:00
dd2eca9e4a
Merge "Remove ConnectivityService#PerUidCounter hack"
Junyu Lai   authored and   Gerrit Code Review   commited 2022-08-11 09:40:53 +00:00
1125946264
Remove ConnectivityService#PerUidCounter hack
Follow up from aosp/1781202 and aosp/1821293, creating nris
before removing old nris had been proven not necessary for
per-app API flow. Hence, the per-uid counter hack for system
uid that allows counter temporary go over limit does not
actually be used in the production code.

In other words, this CL is a no-op refactoring.

Test: testRequestCountLimits
Bug: 235771502
Change-Id: I8f71c6e4506fbec60cb503731aee64ab022b4634

Junyu Lai   commited 2022-08-11 11:06:07 +08:00
31d38bffdf
split TCP control packet error into IPv4 vs IPv6
Bug: 241887405
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia155dbf7780b7bcff87e8fa6752d620ccbcae4a4

Maciej Żenczykowski   commited 2022-08-10 19:34:35 +00:00
0dd2bb31b6
split IP version mismatch error into IPv4 vs IPv6
Bug: 241887405
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6ff121ebaec26c9fe14ec8f4f7daebeff77eb7d1

Maciej Żenczykowski   commited 2022-08-10 19:28:48 +00:00
b82bf6502a
Merge "TestOnly: reduce duplicated start/stop hotspot verification"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-08-10 16:13:51 +00:00
b40cbad40c
TestOnly: reduce duplicated start/stop hotspot verification
Test: atest TetheringTests
Change-Id: Id6469c5be4a424a68e370bea475dc7399a0037ac

Mark   commited 2022-08-10 12:24:13 +00:00
0a1a97250d
Merge "dscpPolicy - sport is network endian, dport is host endian"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-08-10 11:35:47 +00:00
bab2430154
Merge "deflake DscpPolicyTest"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-08-10 08:18:10 +00:00
b70bda58db
Merge "Revert mCookieTagMap dump in TrafficController"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-08-10 08:04:26 +00:00
d5c9b02f2d
Merge "Use random link-local addresses in EthernetManagerTest."
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-08-10 05:19:50 +00:00
02a67d843f
Merge "ethernet: IpConfigStore#readIpConfigurations() can return null"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-08-10 04:37:50 +00:00
cbbda3ed6a
Revert mCookieTagMap dump in TrafficController
aosp/2167063 moved mCookieTagMap dump from TrafficController to
NetworkStatsService.
But this dump was used from Cts TagSocketTest.
So, this CL re-adds mCookieTagMap dump to TrafficController to avoid
failure of released Cts.
Upcoming CL will update Cts test to check dump both from
TrafficController and NetworkStatsService.
And after the old Cts support period is over, mCookieTagMap dump in
TrafficController can be removed.

Bug: 241787285
Test: atest TagSocketTest TrafficControllerTest
Change-Id: Ie2ef09fa7d91cf96f56c5efcbe9d863dd68a1020

Motomu Utsumi   commited 2022-08-10 03:51:40 +00:00
872c369ecc
Merge changes Ib0652654,I31111d16
* changes:
  ethernet: clean up test interface tracking
  ethernet: fix aosp <-> internal conflict

Patrick Rohr   authored and   Gerrit Code Review   commited 2022-08-10 03:46:40 +00:00
c093f14c18
Use random link-local addresses in EthernetManagerTest.
Test: test-only change
Bug: 240323229
Change-Id: I0f57652fdcb62628bcaf72cc3ee8e15862148e2c

Lorenzo Colitti   commited 2022-08-10 02:56:31 +00:00
a9caccc8d4
Merge changes I1cf472bd,Ibdaf2b23,I6967ad6f,I65f522c2,I0f220d1f, ...
* changes:
  Make the temporary NC sanitized instead of inlining
  Remove the legacy int from FullScore.
  Remove accessors for legacy int score from NAI
  Log the creation time of network agents
  Show time taken by the rematch
  Address some IDE warnings in ConnectivityService
  Copy arguments from NetworkAgent registration early

Paul Hu   authored and   Gerrit Code Review   commited 2022-08-10 01:41:43 +00:00
a3340c1355
ethernet: IpConfigStore#readIpConfigurations() can return null
If the version is invalid IpConfigStore#readIpConfigurations() will
return null, in which case ArrayMap#putAll() will throw an NPE.
Log and return instead.

Bug: 241588375
Test: TH
Change-Id: I1d7278f9571164a95ce21cb92e1219558cb1569f

Patrick Rohr   commited 2022-08-09 16:19:04 -07:00
aa2291a6fb
dscpPolicy - sport is network endian, dport is host endian
be more consistent, and thus also less htons() calls

Test: TreeHugger, atest DscpPolicyTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia331a33a615a598e061db53ae180fffaef7a4342

Maciej Żenczykowski   commited 2022-08-09 23:03:20 +00:00
640752bc4c
ethernet: clean up test interface tracking
This change adds a isValidEthernetInterface() similar to
isValidTestInterface() in place of updating the interface matching
regex. This makes the code more readable.

It's unfortunate that getInterfaceList() was added as a synchronous API
making its behavior race-y around setting setIncludeTestInterfaces().

Test: atest EthernetManagerTest
Change-Id: Ib0652654020fc3f6e965de9091c5bc960d1d4cdf

Patrick Rohr   commited 2022-08-09 15:48:01 -07:00
d2ce8c05fb
ethernet: fix aosp <-> internal conflict
Ic36d26be7dae5fd3f72abce3cea1ee845813a6e5 was merged with a new line in
internal-master. This mismatch is now creating conflicts.

Test: TH
Change-Id: I31111d1634f8dbe58873e1db86a6b38a5a521ef6

Patrick Rohr   commited 2022-08-09 15:45:24 -07:00
1176221732
Merge "dscpPolicy - remove bpf byteswap in favour of userspace"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-08-09 21:24:26 +00:00
f39f7f83b0
resolve nit from 'netd.c - update some permission related comments'
Test: TreeHugger
Bug: 236672779
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5dcf6c32ef9bfd067afbfbbbd90e67ff678691f4

Maciej Żenczykowski   commited 2022-08-09 17:50:46 +00:00
285f705ced
Merge "netd.c - update some permission related comments"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-08-09 17:49:06 +00:00
2e922c3de4
deflake DscpPolicyTest
whoever said connect()-ing a second time would change
the previously selected source ip?

Test: atest DscpPolicyTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I015b443b7063940d0aa536f40b36686f42e19902

Maciej Żenczykowski   commited 2022-08-09 15:00:06 +00:00
b625a55e2f
dscpPolicy - remove bpf byteswap in favour of userspace
Test: atest DscpPolicyTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7a008434d58fc0fba5b503eb6fcfbca15bb2015c

Maciej Żenczykowski   commited 2022-08-09 14:59:46 +00:00
a44510ba0c
Merge "dscpPolicy - further improvements"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-08-09 14:55:20 +00:00
d4e6d1c971
dscpPolicy - further improvements
Bug: 237485762
Test: atest DscpPolicyTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia88b14609cad4604523e3fc41860c980ee11abe0

Maciej Żenczykowski   commited 2022-08-09 14:48:20 +00:00
1feaa43cbb
netd.c - update some permission related comments
Test: TreeHugger
Bug: 236672779
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I66187d61ccdd3d625a9873090ab8c0dff18ac6a3

Maciej Żenczykowski   commited 2022-08-09 14:15:59 +00:00
06085b0425
Remove qtaguid support from native
All devices shipped with S+ release would have 4.9+ kernel
with bpf enabled, and for older devices qtag uid is already
broken for a long time. Also, framework layer already removed
qtaguid support. Hence, it is safe to remove the related code.

Bug: 241880436
Test: build, FrameworksNetTests
      CtsNetTestCases, CtsHostsideNetworkTests
Change-Id: Idc3d8b729c1c8fe9cfff14068c07b0837ce0fe03

Aaron Huang   commited 2022-08-09 19:18:16 +08:00
7106fed750
Merge changes from topic "switch_uid_owner_map_api"
* changes:
  Switch previous and new code path in replaceUidChain
  Switch previous and new code path in setUidRule
  Switch previous and new code path in removeUidInterfaceRules
  Switch previous and new code path in addUidInterfaceRules
  Switch previous and new code path in updateUidLockdownRule
  Switch previous and new code path in addNiceApp
  Switch previous and new code path in removeNiceApp
  Switch previous and new code path in addNaughtyApp
  Switch previous and new code path in removeNaughtyApp

Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-08-09 09:33:36 +00:00
eec62aafe4
Merge "Force specifying sanitized/not sanitized in caps from agent"
Paul Hu   authored and   Gerrit Code Review   commited 2022-08-09 09:16:21 +00:00
1896d713cc
Merge "Stop calling setAlwaysOnPackage from VpnManagerService"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-08-09 09:02:50 +00:00
588e1bde6f
Merge "Switch previous and new code path in setChildChain"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-08-09 04:07:41 +00:00
02c02a3e83
Switch previous and new code path in replaceUidChain
replaceUidChain was updated to use Java BpfMap class instead of native JNI
functions in aosp/2145584.
But it is better to verify this refactoring by the experiment.
So this commit update replaceUidChain to switch previous code path(JNI)
and new code path(Java) based on the flag.

Also this commit removes @GuardedBy("sUidOwnerMap") from
native_replaceUidChain.
This was needed to avoid JNI and Java code modify the UidOwnerMap
concurrently when some API uses previous code path (JNI) and other APIs
use new code path (Java BpfMap class).
But, after this topic, it will not be needed because all the APIs will use JNI
"or" all the APIs will use Java BpfMap class to update UidOwnerMap.

Bug: 217624062
Test: atest BpfNetMapsTest
Change-Id: Icc264e0665b610adae5706f57fe29a296e6e6d6e

Motomu Utsumi   commited 2022-08-09 04:02:46 +00:00
c7c16853e0
Switch previous and new code path in setUidRule
setUidRule was updated to use Java BpfMap class instead of native JNI
functions in aosp/2145583.
But it is better to verify this refactoring by the experiment.
So this commit update setUidRule to switch previous code path(JNI)
and new code path(Java) based on the flag.

Also this commit removes @GuardedBy("sUidOwnerMap") from
native_setUidRule.
This was needed to avoid JNI and Java code modify the UidOwnerMap
concurrently when some API uses previous code path (JNI) and other APIs
use new code path (Java BpfMap class).
But, after this topic, it will not be needed because all the APIs will use JNI
"or" all the APIs will use Java BpfMap class to update UidOwnerMap.

Bug: 217624062
Test: atest BpfNetMapsTest
android.net.cts.ConnectivityManagerTest#testFirewallBlocking

Change-Id: I0d293c3eb89649c969f09578639dc4cb0233501b

Motomu Utsumi   commited 2022-08-09 04:01:47 +00:00
381ad9e54f
Switch previous and new code path in removeUidInterfaceRules
removeUidInterfaceRules was updated to use Java BpfMap class instead of
native JNI functions in aosp/2141539.
But it is better to verify this refactoring by the experiment.
So this commit update removeUidInterfaceRules to switch previous code
path(JNI) and new code path(Java) based on the flag.

Also this commit removes @GuardedBy("sUidOwnerMap") from
native_removeUidInterfaceRules.
This was needed to avoid JNI and Java code modify the UidOwnerMap
concurrently when some API uses previous code path (JNI) and other APIs
use new code path (Java BpfMap class).
But, after this topic, it will not be needed because all the APIs will use JNI
"or" all the APIs will use Java BpfMap class to update UidOwnerMap.

Bug: 217624062
Test: atest BpfNetMapsTest HostsideVpnTests#testBlockIncomingPacket
Change-Id: I1fb103fb3637ef324f92bbc945568ba316b164b8

Motomu Utsumi   commited 2022-08-09 04:00:48 +00:00
7dc657d4aa
Switch previous and new code path in addUidInterfaceRules
addUidInterfaceRules was updated to use Java BpfMap class instead of native JNI
functions in aosp/2141538.
But it is better to verify this refactoring by the experiment.
So this commit update addUidInterfaceRules to switch previous code path(JNI)
and new code path(Java) based on the flag.

Also this commit removes @GuardedBy("sUidOwnerMap") from
native_addUidInterfaceRules.
This was needed to avoid JNI and Java code modify the UidOwnerMap
concurrently when some API uses previous code path (JNI) and other APIs
use new code path (Java BpfMap class).
But, after this topic, it will not be needed because all the APIs will use JNI
"or" all the APIs will use Java BpfMap class to update UidOwnerMap.

Bug: 217624062
Test: atest BpfNetMapsTest HostsideVpnTests#testBlockIncomingPacket
Change-Id: Idb6400ed5808f8c5f4b0a962a356ac3850fbcff3

Motomu Utsumi   commited 2022-08-09 04:00:02 +00:00
f794e7d4f9
Switch previous and new code path in updateUidLockdownRule
updateUidLockdownRule was updated to use Java BpfMap class instead
of native JNI functions in aosp/2141537.
But it is better to verify this refactoring by the experiment.
So this commit update updateUidLockdownRule to switch previous code
path(JNI) and new code path(Java) based on the flag.

Also this commit removes @GuardedBy("sUidOwnerMap") from
native_updateUidLockdownRule.
This was needed to avoid JNI and Java code modify the UidOwnerMap
concurrently when some API uses previous code path (JNI) and other APIs
use new code path (Java BpfMap class).
But, after this topic, it will not be needed because all the APIs will use JNI
"or" all the APIs will use Java BpfMap class to update UidOwnerMap.

Bug: 217624062
Test: atest BpfNetMapsTest HostsideVpnTests#testBlockIncomingPacket
Change-Id: Ifd17d8a5c3a10a92c63010e5d329f9f541b3bfbf

Motomu Utsumi   commited 2022-08-09 03:59:06 +00:00
b2d32b7471
Switch previous and new code path in addNiceApp
addNiceApp was updated to use Java BpfMap class instead of native JNI
functions in aosp/2139316.
But it is better to verify this refactoring by the experiment.
So this commit update addNiceApp to switch previous code path(JNI)
and new code path(Java) based on the flag.

Also this commit removes @GuardedBy("sUidOwnerMap") from
native_addNiceApp.
This was needed to avoid JNI and Java code modify the UidOwnerMap
concurrently when some API uses previous code path (JNI) and other APIs
use new code path (Java BpfMap class).
But, after this topic, it will not be needed because all the APIs will use JNI
"or" all the APIs will use Java BpfMap class to update UidOwnerMap.

Bug: 217624062
Test: atest BpfNetMapsTest HostsideRestrictBackgroundNetworkTests
Change-Id: I27b4dccdbfee86e772049caa702853bcab8980ca

Motomu Utsumi   commited 2022-08-09 03:58:24 +00:00
7f19df92e6
Switch previous and new code path in removeNiceApp
removeNiceApp was updated to use Java BpfMap class instead of native JNI
functions in aosp/2139315.
But it is better to verify this refactoring by the experiment.
So this commit update removeNiceApp to switch previous code path(JNI)
and new code path(Java) based on the flag.

Also this commit removes @GuardedBy("sUidOwnerMap") from
native_removeNiceApp.
This was needed to avoid JNI and Java code modify the UidOwnerMap
concurrently when some API uses previous code path (JNI) and other APIs
use new code path (Java BpfMap class).
But, after this topic, it will not be needed because all the APIs will use JNI
"or" all the APIs will use Java BpfMap class to update UidOwnerMap.

Bug: 217624062
Test: atest BpfNetMapsTest HostsideRestrictBackgroundNetworkTests
Change-Id: I4bbd4480fa66ea43b9244047ae34ce4b3b764e22

Motomu Utsumi   commited 2022-08-09 03:57:17 +00:00
5f15f7514c
Switch previous and new code path in addNaughtyApp
addNaughtyApp was updated to use Java BpfMap class instead of native JNI
functions in aosp/2138295.
But it is better to verify this refactoring by the experiment.
So this commit update addNaughtyApp to switch previous code path(JNI)
and new code path(Java) based on the flag.

Also this commit removes @GuardedBy("sUidOwnerMap") from
native_addNaughtyApp.
This was needed to avoid JNI and Java code modify the UidOwnerMap
concurrently when some API uses previous code path (JNI) and other APIs
use new code path (Java BpfMap class).
But, after this topic, it will not be needed because all the APIs will use JNI
"or" all the APIs will use Java BpfMap class to update UidOwnerMap.

Bug: 217624062
Test: atest BpfNetMapsTest HostsideRestrictBackgroundNetworkTests
Change-Id: If18c26b805081182153d1dc67bb08f1966fa4990

Motomu Utsumi   commited 2022-08-09 03:56:31 +00:00
55c282e8ca
Switch previous and new code path in removeNaughtyApp
removeNaughtyApp was updated to use Java BpfMap class instead of native JNI
functions in aosp/2135056.
But it is better to verify this refactoring by the experiment.
So this commit update removeNaughtyApp to switch previous code path(JNI)
and new code path(Java) based on the flag.

Also this commit removes @GuardedBy("sUidOwnerMap") from
native_removeNaughtyApp.
This was needed to avoid JNI and Java code modify the UidOwnerMap
concurrently when some API uses previous code path (JNI) and other APIs
use new code path (Java BpfMap class).
But, after this topic, it will not be needed because all the APIs will use JNI
"or" all the APIs will use Java BpfMap class to update UidOwnerMap.

Bug: 217624062
Test: atest BpfNetMapsTest HostsideRestrictBackgroundNetworkTests
Change-Id: I4df6185e85f6c5512797c1b62e14aa590f4903ee

Motomu Utsumi   commited 2022-08-09 03:54:27 +00:00
878ce0d1a7
Merge "make sure netd can open all bpf programs"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-08-08 18:16:18 +00:00
d587f0d66d
Merge "remove duplicate jni include"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-08-08 18:14:44 +00:00
918b56c96d
Merge "fail *hard* if TrafficController::start() fails"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-08-08 17:41:57 +00:00
feb83ba675
Merge "update CRITICAL annotations for mainline"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-08-08 17:40:52 +00:00
869c4ad452
Merge "TestOnly: getting WifiInfo with NETWORK_SETTINGS"
Mark Chien   authored and   Gerrit Code Review   commited 2022-08-08 17:04:33 +00:00
119407ab8f
BpfCoordinator: avoid attach/deatach ipv6 program on 464xlat interface
464xlat interface v4-* doesn't have IPv6 address. IPv6 program should
not be attached/deatached on v4-* interface.

Bug: 241106456
Test: atest BpfCoordinatorTest
Test: manual test

Use IPv6-only wifi to test because there is no IPv6-only live
cellular environment here.

1. Patch TetheringInterfaceUtils.allowIpv6Tethering to allow WIFI.
2. Connect to IPv6-only wifi Google-Guest.
3. Enable USB tethering.
4. Check that v4-wlan0 doesn't have IPv6 program.

$ adb shell tc filter show dev wlan0 ingress;
filter protocol ipv6 pref 2 bpf chain 0
filter protocol ipv6 pref 2 bpf chain 0 handle 0x1 prog_offload_schedcls_tether_downstream6_ether:[*fsobj] direct-action not_in_hw id 2 tag 7d9be9d02d02e8d8
filter protocol ip pref 3 bpf chain 0
filter protocol ip pref 3 bpf chain 0 handle 0x1 prog_offload_schedcls_tether_downstream4_ether:[*fsobj] direct-action not_in_hw id 8 tag 434b3ecac7968bb3
filter protocol ipv6 pref 4 bpf chain 0
filter protocol ipv6 pref 4 bpf chain 0 handle 0x1 prog_clatd_schedcls_ingress6_clat_ether:[*fsobj] direct-action not_in_hw id 24 tag 06763574e0e1f984

$ adb shell tc filter show dev v4-wlan0 ingress;
filter protocol ip pref 3 bpf chain 0
filter protocol ip pref 3 bpf chain 0 handle 0x1 prog_offload_schedcls_tether_downstream4_rawip:[*fsobj] direct-action not_in_hw id 6 tag 9e6e587e0c6cf0bc

$ adb shell tc filter show dev v4-wlan0 egress;
filter protocol ip pref 4 bpf chain 0
filter protocol ip pref 4 bpf chain 0 handle 0x1 prog_clatd_schedcls_egress4_clat_rawip:[*fsobj] direct-action not_in_hw id 27 tag 9158397a2869247e

$ adb shell tc filter show dev ncm0 ingress;
filter protocol ipv6 pref 2 bpf chain 0
filter protocol ipv6 pref 2 bpf chain 0 handle 0x1 prog_offload_schedcls_tether_upstream6_ether:[*fsobj] direct-action not_in_hw id 3 tag 5f70a4f42dffe899
filter protocol ip pref 3 bpf chain 0
filter protocol ip pref 3 bpf chain 0 handle 0x1 prog_offload_schedcls_tether_upstream4_ether:[*fsobj] direct-action not_in_hw id 9 tag 26f324113d54c30a

Change-Id: Ic1c1cfc7646b4d4004856850b66428e4651d42ab

Hungming Chen   commited 2022-08-08 20:56:50 +08:00
1668b2da03