Commit Graph

1238 Commits

Author SHA1 Message Date
Junyu Lai
7e3cdf9ef2 Merge changes from topic "st03"
* changes:
  Interrupt thread before closing socket
  [ST03] Add test dns server for integration tests
2022-12-19 02:34:33 +00:00
Chiachang Wang
ca7fd6df9b Merge "Add SocketUtils in the shared libs" 2022-12-19 00:54:16 +00:00
Maciej Żenczykowski
ec6505edd6 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
2022-12-18 19:48:54 +00:00
Maciej Żenczykowski
d6ba77ab89 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
2022-12-18 16:37:32 +00:00
Maciej Żenczykowski
8da25a73a5 remove unused SKIP_IF_XDP_NOT_SUPPORTED macro
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2480cbe958d2827440e5dd827b43a89f4b7a556c
2022-12-18 11:11:21 +00:00
Maciej Żenczykowski
d8c03fec3a BpfSyscallWrapper - use 'enum bpf_cmd' instead of int for bpf() arg
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I73d8d33e1677088fbbed02c554c88269912d2f76
2022-12-16 20:59:31 +00:00
chiachangwang
f618ab0769 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
2022-12-16 09:31:44 +00:00
Jean Chalard
1a2aafc9a4 Merge "Add a physical local native network type." 2022-12-15 08:29:09 +00:00
Treehugger Robot
0a3110218a Merge "Add DHCPv6 relevant constants such as port and multicast group address." 2022-12-15 06:30:55 +00:00
Xiao Ma
f3e13a3fdd Add DHCPv6 relevant constants such as port and multicast group address.
Bug: 260934173
Test: m
Change-Id: Ice5e9c7fa3f2250654a6a9822d05786831bd66c4
2022-12-15 11:29:46 +09:00
Treehugger Robot
22d2158452 Merge "Add skeleton BPF ring buffer integration test" 2022-12-14 21:04:18 +00:00
Chalard Jean
8a00b8cf7c Add a physical local native network type.
There are no local networks yet, but they will come in
followup patches.

Test: netd_integration_test
Bug: 64955351
Change-Id: Ic82cf2390f52024e44e03b264b55c9843b932b71
2022-12-14 19:33:09 +09:00
Treehugger Robot
26388b06ef Merge "Use TargetSetupError for ConnectivityCheck" 2022-12-14 07:27:28 +00:00
Junyu Lai
70b03f9299 Interrupt thread before closing socket
Test failed when socket.close() ran, and in the other thread
we are trying to initialize an InetSocketAddress. If the socket
was closed, the port got from the socket object becomes -1 hence
the InetSocketAddress cannot be constructed and the
IllegalArgumentException would be thrown.

Interrupt thread before closing socket to prevent from the race.

Test: atest TestDnsServerTest --rerun-until-failure 1000
Fix: 259160848
Change-Id: I219ee1e32144ba9983a28765e7a84621c27c1c09
2022-12-14 14:01:31 +08:00
Junyu Lai
3d4eb94be5 [ST03] Add test dns server for integration tests
This is re-upload of aosp/1390056, CL that fixes test is separated
in a follow-up CL that submit at the same time.

Bug: 139774492
Test: atest DnsAnswerProviderTest TestDnsServerTest
Change-Id: Ia72975f3044f009ebb0f4564a527830268a4a157
2022-12-13 16:15:46 +08:00
Xiao Ma
089c4c750e Merge "Address comments left from aosp/2324894." 2022-12-13 07:09:27 +00:00
Remi NGUYEN VAN
449c01f6f6 Use TargetSetupError for ConnectivityCheck
If the preparer throws AssertionError, tests will still
be retried without re-running the preparer. It needs
to throw TargetSetupError to indicate that setup failed.

Change-Id: Id01845536a216e1a3ca1c671c97f7bcd992c354e
Fixes: 254542801
Test: atest
2022-12-13 14:58:40 +09:00
Ryan Zuklie
ccd5eb9359 Add skeleton BPF ring buffer integration test
This adds a BPF program with a ring buffer and an associated test that
ensures the program and ring buffer can be loaded by the bpf loader. In
the following changes, this foundation will be used to test the user
space ring buffer wrapper class.

Unlike BpfMap, userspace can't (easily) write to the ring buffer so the
most accurate way to test a userspace ring buffer implementation is to
write to it from a BPF program.

