Commit Graph

1238 Commits

Author SHA1 Message Date
Chalard Jean
ab47793183 Rename BlockedStatusInt.blocked to .reason
It's a reason, so it's a lot clearer this way

Bug: 157405399
Test: ConnectivityServiceTest NetworkStaticLibTests
Change-Id: Id71d710a33b4df3c211e40141adb2aa0a535f458
2023-02-09 16:19:09 +09:00
Chalard Jean
12038d2e28 Remove expectBlockedStatusCallback
expect() does a better job.

Bug: 157405399
Test: ConnectivityServiceTest NetworkStaticLibTests
Change-Id: I2bc4dc0f175b8d46784dbdb3a4724dea41200dc7
2023-02-09 16:19:09 +09:00
Jean Chalard
cd18acab06 Merge "Remove expectCapabilitiesWith and without" 2023-02-09 02:20:20 +00:00
Yuyang Huang
165c6ffbd6 Merge "Add CtsNetTestCasesMaxTargetSdk33" 2023-02-07 10:44:15 +00:00
Chalard Jean
ab521cf49d Remove expectCapabilitiesWith and without
This is not clearer than using the base method.

Test: ConnectivityServiceTest NetworkStaticLibTests
Bug: 157405399
Change-Id: Iac9aeffb563d0a1cb6c1287b46b9bbfffc0c75ca
2023-02-06 13:49:52 +09:00
Chalard Jean
c0ba521f79 Replace expectCapabilitiesThat with expectCaps
Add all the necessary overloads too.

Bug: 157405399
Test: ConnectivityServiceTest NetworkStaticLibTests
Change-Id: Idea768934182d4e2226c273fda0189942dcbf62e
2023-02-06 13:49:51 +09:00
Yuyang Huang
bdb79c510f Add CtsNetTestCasesMaxTargetSdk33
The annotation is used to verify behavior for apps with max target SDK
33.

Bug: 267102290
Test: atest CtsNetTestCasesMaxTargetSdk33
Change-Id: I71ba4433389ba07553ea3d6d34a2bf64fdc132ad
2023-02-02 13:22:12 +09:00
Chalard Jean
60b95c4090 Factorize describeDifferences
Fixes: 259479229
Test: new test for this in this patch
Change-Id: Iecbccd10b04ada49f3485097dfcf3511c26c0925
2023-01-27 08:02:10 +00:00
Ryan Zuklie
2669e24058 Add BpfRingbuf class to wrap ringbuf access
This implements the bare minimum to read from BPF ring buffers in
userspace. The implementation uses two shared memory regions with
atomic-like access. Currently, the class only guarantees that the
element type has the same size (later can add btf support).

The alternative would be to use libbpf or bcc, but since this is a small
header-only library that seemed like it could end up being more
difficulty than it was worth.

Bug: 246985031
Test: atest libbpf_android_test
Change-Id: I7f08e76db9cb9672ef66c629bccb3db63d3c2229
2023-01-23 08:28:50 -08:00
Remi NGUYEN VAN
bcdc972c86 Add packet filters for IPv6 UDP
This is useful to test mDNS.

Bug: 266151066
Test: atest NsdManagerTest (with related change)
Change-Id: I790da3f3be5277f2480600cfbbaeac86c306f77d
2023-01-23 18:20:44 +09:00
Ryan Zuklie
be2ff67dae Add macro support for ignore_on BPF maps.
This is similar to https://r.android.com/2374598 for maps.

Bug: 246985031
Test: build connectivity module
Change-Id: Id4c9f93b69e808d461b4554bf3fa591828635dd1
2023-01-19 17:24:10 -08:00
Igor Chernyshev
004c5b422b Add OS access interfaces and test impl for wear tethering
Bug: 245971639

Change-Id: I750c2e9bbe8c9a3992ae91d9fea4958bfce60828
2023-01-13 17:57:01 +00:00
Treehugger Robot
ccc7d37685 Merge "Cleanup TestableNetworkCallback#assertNoCallback" 2023-01-13 07:41:06 +00:00
Treehugger Robot
b2e37305d9 Merge "Return default value when getModuleVersion throwed" 2023-01-13 05:06:57 +00:00
Junyu Lai
b4ecb5e750 Return default value when getModuleVersion throwed
In aosp, getModuleVersion would always throw since there is
no meta-info for modules. Currently it would make
isFeatureEnabled method return false, which is not
a right thing for features are default enabled.
Change it to return default value when throwed.

