Commit Graph

1238 Commits

Author SHA1 Message Date
Treehugger Robot
68783d0260 Merge "Remove pollOrThrow" 2023-04-10 04:58:22 +00:00
Jean Chalard
10dd699d9f Merge "Add javadoc descriptions for family of methods" 2023-04-08 02:02:43 +00:00
Jean Chalard
32a735e8fa Merge "Remove eventuallyExpectOrNull" 2023-04-08 02:02:22 +00:00
Treehugger Robot
5fc2bcf360 Merge "Update StructInetDiagMsg to parse all the fields" 2023-04-07 11:48:37 +00:00
Yuyang Huang
2a1e2288ed Merge "Add a build rule for files used by mdns" 2023-04-06 02:08:46 +00:00
Motomu Utsumi
80c53fa4fd Update StructInetDiagMsg to parse all the fields
Bug: 270298713
Test: atest NetworkStaticLibTests
Change-Id: I782eca50b6db6dca88ee933edb5d5d19223886dd
2023-04-06 11:03:52 +09:00
Yuyang Huang
f67388b0ff Add a build rule for files used by mdns
mdns may be imported in other non-AOSP projects as a library, along with
its dependencies from net-utils-device-common. While all of
net-utils-device-common may not build against system API, this requires
the files used by mdns to build against system API.

Add a library to allow checking that the dependencies can still build
against system API.

Test: m
Bug: 272392042
Change-Id: I468f53b47ef55c23137594a79599b148084f4535
2023-04-05 19:31:31 +09:00
Maciej Żenczykowski
fb914d8226 update comment about synchronizeKernelRCU() still working
Since it just came up again, and I just verified this still works

Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I292c94cf9af63488ed30a6ac367ac83c8912e97e
2023-04-04 22:24:31 +00:00
Xiao Ma
6559a91e3e Add constants for a DHCP packet maximum length and maximum option length.
Bug: 260934173
Test: m
Change-Id: I484a7a04c73906b11edb70e1053ee7f3172e8ffd
2023-04-04 10:27:34 +09:00
Chalard Jean
b56b9f2dcc Add util to compare getAllAddresses
Bug: 269715746
Test: New test in this patch
Change-Id: I243940df693d984a8adfa5c55b49088f7d8bc5ff
2023-03-31 21:35:44 +09:00
Maciej Żenczykowski
7c8bdba450 Merge "bpf_headers: add bpf_probe_read_user_str" 2023-03-29 02:15:09 +00:00
Steven Moreland
59e343367a bpf_headers: add bpf_probe_read_user_str
Bug: 269407130
Test: N/A
Change-Id: I735bffefd41ea3edcafd846041f8c237e860ee6c
2023-03-29 00:12:36 +00:00
Treehugger Robot
eab30c4fe7 Merge "[ST07] Add more documentation for PacketReflector" 2023-03-28 07:09:29 +00:00
Junyu Lai
63ff33b9e0 [ST07] Add more documentation for PacketReflector
Test: TH
Bug: 139774492
Change-Id: I778a8392a01806da313335b8103d27295b3e96e4
2023-03-28 10:37:26 +08:00
Junyu Lai
6210d4df5c Merge changes from topics "st05", "st06"
* changes:
  [ST06.2] Read http body for PUT or POST http request
  [ST05.3] Support PacketBridge
2023-03-28 02:25:52 +00:00
Junyu Lai
8fef4f726a [ST06.2] Read http body for PUT or POST http request
Currently, the test http server will respond whenever
http request is read, no matter how much data was declared
in the Content-Length header. For tests that uses POST
request to test uplink traffic this is not good enough.

Invoke parseBody to read data from input stream to make
sure the http body is read.

Test: atest android.net.NetworkStatsIntegrationTest \
      --rerun-until-failure 100
Bug: 139774492
Change-Id: I1b71f3e55747d104e4a8796611517d93f178321f
2023-03-27 18:45:46 +08:00
Junyu Lai
86c95b4925 [ST05.3] Support PacketBridge
For testing purposes, a TestNetworkInterface provides a
FileDescriptor which allows content injection on the test
network. However, this could be hard to use because the
callers need to compose IP packets in order to inject
content to the test network.

In order to remove the need of composing the IP packets,
this class forwards IP packets between two
TestNetworkInterface instances. Thus, the TCP/IP headers
could be parsed/composed automatically by the protocol stack of
this additional TestNetworkInterface, while the payload is
supplied by the servers run on the interface.

Test: 1. atest android.net.NetworkStatsIntegrationTest
      2. atest com.android.cts.net.HostsideVpnTests
