Commit graph

43,776 commits

Message SHA1
Dump BPF map in base64 encoded strings for testing
Test: atest EthernetTetheringTest

Change-Id: I3ae863cbb8ed0af1ffc78c6dda21b9e3c0ac74c9

Hungming Chen   authored and   Nucca Chen   commited 2022-02-09 10:46:54 +00:00
3de910ea96
Move Tether4Key and Tether4Value to common libs
EthernetTetheringTest needs to parse BPF map content for IPv4
forwarding rule tests. Move the struct class files to common
libs.

Compare Tether4{Key, Value}.java between frameworks/libs/net/common
and packages/modules/Connectivity/Tethering.
There is only the package name change as expected.

$ diff packages/modules/Connectivity/Tethering/src/com/android/networkstack/tethering/Tether4Key.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/Tether4Key.java
17c17
< package com.android.networkstack.tethering;
---
> package com.android.net.module.util.bpf;

$ diff packages/modules/Connectivity/Tethering/src/com/android/networkstack/tethering/Tether4Value.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/Tether4Value.java
17c17
< package com.android.networkstack.tethering;
---
> package com.android.net.module.util.bpf;

Test: atest TetheringCoverageTests

Change-Id: I73c180fa4129aefde1e64ecbafe928f388b061d6

Hungming Chen   authored and   Nucca Chen   commited 2022-02-09 10:45:37 +00:00
887a22cc4a
Merge "Address API review comments for DhcpOption object"
Mingguang Xu   authored and   Gerrit Code Review   commited 2022-02-08 07:30:45 +00:00
446c376434
Address API review comments for DhcpOption object
Add a link to javadoc for the allowed types and use the lint annotation
to suppress compilation errors instead of modifying the baseline file.

Bug: 213240318

Test: atest FrameworksNetTests
Test: atest NetworkStackTests

Signed-off-by: Mingguang Xu <mingguangxu@google.com>
Change-Id: I2a83cc19baa25068326517b30a9afdea19536af9

Mingguang Xu   commited 2022-02-07 19:42:40 -08:00
6914a16c95
Expose public APIs for IP & static IP configuration
Create public API for IP and static IP configuration.

Bug: 209840828
Test: atest android.net.cts.IpConfigurationTest
Test: atest android.net.cts.StaticIpConfigurationTest
Test: atest android.net.dhcp.DhcpResultsParcelableUtilTest
Change-Id: I720f168d1023806970919ca5dd44239a276826b6

Etan Cohen   commited 2022-02-07 19:57:07 +00:00
1e86b3af26
Merge "Reduce the flakiness of carrier privileges check"
Rambo Wang   authored and   Gerrit Code Review   commited 2022-02-07 03:47:52 +00:00
e7036bec68
Fix libnetworkstats_test.
If libraries are moved from the platform to a module, the test
will fail with:

CANNOT LINK EXECUTABLE "/data/local/tmp/libnetworkstats_test/arm64/libnetworkstats_test": library "libnetworkstats.so" not found: needed by main executable

This may be because it can't find libnetworkstats.so because that
is in platform.

In any case, since this is the test for libnetworkstats,
dynamically linking libnetworkstats is incorrect, because it
means if the same CL modifies both libnetworkstats and its test,
that CL will run the modified test against the unmodified
libnetworkstats.so on the device, when running updating tests
without reflashing the device.

Also remove libutils because it does not seem to be needed.

Test: atest libnetworkstats_test passes with libraries moved
Change-Id: Id49641c0a919129e2c54531c3995ec7421161002

Lorenzo Colitti   authored and   Remi NGUYEN VAN   commited 2022-02-07 02:16:34 +00:00
0db496ef39
Update the UIDs only after the native network is created
UIDs can't be sent to netd until the native network is created.
Also, it's possible that the interface disappears at any moment,
so in that case catch the ServiceSpecificException.

Test: FrameworksNetTests
Bug: 218100554
Change-Id: I79285166acf5d89aa34107e00dfff963ccc22d52

