Commit graph

3,550 commits

Message SHA1
Remove expectCapabilitiesWith and without
This is not clearer than using the base method.

Test: ConnectivityServiceTest NetworkStaticLibTests
Bug: 157405399
Change-Id: Iac9aeffb563d0a1cb6c1287b46b9bbfffc0c75ca

Chalard Jean   commited 2023-02-06 13:49:52 +09:00
ab521cf49d
Replace expectCapabilitiesThat with expectCaps
Add all the necessary overloads too.

Bug: 157405399
Test: ConnectivityServiceTest NetworkStaticLibTests
Change-Id: Idea768934182d4e2226c273fda0189942dcbf62e

Chalard Jean   commited 2023-02-06 13:49:51 +09:00
c0ba521f79
Factorize describeDifferences
Fixes: 259479229
Test: new test for this in this patch
Change-Id: Iecbccd10b04ada49f3485097dfcf3511c26c0925

Chalard Jean   authored and   Jean Chalard   commited 2023-01-27 08:02:10 +00:00
60b95c4090
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

Ryan Zuklie   commited 2023-01-23 08:28:50 -08:00
2669e24058
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

Ryan Zuklie   commited 2023-01-19 17:24:10 -08:00
be2ff67dae
Merge "Cleanup TestableNetworkCallback#assertNoCallback"
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-01-13 07:41:06 +00:00
ccc7d37685
Merge "Return default value when getModuleVersion throwed"
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-01-13 05:06:57 +00:00
b2e37305d9
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

Junyu Lai   commited 2023-01-12 15:04:06 +08:00
b4ecb5e750
Cleanup TestableNetworkCallback#assertNoCallback
Test: FrameworksNetTests
      CtsNetTestCases
      FrameworksNetIntegrationTests
      NetworkStackTests
      NetworkStaticLibTests
      TetheringTests
      MtsTetheringTestLatestSdk
      TetheringIntegrationTests
Bug: 157405399
Change-Id: I43eb47bbcf947899c18fcd9498c9064edceb0ecf

Chalard Jean   commited 2023-01-06 16:50:08 +09:00
5987fc4fbe
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

Ryan Zuklie   commited 2023-01-05 18:00:55 -08:00
888bd2de67
Merge "bpf_helpers.h: add load_byte/half/word() llvm/clang asm magic"
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-01-04 12:17:22 +00:00
d2819de4d7
Merge "Use the .o-wide bpfloader min/max ver for maps & programs too"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2023-01-04 10:28:51 +00:00
d6aa6218e3
Add base async io interfaces for wear tethering
Bug: 245971639

Change-Id: I31ccd7193409c82a0902e4ae318cc096f93f32da

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

Maciej Żenczykowski   commited 2023-01-03 11:09:02 +00:00
508c60d87a
Add wear tethering util classes
Bug: 245971639

Change-Id: I97655ece334ca93743896e89e12f8501f4e24776

Igor Chernyshev   commited 2023-01-03 06:55:23 +00:00
a25f1091c5
Merge "Introduce visibleOnHandlerThread"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-12-29 10:25:13 +00:00
2529234f69
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

Maciej Żenczykowski   commited 2022-12-27 12:31:27 +00:00
3114700eba
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

Maciej Żenczykowski   commited 2022-12-27 12:07:03 +00:00
ff998720b6
Merge "Adds setNetworkAllowlist and freeze AIDL to v13"
Ken Chen   authored and   Gerrit Code Review   commited 2022-12-25 12:01:59 +00:00
074e4c656b
dedup kernelversion.h
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie7a4dd46122e86bf808d0a3ac566075e1c3a2cd4

Maciej Żenczykowski   commited 2022-12-24 17:17:14 +00:00
d7d3b03e13
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

Ken Chen   commited 2022-12-23 09:47:29 +00:00
da7a00d147
Merge "switch BpfBitmap key from U32 to S32"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-12-22 21:17:48 +00:00
c97fcbdc9b
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

Maciej Żenczykowski   commited 2022-12-22 12:06:35 +00:00
463f211a76
Merge "verify java map key/value struct size matches file descriptor"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-12-22 10:57:40 +00:00
89a81fa85f
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

Chalard Jean   commited 2022-12-22 16:17:22 +09:00
9f7d45203f
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

