Commit graph android_packages_modules_Co.../staticlibs/device
Message SHA1
Move the owner of xfrm netlink source code to its own directory.
Test: TH
Change-Id: I260665a0afa056e32021c5255a17ea0af59b6575

Xiao Ma   commited 2023-11-22 18:50:00 +09:00
4ba5edcb8a
[XFRM_MSG_GETSA] Fix the class names and code locations
- Change class names to start with Xfrm or StructXfrm for consistency
  with other messages and structs
- Create xfrm sub-folder for xfrm messages
- Add "finals" to input parameters

Bug: 308011229
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink
      (new tests added)
Change-Id: Id6d34b4549bbc1890b3f4dd9f1638977f66e3236

Yan Yan   commited 2023-11-21 19:21:32 +00:00
f085fadfdc
[XFRM_MSG_GETSA] Support xfrm_address_t and xfrm_usersa_id
Add xfrm_address_t and xfrm_usersa_id structs

Bug: 308011229
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink
      (new tests added)
Change-Id: I552983d7e768e7fb8ba307ffc55060c8b35e7436

Yan Yan   commited 2023-11-16 21:46:43 +00:00
1c363601a1
Merge "BpfUtils.java - add requires T+ annotation" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2023-11-16 11:06:57 +00:00
fdcf0111c3
BpfUtils.java - add requires T+ annotation
Networking bpf (including cgroup related portions)
was mainlined in Android T.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I779584828f03caa2d61d5081cb3d39566db9b9de

Maciej Żenczykowski   commited 2023-11-16 01:57:46 +00:00
1df0aafcc3
BpfMap.java - add requires S+ annotation
Since the first mainline eBPF code (for Tethering offload)
landed in Android S.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ifb44a43a98e7f0ff4cd59017b47f64eff30ee715

Maciej Żenczykowski   commited 2023-11-16 01:45:46 +00:00
6f776f5af3
switch SynchronizeKernelRCU back to jni - but from BpfMap
we can't use java for this, because pre-U-QPR2 does not include:
  https://android-review.googlesource.com/c/platform/system/sepolicy/+/2821590
  system_server dontaudit key_socket getopt

so we'll spew lots of:
  11-08 07:52:43.776 1469 1469 I auditd : type=1400 audit(0.0:4): avc: denied { getopt } for comm="system_server" scontext=u:r:system_server:s0 tcontext=u:r:system_server:s0 tclass=key_socket permissive=0
  11-08 07:52:44.360 1469 1469 I auditd : type=1400 audit(0.0:5): avc: denied { getopt } for comm="NetworkStats" scontext=u:r:system_server:s0 tcontext=u:r:system_server:s0 tclass=key_socket permissive=0
  11-08 07:52:44.508 1469 1469 I auditd : type=1400 audit(0.0:7): avc: denied { getopt } for comm="android.bg" scontext=u:r:system_server:s0 tcontext=u:r:system_server:s0 tclass=key_socket permissive=0
and the like.

This is due to Java's Os.close() in:
  libcore/luni/src/main/java/libcore/io/BlockGuardOs.java;l=100
calling:
  if (fd.isSocket$()) if (isLingerSocket(fd)) ...

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib87fa5e8f0dfd9fbbccb25fb58a9fa78d6a07111

Maciej Żenczykowski   commited 2023-11-09 11:08:58 +00:00
c350db788a
Merge changes from topic "apipluscts" into main
* changes:
  [BR03.3] Add feature version constant for accessing bpf in Connectivity
  [BR03.1] Expose isUidNetworkingBlocked

Junyu Lai   authored and   Gerrit Code Review   commited 2023-11-06 09:09:03 +00:00
092839a6b5
[BR03.3] Add feature version constant for accessing bpf in Connectivity
This is needed by the callers to determine if the Tethering
module is new enough to support the API that get whether
the network is blocked for the given uid and conditions.

Test: adb shell cmd network_stack is-uid-networking-blocked <uid> <metered>
Bug: 297836825
Change-Id: Ie79eacb1e63ff60291ad4f0ef6e8bba5ab0bdb07

Junyu Lai   commited 2023-11-06 14:51:01 +08:00
ec5500de79
Rename method connectSocketToNetlink to connectToKernel
Address leftover comments in aosp/2354202.

Bug: 265877161
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: I77f36b890265e9af6f5ab866d5e0071363bb3d0f

Chiachang Wang   commited 2023-11-06 03:18:18 +00:00
fe84f59ff0
Handle v4-mapped v6 address in Struct parsing
testV4MappedV6Address fails without change in Struct.java