Chalard Jean   commited 2022-02-06 20:06:18 +09:00
a7d4766d0d
Merge "Use RECEIVER_NOT_EXPORTED in CarrierPrivilegeAuthenticator."
Jean Chalard   authored and   Gerrit Code Review   commited 2022-02-04 16:40:30 +00:00
d262e71965
Reduce the flakiness of carrier privileges check
Monitoring carrier config change broadcast and then checking
carrier privileges status is racy. The component that updates CP
status (e.g. CarrierPrivilegeTracker) may monitor the same
broadcast and the status check result will be determined by the
fact who received it firstly.

This CL moves the CP check after the current sleep to reduce
the flakiness to unblock the CP migration. The follow CL
(aosp/1971439) will throughly resolve the flakiness by the
the help of CarrierPrivilegesListener.

Bug: 217557996
Test: atest android.net.cts.ConnectivityDiagnosticsManagerTest
Change-Id: Ib1ab554732b6bb25426a07a42043801a2d05c546

Rambo Wang   commited 2022-02-04 07:55:45 -08:00
4d64bd6b2a
Merge "Remove libbase_headers from libservice-connectivity"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-02-04 14:09:00 +00:00
54957450bc
Merge changes from topic "move-testbpfmap"
* changes:
  Extract TestBpfMap from BpfCoordinatorTest.
  Add jarjar rule for com.android.testutils.TestBpfMap

Patrick Rohr   authored and   Gerrit Code Review   commited 2022-02-04 12:37:50 +00:00
f7d2824956
Merge "Add APIs for discovery with a network request"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-02-04 12:07:58 +00:00
9335a56282
Merge "Add APIs for discover/resolve on specific networks"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-02-04 12:07:38 +00:00
d61719c422
Remove libbase_headers from libservice-connectivity
libservice-connectivity already links against libbase dynamically.

Test: m
Change-Id: I66da65d6f618799ded21a3f6cdc71f444acd72fd

Patrick Rohr   commited 2022-02-04 08:56:08 +00:00
a46e4b52c3
Use RECEIVER_NOT_EXPORTED in CarrierPrivilegeAuthenticator.
Passing one of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED is
required for all code targeting T or above. The correct value
here is RECEIVER_NOT_EXPORTED because the receiver is being
registered in the system server and the broadcast comes from
the system server itself (same UID).

This does not need to be guarded by OS version because
CarrierPrivilegeAuthenticator is only used on T+.

Test: m
Fix: 217642082
Change-Id: I09840b17bd54352896607737b56c6a692ffbd2c2

Lorenzo Colitti   authored and   Chalard Jean   commited 2022-02-04 15:31:06 +09:00
7569d51446
Merge "Fix documentation link"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-02-04 06:01:13 +00:00
1513c9991e
Extract TestBpfMap from BpfCoordinatorTest.
The class is being moved to a common test utils location in
another CL in this topic.

Test: atest BpfCoordinatorTest
Change-Id: Ibf8dae3e05aacaea4f7c3fe8229d87e1ad6a68d5

Lorenzo Colitti   authored and   Patrick Rohr   commited 2022-02-03 22:53:07 +01:00
1705eb9964
Add jarjar rule for com.android.testutils.TestBpfMap
TestBpfMap needs to be jarjar'ed to work with ConnectivityCoverageTests
which combines both framework tests and tethering tests (and their
respective jarjar rules).

Test: atest ConnectivityCoverageTests:BpfCoordinatorTest
Change-Id: Ie3e7f0be9aeb848978f0df97be48100c808086bc

Patrick Rohr   commited 2022-02-03 22:53:07 +01:00
3157918fc9
Merge changes I50417e69,I6892d81c,Id8846844,Ib22da8d4,Iad66f0d4
* changes:
  jni - dynamically link C++ - saves 43 kB
  libservice-connectivity - dynamically link c++ - saves 600 kB
  link libbase & libnetdutils dynamically - save ~17.5 kiB
  remove spurious headers
  libclat only depends on libbase_headers not libbase itself