Test: atest NetworkStaticLibTests
Bug: 263219497
Change-Id: Iadcdcedac1f1da7d894e03b76b3e985f87ca8b0e
2023-01-12 15:04:06 +08:00
Chalard Jean
5987fc4fbe Cleanup TestableNetworkCallback#assertNoCallback
Test: FrameworksNetTests
      CtsNetTestCases
      FrameworksNetIntegrationTests
      NetworkStackTests
      NetworkStaticLibTests
      TetheringTests
      MtsTetheringTestLatestSdk
      TetheringIntegrationTests
Bug: 157405399
Change-Id: I43eb47bbcf947899c18fcd9498c9064edceb0ecf
2023-01-06 16:50:08 +09:00
Ryan Zuklie
888bd2de67 Update bpf helpers to support new ignore_on fields
This updates the ringbuffer and program helpers to allow specifying
which platform builds they are ignored on. In order to use this, you
must specify a min loader version >= 0.32, so the helpers also add
options for setting this at the program/ringbuf level.

Bug: 246985031
Test: tethering build & install, full platform build & install
Change-Id: I6bf9f7945c3fbac8fd4e02b5805016ac275b7884
2023-01-05 18:00:55 -08:00
Treehugger Robot
d2819de4d7 Merge "bpf_helpers.h: add load_byte/half/word() llvm/clang asm magic" 2023-01-04 12:17:22 +00:00
Maciej Żenczykowski
d6aa6218e3 Merge "Use the .o-wide bpfloader min/max ver for maps & programs too" 2023-01-04 10:28:51 +00:00
Igor Chernyshev
17686b4c05 Add base async io interfaces for wear tethering
Bug: 245971639

Change-Id: I31ccd7193409c82a0902e4ae318cc096f93f32da
2023-01-04 01:05:03 +00:00
Treehugger Robot
2b2a0cd769 Merge "Add wear tethering util classes" 2023-01-04 00:50:05 +00:00
Treehugger Robot
06ef5250f5 Merge "Treat unknown dns modes as empty string (ie. opportunistic)" 2023-01-03 14:25:44 +00:00
Treehugger Robot
d4d6d828a3 Merge "dedup kernelversion.h" 2023-01-03 13:20:26 +00:00
Maciej Żenczykowski
508c60d87a Treat unknown dns modes as empty string (ie. opportunistic)
Bug: 260211513
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I39282d887ec17bf4ed7aee2a7ae712d69b94bc31
2023-01-03 11:09:02 +00:00
Igor Chernyshev
a25f1091c5 Add wear tethering util classes
Bug: 245971639

Change-Id: I97655ece334ca93743896e89e12f8501f4e24776
2023-01-03 06:55:23 +00:00
Treehugger Robot
2529234f69 Merge "Introduce visibleOnHandlerThread" 2022-12-29 10:25:13 +00:00
Maciej Żenczykowski
3114700eba bpf_helpers.h: add load_byte/half/word() llvm/clang asm magic
see kernel's
  samples/bpf/bpf_helpers.h
or
  tools/testing/selftests/bpf/bpf_legacy.h

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id331fb9abcd87df8bf87c5a86749acf0144ffbde
2022-12-27 12:31:27 +00:00
Maciej Żenczykowski
ff998720b6 Use the .o-wide bpfloader min/max ver for maps & programs too
This is basically a no-op, but will make future compatibility checks easier.

The programs/maps already won't load on a bpfloader outside of
this range, as the entire .o will be skipped.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0669c7ff9e04e24a8da68aa821c9ad705a8f5a93
2022-12-27 12:07:03 +00:00
Ken Chen
074e4c656b Merge "Adds setNetworkAllowlist and freeze AIDL to v13" 2022-12-25 12:01:59 +00:00
Maciej Żenczykowski
d7d3b03e13 dedup kernelversion.h
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie7a4dd46122e86bf808d0a3ac566075e1c3a2cd4
2022-12-24 17:17:14 +00:00
Ken Chen
da7a00d147 Adds setNetworkAllowlist and freeze AIDL to v13
Add this interface so that CS can tell netd the network is allowed for
the given UID ranges.

Freeze AIDL to v13.

Test: netd_integration_test
Change-Id: I00c45a663dc917fc0ba4da5a99828edad1562d8c
2022-12-23 09:47:29 +00:00
Maciej Żenczykowski
c97fcbdc9b Merge "switch BpfBitmap key from U32 to S32" 2022-12-22 21:17:48 +00:00
Maciej Żenczykowski
463f211a76 convert BpfDumpTest from U32 to S32
no need to use U32, of which uses I'd like to eliminate wherever possible

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8c0a2df73c4153b21d33ee7a8f5d434f0fc80103
2022-12-22 12:06:35 +00:00
Maciej Żenczykowski
89a81fa85f Merge "verify java map key/value struct size matches file descriptor" 2022-12-22 10:57:40 +00:00
Chalard Jean
9f7d45203f Introduce visibleOnHandlerThread
This is a helper function that lets a caller make sure the
side effects of a piece of code are visible both on a handler
thread and in the caller thread before continuing.

