Commit Graph

1217 Commits

Author SHA1 Message Date
Anton Kulakov
316346be6e Revert "Simplify addRoutesToLocalNetwork calls"
Revert submission 2777667

Reason for revert: DroidMonitor-triggered revert due to breakage, bug b/305187495

Reverted changes: /q/submissionid:2777667

Bug: 305187495

Change-Id: I516d40b20d775e9c61b2f825bc094329d016d0c3
2023-10-13 15:15:50 +00:00
Chalard Jean
cf70df3e9b Simplify addRoutesToLocalNetwork calls
There are only three calls to this method, and two of them
are with a list of 1 address which means it's simpler inlined.

The last call will be replaced with calls to RouteController
in a followup, meaning we addRoutesToLocalNetwork can be removed.

Test: RouterAdvertisementDaemonTest
      NetdUtilsTest
Change-Id: I3b6ee1db40f09954b336321000735a66306bf000
2023-10-13 16:19:25 +09:00
Chalard Jean
d6f4efb1a8 Add hidden constants for communicating about local network agents
Test: FrameworksNetTests
Change-Id: Ic490fee6ee70d74acff0a290199b2946817173d0
2023-10-12 13:30:49 +09:00
Xiao Ma
a1eb2e453f Merge "Move the delegated prefix validity check to IaPrefixOption class." into main 2023-10-10 03:27:35 +00:00
Xiao Ma
fac8a33763 Move the delegated prefix validity check to IaPrefixOption class.
Bug: 260934173
Test: TH
Change-Id: Idc6e32f8dbaf3b0e3c57eff496a006fafee02b5e
2023-10-08 14:33:25 +09:00
Maciej Żenczykowski
3a64568abb type safety for kernel version
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If05c0c5383dceeb65964143f5574d2ee1a484907
2023-10-06 15:54:38 -07:00
Maciej Żenczykowski
6dec6e9374 type safety for bool ignore_on_{eng,user,userdebug}
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia85e16d1a7f8d1b21e4ce4c306db6bbea06138e0
2023-10-06 14:57:12 -07:00
Maciej Żenczykowski
f2466ef4bb type safety for bool optional
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6f10395ca6f1c73f3513031f561fdf1b1dedf451
2023-10-06 14:48:43 -07:00
Maciej Żenczykowski
a262bd3d1e type safety for bool shared
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4883eab734f47522fec718f0709475f7e6dd0a53
2023-10-06 14:46:11 -07:00
Maciej Żenczykowski
10da6d4e61 move PRIVATE/SHARED/MANDATORY/OPTIONAL/{LOAD,IGNORE}_ON_* into core headers
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7053ab46e73b763f64f36baf5e7ab64b62421045
2023-10-06 14:25:41 -07:00
Maciej Żenczykowski
1e32277fff BpfClassic.h - add missing commas
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ife32fa36808de13c5f37ace497395dcc381ca336
2023-10-06 13:50:13 -07:00
Maciej Żenczykowski
d5bf2061f3 more classic bpf macros
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5c7fd55301cd5aa44502f8481923c86bc49ea914
2023-10-04 22:41:21 +00:00
Maciej Żenczykowski
f24beefe55 TcUtils jni: jobject clazz -> jclass clazz
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0a06d2627ef06fe4606b3d1a6525af767d218945
2023-10-04 19:15:53 +00:00
Maciej Żenczykowski
b0f8d31e7d BpfUtils jni: jobject clazz -> jclass clazz
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I3fd51ad129873782b74c7c47b50e16f1f1f0fa6e
2023-10-04 19:15:44 +00:00
Maciej Żenczykowski
85ac050b35 bpf jni: add native_getProgramIdFromCgroup
Test: TreeHugger
Bug: 292156770
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib7b194b9cbf6519f9fbcfd1fcefcbe5d825f5c3a
2023-10-04 19:14:43 +00:00
Maciej Żenczykowski
340e2ff355 BpfSyscallWrappers: add queryProgram()
Test: TreeHugger
Bug: 292156770
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0f77220a6c4b13efb5630d7a5ade1db39c59901e
2023-10-04 19:12:25 +00:00
Motomu Utsumi
30ef5308d6 Merge "Remove lint-baseline in staticlibs" into main 2023-10-04 06:45:02 +00:00
Treehugger Robot
a675e966b2 Merge "Remove defaultEnabled arg from isNetworkStackFeatureEnabled" into main 2023-10-03 11:51:32 +00:00
Maciej Żenczykowski
73df7414f1 BpfClassic.h - more helpers
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie0eb8895c2d887b71ba886735ad106c1118ebeac
2023-10-02 20:03:41 +00:00
Maciej Żenczykowski
b900201ffe rename BPF2_REJECT_IF_ANY_BITS_SET -> BPF2_REJECT_IF_ANY_MASKED_BITS_SET
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I54a189f0f7b73917aa3fd049fe2eca387aaca250
2023-10-02 16:09:05 +00:00
Treehugger Robot
f74f42b4c0 Merge "Add method to read trunk stable flag" into main 2023-10-02 13:17:53 +00:00
Motomu Utsumi
b0f489021b Add method to read trunk stable flag
aconfig soong modules should be used to read the trunk stable flag.
However they are not available in the mainline branch.
So this CL adds the method to check if the trunk stable flag is enabled
or not by directly reading from DeviceConfig.
It's expected that this does not work correctly if flag value is not
stored in the DeviceConfig.
But for the time being, this method can be used to keep development.
Once the mainline branch supports the aconfig soong modules, method
added by this CL must be removed and java_aconfig_library should be
used instead.