Patrick Rohr   authored and   Gerrit Code Review   commited 2022-02-03 19:19:11 +00:00
445dede4eb
Merge changes from topic "low-power-standby-impl"
* changes:
  Add Low Power Standby support to TrafficController
  Handle Low Power Standby chain in ConnectivityService
  Implement Low Power Standby packet filtering in BPF program

Robert Horvath   authored and   Gerrit Code Review   commited 2022-02-03 16:07:39 +00:00
3b20dfbcb7
Add APIs for discovery with a network request
Verify that services will be found / lost when underlying networks
change.

Bug: 190249673
Test: atest NsdManagerTest
Change-Id: If62b18a729c6d7b8e2c8701eda6f860ecea4cbaf

Remi NGUYEN VAN   commited 2022-02-03 18:39:34 +09:00
792947307e
Add APIs for discover/resolve on specific networks
Test that NsdManager specifies the correct network when a service is
discovered, and that services can be resolved on a specified network.
Also test that service discovery can be started on a specific network.

Bug: 190249673
Test: atest NsdManagerTest

Change-Id: Ie8b551ce9e33e3adf35f75508f91bbd0df71f837

Remi NGUYEN VAN   commited 2022-02-03 16:05:02 +09:00
06bdcec9fa
jni - dynamically link C++ - saves 43 kB
Since we already ship libc++ in the apex anyway...

Before in /apex/com.android.tethering/lib:
  -rw-r--r-- 1 system system  64560 1969-12-31 16:00 libandroid_net_connectivity_com_android_net_module_util_jni.so
After:
  -rw-r--r-- 1 system system  21460 1969-12-31 16:00 libandroid_net_connectivity_com_android_net_module_util_jni.so

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

Maciej Żenczykowski   commited 2022-02-03 03:51:40 +00:00
6a6b071dec
libservice-connectivity - dynamically link c++ - saves 600 kB
Before in /apex/com.android.tethering/lib:
  -rw-r--r-- 1 system system 749980 1969-12-31 16:00 libservice-connectivity.so
After:
  -rw-r--r-- 1 system system 150748 1969-12-31 16:00 libservice-connectivity.so

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

Maciej Żenczykowski   commited 2022-02-03 03:51:20 +00:00
167c8607e6
link libbase & libnetdutils dynamically - save ~17.5 kiB
Before:
  $ adbz root && adbz wait-for-device && adbz shell ls -l /apex/com.android.tethering/{bin/for-system,lib,liv64}
  /apex/com.android.tethering/bin/for-system:
= -rwsr-sr-x 1 clat clat 18412 1969-12-31 16:00 clatd

  /apex/com.android.tethering/lib:
= -rw-r--r-- 1 system system  64560 1969-12-31 16:00 libandroid_net_connectivity_com_android_net_module_util_jni.so
= -rw-r--r-- 1 system system 713636 1969-12-31 16:00 libc++.so
= -rw-r--r-- 1 system system  13596 1969-12-31 16:00 libframework-connectivity-jni.so
d -rw-r--r-- 1 system system 212624 1969-12-31 16:00 libnetd_updatable.so
d -rw-r--r-- 1 system system 948044 1969-12-31 16:00 libservice-connectivity.so

After:
  $ adbz root && adbz wait-for-device && adbz shell ls -l /apex/com.android.
  /apex/com.android.tethering/bin/for-system:
= -rwsr-sr-x 1 clat clat 18412 1969-12-31 16:00 clatd

  /apex/com.android.tethering/lib:
= -rw-r--r-- 1 system system  64560 1969-12-31 16:00 libandroid_net_connectivity_com_android_net_module_util_jni.so
+ -rw-r--r-- 1 system system 251404 1969-12-31 16:00 libbase.so
= -rw-r--r-- 1 system system 713636 1969-12-31 16:00 libc++.so
= -rw-r--r-- 1 system system  13596 1969-12-31 16:00 libframework-connectivity-jni.so
d -rw-r--r-- 1 system system  45584 1969-12-31 16:00 libnetd_updatable.so
+ -rw-r--r-- 1 system system  95872 1969-12-31 16:00 libnetdutils.so
d -rw-r--r-- 1 system system 749980 1969-12-31 16:00 libservice-connectivity.so

