Commit Graph

1238 Commits

Author SHA1 Message Date
chiachangwang
3b64739d81 Address review comments in aosp/2677976
This commit address the follow-up review comments
in aosp/2677976.

Fix: 296150560
Test: atest FrameworksNetTests NetworkStaticLibTests
Change-Id: I0ff4cef8585e2ae496447c4d37e072c1de281775
2023-08-18 08:13:27 +00:00
Motomu Utsumi
c046ac418e Rename to isTetheringFeatureEnabled
DeviceConfigUtils has isFeatureEnabled for NetworkStack and Tethering
which were confusing since the difference was only the arguments.
This CL renames isFeatureEnabled for Tethering module to
isTetheringFeatureEnabled to avoid confusion.

Bug: 279108992
Test: m
Change-Id: I16e8e4f6c0080d73533ce8bd36adfa7038347500
2023-08-17 19:00:22 +09:00
Motomu Utsumi
27d5411011 Merge "UpsideDownCake is now 34" into main 2023-08-17 06:18:22 +00:00
Motomu Utsumi
396605364c Merge "Rename to isTetheringFeatureNotChickenedOut" into main 2023-08-17 06:12:36 +00:00
Cole Faust
de112b6109 Baseline NewApi issues
NewApi was recently updated to support linting methods in
the system, module_lib, and system_server sdks, and was
demoted to a warning due to the new issues it finds.
Baseline all the new issues that NewApi can be made an error
again.

These cls were generated automatically by a script that
copied the NewApi issues from the reference baselines.

Bug: 268261262
Test: m lint-check
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:b6d6bf359ca53d41a08b7e2af86f7a080e2b5741)
Merged-In: I31beadf91173116b9750fe6f132a4f979a2e0d9a
Change-Id: I31beadf91173116b9750fe6f132a4f979a2e0d9a
2023-08-17 04:42:53 +00:00
Alex Buynytskyy
57bd2e41e9 UpsideDownCake is now 34
Ignore-AOSP-First: UpsideDownCake Finalization
Bug: 275409981
Test: build
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:8bc31011a242dddb401273b5b6505b49b649ae67)
Merged-In: Ic36cad45118f0220e44279a8b6ac89d22c3319d3
Change-Id: Ic36cad45118f0220e44279a8b6ac89d22c3319d3
2023-08-17 04:07:50 +00:00
Motomu Utsumi
aad6281844 Rename to isTetheringFeatureNotChickenedOut
Expected use case of isTetheringFeatureForceDisabled was
`enabled = !isTetheringFeatureForceDisabled`, which is error prune.
So this CL renames to isTetheringFeatureNotChickenedOut and updates to
return true if the feature is not disabled.
If the feature is enabled by default and disabled by flag push (kill
switch), isTetheringFeatureNotChickenedOut should be used.

Bug: 279108992
Test: m
Change-Id: I5f85c24032bae298831bbf042874a63ea2c9b75f
2023-08-17 02:18:22 +00:00
Remi NGUYEN VAN
f3bd5e5a0a Merge "Fix DevSdkIgnoreRule for Q-" into main 2023-08-14 03:15:37 +00:00
Xiao Ma
a3f942de44 Add IA Address option struct.
Bug: 293393743
Test: m
Change-Id: Id4ab164579a95b87fa8a8d1d00447c6a3bd394d5
2023-08-12 16:38:06 +09:00
Xiao Ma
79f5dc6b4d Remove the VisibleForTesting annotation on IaPrefixOption constructor.
Fix AndroidLint warning in aosp/2691418.

Bug: 260934173
Test: TH
Change-Id: Idfaff1342931d6c3ebfd3aa2fea02ab3ed5bb6f1
2023-08-11 15:53:49 +09:00
Remi NGUYEN VAN
a6e8a281a4 Fix DevSdkIgnoreRule for Q-
UnboundedSdkLevel stopped working on Q as it now depends on Set.of,
which is an R+ API. Arguably this should be fixed as its minSdk is still
29, but long-term UnboundedSdkLevel may drop Q support as modules now
only need to support R+.

Avoid using UnboundedSdkLevel on Q- in DevSdkIgnoreRule: this avoids the
above problem, and also makes it compatible with even older builds,
which may happen in GTS.