Bug: 139774492
Change-Id: I8fe5a434d6d727a81d106a967dcdca157424e12e
2023-03-27 18:25:29 +08:00
Motomu Utsumi
b0c6afda18 Merge "Fix StructInetDiagMsg#parse bug" 2023-03-24 08:44:55 +00:00
Motomu Utsumi
06e615e3ce Fix StructInetDiagMsg#parse bug
StructInetDiagMsg#parse used absolute position to parse id and idiag_uid
fields.
This causes an issue when byte buffer contains multiple netlink messages
and parsed netlink message starts from the middle of byte buffer.

This CL fixes above issue and adds test for the case that single byte
buffer contains multiple netlink messages.

Test: atest NetworkStaticLibTests
Change-Id: I771daf17b4a606915d5edefd9f0e90ef01abf168
2023-03-24 12:34:04 +09:00
Xiao Ma
f15914cccf Merge "Support NLM_F_REPLACE flag when sending a RTM_NEWADDR message." 2023-03-24 02:51:53 +00:00
Xiao Ma
9a1359b46c Support NLM_F_REPLACE flag when sending a RTM_NEWADDR message.
NLM_F_REPLACE is helpful when we only want to update the preferred and
valid lifetime for a specific IPv6 address. DHCPv6 prefix delegation
gives a concrete example, once client refreshes the delegated prefix
successfully in RENEW or REBIND state, it also needs to extend the
preferred and valid lifetime of an IPv6 address, otherwise, it becomes
depreacated when the lifetime expires. Add the NLM_F_REPLACE flag to
replace the existing matching address object with updated fields.

Bug: 260934173
Test: atest NetworkStaticLibsTests
Change-Id: Ic001ddf9cfb031a586bbe177819e7666eaf7cde0
2023-03-23 15:59:40 +09:00
Junyu Lai
460c042999 Merge "Fix lint errors and adding nullability annotations in PacketReflector" 2023-03-20 05:49:19 +00:00
Junyu Lai
621c1b739d Merge "[ST04.1] Move PacketReflector to static library" 2023-03-16 13:23:14 +00:00
Junyu Lai
388204218b Fix lint errors and adding nullability annotations in PacketReflector
This is a no-op refactoring.

Test: TH
Bug: 139774492
Change-Id: Ibb6605a9f7add8319321e5b4960a0b9b637f1434
2023-03-15 13:53:36 +08:00
Junyu Lai
5622c37a85 [ST04.1] Move PacketReflector to static library
This is also needed by integration test in NetworkStack module
in follow-up CLs. Move to a common place first.
This is a no-op refactoring.

Test: atest com.android.cts.net.HostsideVpnTests
Bug: 139774492
Change-Id: Ifc7ed4c93edfb0f6f8eb47231f6df40332d2c10c
2023-03-15 13:35:00 +08:00
Maciej Żenczykowski
6ba8685aba minor checksum changes
main change is checksum of zero buffer is now 0 instead of
the equivalent, but technically incorrect 0xFFFF.

Test: TreeHugger
Bug: 265591307
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1a8b0ace704009f82d3b7ad1c299bf8a6d8964d8
2023-03-15 02:58:28 +00:00
Yuyang Huang
048a452551 Adds constructors for RtNetlinkAddressMessage and StructIfaddrMsg
Adds constructors for RtNetlinkAddressMessage and StructIfaddrMsg to
make it possible to directly construct RtNetlinkAddressMessage in the
test cases.

Bug: 267980538
Test: m
Change-Id: I21bf0cbef888495dc9a165a0fe6d5b39135e4c18
2023-03-14 11:30:28 +09:00
Treehugger Robot
88370eaae3 Merge "introduce BpfClassic.h" 2023-03-11 04:54:53 +00:00
Maciej Żenczykowski
aab04f1455 introduce BpfClassic.h
with helper macros for writing classic bpf code

Bug: 265591307
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibffad51668303ddc5d6850409f9058dfc2894ef6
2023-03-10 23:46:42 +00:00
Jean Chalard
ead06ac681 Merge "Remove eventuallyExpectOrNull usages from AOSP" 2023-03-09 08:45:00 +00:00
Treehugger Robot
754a8f97a3 Merge "Mark struct member as final in IaPdOption and IaPrefixOption." 2023-03-08 12:53:21 +00:00
Chalard Jean
c2cf7eb82d Remove pollOrThrow
This method is better removed, because it doesn't follow the
naming conventions we want to keep in this file. It also isn't
useful :
• There is only one use of it outside tests, and it's in the
  same file. It's trivial to inline it.
• The method has a unit test, which becomes useless once the
  method is inlined.
• There is a corresponding command in the interpreter, but it's
  only used by the unit test and therefore can be removed once
  the unit test is removed.