Delta: -212624-948044+251404+45584+95872+749980 == -17828

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

Maciej Żenczykowski   commited 2022-02-02 18:03:23 -08:00
dcae351663
remove spurious headers
bpf_connectivity_headers already pulls in bpf_headers,
which already pulls in bpf_syscall_wrappers.

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

Maciej Żenczykowski   commited 2022-02-02 16:38:36 -08:00
2f7dac1bad
libclat only depends on libbase_headers not libbase itself
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iad66f0d4bed4100261e8aa7d135e62336cdd1ae8

Maciej Żenczykowski   commited 2022-02-02 16:38:36 -08:00
0bbe3d2ce4
Merge "Remove libtcutils from dependencies as it is included in lib bpfjni"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-02-02 22:34:51 +00:00
35e2ab4c11
Add Low Power Standby support to TrafficController
Bug: 190822356
Test: atest TrafficControllerTest
Change-Id: I84a95081ab6e6a86543fe2cddf0efdab16c90d72

Robert Horvath   commited 2022-02-02 22:54:21 +01:00
d945bf0b4f
Handle Low Power Standby chain in ConnectivityService
Bug: 190822356
Test: atest NetworkManagementServiceTest
Change-Id: If5a07d0ea958d832b00797a9d9a4d5ad4f129b89

Robert Horvath   commited 2022-02-02 22:54:21 +01:00
1db49e1c7f
Implement Low Power Standby packet filtering in BPF program
Bug: 190822356
Test: atest NetworkManagementServiceTest
Change-Id: I664414fbb744a118d4d0fea4ed91680bb38efe07

Robert Horvath   commited 2022-02-02 22:54:21 +01:00
54423027fa
Grant 'w' rights to for-system subdirectory for root.
This is basically a no-op since the apex/fs is r/o anyway,
but it appears like it might help the emulator build...

Test: N/A
Bug: 217565060
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5e9c9fb41687aa5a4b15ff2bf21eafecada726a8

Maciej Żenczykowski   commited 2022-02-02 20:54:53 +00:00
d9025190fa
Remove libtcutils from dependencies as it is included in lib bpfjni
Test: builds && boots
Change-Id: Iacaed446655a606399188b8e5e4a5e98fefee121

Patrick Rohr   authored and   Maciej Żenczykowski   commited 2022-02-02 19:40:12 +00:00
8dfcb14be3
Merge "link libbase statically into libnetd_updatable - saves ~85 kB"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-02-02 19:35:00 +00:00
1a435a8003
Merge changes from topic "low-power-standby-connectivity"
* changes:
  Define BLOCKED_REASON_LOW_POWER_STANDBY
  Define FIREWALL_CHAIN_LOW_POWER_STANDBY

Robert Horvath   authored and   Gerrit Code Review   commited 2022-02-02 11:23:59 +00:00
c22652401d
Merge changes Ic6a1aa92,I685f924a,I50fab91e
* changes:
  Use packBitList to prevent long-related mistakes
  Introduce ensureListenableCapabilities
  Accept accessUids from telephony when it's the carrier config app

Jean Chalard   authored and   Gerrit Code Review   commited 2022-02-02 07:40:06 +00:00
2bc73d3b18
Use packBitList to prevent long-related mistakes
In the following expression
  1L << CONSTANT
it is easy to forget the L, especially where it has
not been necessary historically. This has happened
in capabilities where they exceeded 30, see
aosp/1928394. Use the new packBitList to avoid
repeats of the same mistake.

Test: FrameworksNetTests
Change-Id: Ic6a1aa9254bf9ad222c3e2fe4f52bb89a1f9c4e5