Test: adb shell device_config put android_core_networking \
Test: com.android.net.flags.test_feature true
Test: Compares the value from java_aconfig_library and DeviceConfigUtils
Change-Id: I8e35b33a3201192e940e88f96aad3b2b6685b046
2023-10-02 19:34:01 +09:00
Chalard Jean
2aa4412503 Address comments on aosp/2765367
Test: comment-only change
Change-Id: I788f6e9f5fdd913d4c5077b6bb82c19664d3cd3f
2023-09-29 15:48:09 +09:00
Jean Chalard
1d600f4300 Merge changes Ifd7abd8a,I39cab8ff,I6b3270d6,Ia28c6abc,If47d7e23 into main
* changes:
  Move the MULTI_SIM_ACTION receiver inline
  Inline registerForCarrierChanges
  Make mThread a local
  Introduce a flag for using the carrier service changed callbacks.
  Have DevSdkIgnoreRunner support @Parameterized parameters
2023-09-29 06:46:08 +00:00
Xiao Ma
f45ec2858a Merge "Exclude testGetNeighborsQuery from NetworkStackCoverageTests." into main 2023-09-29 05:42:16 +00:00
Xiao Ma
998f6b0eda Exclude testGetNeighborsQuery from NetworkStackCoverageTests.
sepolicy gates RTM_GETNEIGH{TBL} with a new permission nlmsg_getneigh
and block access from untrusted_apps, but NetworkStackCoverageTests
uses the same UID with NetworkStack module, so it still has the
permission to send RTM_GETNEIGH(context: u:r:network_stack:s0<00>),
which causes the test always fails. Add the same assumeFalse check
for tests with network_stack context.

Bug: 283346574
Test: atest NetworkStackCoverageTests
Change-Id: Iaf652841bb9868783c924aa22fdf0c4f07e1e391
2023-09-29 12:26:49 +09:00
Maciej Żenczykowski
d58042e0d4 Merge "reverse BpfMap & BpfMapRO inheritence to make sense" into main 2023-09-29 03:24:37 +00:00
Maciej Żenczykowski
7e2f53e762 reverse BpfMap & BpfMapRO inheritence to make sense
Bug: 235590615
Bug: 235907076
Bug: 286003437
Test: TreeHugger, m droid gpuservice_unittest libtimeinstate_test bpf_benchmark bpf_module_test libbpf_load_test && mma
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I020a898fe8b257040a100f146654d4a04b19f843
2023-09-29 00:44:33 +00:00
Chalard Jean
a10ae005df Have DevSdkIgnoreRunner support @Parameterized parameters
Test: aosp/2405723 uses this, TH is happy with existing tests
Change-Id: If47d7e239d8483716fb78a97bbc2da4e24731209
2023-09-28 21:37:31 +09:00
Motomu Utsumi
2359e7b554 Remove defaultEnabled arg from isNetworkStackFeatureEnabled
Test: NetworkStaticLibsTests
Bug: 279108992
Change-Id: Id5409158fd720efc92e1b39678e636a8a7d5a0a5
2023-09-27 17:39:31 +09:00
Motomu Utsumi
ed4e7ec954 Update the logic of isFeatureEnabled and isFeatureNotChickenedOut
If the flag value is unset or 0, isFeatureEnabled return false and
isFeatureNotChickenedOut return true.
If the flag value is -1 (force disable), both return false.
If the flag value is other values, both query the package version and
return `flagValue <= packageVersion`

Now the only difference is a default behavior when the flag is not set
or 0.
So isFeatureEnabled and isFeatureNotChickenedOut can use the same flag.

This CL also fixes the issue in rollback.
Before this CL, isFeatureNotChickenedOut did not check the module
version and could have a issue if there is a rollback.

