Commit graph android_packages_modules_Co.../staticlibs
Message SHA1
Move UDP header assembly to build()
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I5e070a57bfa40f95b72549cb02662f6557f78d45

Patrick Rohr   commited 2025-04-07 20:10:18 -07:00
c1cf40d38e
Add packet builder support for UDP packets
UDP packets can be built as:

val p = ether / ipv6 / udp / data
val p2 = ether / ipv4 / udp / data
val p3 = ether / ipv4 / udp / ipv4 / udp / data

This also gets rid of Icmp6Pkt in favor of a function call that
calculates the checksum over an L4 packet.

This does add a bit of duplication: the build() function for RA and NA
packets is identical, and UdpPkt#build() is not far off. However, subtle
differences in L4 packet format (namely the checksum and length
positions) make generalizing this code difficult. This is possible by
passing the checksum position, proto byte, and adding an abstract
function that fills in the L4 length field before performing checksum
calculation. However, this complexity is likely not worth it. If the
repetition becomes obvious once more protocols (such as ICMPv4/6 echo,
etc.) are added, this decision will be revisited.

Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: Ia78792418f29a3be091ebdc9bb2c26e45da9f2b1

Patrick Rohr   authored and   Maciej Żenczykowski   commited 2025-04-07 14:22:43 -07:00
328cfb5051
Add packet builder support for IPv4 packet
Options and fragments aren't currently supported.

Test: decoded test packet on packetor.com
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: Ia3a094cb1d2b093cae2f372cc84a72ad7e107105

Patrick Rohr   commited 2025-04-07 10:28:35 -07:00
313c1057f6
Add support to NdResponder to add custom RA
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: Ic7f2567f15b76478df1c438e756929a93ffd4d43

Patrick Rohr   commited 2025-04-07 10:28:35 -07:00
495edd20a8
Merge changes Ia1e08c43,Ifbca38e6 into main
* changes:
  Delete RouterAdvertisementResponder
  Rewrite RouterAdvertisementResponder in Kotlin

Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-04-04 11:02:03 -07:00
8ca69b3028
Delete RouterAdvertisementResponder
And move all other tests over to NdResponder.

Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: Ia1e08c439a039a4ffa020318da44652fadadf5c9

Patrick Rohr   commited 2025-04-03 22:09:47 -07:00
d107a1692f
Rewrite RouterAdvertisementResponder in Kotlin
And integrate into EthernetManager. So it can make proper use of
PacketBuilderUtils.

Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: Ifbca38e6efde68e015c69bf919d079d1605310d1

Patrick Rohr   commited 2025-04-03 21:59:21 -07:00
75a83c51ad
Merge changes Id81c57a7,I9b0fa0e5 into main
* changes:
  Add support for ICMPv6 checksumming
  Support scapy packet builder syntax

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-03 17:52:43 -07:00
c162c3c86a
Add support for ICMPv6 checksumming
Test: parsed packet on packetor
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: Id81c57a7f9ca9ee3671768941687458100beb068

Patrick Rohr   commited 2025-04-03 16:23:08 -07:00
a39bf4ee97
Support scapy packet builder syntax
Scapy allows building packets in order, i.e. by assembling them using
the division operator: val p = ether / ipv6 / icmpv6.

This change adds support for an identical pattern. To do so, it first
assembles all packets in order inside a packet builder class. When
build() is called, it traverses the packet list in reverse and assembles
the final packet, similar to ther original instance of the code. To
support checksum generation in the future, the code also keeps track of
the "closest pseudo header packet", i.e. the nearest encapsulating IPv6
(and soon IPv4) packet. This architecture should eventually be able to
support the creation of more complex packets, for example:
val p = ether / ipv6 / ipv6-ext / udp / ipv6 / udp.

(Note that now that I am writing this, I realize that this could
probably be significantly simplified by including IPv6 extension header
support as part of Ip6Pkt and always using the encapsulating packet for
the pseudo header...)

This code does not yet implement checksum generation.

Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I9b0fa0e5bb66edf6928d9b96144c5ed133ebab64