Bug: 292868272
Test: all tests using this rule
Change-Id: I5e1559d841398a6c6763283f32c9f766a3661e21
2023-08-10 16:24:48 +09:00
Patrick Rohr
533af6d72d TrackRecord: add a method to return callbacks since last poll
This change adds a backtrace() method which returns a list of events
that were received since the last time a user called poll() on a
ReadHead. This is particularly useful for logging observed events while
a poll was in progress that did not end up matching an event.

Test: atest EthernetManagerTest
Change-Id: If019cf9eb5e3e9268c5e6b74edbd8f49959cc71c
2023-08-09 05:26:36 -07:00
Xiao Ma
a95710dd60 Move RFC7421_PREFIX_LENGTH from NetworkConstants to NetworkStackConstants.
NetworkStack module imports RFC7421_PREFIX_LENGTH constant from
filegroup services-connectivity-shared-srcs, to get rid of this
dependency, move the constants to NetworkStackConstants.

Bug: 290885904
Test: TH
Change-Id: I0e8f068856c8843121273e0b598097d82b8465d5
2023-08-09 18:08:10 +09:00
Colin Cross
d91c89ba51 Fix kotlin nullable errors in net-test-utils and NetworkStaticLibTests
Fix kotlin nullable errors that were exposed by setting the retention
of android.annotation.NonNull and android.annotation.Nullable to
class retention.

Bug: 294110802
Test: builds
Change-Id: I2a2c91188b64619fca190a9bd7812d32f9610abd
2023-08-08 14:26:10 -07:00
Jean Chalard
d51371bc8b Merge "Add constants for clat and v6 fragmentation" into main 2023-08-07 05:21:57 +00:00
Yuyang Huang
783d4fb4f6 Add helpers method to SharedLog
Bug: 294326360
Test: atest FrameworksNetTests
Change-Id: Ib8ba3e9a556a70de28813465396c6609b7c22333
2023-08-06 17:34:58 +09:00
Chiachang Wang
cc5c2a648a Merge "Add isFeatureSupported and isTetheringFeatureForceDisabled methods" into main 2023-08-03 06:58:28 +00:00
Chiachang Wang
f870ae3120 Merge "Add resolvePkgPrefix() method" into main 2023-08-03 06:58:20 +00:00
chiachangwang
1637730010 Add isFeatureSupported and isTetheringFeatureForceDisabled methods
Add isFeatureSupported helper method to check whether
a specific feature is supported. This is useful when a specific
module version is required on a cross module feature, e.g.
a connectivity feauture requires to work with a older
networkstack module.

This commit also adds isTetheringFeatureForceDisabled() method
as a method that refers to DeviceConfig which can be controlled
to explicitly disabled.

Bug: 291870956
Test: atest FrameworksNetTests NetworkStaticLibTests
Change-Id: I511d00663e2378c36b4ca017db4b88d88f650852
2023-08-02 13:12:14 +00:00
Remi NGUYEN VAN
547c94d171 Merge "Use requestNetwork for mobile data, not a callback" into main 2023-08-02 07:09:04 +00:00
Remi NGUYEN VAN
fa33ba6f3d Merge "Add DomainsUtils class to encode/decode domain names." into main 2023-08-02 00:58:40 +00:00
Remi NGUYEN VAN
837837e0fe Use requestNetwork for mobile data, not a callback
On devices that do not have always active mobile data, it needs
to be requested for onAvailable to be called.

Change-Id: Ic814684bcd06389c013a6e6636487d9b47627901
Test: TH
2023-08-01 08:48:32 +00:00
Xiao Ma
d0d7f2aa3c Merge "Add Ipv6PktInfo (in6_pktinfo) struct." into main 2023-08-01 05:46:23 +00:00
chiachangwang
9835a4eae0 Add resolvePkgPrefix() method
This is a no-op refactor change to create resolvePkgPrefix()
helper method to prevent code duplication for the follow up
commit.

Bug: 291870956
Test: atest NetworkStaticLibTests
Change-Id: I8deea97acdb793dfa076ce55f7f2c3eb0b224461
2023-07-31 14:01:24 +00:00
Junyu Lai
3416eae310 Merge "Make SkipPresubmit annotation visible by HostsideVpnTests" into main 2023-07-28 02:06:17 +00:00
Patrick Rohr
ea6b69dcec Merge "Remove truth lib denpendency temporarily due to code coverage regression." into main 2023-07-27 16:27:00 +00:00
Xiao Ma
80dbd06f64 Add Ipv6PktInfo (in6_pktinfo) struct.
in6_pktinfo structure specifies the source IPv6 address and interface
for an outgoing packet(used with UDP or RAW socket), we can specify the
IPV6_PKTINFO ancillary data on sendmsg() with this structure to set the
source address (e.g. a global IPv6 address).