Maciej Żenczykowski   commited 2022-12-21 23:12:37 +00:00
89e363d907
Merge "Add XFRM_MIGRATE support and freeze INetd v12."
Yan Yan   authored and   Gerrit Code Review   commited 2022-12-21 18:54:49 +00:00
f219efb124
Merge "Add @JvmOverloads for eventuallyExpect and expectAvailableCallbacks"
Lucas Lin   authored and   Gerrit Code Review   commited 2022-12-21 01:13:47 +00:00
f4eb9e5f6e
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

Maciej Żenczykowski   commited 2022-12-21 00:03:37 +00:00
32be06f45f
Merge "remove spurious #include and OVERFLOW_COUNTERSET"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-12-20 12:13:43 +00:00
cc40e9c110
Merge "Add option to skip map/prog based on build type"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-12-20 08:38:45 +00:00
e504cc8754
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

lucaslin   commited 2022-12-20 02:59:41 +00:00
4045840fd4
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

Yan Yan   commited 2022-12-20 01:10:00 +00:00
111118096a
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

Ryan Zuklie   commited 2022-12-19 14:08:53 -08:00
8531cfe5dd
Merge "remove SKIP_IF_BPF_NOT_SUPPORTED"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-12-19 19:10:11 +00:00
ebdb391e3c
Merge "remove no longer needed SKIP_IF_EXTENDED_BPF_NOT_SUPPORTED macro"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-12-19 18:53:31 +00:00
96b9b38a7c
Merge "remove unused SKIP_IF_XDP_NOT_SUPPORTED macro"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-12-19 18:53:25 +00:00
77a039029e
remove spurious #include and OVERFLOW_COUNTERSET
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8ad1b19905509862bdfa4e710da778ed0effb058

Maciej Żenczykowski   commited 2022-12-19 09:59:25 -08:00
6776e3b02b
Merge "Add common netlink operation and definition for TCP socket polling"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-12-19 12:40:41 +00:00
da152d63b4
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

chiachangwang   commited 2022-12-19 09:11:00 +00:00
29bbf2dace
Merge changes from topic "st03"
* changes:
  Interrupt thread before closing socket
  [ST03] Add test dns server for integration tests

Junyu Lai   authored and   Gerrit Code Review   commited 2022-12-19 02:34:33 +00:00
7e3cdf9ef2
Merge "Add SocketUtils in the shared libs"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-12-19 00:54:16 +00:00
ca7fd6df9b
remove SKIP_IF_BPF_NOT_SUPPORTED
There is only user left, let us simply move the macro
definition into the resolv_integration_test.cpp file.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6eb66abaa7f6392ab43300e5087e4277491e44c9

Maciej Żenczykowski   commited 2022-12-18 19:48:54 +00:00
ec6505edd6
remove no longer needed SKIP_IF_EXTENDED_BPF_NOT_SUPPORTED macro
We can merge this now that:
  https://googleplex-android-review.git.corp.google.com/c/platform/system/netd/+/20284735
  'bpf_base_test - unconditionally run TestSocketFilterSetUp'
has been pulled into tm-mainline-prod.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1b65cd41ce7b4eaab7f1fead2742c72e48294244

Maciej Żenczykowski   commited 2022-12-18 16:37:32 +00:00
d6ba77ab89
remove unused SKIP_IF_XDP_NOT_SUPPORTED macro
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2480cbe958d2827440e5dd827b43a89f4b7a556c

Maciej Żenczykowski   commited 2022-12-18 11:11:21 +00:00
8da25a73a5
BpfSyscallWrapper - use 'enum bpf_cmd' instead of int for bpf() arg
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I73d8d33e1677088fbbed02c554c88269912d2f76

Maciej Żenczykowski   commited 2022-12-16 20:59:31 +00:00
d8c03fec3a
Add SocketUtils in the shared libs
SocketUtils in the framework should be better to move to shared
lib since it's commonly used by modules. But it is exposed in
API surface, so it cannnot simply move from framework to shared
lib. Create a SocketUtils in libs to deprecate the usage of
the original SocketUtils so that adding extra socket utils will
not be restricted by API release.

Test: m
Change-Id: Idf57071a4bd89a6114dda9a9c9c19fd0e5db54c5

chiachangwang   commited 2022-12-16 09:31:44 +00:00
f618ab0769