Patrick Rohr   commited 2025-04-03 14:50:09 -07:00
0b8e3a26fb
Merge changes Ic4b22e2c,Iaf4250da,I429b316a,I03cdb93f into main
* changes:
  Use Kotlin syntax for getters
  Return this from add*Option methods
  Add some documentation to RaPkt
  s/payload/data/ for brevity

Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-04-02 19:35:47 -07:00
96e3faa6bc
Merge "Add packet builder support for neighbor advertisement" into main
Maciej Żenczykowski   authored and   Android (Google) Code Review   commited 2025-04-02 19:35:17 -07:00
e470d2559b
Use Kotlin syntax for getters
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: Ic4b22e2c6154bf634bfbbe6c539bc6b26a29b3af

Patrick Rohr   commited 2025-04-02 11:41:01 -07:00
e2db1fe7e0
Return this from add*Option methods
To support friendlier builder syntax.

Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: Iaf4250da61e2c0b5311682b2c462eb07467428f7

Patrick Rohr   commited 2025-04-02 11:37:24 -07:00
91ef24c6f6
Add packet builder support for neighbor advertisement
In the future, we could consider adding an ICMPv6 base class that
implements common functionality between NaPkt and RaPkt. However, given
that checksumming is not currently supported, the common functionality
is limited to only a couple of lines.

Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: Id45f2ed43f45778e80b303bd356babcc93de1c3f

Patrick Rohr   commited 2025-04-02 10:30:36 -07:00
49eede426b
Add some documentation to RaPkt
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I429b316a2660789316f46fae63c621d81dfe67af

Patrick Rohr   commited 2025-04-02 10:30:36 -07:00
22727f7bef
s/payload/data/ for brevity
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I03cdb93f616510c3648d91f993577cb4d846a5bd

Patrick Rohr   commited 2025-04-02 10:30:36 -07:00
2e95c356d7
Merge "Improve stability of APFv{4,6} multi-device tests" into main
Yuyang Huang   authored and   Android (Google) Code Review   commited 2025-04-02 06:42:36 -07:00
1843442d0a
Improve stability of APFv{4,6} multi-device tests
This commit enhances the stability of the APFv{4,6} multi-device tests by addressing several sources of flakiness and improving the test setup and validation.

Specifically, this commit:

* Increased sleep time in the test setup. This ensures APF is activated before each test, preventing unexpected behavior.
* Added sleep time in `ApfV4Test` to ensure APF remains enabled and is not disabled due to high throughput scenarios.
* Changed the validation order to first check received packets and then APF counters. This helps to more easily identify the root cause of test failures.
* Changed the Ethernet destination address from multicast to unicast in `ApfV6Test` to prevent packets from being filtered due to DTIM skip.
* Removed the `test_broadcast_arp_request_offload()` test, which was flaky due to DTIM skip and is adequately covered by the `test_unicast_arp_request_offload()` test.

Bug: 406570694
Flag: TEST_ONLY
Test: atest CtsConnectivityMultiDevicesTestCases:ApfV4Test
Test: atest CtsConnectivityMultiDevicesTestCases:ApfV6Test
Test: run cts -m CtsConnectivityMultiDevicesTestCases --skip-preconditions -t ApfV4Test --shard-count 2
Test: run cts -m CtsConnectivityMultiDevicesTestCases --skip-preconditions -t ApfV6Test --shard-count 2
Change-Id: I053509459078d0bd94e16a6bf7349b948f930e6c

Jimi Chen   authored and   Yuyang Huang   commited 2025-04-02 04:31:01 -07:00
744a17443a
Add packet builder support for more RA options
Test: Built packet and parsed it in packetor
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I69d3451cbdd7f229f914ee5d0e4dd2c7a5178f0a

Patrick Rohr   commited 2025-04-01 16:26:30 -07:00
6269bbdedb
Remove unnecessary {}
Test: TH
Flag: EXEMPT mainline
Bug: 100
Change-Id: I4ca9f92ce6535cf6f07aa74a94ee58ced541e73f

Patrick Rohr   commited 2025-04-01 14:45:46 -07:00
62154f61be
Introduce generic packet builder utilities for use in tests
This change introduces a set of generic packet builder utility classes
that can be used in tests. The API surface aims to be similar to scapy
with a focus on ease of use.

Test: TH
Flag: EXEMPT mainline
Bug: 1
Change-Id: I9c751cece7bbad6bc38953cb52e9ab42393bab89

Patrick Rohr   commited 2025-04-01 10:48:31 -07:00
c3af22faca
Enable TETHER_FORCE_RANDOM_PREFIX_BASE_SELECTION by default
Since the feature was fully rolled out via experiment without
regression, this commit replaced with a
kill switch.