Bug: 295800201
Test: atest ConnectivityCoverageTests
Change-Id: I4a40bc47b051860c6420f211491e2ecd34c1d732

Motomu Utsumi   commited 2023-10-31 17:01:48 +09:00
e3e34bdf3a
Merge "Add public getter for IpPrefix" into main
Patrick Rohr   authored and   Gerrit Code Review   commited 2023-10-26 18:21:07 +00:00
149868f1b1
Merge "move convenience methods from BpfMap to IBpfMap" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2023-10-25 22:54:04 +00:00
ad3badf7a8
Add public getter for IpPrefix
Test: TH
Change-Id: I8d2c8e1a6b76f04257f2137c1ce893b59e52e420

Patrick Rohr   commited 2023-10-25 15:32:06 -07:00
6f0dc0dc95
move convenience methods from BpfMap to IBpfMap
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5f4ee8bdc3aaff1f306a36126e6e812b486e312b

Maciej Żenczykowski   commited 2023-10-25 11:51:40 -07:00
74641d82c4
remove dead portions of BpfUtils.java
(mostly to improve code coverage)

We can always revert if it ever turns out this is useful,
but I'd prefer for cgroup attach to be a once-at-boot
thing and handled either from bpfloader or the netd updatable
which are both directly C++ code.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I79b5ca8a47388cb6b9189234942e74ab6056aab9

Maciej Żenczykowski   commited 2023-10-25 17:40:35 +00:00
de9d367ab2
Add toString for more consistent logging to IaPrefixOption
toString() approximately follows the format of tcpdump logging ND
options.

Test: TH
Change-Id: Idce2024f44bba5427dc0f88128b87b367c09ccb6

Patrick Rohr   commited 2023-10-24 15:07:14 -07:00
8f77f016df
Create IpPrefix in IaPrefixOption constructor
The constructor is invoked during Struct#parse() at which point we might
as well try to create the IpPrefix object which will be used later. If
this fails for some reason (UnknownHostException or ClassCastException),
the prefix is bogus and should not be used.

Test: TH
Change-Id: I7e0090735022d017ba11aa85266ba19e65807da7

Patrick Rohr   commited 2023-10-24 15:04:19 -07:00
9f03f9e6e5
Add @Computed annotation to Struct
@Computed will ignore "computed" fields from struct parsing. Fields
cannot both be annotated by @Computed and @Field (though there
currently is no check for this).

Test: builds
Change-Id: I29fe506c5e3be4cc50fdaf3a07fc5e922111165b

Patrick Rohr   commited 2023-10-24 15:03:35 -07:00
3b2c559149
Remove check that preferred lifetime >= t2
For a single address, DHCPv6 won't work well (i.e. potentially lose provisioning) if
the preferred lifetime is lower than t2. However, this might be a valid
scenario in a renumbering event in the presence of multiple prefixes.

Additionally, in DHCPv6 it is up to the server to configure the client
correctly.

Test: TH
Change-Id: I37b2a0b89deda85b3f7be29c8f02f685aa6e65f8

Patrick Rohr   commited 2023-10-24 11:44:46 -07:00
dc6c70fd5f
Remove IA prefix option option-code from public constructor
Since it is constant. Struct.parse() still requires a constructor that
includes the code field, so it is marked protected.

Test: TH
Change-Id: Iccb4e3ec4078e0dcc73836f0d1b721146153da50

Patrick Rohr   commited 2023-10-23 14:28:19 -07:00
b8af9d5c19
Merge "Add method to check if IA prefix option takes 0 lifetimes." into main
Xiao Ma   authored and   Gerrit Code Review   commited 2023-10-20 05:37:26 +00:00
26af70f5fe
Dump bpf program status in dumpsys
Sample output:
Bpf Program Status:
  CGROUP_INET_INGRESS: 21
  CGROUP_INET_EGRESS: 22
  CGROUP_INET_SOCK_CREATE: 28
  CGROUP_INET4_BIND: 30
  CGROUP_INET6_BIND: 31

Test: adb shell dumpsys connectivity
Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.ConnectivityServiceTest#testDumpDoesNotCrash
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest#testDumpDoesNotCrash
Bug: 292156770
Change-Id: I312c90c524af12d093536156d6d5c6febd64305a

Junyu Lai   commited 2023-10-18 16:05:55 +08:00
155760b57b
Add method to check if IA prefix option takes 0 lifetimes.
Bug: 260934173
Test: TH
Change-Id: If49a888198a52bf0cfefc125e0aa9636c1692279

Xiao Ma   commited 2023-10-12 23:36:59 +09:00
cc9b86c647
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