Also move HandlerUtilsTests to the tests directory of
frameworks/libs/net from the NetworkStack where it used to be

Test: NetworkStaticLibTests
Change-Id: Icf1bd8bbe1216777c52b73cfbd0a46b647b72260
2022-12-22 16:17:22 +09:00
Maciej Żenczykowski
89e363d907 switch BpfBitmap key from U32 to S32
Since this is an array from 32 bit int to 64 bit int,
the S32/U32 distinction doesn't matter before we hit
a bitmap with 2 billion entries, ie. 128 billion bits,
taking up 16GiB of RAM...

But S32 is a native java int, while U32 requires long.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5b06e80e801e007bafb18693647d968cba905c36
2022-12-21 23:12:37 +00:00
Yan Yan
f219efb124 Merge "Add XFRM_MIGRATE support and freeze INetd v12." 2022-12-21 18:54:49 +00:00
Lucas Lin
f4eb9e5f6e Merge "Add @JvmOverloads for eventuallyExpect and expectAvailableCallbacks" 2022-12-21 01:13:47 +00:00
Maciej Żenczykowski
32be06f45f verify java map key/value struct size matches file descriptor
(this should avoid kernel reading/writing from out of bounds)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I71fe71eee4e4e6a917477eef5fd2266439e803f3
2022-12-21 00:03:37 +00:00
Maciej Żenczykowski
cc40e9c110 Merge "remove spurious #include and OVERFLOW_COUNTERSET" 2022-12-20 12:13:43 +00:00
Maciej Żenczykowski
e504cc8754 Merge "Add option to skip map/prog based on build type" 2022-12-20 08:38:45 +00:00
lucaslin
4045840fd4 Add @JvmOverloads for eventuallyExpect and expectAvailableCallbacks
It's useful for the java code to have the overload methods for
eventuallyExpect and expectAvailableCallbacks.

Bug: 231749077
Test: atest CtsHostsideNetworkTests:HostsideVpnTests
Change-Id: I6bb1385ee84d1ff1e9f0472e6de3f452ab142958
2022-12-20 02:59:41 +00:00
Yan Yan
111118096a Add XFRM_MIGRATE support and freeze INetd v12.
This commit updates netd_aidl_interface to support
migrating IPsec tunnel mode SA to different source
and destination addresses.

server/aidl_api/netd_aidl_interface/12/ are generated
by "m netd_aidl_interface-freeze-api"

Bug: 169170985
Test: atest netd_integration_test (new tests)
Change-Id: I89b54272c1528f12e6351819e0efe666af7a2946
2022-12-20 01:10:00 +00:00
Ryan Zuklie
8531cfe5dd Add option to skip map/prog based on build type
This feature allows skipping a program or map based on the type of the
build. This allows things like userdebug-only programs.

Bug: 246985031
Test: added test program and watched it skipped on userdebug
Change-Id: I5cd9725ad8f133c98c86e6ba620a266313055157
2022-12-19 14:08:53 -08:00
Maciej Żenczykowski
ebdb391e3c Merge "remove SKIP_IF_BPF_NOT_SUPPORTED" 2022-12-19 19:10:11 +00:00
Treehugger Robot
96b9b38a7c Merge "remove no longer needed SKIP_IF_EXTENDED_BPF_NOT_SUPPORTED macro" 2022-12-19 18:53:31 +00:00
Treehugger Robot
77a039029e Merge "remove unused SKIP_IF_XDP_NOT_SUPPORTED macro" 2022-12-19 18:53:25 +00:00
Maciej Żenczykowski
6776e3b02b remove spurious #include and OVERFLOW_COUNTERSET
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8ad1b19905509862bdfa4e710da778ed0effb058
2022-12-19 09:59:25 -08:00
Chiachang Wang
da152d63b4 Merge "Add common netlink operation and definition for TCP socket polling" 2022-12-19 12:40:41 +00:00
chiachangwang
29bbf2dace Add common netlink operation and definition for TCP socket polling
Move code to common lib to support coming TCP socket polling
design in connectivity module to prevent code duplication.

Bug: 259000745
Test: atest FrameworksNetTests
Change-Id: I89ca1c19122c3b4306b93a6a253e0ea67259eb77
2022-12-19 09:11:00 +00:00