Flag: EXEMPT refactor
Test: atest ConnectivityCoverageTests:PrivateAddressCoordinatorTest
Fix: 312647670
Fix: 406955982
Change-Id: I18adcca45fa5f698adc80cea044d8006de097977

Junyu Lai   commited 2025-03-31 02:48:52 -07:00
db75d68801
Revert "Enable TETHER_FORCE_RANDOM_PREFIX_BASE_SELECTION by default on 25Q2+"
This reverts commit 44f2eb6e42.

Reason for revert: Networking mainline release council review feedback at b/406955982

Flag: EXEMPT bugfix
Test: TH
Bug: 406955982
Change-Id: I89bc8f5863c3acb72b5c4af5aadc40d34f2380ce

Junyu Lai   commited 2025-03-31 14:51:42 +08:00
121a4f90ba
Move EthernetTestInterface to testutils
To make it usable for integration tests not in CTS.

Test: TH
Change-Id: If243997f086c442d4f0ef8f3c77760fada769448

Patrick Rohr   commited 2025-03-28 10:06:13 -07:00
f23f6ae45b
Add generic createTestInterface to AutoCloseTestInterfaceRule
Test: TH
Change-Id: Ib0519f99417c94f3ae77ab1d56a81fe1fd167c0c

Patrick Rohr   commited 2025-03-28 09:50:21 -07:00
bd9376982e
Merge changes from topic "revert-3561690-revert-3538339-SNUWWZJNJZ-BUWEOGUTIT" into main am: 2519a78731
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3563843

Change-Id: I71adf8e70b37b93378041ca17bb3d20c8f871cd5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2025-03-27 01:14:42 -07:00
480d443869
Revert "Revert "Remove unnecessary ifindex arg from destroyUdpSo..."
Revert submission 3561690-revert-3538339-SNUWWZJNJZ

Reason for revert: NewAPI error will be fixed by separate CL

Reverted changes: /q/submissionid:3561690-revert-3538339-SNUWWZJNJZ

Change-Id: I2ae43c61c9ba0e0db3202a46e63756a3ea5a6512

Motomu Utsumi   commited 2025-03-27 08:49:10 +09:00
4d4563d62a
Merge changes from topic "revert-3538339-SNUWWZJNJZ" into main am: 86961c4b73
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3561690

Change-Id: I8ad3379f937a13c11fe0574c4397a4e5823d777c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Chaitanya Cheemala (xWF)   authored and   Automerger Merge Worker   commited 2025-03-26 04:08:27 -07:00
3d3b87b4f9
Merge changes from topic "revert-3538339-SNUWWZJNJZ" into main
* changes:
  Revert "Add hidden API to register/unregister QUIC connection cl..."
  Revert "Remove unnecessary ifindex arg from destroyUdpSocket"

Chaitanya Cheemala (xWF)   authored and   Gerrit Code Review   commited 2025-03-26 03:44:15 -07:00
86961c4b73
Merge changes I0eb70c12,I6cd727bd into main am: ebdcd9e199
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3538339

Change-Id: Iceb5c099835684c4014d1e05613d4200869b802e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2025-03-26 03:11:15 -07:00
fdb5ac536f
Revert "Remove unnecessary ifindex arg from destroyUdpSocket"
Revert submission 3538339

Reason for revert: Likely culprit for b/406432012 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Reverted changes: /q/submissionid:3538339

Change-Id: I70395af68b0f28e5c333333cb03a42f7633b0d5d

Chaitanya Cheemala (xWF)   authored and   Gerrit Code Review   commited 2025-03-26 03:07:07 -07:00
68b852a69c
Merge changes I0eb70c12,I6cd727bd into main
* changes:
  Remove unnecessary ifindex arg from destroyUdpSocket
  Add hidden API to register/unregister QUIC connection close payload

Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-26 02:30:35 -07:00
ebdcd9e199
Remove unnecessary ifindex arg from destroyUdpSocket
Bug: 311792075
Test: m
Change-Id: I0eb70c1248aff347e6f988789f340e117fceea33

Motomu Utsumi   commited 2025-03-26 16:48:43 +09:00
58498d1eee
Merge "Address aosp/3541181 leftover comments" into main am: bd1703ff4f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3555993