Chalard Jean   commited 2022-02-02 13:52:26 +09:00
5fd3cfa342
Introduce ensureListenableCapabilities
Renamed from ensureValid, this is an easier to understand name.
It is also a lot clearer when requestable capabilities also
have to be listenable.

Also move the 2 functions together.

Test: FrameworksNetTests
Change-Id: I685f924a3720846d740837a4a0fee3d88a26725a

Chalard Jean   commited 2022-02-02 13:52:26 +09:00
dd4219978d
Accept accessUids from telephony when it's the carrier config app
Test: FrameworksNetTests, new test in this patch
Change-Id: I50fab91e107c51d33a5e529c73b83db198a88d2c

Chalard Jean   commited 2022-02-02 13:52:25 +09:00
ac9ace0bbe
Move netlink_listener_test into TrafficControllerTest
netlink_listener_test tests the socket destroy listener, so it makes
sense to just merge it into the TrafficControllerTest.

Test: atest traffic_controller_unit_test
Change-Id: Ibc0b483203150aa2d7898a761fa4715dce6f4218

Patrick Rohr   commited 2022-02-01 21:13:30 +01:00
61e9467fa6
Fix BpfNetMap error logging
Log result code in native_init and fix spelling in log messages.

Test: m
Change-Id: I39b429ba05c6d5ccf50d28b0592fa5241972aa1b

Patrick Rohr   commited 2022-02-01 17:39:11 +01:00
83fb6742ac
Enable TrafficController in apex
Test: atest FrameworksNetTests FrameworksNetIntegrationTests
CtsNetTestCases:android.net.TrafficStatsTest NetworkUsageStatsTest
CtsHostsideNetworkTests

Change-Id: I03f70e3258bf121cbac69a3bb302871ac680c6fb

Patrick Rohr   commited 2022-02-01 17:39:11 +01:00
216dfc82f6
Revert "Prevent native_init from starting TrafficController"
We are ready to remove traffic controller from netd, so
TrafficController::start() should be called from the system server.

This reverts commit c2984fdca8.

Test: atest FrameworksNetTests FrameworksNetIntegrationTests
CtsNetTestCases:android.net.TrafficStatsTest NetworkUsageStatsTest
CtsHostsideNetworkTests

Change-Id: Ic324ad0c064271977ab35d7f55badee00098e196

Patrick Rohr   commited 2022-02-01 17:38:57 +01:00
2b1b2c7206
Define BLOCKED_REASON_LOW_POWER_STANDBY
Bug: 190822356
Test: atest NetworkPolicyManagerServiceTest
Change-Id: I72c81ba1c3791e40a2d311cc3a06bf3b5d3727d1

Robert Horvath   commited 2022-02-01 16:04:35 +01:00
2dac94841a
Define FIREWALL_CHAIN_LOW_POWER_STANDBY
Bug: 190822356
Test: atest NetworkManagementServiceTest
Change-Id: I970eea0e1952f8074cc5c998bbd2ee1ff5a3dc92

Robert Horvath   commited 2022-02-01 16:04:35 +01:00
34cba14425
Add libservice-connectivity to integration tests
Test: atest FrameworksNetIntegrationTests
Change-Id: I1548793872bef2f8247558d7d4222cd8162c1601

Patrick Rohr   commited 2022-02-01 14:31:08 +01:00
d817436f17
Merge "Clean up BpfNetMaps"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-02-01 12:50:28 +00:00
d36de12652
Clean up BpfNetMaps
Cleans up BpfNetMaps.java before enabling mainline code path.

Bug: 202086915
Test: atest FrameworksNetTests
Change-Id: I28e5d63ed4624df540b1ca47b71899cff7321ded

Ken Chen   authored and   Patrick Rohr   commited 2022-02-01 12:31:03 +01:00
f5f51339af
Fix lint errors in NetworkStatsManagerTest.
Test: atest CtsNetTestCases:android.net.cts.NetworkStatsManagerTest
Change-Id: I45bd097da3c7667138ec81d1de728f78adfae4f7

Lorenzo Colitti   commited 2022-02-01 11:24:52 +00:00
687c383d78