Test: NetworkStaticLibsTests
Bug: 279108992
Change-Id: I12d6ebadff3aee7b7c614aca4eb0a34ef0db9857
2023-09-27 17:30:01 +09:00
Motomu Utsumi
195a30f02e Remove lint-baseline in staticlibs
Bug: 300384860
Test: TH
Change-Id: Ic26efebc24b3f7030b6ff66579fc0f5e5d019d5f
2023-09-27 17:24:30 +09:00
Treehugger Robot
1b0f6fe058 Merge "use different log.h header file" into main 2023-09-22 04:11:47 +00:00
Jean Chalard
487191dbe6 Merge changes I8843ce7c,I90566998 into main
* changes:
  Block the package updater while CTS are running
  Add a command to block networking for an app
2023-09-22 02:26:19 +00:00
Maciej Żenczykowski
601d9f8b65 use different log.h header file
Test: TreeHugger
Bug: 299653233
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1e5c7bfc86d2ad61c0bad3b5ef2add94b4ce1481
2023-09-21 22:11:43 +00:00
Chalard Jean
3a6544fb1f Block the package updater while CTS are running
Test: manual
Bug: 284534251
Change-Id: I8843ce7c9e14cfe3f6f3439405d519587f2656ef
2023-09-21 12:57:10 +09:00
Maciej Żenczykowski
127a1441c3 bump min_sdk_version from 29 (Q) to 30 (R)
Mainline no longer supports Q.
These files were recently moved into p/m/C as part of a refactor.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0f06ace921db6c79d63c0048bdb73d167ff606cf
2023-09-19 23:22:58 +00:00
Remi NGUYEN VAN
f1846ac13b Check that wifi, cell validates before tests
Tests are sometimes run on hardware devices with wrongly configured wifi
or cell data. Ensure that this is reported as an infra error, and not a
test error, so the root cause is easier to identify.

Bug: 264170054
Test: atest
Change-Id: I4f964fbd4ee497e8ac92f7729375b75b6c4594a3
2023-09-19 17:26:20 +09:00
Motomu Utsumi
c480039309 Merge remote-tracking branch 'remotes/aosp/tmp_libs_net_move' into libs_net_move_merge
frameworks/libs/net/common ->
packages/modules/Connectivity/staticlibs

frameworks/libs/net/client-libs ->
packages/modules/Connectivity/staticlbs/client-libs

Test: TH
Bug: 296014682
Change-Id: I5dc78f0c4653e20312ab3d488b1e69262dbb9840
2023-09-11 11:53:46 +09:00
Motomu Utsumi
89e9fac536 Merge common/ from platform/frameworks/libs/net/ to staticlibs/ 2023-09-11 11:27:49 +09:00
Motomu Utsumi
daae5ca53d Merge "Rename to isNetworkStackFeatureEnabled" into main 2023-09-08 09:27:13 +00:00
Motomu Utsumi
958ee15299 Merge "Remove unnecessary arguments from isTetheringFeatureEnabled" into main 2023-09-08 09:24:57 +00:00
Maciej Żenczykowski
05304f1437 Merge "fix a compile warning about out of order field init" into main 2023-09-07 15:25:55 +00:00
Xiao Ma
e129bc5958 Merge "Add IA Address option struct." into main 2023-09-07 08:43:12 +00:00
Xiao Ma
af996bec47 Merge "Remove the VisibleForTesting annotation on IaPrefixOption constructor." into main 2023-09-07 08:18:23 +00:00
Maciej Żenczykowski
325f675273 fix a compile warning about out of order field init
http://cs/h/prodkernel/kernel/upstream/torvalds/linux-2.6/+/master:tools/include/uapi/linux/bpf.h?l=1486

struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */
		__u32		prog_fd;
		__u32		retval;
		__u32		data_size_in;
		__u32		data_size_out;
		__aligned_u64	data_in;
		__aligned_u64	data_out;
...

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2c08b65bdcdbd7fb9872b6d4cbbf542fe28ef916
2023-09-06 23:51:37 +00:00
Motomu Utsumi
eff2facfd5 Merge common/ from platform/frameworks/libs/net/ to staticlibs/ 2023-09-05 19:04:56 +09:00
Motomu Utsumi
e323c1db81 Rename to isNetworkStackFeatureEnabled
DeviceConfigUtils had isFeatureEnabled for NetworkStack and Tethering
which were confusing since the difference was only the arguments.
This CL renames isFeatureEnabled for NetworkStack module to
isNetworkStackFeatureEnabled to avoid confusion.

This CL also removes unnecessary arguments.

Bug: 279108992
Test: m
Change-Id: I523b98bd3754c209c64ce7d1513b5afcb36599b9
2023-09-05 17:50:24 +09:00
Motomu Utsumi
6a22207190 Remove unnecessary arguments from isTetheringFeatureEnabled
Test: m
Bug: 279108992
Change-Id: Iadc1b4665c364bf754ed32e7bb53b78e555ed457
2023-09-05 17:50:15 +09:00
Yuyang Huang
343683916f Merge "Add util to check if permission has system signature" into main 2023-09-05 08:45:40 +00:00