Change-Id: I5b6a7126ff771f27a7d74b48ae4eb947243138dc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Paul Hu   authored and   Automerger Merge Worker   commited 2025-03-25 22:25:41 -07:00
22ffcebc41
Merge "Address aosp/3541181 leftover comments" into main
Paul Hu   authored and   Gerrit Code Review   commited 2025-03-25 22:06:01 -07:00
bd1703ff4f
Address aosp/3541181 leftover comments
Test: atest TetheringTests CtsTetheringTest
Change-Id: Iee9c1eec33403c95e29656b3dfb1bfefea81108e

Paul Hu   commited 2025-03-25 10:02:37 +00:00
3f81aec099
Merge "Avoid unavailable APIs in ShellUtil" into main am: 137f2d754c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3556284

Change-Id: I7ae1aab33a049accd408b12328afa6e9d07120e2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2025-03-23 20:04:14 -07:00
9e5172b9f4
Merge "Avoid unavailable APIs in ShellUtil" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-23 19:33:44 -07:00
137f2d754c
Avoid unavailable APIs in ShellUtil
executeShellCommandRwe is U+. Use executeShellCommandRw which is S+
instead, and annotate methods accordingly. stderr is not used in any
instrumentation at the moment.

Bug: 405109522
Test: atest
Change-Id: I8212cb340cfb7e5ee5d0da314613b474e4f155fc

Remi NGUYEN VAN   commited 2025-03-24 10:15:44 +09:00
b84286a35a
Merge "Don't use NetworkScore in TestableNetworkAgent" into main am: b19b6d74b7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3555852

Change-Id: I3191ae158d634ee0480a329d9eb60ea1545ac9d4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2025-03-21 17:37:34 -07:00
8a2a08b01d
Don't use NetworkScore in TestableNetworkAgent
...because R doesn't know that class

Bug: 404977645
Test: NetworkAgentTest
Change-Id: Iac558bf02bb9372ba397013524839be2b0b4d415

Chalard Jean   commited 2025-03-22 02:15:57 +09:00
f68316091d
Merge "Make sure tests know to handle both early creation true and false" into main am: a0fa137d85
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3554646

Change-Id: I1db34d3fdd3033b59a40ef9d065e29021f1e49d7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2025-03-21 05:40:31 -07:00
5f0c5ce0dc
Merge "Make sure tests know to handle both early creation true and false" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-21 05:02:06 -07:00
a0fa137d85
Merge changes I7fae1964,Ic7cc9e1d into main am: d5743b9795
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3512874

Change-Id: Ia6de0e7d6033918e5cdf6d0a9ab76638fc0e1487
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2025-03-21 03:54:29 -07:00
aa737d2a76
Merge changes I7fae1964,Ic7cc9e1d into main
* changes:
  Add carrier-privileged app bypass for start/stopTethering
  Fix CarrierConfigRule#setHoldCarrierPrivilege race

Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-21 03:47:22 -07:00
d5743b9795
Make sure tests know to handle both early creation true and false
This is necessary to pass tests whatever the values of the features are.

NetworkAgentTest was updated assuming the feature was true, so
this patch revives the old code for when it's false.

TestableNetworkAgent reads the feature directly from
ConnectivityManager when it's not mocked.

Test: CtsNetTestCases
Change-Id: Ia556fbb1d1b6a38a4995b021981e2693d778bfff

Chalard Jean   commited 2025-03-21 19:29:06 +09:00
0cc8d81cc7
Fix CarrierConfigRule#setHoldCarrierPrivilege race
CarrierConfigRule#setHoldCarrierPrivilege will try to acquire/drop the
carrier privilege, but does not wait for the result of the operation. If
a test immediately calls an API that requires carrier privilege before
the operation completes, then it will fail.

Fix this by waiting for the operation to succeed before returning.

Bug: 295979433
Test: presubmit
Change-Id: Ic7cc9e1dbc206fbc0c3b79058b5782d93e89f1d7

Quang Anh Luong   commited 2025-03-21 18:13:37 +09:00
d3058d5ffe
Merge "Use scapy to generate ARP packet in multi-device test" into main am: 4703e17d98
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3549447

Change-Id: I7d3db5674448a91e742f451ddec22b0597828c6e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Yuyang Huang   authored and   Automerger Merge Worker   commited 2025-03-20 17:02:27 -07:00
e9726e8983
Merge "Use scapy to generate ARP packet in multi-device test" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2025-03-20 16:58:58 -07:00
4703e17d98