Note: the BPF program in this change is never actually attached to a
cgroup, it is only loaded. The program will be executed manually using
BPF_PROG_RUN which is "side-effect free" (it can have side effects on
BPF maps, but not on Kernel state, e.g. dropping packets).

Bug: 246985031
Test: atest libbpf_android_test
Change-Id: Ib9c591218188f5f358a755c8854bc6f87d26af12
2022-12-12 10:02:18 -08:00
Xiao Ma
d03464df21 Address comments left from aosp/2324894.
- address flags preferrence, support u32 flags
    - assert IP address should not be null
    - add unit tests for the update.

Bug: 260934173
Test: atest NetworkStaticLibTests
Change-Id: I18b3a717a9602748617cad279f65c0fefd5dec48
2022-12-12 18:40:30 +09:00
Treehugger Robot
0a9506978a Merge "Add IPV4_FLAG_{DF,MF} constants." 2022-12-12 05:01:41 +00:00
Chiachang Wang
6c6a58639c Merge "Add NetlinkUtils" 2022-12-12 01:02:38 +00:00
Maciej Żenczykowski
39f2501c50 Merge "updated TODO's for bpf_shared.h -> netd.h rename" 2022-12-10 10:26:54 +00:00
Treehugger Robot
521ed5b92d Merge "Rename DEFINE_BPF_RINGBUF to DEFINE_BPF_RINGBUF_EXT" 2022-12-10 02:27:05 +00:00
Treehugger Robot
e027ddf90d Merge "Add the name of the expected callback" 2022-12-09 21:15:45 +00:00
Ryan Zuklie
5a8738e7de Rename DEFINE_BPF_RINGBUF to DEFINE_BPF_RINGBUF_EXT
_EXT suffix is used for the all-args versions of these, such as the one
here.

Bug: 246985031
Test: build and flash on 4.19 and 5.10
Change-Id: Ibd76cbdc38f4d1f9df4f440147e5f18d9a2ea026
2022-12-08 17:18:54 -08:00
Maciej Żenczykowski
41abe75ba7 updated TODO's for bpf_shared.h -> netd.h rename
Test: TreeHugger
Signed-off: Maciej Żenczykowski <maze@google.com>
Change-Id: I44bb430f176161cafd6dfbd5e26e61dbe2a0183a
2022-12-08 16:40:28 +00:00
chiachangwang
c7801476ea Add NetlinkUtils
Add NetlinkUtils to support common netlink related utilities.
Also add method to support usage for construct an
inet_diag_req_v2 message for querying alive TCP sockets from
kernel.

Bug: 259000745
Test: atest NetworkStackTests
Change-Id: I542a115128fe663dd1c478942091452fb9352111
2022-12-08 05:34:02 +00:00
Lorenzo Colitti
741ae9ff5d Add IPV4_FLAG_{DF,MF} constants.
Bug: 258093642
Test: see other CL in topic
Change-Id: I04b954a7adb0a0e8bc4032a2cbfc899fe958b3b1
2022-12-07 23:44:25 +00:00
Xiao Ma
0937911c41 Add a method helper to create RTM_NEWADDR message in user space.
Bug: 260934173
Test: atest NetworkStaticLibTests
Change-Id: I39a53a3d8b0cd10437aeed502657dd34d8b7775d
2022-12-07 12:53:55 +09:00
Chiachang Wang
7e04d1678d Merge "Add withCleanCallingIdentity with Supplier to module utils" 2022-12-05 00:48:25 +00:00
chiachangwang
b2a6964fc2 Add withCleanCallingIdentity with Supplier to module utils
Binder#withCleanCallingIdentity with Supplier is a very useful
utility but it's not public.  Thus, make one in the connectivity
module utils.

Bug: 255231779
Test: m ; adb shell dumpsys connectivity
Change-Id: I029a34a96b1107111a605b91a54c8fdb071e9fc0
2022-12-01 08:10:07 +00:00
Maciej Żenczykowski
8b541aa6ae Merge "Add macro to create BPF ring buffers." 2022-11-29 13:58:51 +00:00
Ryan Zuklie
79ce874e8f Add macro to create BPF ring buffers.
BPF ring buffers are defined like maps, but cannot specify a key or
value size (attempting to do so is a verifier error). This change also
adds the type-safe methods for interacting with the map (output, reserve
and submit).