Bug: 293393743
Test: TH
Change-Id: I2bd8ea6fcdb7398db9b3a54243c81ca27e832e45
2023-07-27 15:17:24 +09:00
Xiao Ma
9e9bc97317 Remove truth lib denpendency temporarily due to code coverage regression.
Bug: 291341416
Test: atest NetworkStaticLibTests
Change-Id: Id8fac2ff76dab174761fbc48d0599bcce81918ed
2023-07-27 12:12:41 +09:00
Remi NGUYEN VAN
7035b4418d Merge "Add an annotation for @SkipMainlinePresubmit" into main 2023-07-27 02:13:22 +00:00
Junyu Lai
af464eb494 Make SkipPresubmit annotation visible by HostsideVpnTests
Test: TH
Bug: 291701394
Change-Id: I93d72a809b2779deec3c8182c5efed6d38393ab8
2023-07-26 14:42:56 +08:00
Remi NGUYEN VAN
5e4900dbbe Add an annotation for @SkipMainlinePresubmit
This will typically be used in mainline-presubmit TEST_MAPPING
configuration to exclude some tests.

This is necessary as some tests are flaky in mainline configurations
(when running on older devices), and they need to be disabled to meet
SLO requirements, but they are not flaky on presubmit using the latest
platform builds.

Test: m
Change-Id: Ia532d6d3f9833ddec613d79c0eb517d20a1c529a
2023-07-26 13:37:47 +09:00
Mike Yu
4838904eb3 Merge "Add DnsResolverModuleTest annotation" into main 2023-07-26 03:17:09 +00:00
fqjc86
48693a994a Add DomainsUtils class to encode/decode domain names.
Both encode and deocde methods support message compression which is
described in RFC1035 section 4.1.4. We can leverage both methods in
a follow-up CL to parse DHCPv4 option 119 and DNSSL RA option.

This cl also adds maxLabelCount argument for DnsRecordParser#parseName
to prevent the potential recursion from overflowing the stack.

Bug: 189865016
Test: atest NetworkStaticLibTests
Change-Id: I90101ecda64bfecb0233e80ea93c91c204fbf176
2023-07-25 18:29:23 +05:30
Maciej Żenczykowski
54044cf4c9 Merge "BpfClassic - add three more macros" into main 2023-07-24 19:08:57 +00:00
Xiao Ma
72b0cd986a Add RouteInformation option Struct.
This structure is useful when building an RA with RIO for integration
tests and verify the device's provisioning behavior, for example, check
if devices in ULA networks can recover its IPv6 connectivity from
receiving a normal RA after losing IPv6 default route (e.g. received RA
with zero router lifetime).

Bug: 183601771
Test: m
Change-Id: I13b85000ea1633f56edc74e3d62b7a38b9a851bf
2023-07-24 12:51:01 +09:00
Maciej Żenczykowski
2cd8b69005 BpfClassic - add three more macros
Example use case:
  BPF_LOAD_SKB_PROTOCOL,
  BPF2_ACCEPT_IF_EQUAL(ETH_P_ARP),
  BPF2_REJECT_IF_NOT_EQUAL(ETH_P_IP),
  BPF_LOAD_IPV4_BE16(frag_off),
  BPF2_REJECT_IF_ANY_BITS_SET(IP_MF | IP_OFFMASK),
  BPF_ACCEPT,
which is a sample program which accepts ARP plus non-fragmented IPv4.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibe6f9f7941f11bc7b767a092d3d108fa0291f360
2023-07-22 14:32:47 +00:00
Maciej Żenczykowski
28a8600dc0 Merge "Move ticksToMilliSeconds to NetlinkUtils." into main 2023-07-20 12:02:48 +00:00
Xiao Ma
c4789d0df4 Merge "Add DomainsUtils class to encode/decode domain names." into main 2023-07-20 09:03:24 +00:00
Xiao Ma
a56b949726 Move ticksToMilliSeconds to NetlinkUtils.
ticksToMilliSeconds is used to convert the clock ticks to milliseconds,
move it to a common utils class, we can call this method to convert the
rta_cacheinfo.rta_expires in user space as well to get when the default
route will expire.

