aconfig soong modules should be used to read the trunk stable flag.
However they are not available in the mainline branch.
So this CL adds the method to check if the trunk stable flag is enabled
or not by directly reading from DeviceConfig.
It's expected that this does not work correctly if flag value is not
stored in the DeviceConfig.
But for the time being, this method can be used to keep development.
Once the mainline branch supports the aconfig soong modules, method
added by this CL must be removed and java_aconfig_library should be
used instead.
Test: adb shell device_config put android_core_networking \
Test: com.android.net.flags.test_feature true
Test: Compares the value from java_aconfig_library and DeviceConfigUtils
Change-Id: I8e35b33a3201192e940e88f96aad3b2b6685b046
If the flag value is unset or 0, isFeatureEnabled return false and
isFeatureNotChickenedOut return true.
If the flag value is -1 (force disable), both return false.
If the flag value is other values, both query the package version and
return `flagValue <= packageVersion`
Now the only difference is a default behavior when the flag is not set
or 0.
So isFeatureEnabled and isFeatureNotChickenedOut can use the same flag.
This CL also fixes the issue in rollback.
Before this CL, isFeatureNotChickenedOut did not check the module
version and could have a issue if there is a rollback.
Test: NetworkStaticLibsTests
Bug: 279108992
Change-Id: I12d6ebadff3aee7b7c614aca4eb0a34ef0db9857
DeviceConfigUtils had isFeatureEnabled for NetworkStack and Tethering
which were confusing since the difference was only the arguments.
This CL renames isFeatureEnabled for NetworkStack module to
isNetworkStackFeatureEnabled to avoid confusion.
This CL also removes unnecessary arguments.
Bug: 279108992
Test: m
Change-Id: I523b98bd3754c209c64ce7d1513b5afcb36599b9
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
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
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
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
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
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
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
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
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
This allows other class to refer StructIfaddrMsg constructor as well,
otherwise, the default visibility is private.
Bug: 263222068
Test: atest NetworkStaticLibTests
Change-Id: If571b014ade51e3387748a4df0abcb49b59cb462
Then we can create an IaPrefixOption instance via constructor in the
NetworkStackIntegration test.
Bug: 260934173
Test: atest NetworkStackIntegrationTests
Change-Id: I05be1dde6ba5bda125631674c5c0f8634eb18924
destroyLiveTcpSockets APIs are replacement of socketDestroy in
NetdNativeService which has logging for target uids and duration.
Logging them would be useful in debug.
So adding equivalent logging to destroyLiveTcpSockets APIs.
Test: atest com.android.cts.net.HostsideVpnTests#testSocketClosed
Test: atest ConnectivityManagerTest#testFirewallCloseSocketDenylistChainDeny
Bug: 270298713
Change-Id: I347d010541656c92a64029b1474fae601d6e5659