Test: TH
Bug: 157405399
Change-Id: Ib5b1369ac28e4577adc98204e42ff2f27729e64c
2023-03-07 21:48:24 +09:00
Chalard Jean
2725af813a Add javadoc descriptions for family of methods
Test: comment-only change
Bug: 157405399
Change-Id: I58ccb8b05a8ffb82d4575b727bb48dfb21b191fd
2023-03-07 21:48:24 +09:00
Chalard Jean
0784d5dbd1 Remove eventuallyExpectOrNull
This is no longer used and is advantageously replaced
by a call to poll(), which has the same semantics.

Test: TH
Bug: 157405399
Change-Id: I3182fd3e3ac749e11a8f962ef1acfdca5d031b05
2023-03-07 21:47:50 +09:00
Chalard Jean
febf4ab6fb Remove eventuallyExpectOrNull usages from AOSP
This is not useful because it has the exact same semantics
as poll() : it returns the first event that matches the
predicate within the timeout, or null if none.

Unfortunately the method can't be removed until all
uses in internal master are removed, so the actual
removal will have to wait for the next patch.

Test: TH
Bug: 157405399
Change-Id: I471c44568e359f8686dcb21ae04c76ca8095f02f
2023-03-07 21:47:11 +09:00
Xiao Ma
17edf2c733 Mark struct member as final in IaPdOption and IaPrefixOption.
Bug: 271797628
Test: m
Change-Id: I6b4ae9e9b4011f705831eec48ebab813ab5911b6
2023-03-07 11:18:25 +09:00
Maciej Żenczykowski
aa9063c3d5 improve getSocketCookie()
(and a few minor cleanups while at it)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I657c3314fb0ad2519dc4d1b0743e1be6a81a887a
2023-03-03 01:56:47 +00:00
Junyu Lai
ff5ee31314 Merge "Revert "Return default value when getModuleVersion throwed"" 2023-02-21 07:47:51 +00:00
Chalard Jean
2695fdf6ce Bubble up exceptions in visibleOnHandlerThread
Test: NetworkStaticLibTests
Fixes: 269390906
Change-Id: I3c2d330dd719869562f437c1995e85abd32dbd68
2023-02-17 07:19:22 +00:00
Junyu Lai
1236b9e809 Revert "Return default value when getModuleVersion throwed"
This reverts commit 76a97e81f51cb28e9c2b9eaf039e4186029989a3.

Reason for revert: b/269391238

Fix: 269391238
Change-Id: Ic1fbe09c341f147350e64357f9f647ec61d7e828
2023-02-16 02:30:08 +00:00
Xiao Ma
0ceff621d1 Merge "Add DHCPv6 IA Prefix Option structure." 2023-02-15 09:36:52 +00:00
Suprabh Shukla
5b4050448d Add an empty implementation of INetdEventListener
Adding a class that has maintains no-op implementation for all methods
in INetdEventListener to allow extending in a compatible way across
projects

Test: Builds, boots

Bug: 265742148
Change-Id: I46327d78a3685848e06f7a369e238d2952410296
2023-02-14 08:33:59 -08:00
Xiao Ma
fa4c0c5c3e Add DHCPv6 IA Prefix Option structure.
Bug: 260934173
Test: m
Change-Id: Iba9be5ad6c696b6b44c39bd50f5f27ade3e33846
2023-02-14 23:35:21 +09:00
Xiao Ma
b9ecc44a05 Add DHCPv6 IA_PD option structure.
Bug: 260934173
Test: m
Change-Id: I890f9c651dc9089d463783725731903bd3969e4e
2023-02-14 23:31:11 +09:00
Treehugger Robot
69715f9bad Merge "Add DHCPv6 IA_PD and IA_PREFIX option constants." 2023-02-14 14:18:32 +00:00
Xiao Ma
188387ebc6 Add DHCPv6 IA_PD and IA_PREFIX option constants.
Bug: 260934173
Test: m
Change-Id: I2f6692f4915c937787f023d40924f17f61d4a44e
2023-02-14 20:14:52 +09:00
Jean Chalard
35f954324f Merge "Remove expectLinkPropertiesThat" 2023-02-11 02:09:38 +00:00
Jean Chalard
c67deee923 Merge changes from topics "remove_expectblocked", "rename_reason"
* changes:
  Rename BlockedStatusInt.blocked to .reason
  Remove expectBlockedStatusCallback
2023-02-10 05:26:50 +00:00
Igor Chernyshev
f063240c56 Merge "Add OS access interfaces and test impl for wear tethering" 2023-02-09 21:17:54 +00:00
Chalard Jean
36e8ff3f87 Remove expectLinkPropertiesThat
expect() is simply better

Bug: 157405399
Test: ConnectivityServiceTest NetworkStaticLibTests
Change-Id: If8da940e378722f4cde2a4e7ea3eaef3b1380f18
2023-02-09 16:19:09 +09:00