Commit graph android_packages_modules_Co.../staticlibs/device
Message SHA1
Move the delegated prefix validity check to IaPrefixOption class.
Bug: 260934173
Test: TH
Change-Id: Idc6e32f8dbaf3b0e3c57eff496a006fafee02b5e

Xiao Ma   commited 2023-10-08 14:33:25 +09:00
fac8a33763
bpf jni: add native_getProgramIdFromCgroup
Test: TreeHugger
Bug: 292156770
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib7b194b9cbf6519f9fbcfd1fcefcbe5d825f5c3a

Maciej Żenczykowski   commited 2023-10-04 19:14:43 +00:00
85ac050b35
Merge "Remove lint-baseline in staticlibs" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2023-10-04 06:45:02 +00:00
30ef5308d6
Merge "Remove defaultEnabled arg from isNetworkStackFeatureEnabled" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-10-03 11:51:32 +00:00
a675e966b2
Merge "Add method to read trunk stable flag" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-10-02 13:17:53 +00:00
f74f42b4c0
Add method to read trunk stable flag
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

Motomu Utsumi   commited 2023-10-02 19:34:01 +09:00
b0f489021b
Remove defaultEnabled arg from isNetworkStackFeatureEnabled
Test: NetworkStaticLibsTests
Bug: 279108992
Change-Id: Id5409158fd720efc92e1b39678e636a8a7d5a0a5

Motomu Utsumi   commited 2023-09-27 17:39:31 +09:00
2359e7b554
Update the logic of isFeatureEnabled and isFeatureNotChickenedOut
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

Motomu Utsumi   commited 2023-09-27 17:30:01 +09:00
ed4e7ec954
Remove lint-baseline in staticlibs
Bug: 300384860
Test: TH
Change-Id: Ic26efebc24b3f7030b6ff66579fc0f5e5d019d5f

Motomu Utsumi   commited 2023-09-27 17:24:30 +09:00
195a30f02e
Merge "Rename to isNetworkStackFeatureEnabled" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2023-09-08 09:27:13 +00:00
daae5ca53d
Merge "Remove unnecessary arguments from isTetheringFeatureEnabled" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2023-09-08 09:24:57 +00:00
958ee15299
Merge "Add IA Address option struct." into main
Xiao Ma   authored and   Gerrit Code Review   commited 2023-09-07 08:43:12 +00:00
e129bc5958
Merge "Remove the VisibleForTesting annotation on IaPrefixOption constructor." into main
Xiao Ma   authored and   Gerrit Code Review   commited 2023-09-07 08:18:23 +00:00
af996bec47
Rename to isNetworkStackFeatureEnabled
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

Motomu Utsumi   commited 2023-09-05 17:50:24 +09:00
e323c1db81
Remove unnecessary arguments from isTetheringFeatureEnabled
Test: m
Bug: 279108992
Change-Id: Iadc1b4665c364bf754ed32e7bb53b78e555ed457

Motomu Utsumi   commited 2023-09-05 17:50:15 +09:00
6a22207190
Add isNetworkStackFeatureNotChickenedOut API for NetworkStack module.
Bug: 279108992
Test: atest NetworkStaticLibsTests
Change-Id: If42eb401b812017bd4d724b4323a8d51f7430606

Xiao Ma   commited 2023-08-28 17:52:04 +09:00
9209b00164
Merge "Move ArpPacket.java to frameworks/libs/net" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2023-08-24 07:12:27 +00:00
62a016e514
Move ArpPacket.java to frameworks/libs/net
Bug: 281639507
Test: TH
Change-Id: Ic0d273695d3f0f85a0ec56337a9d12d77b60ea3b

Yuyang Huang   commited 2023-08-24 12:48:02 +09:00
6acc55e129
Merge "BpfMap.java - remove getNextRawKey()" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2023-08-21 17:15:32 +00:00
82ae7ff289
Merge "BpfMap.java - remove getRawValue()" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2023-08-21 17:15:14 +00:00
4ed5e9e497
Merge "Rename to isTetheringFeatureEnabled" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2023-08-21 03:17:38 +00:00
656c77f4f0
Merge "Address review comments in aosp/2677976" into main
Chiachang Wang   authored and   Gerrit Code Review   commited 2023-08-21 02:34:01 +00:00
bdbcc0cc30
BpfMap.java - remove getRawValue()
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6903a29773ee4782c0f2ae64561e1c0fdcba618f

Maciej Żenczykowski   commited 2023-08-20 14:05:43 +00:00
b6a23b1504
BpfMap.java - remove getNextRawKey()
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ida62d346c1d6df800b5d45b67de60e945ac2b4c8

Maciej Żenczykowski   commited 2023-08-20 13:01:13 +00:00
2c87b82603
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