Bug: 246985031
Test: local run of Network Tracing w/ ring buffers
Change-Id: Ie8a47d987be6cb219fe7d73f2c61a56e3a3ab21a
2022-11-28 11:06:30 -08:00
Chalard Jean
c79a231a16 Add the name of the expected callback
Before :
  java.lang.AssertionError: Did not receive callback after 5000
After :
  java.lang.AssertionError: Did not receive Available after 5000ms

Test: manual
Change-Id: If46d52cb0db8ea3d418169ea330d915d835e4373
2022-11-25 15:52:03 +09:00
Hassan Ali
47d424e49d Add ConfigInfrastructure lib to Android.bp
As part of moving DeviceConfig.java to
packages/modules/ConfigInfrastructure, We need to add
ConfigInfrastructure lib dependency to Android.bp.

Test: m
bug: 253019048
Change-Id: Id35bec32e9b46ef6589034d442a767ce1a4aaac8
2022-11-17 16:34:31 +00:00
Treehugger Robot
8228246ad0 Merge "Revert "[ST03] Add test dns server for integration tests"" 2022-11-16 05:13:03 +00:00
Jean Chalard
55de7e4c84 Merge "Add useful utils to CollectionUtils" 2022-11-15 08:50:19 +00:00
Junyu Lai
88c48e18e4 Revert "[ST03] Add test dns server for integration tests"
Revert "[ST03.1] Add DnsAnswerProviderTest"

Revert submission 1390056-st03

Reason for revert: test failed in presubmit, still under checking.
Reverted Changes:
Ia5039a47f:[ST03] Add test dns server for integration tests
I9157e030c:[ST03.1] Add DnsAnswerProviderTest

Change-Id: I1ff291ca62e2209343ed5c5e4aa3bf3e93229f47
2022-11-15 05:55:27 +00:00
Treehugger Robot
40b76e8bac Merge "[ST03] Add test dns server for integration tests" 2022-11-14 14:01:12 +00:00
Chalard Jean
43bb172e82 Add useful utils to CollectionUtils
Test: new tests in this patch
Change-Id: I9cca999f9235d4d6508533230afcd8ee0c1c54c1
2022-11-14 20:47:59 +09:00
Treehugger Robot
1a81ae4eb9 Merge "Move DeviceConfigRule to libs/net" 2022-11-14 09:34:58 +00:00
Junyu Lai
c32afc4238 Merge "Add eventuallyExpect method that takes mark" 2022-11-14 05:55:58 +00:00
Jean Chalard
664e53bd88 Merge "[CC08] Remove expectCallback*" 2022-11-11 03:17:42 +00:00
Remi NGUYEN VAN
7356d356fb Move DeviceConfigRule to libs/net
The utility can be useful for tests in several repositories, not just
CTS.

Test: m
Change-Id: Id4c653793e58d91d604b388a06a7c137ed020110
2022-11-10 18:10:24 +09:00
Junyu Lai
53a6b7053d Add eventuallyExpect method that takes mark
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest
Fix: 254188130
Change-Id: I98ea8aef5cb21ee92ce47d97d2f9c81448b1cd9e
2022-11-10 14:35:29 +08:00
Maciej Żenczykowski
91e4845301 Merge "Revert "add bpf_for_each_map_elem() helper definition"" 2022-11-07 23:36:35 +00:00
Treehugger Robot
5043f90f0f Merge "Add option to validate DUN networks" 2022-11-04 11:14:41 +00:00
Remi NGUYEN VAN
8076110105 Add option to validate DUN networks
When isDunValidationRequired is true, networks with DUN capability will
always be validated. Otherwise previous behavior will apply.

Bug: 253989196
Test: atest NetworkMonitorTests
Change-Id: I6e8bc7fcbf561f636abbf42ca69749fd0eabfd6c
2022-11-04 17:05:49 +09:00
Maciej Żenczykowski
61e21fff0b Revert "add bpf_for_each_map_elem() helper definition"
This reverts commit 8711ae5494a3011f48543987fa08872d775df652.

Bug: 256991746
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4835904f906422d5927feef82459ce1adcebc90c
2022-11-02 08:39:20 +00:00
Junyu Lai
be99103196 [ST03] Add test dns server for integration tests
Bug: 139774492
Test: atest DnsAnswerProviderTest TestDnsServerTest
Change-Id: Ia5039a47f4b818efb09aab8174beb9d921339c3d
2022-11-02 11:18:48 +08:00