Bug: 183601771
Test: atest NetworkStaticLibTests
Change-Id: Iabd510fe290f835a8fe690d91921d5b706a23b56
2023-07-20 16:54:46 +09:00
Xiao Ma
da97a39255 Improve testBasicWorkingGetAddrQuery by checking the specific IPv4/v6 address.
Parse the entire RTM_NEWADDR message instead of only parsing the nlmsg
header and Ifaddr header. Besides, that would be better to know which IP
address will be returned from kernel via netlink message, that's IPv4
and IPv6 loopback addresses.

Test: atest NetworkStaticLibTests
Change-Id: I3a01137db4a7774fa30ebdec5a1711697991b9fe
2023-07-12 13:32:19 +09:00
fqjc86
cece401526 Add DomainsUtils class to encode/decode domain names.
Both encode and deocde methods support message compression which is
described in RFC1035 section 4.1.4. We can leverage both methods in
a follow-up CL to parse DHCPv4 option 119 and DNSSL RA option.

This cl also adds maxLabelCount argument for DnsRecordParser#parseName
to prevent the potential recursion from overflowing the stack.

Bug: 189865016
Test: atest NetworkStaticLibTests
Change-Id: I624649c224f141848a475ac85c56012d138c5224
2023-07-11 18:04:18 +09:00
Xiao Ma
2ca9f07b99 Merge "Remove duplicated IfaddrMsg and RtgenMsg Struct used in NetlinkUtilsTests." into main 2023-07-10 04:08:55 +00:00
Xiao Ma
3ffb814525 Remove duplicated IfaddrMsg and RtgenMsg Struct used in NetlinkUtilsTests.
Bug: 263222068
Test: atest NetworkStaticLibTests
Change-Id: Iea5f91e0b20db7cd4cb4451b06e713dd68e9c387
2023-07-10 11:12:33 +09:00
Motomu Utsumi
2ba922ad85 Use default package version in isFeatureEnabled if package is not found
Bug: 287359634
Bug: 289173013
Test: atest HostsideVpnTests
Change-Id: I379cde0391f96a8ac5dcdb2ff7723ea950684e36
2023-07-07 15:57:58 +09:00
Xiao Ma
723515738d Add a method helper to create RTM_DELADDR message in user space.
Bug: 260934173
Bug: 263222068
Test: atest NetworkStaticLibTests
Change-Id: Ibddaed91b12d3f27778d0bd2171bc5be38ff8bda
2023-06-30 23:52:23 +09:00
Xiao Ma
3a4ad37d61 Remove StructIfaddrMsg ctor VisibleForTesting annotation.
This allows other class to refer StructIfaddrMsg constructor as well,
otherwise, the default visibility is private.

Bug: 263222068
Test: atest NetworkStaticLibTests
Change-Id: If571b014ade51e3387748a4df0abcb49b59cb462
2023-06-30 23:48:27 +09:00
Junyu Lai
729c65662c Merge "Parse DnsRecord by factory method" 2023-06-27 03:21:08 +00:00
Mike Yu
8f4debc3f9 Add DnsResolverModuleTest annotation
This annotation can be used to mark a test case that requires
the latest resolv module. Tests that don't run with the latest
resolv module (for example CtsNetTestCasesLatestSdk) can exclude
the testcases being flaky due to some known issues in old resolv
module.

Bug: 279846955
Test: TreeHugger
Change-Id: Ie19eed1c4aa17645c4eec45493e7999027a01205
2023-06-26 07:40:18 +00:00
Junyu Lai
cba11a2370 Parse DnsRecord by factory method
Currently, DnsPacket calls DnsRecord constructor to create
DnsRecord instances from a ByteBuffer. However, invoking
DnsRecord constructor cannot create subclass instances of
DnsRecord.

To fix this, use a factory method to parse DnsRecord. This
factory method will peek the nsType field of the DnsRecord
as an argument, and it will use this field to determine which
subclass of DnsRecord to create.

This change is no-op, because it does not change the
functionality of DnsPacket. However, it does allow subsequent
changes to create subclass instances of DnsRecord in the future.

Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.net.module.util.DnsPacketTest

Change-Id: Ibbdeaf6e5a844573f393f05609310658d8d225b3
2023-06-26 14:52:21 +08:00
Lorenzo Colitti
4bf0632086 Merge "Add a dumpService variant that uses libbinder_ndk." 2023-06-23 03:54:37 +00:00