chiachangwang   authored and   Chiachang Wang   commited 2023-08-18 08:13:27 +00:00
3b64739d81
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

Motomu Utsumi   commited 2023-08-17 19:00:22 +09:00
c046ac418e
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

Motomu Utsumi   commited 2023-08-17 02:18:22 +00:00
aad6281844
Add IA Address option struct.
Bug: 293393743
Test: m
Change-Id: Id4ab164579a95b87fa8a8d1d00447c6a3bd394d5

Xiao Ma   commited 2023-08-12 16:38:06 +09:00
a3f942de44
Remove the VisibleForTesting annotation on IaPrefixOption constructor.
Fix AndroidLint warning in aosp/2691418.

Bug: 260934173
Test: TH
Change-Id: Idfaff1342931d6c3ebfd3aa2fea02ab3ed5bb6f1

Xiao Ma   commited 2023-08-11 15:53:49 +09:00
79f5dc6b4d
Add helpers method to SharedLog
Bug: 294326360
Test: atest FrameworksNetTests
Change-Id: Ib8ba3e9a556a70de28813465396c6609b7c22333

Yuyang Huang   commited 2023-08-06 17:34:58 +09:00
783d4fb4f6
Merge "Add isFeatureSupported and isTetheringFeatureForceDisabled methods" into main
Chiachang Wang   authored and   Gerrit Code Review   commited 2023-08-03 06:58:28 +00:00
cc5c2a648a
Merge "Add resolvePkgPrefix() method" into main
Chiachang Wang   authored and   Gerrit Code Review   commited 2023-08-03 06:58:20 +00:00
f870ae3120
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

chiachangwang   commited 2023-08-02 13:12:14 +00:00
1637730010
Merge "Add DomainsUtils class to encode/decode domain names." into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-08-02 00:58:40 +00:00
fa33ba6f3d
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

chiachangwang   commited 2023-07-31 14:01:24 +00:00
9835a4eae0
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

Xiao Ma   commited 2023-07-27 15:17:24 +09:00
80dbd06f64
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

fqjc86   commited 2023-07-25 18:29:23 +05:30
48693a994a
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

Xiao Ma   commited 2023-07-24 12:51:01 +09:00
72b0cd986a
Merge "Move ticksToMilliSeconds to NetlinkUtils." into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2023-07-20 12:02:48 +00:00
28a8600dc0
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

Xiao Ma   commited 2023-07-20 16:54:46 +09:00
a56b949726
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

fqjc86   authored and   Xiao Ma   commited 2023-07-11 18:04:18 +09:00
cece401526
Use default package version in isFeatureEnabled if package is not found
Bug: 287359634
Bug: 289173013
Test: atest HostsideVpnTests
Change-Id: I379cde0391f96a8ac5dcdb2ff7723ea950684e36

Motomu Utsumi   commited 2023-07-07 15:57:58 +09:00
2ba922ad85
Add a method helper to create RTM_DELADDR message in user space.
Bug: 260934173
Bug: 263222068
Test: atest NetworkStaticLibTests
Change-Id: Ibddaed91b12d3f27778d0bd2171bc5be38ff8bda

Xiao Ma   commited 2023-06-30 23:52:23 +09:00
723515738d
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

Xiao Ma   commited 2023-06-30 23:48:27 +09:00
3a4ad37d61
Parse rta_cacheinfo structure in RtNetlinkRouteMessage.
Bug: 183601771
Test: atest NetworkStaticLibTests
Change-Id: I9ea55ad297f5183853eeaa2e53f2406d79a90a20

Xiao Ma   commited 2023-06-22 10:37:39 +09:00
34ab408ade
Add netlink rta_cacheinfo structure.
Bug: 183601771
Test: m
Change-Id: Iaa65425fa875a9dde4d4b7c1b110d9a2a406f444

Xiao Ma   commited 2023-06-22 10:37:27 +09:00
4cb10fdc28
Make IaPrefixOption constructor public.
Then we can create an IaPrefixOption instance via constructor in the
NetworkStackIntegration test.

Bug: 260934173
Test: atest NetworkStackIntegrationTests
Change-Id: I05be1dde6ba5bda125631674c5c0f8634eb18924

Xiao Ma   commited 2023-06-09 11:38:11 +09:00
789baf20d3
Add a helper function to send RTM_NEWADDR netlink message to kernel.
Bug: 260934173
Test: TH
Change-Id: I6e9100e6f04a85550790c90fb0fde8d839e74578

Xiao Ma   commited 2023-06-01 11:02:05 +09:00
a6fba08f82
Merge "Add logs for target uids and duration to destroyLiveTcpSockets"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2023-05-23 02:19:24 +00:00
a0a78d3ca5
Add logs for target uids and duration to destroyLiveTcpSockets
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

Motomu Utsumi   commited 2023-05-23 02:19:11 +00:00
78cc19e25a