Commit Graph

43645 Commits

Author SHA1 Message Date
Treehugger Robot
e0322e3fd1 Merge changes I6745a615,Ic50dc122,I38729c23,I6d1da4f1,I1cef6e09, ...
* changes:
  [CLATJ#16] Rename JNI/Dependencies function and improve JNI error handling
  [CLATJ#15] ClatCoordinator: add socket filter to packet socket
  [CLATJ#14] ClatCoordinator: add anycast to raw socket
  [CLATJ#13] ClatCoordinator: open raw socket
  [CLATJ#12] ClatCoordinator: open packet socket with a given mark
  [CLATJ#11] ClatCoordinator: config tun interface and bring up
  [CLATJ#10] ClatCoordinator: detect mtu
  [CLATJ#9] ClatCoordinator: open tun interface
  [CLATJ#8] ClatCoordinator: select IPv6 address with checksum-neutral IID
  [CLATJ#7] ClatCoordinator: select IPv4 address for clatd
  [CLATJ#6] libclat: move configure_packet_socket() from netd to apex
  [CLATJ#5] libclat: move detect_mtu() from netd to apex
  [CLATJ#4] libclat: move selectIpv4Address() and isIpv4AddressFree() from netd to apex
  [CLATJ#3] libclat: move generateIpv6Address() from netd to apex
  [CLATJ#2] libclat: Add libclat_test to postsubmit
  [CLATJ#1] libclat: move makeChecksumNeutral() from netd to apex
2022-01-21 02:54:21 +00:00
Maciej Żenczykowski
1f36542d1e Merge "Move netd.c to Tethering module" 2022-01-21 02:42:35 +00:00
Maciej Żenczykowski
c060c2dd46 Merge "Add proguard rules for TcUtils" 2022-01-21 01:52:48 +00:00
Junyu Lai
606fb4f79f Merge "[MS41.2] Add unit test for query history APIs" 2022-01-21 00:30:02 +00:00
Ken Chen
587d4231fc Move netd.c to Tethering module
This is a clean move. The content of netd.c is not changed. The object
name is still netd.o. But the module name is renamed to netd.o_mainline
to avoid name collision in sc-mainline-prod branch.

Modified Android.bp according to the file location. The sub_dir is
newly specified. The object file will be compiled to:
- apex/com.android.tethering/etc/bpf/net_shared/netd.o

The extracted programs and maps will be in:
- sys/fs/bpf/net_shared/

The netd.o will not be loaded in pre-T because the bpfloader before T
does not load objects from paths other than:
- apex/com.android.tethering/etc/bpf/
- /system/etc/bpf/

Bug: 202086915
Test: cd system/netd; atest
Test: atest TrafficStatsTest NetworkUsageStatsTest
Change-Id: I5281c851341f9258a37d8aad6da4196c06342940
2022-01-21 07:40:33 +08:00
Patrick Rohr
b194dfe04b Add proguard rules for TcUtils
Without this, proguard strips tcFilterAddDevIngressPolice (as its unused
inside the Tethering apk) and crashes the system.

Bug: 202086915
Bug: 157552970
Test: device boots
Change-Id: I3f29a2d2371ecbfad929f8812f7f15f68258b5d1
2022-01-20 22:11:57 +01:00
William Escande
02fc79437b Add cts test suite in connectivity/cts deps
Test: atest CtsNetTestCases
Change-Id: Ib82b703145096a0b974aa602c7cdd505c333bca0
2022-01-20 17:52:03 +01:00
Junyu Lai
e9c4988632 [MS65.2] Add unit test of NetworkIdentity#Builder
Test: atest NetworkIdentityTest#testBuilder
Bug: 204830222
Change-Id: Ie0d56821608c881c3bffe224cfe240fa900c6f39
2022-01-20 15:58:30 +00:00
Junyu Lai
56f4a9c3d1 [MS57.2] Prepare APIs for data migration utility
Test: atest NetworkStatsHistoryTest#testBuilder
Bug: 204830222
Change-Id: I938c3ed50eea0f2349ea92c3824c637eaa77d328
2022-01-20 15:06:50 +00:00
Junyu Lai
7372824eca [MS41.2] Add unit test for query history APIs
Test: atest NetworkStatsServiceTest NetworkStatsManagerTest
Bug: 204830222
Bug: 200768422
Change-Id: I1dce7d671c5524496e0451665f62447ef6e454ae
2022-01-20 15:06:50 +00:00
Hungming Chen
050b6529c4 [CLATJ#16] Rename JNI/Dependencies function and improve JNI error handling
- rename JNI functions with prefix native_*
- throw exception while JNI function gets invalid address argument
- throw exception while JNI function returns invalid address

Bug: 212345928
Test: flash and boot
Run "atest ClatCoordinatorTest" in a followup commit

Change-Id: I6745a61525c6f72a61fbde0b21b3f7abcdf2446a
2022-01-20 22:50:13 +08:00
Hungming Chen
847b2ce4f9 [CLATJ#15] ClatCoordinator: add socket filter to packet socket
Update our packet socket filter to reflect the new 464xlat IP address

Bug: 212345928
Test: flash and boot
Run "atest ClatCoordinatorTest" in a followup commit

Change-Id: Ic50dc122731f311ad00ab8bff5472cb3bc41f5f1
2022-01-20 22:50:13 +08:00
Hungming Chen
2c3acb01c9 [CLATJ#14] ClatCoordinator: add anycast to raw socket
Start translating packets to the new prefix.

Bug: 212345928
Test: flash and boot
Run "atest ClatCoordinatorTest" in a followup commit.

Change-Id: I38729c23fce72428919b33ac531ede9593337a0a
2022-01-20 22:50:13 +08:00
Hungming Chen
d292f45e16 [CLATJ#13] ClatCoordinator: open raw socket
Move the raw socket initialization from netd to mainline because
mainline module is going to launch clatd. Need to provide raw
socket for writing local 464xlat IPv6 packets.

Bug: 212345928
Test: flash and boot
Run "atest ClatCoordinatorTest" in a followup commit.

Change-Id: I6d1da4f1b400eeed87771ae8197b0c58ec50804b
2022-01-20 22:50:13 +08:00
Hungming Chen
79d34befb1 [CLATJ#12] ClatCoordinator: open packet socket with a given mark
Move the packet socket initialization from netd to jni because
mainline module is going to launch clatd. Need to provide packet
socket for reading local 464xlat IPv6 packets.

Bug: 212345928
Test: flash and boot
Run "atest ClatCoordinatorTest" in a followup commit.

Change-Id: I1cef6e099403f883d668081fb5e917863f5a3c2a
2022-01-20 22:50:13 +08:00
Hungming Chen
397ca65abb [CLATJ#11] ClatCoordinator: config tun interface and bring up
Apply mtu and selected IPv4 address to tun interface.
Then, bring up the tun interface.

Bug: 212345928
Test: flash and boot
Run "atest ClatCoordinatorTest" in a followup commit.

Change-Id: I24a2a91e2b084be28820a7a63b265c5f56293334
2022-01-20 22:50:13 +08:00
Hungming Chen
7de1c49b74 [CLATJ#10] ClatCoordinator: detect mtu
Detect the available mtu for clat. The native mtu detect function
is moved from netd to libclat which is called by jni. The java
adjust mtu function is moved from netd native code.

Bug: 212345928
Test: flash and boot
Run "atest ClatCoordinatorTest" in a followup commit.

Change-Id: Icf5f57c7e7b947997b76152722e46acdd9d95c1a
2022-01-20 22:50:13 +08:00
Hungming Chen
46bbee1bfe [CLATJ#9] ClatCoordinator: open tun interface
Open the v4-... tun interface for clat. The native function
is moved from netd to jni.

Bug: 212345928
Test: flash and boot
Run "atest ClatCoordinatorTest" in a followup commit.

Change-Id: I3f3c587275125ce3fc7481006947211f17dbb2d4
2022-01-20 22:50:13 +08:00
Hungming Chen
884c0a122c [CLATJ#8] ClatCoordinator: select IPv6 address with checksum-neutral IID
Select a local 464xlat IPv6 address for clatd. The IPv6 address has
checksum-neutral IID. The native function is moved from netd to
libclat. Its test is moved from netd as well.

Bug: 212345928
Test: flash and boot
Run "atest ClatCoordinatorTest" in a followup commit.

Change-Id: I11520e5c086e475999847d829dd6341b14199b39
2022-01-20 22:50:13 +08:00
Hungming Chen
e2cf055590 [CLATJ#7] ClatCoordinator: select IPv4 address for clatd
Introduce ClatCoordinator to replace netd/ClatdController.
This is a startup commit. Starting clatd needs to prepare local
464xlat ipv4 address, local 464xlat ipv6 address, tun interface,
clat read/write sockets. These will be implemented from this
and followup commits. This commit implements that prepare local
464xlat ipv4 address.

Bug: 212345928
Test: flash and boot
Run "atest ClatCoordinatorTest" in a followup commit.

Change-Id: I486db8aef0181ee1aedd7cd7702f95d5a1cef812
2022-01-20 22:50:13 +08:00
Hungming Chen
8ff032b990 [CLATJ#6] libclat: move configure_packet_socket() from netd to apex
configure_packet_socket() is moved from ClatdController. Only change
the failure return value from errno to -errno. The remaining parts
are the same.

The test is modified from ClatdControllerTest::ConfigureIpv6Address.
Simply set socket filter to an interface and check that the packet
socket is bound to the interface. We can't check the socket filter
because there is no way to fetch it from the kernel.

Bug: 212345928
Test: build and boot
      atest libclat_test
Change-Id: Ia33c21051b040829c7d2aa55ed5b7de8766c98c5
2022-01-20 22:50:12 +08:00
Hungming Chen
86a56de609 [CLATJ#5] libclat: move detect_mtu() from netd to apex
detect_mtu() is moved from ClatdController without behavior
change. The unique_fd for socket fd is replaced by primitive int
because libbase is not supported in mainline.

Bug: 212345928
Test: build and boot
      atest libclat_test
Change-Id: Ib9c1a9d4b9e1c141d88164e8489c5044fdf70685
2022-01-20 22:50:12 +08:00
Hungming Chen
2f623f381c [CLATJ#4] libclat: move selectIpv4Address() and isIpv4AddressFree() from netd to apex
isIpv4AddressFree() is moved from ClatdController without behavior
change.

selectIpv4Address() and its test are moved from ClatdController as well.
They have been refactored slightly for testing because function pointer
of isIpv4AddressFreeFunc is not a global variable anymore. We can't set
global function pointer to change selectIpv4Address() behavior for
testing. Instead isIpv4AddressFree is sent as an argument of function
pointer. For public caller, selectIpv4Address() has no behavior change.
For test caller, they can call an internal selectIpv4AddressInternal
(.., fn) to change isIpv4AddrFreeFn function pointer for testing.

Bug: 212345928
Test: build and boot
      atest libclat_test
Change-Id: Iab5e6fd5ebbccf10e7b3be2251b45949cf3f3464
2022-01-20 22:50:12 +08:00
Hungming Chen
6139d87623 [CLATJ#3] libclat: move generateIpv6Address() from netd to apex
generateIpv6Address() is moved from ClatdController without behavior
change. The unique_fd for socket fd is replaced by primitive int
because libbase is not supported in mainline.

Bug: 212345928
Test: build and boot
      atest libclat_test
Change-Id: I42e152e6fe3ad577a0274e1d55e737318f61176d
2022-01-20 22:50:12 +08:00
Hungming Chen
aaa8bd8b74 [CLATJ#2] libclat: Add libclat_test to postsubmit
Add native library libclat test to postsubmit.

Bug: 212345928
Test: atest libclat_test
Change-Id: Ied5e0796b01c384b3eee2d40c0c735859709be33
2022-01-20 22:50:12 +08:00
Hungming Chen
ed7b4602b5 [CLATJ#1] libclat: move makeChecksumNeutral() from netd to apex
Introduce the library libclat to implement clat functions for jni.
It is helpful for unit test.

makeChecksumNeutral() and its test are moved from ClatdController
without behavior change.

Bug: 212345928
Test: build and boot
      atest libclat_test

Change-Id: I1c0981d98141fc1cc07b2d3a0f3cbddf38683ff3
2022-01-20 22:50:08 +08:00
Paul Hu
a6ee639dca Merge "Prepare T build rules for backwards compatibility" 2022-01-20 10:44:48 +00:00
Mark Chien
0730625a31 Merge "Fix some typos in comments" 2022-01-20 10:17:27 +00:00
Lorenzo Colitti
ab4c64329b Merge "Move LocalSocketTest out of packages/modules/Connectivity." 2022-01-20 09:43:04 +00:00
Remi NGUYEN VAN
24b3c37e0a Prepare T build rules for backwards compatibility
- Add a default to framework-connectivity-tiramisu for disabling
  T-only build rules.
- Separate the tiramisu hidden apis from hiddenapi txt files, so
  that the framework-connectivity-tiramisu file can avoid being
  referenced by the APEX when the JAR is not part of it.

Bug: 206893064
Test: m
Merged-In: I37c7385b456e4d71789aafe33cc8375adf40a681
Change-Id: I37c7385b456e4d71789aafe33cc8375adf40a681
2022-01-20 13:57:44 +08:00
Aaron Huang
ccdf2a5838 Merge "Add unit test for NetworkStats iterator" 2022-01-20 04:09:00 +00:00
Paul Hu
a77cad355b Merge "Build framework-connectivity-tiramisu library" 2022-01-20 03:02:56 +00:00
Chiachang Wang
7212fbee14 Update the SDK for the tests with intended target in T+
Correct the SDK for those tests are expected running in T+
device. Check @IgnoreUpTo(S) may be incorrect after receiving
patches before T release.

Refer to temporary constant definition in DevSdkIgnoreRule until
the SDK constant being pushed into AOSP and synced with branch
used for mainline.

BUg: 215294242
Test: atest CtsNetTestCases CtsNetTestCasesLatestSdk
Change-Id: Ide6a241f7944dd1e75bc33b21aa29471a5df94c6
2022-01-20 10:30:19 +08:00
Frank
9ef027c2f5 [DU03-2]Remove INetworkStatsService from BatteryStatsImpl
Correct the NetworkStatsServiceTest

BatteryStatsImpl is using INetworkStatsService APIs, which
cannot be accessed after moving into the mainline module. So, replace
and remove those hidden API usages.

Bug: 210066922
Test: atest BatteryStatsImplTest WifiPowerCalculatorTest
            MobileRadioPowerCalculatorTest NetworkStatsServiceTest
CTS-Coverage-Bug: 213437796
Change-Id: I47dc377a5cce7d8a0029dc808ad0f46e651764b1
2022-01-20 00:15:55 +08:00
Treehugger Robot
fac8864d14 Merge "Set the permission to file clatd and directory for-system" 2022-01-19 13:09:39 +00:00
Aaron Huang
2ae5921bc8 Add unit test for NetworkStats iterator
Bug: 210073043
Test: this
Change-Id: I2bcd80627c31e94ac040dbb4e7d38561d8f4c229
2022-01-19 17:10:44 +08:00
Remi NGUYEN VAN
6c232e9b49 Merge "Mark connectivity module tests as such" 2022-01-19 06:49:39 +00:00
Remi NGUYEN VAN
0ac9163620 Merge "Do not verify field count in tests used in CTS" 2022-01-19 06:49:28 +00:00
William Escande
5fd2c7033a Move LocalSocketTest out of packages/modules/Connectivity.
This test is testing non-updatable code in frameworks/base, so it should
not live in packages/modules/Connectivity.

Test: treehugger
Change-Id: Ifdefeeca0190d27e98f687446f984dcc711a8c55
2022-01-19 04:03:26 +00:00
Chiachang Wang
af7c44cc4e Add missing DevSdkIgnoreRule rule variable
DevSdkIgnoreRule.IgnoreUpTo() will not work as expected without
the rule defined.

Bug: 184750836
Test: atest android.net.Ikev2VpnProfileTest#\
      testBuildExcludeLocalRoutesSet works as expected with ignore
      rule
Change-Id: I03a5b28963cd6feebe4358d57c070d941cd114e5
2022-01-18 11:25:03 +00:00
Remi NGUYEN VAN
e347301890 Mark connectivity module tests as such
Add @ConnectivityModuleTest to tests for classes that are mainly used to
back the connectivity (tethering) module, in particular data classes.

This causes the test not to be run in NetworkStack/CaptivePortalLogin
MTS tests when the connectivity (tethering) module is not installed.
Skipping such tests is necessary in that configuration as they may test
behavior that is new in the latest update, and data classes backing the
connectivity module would not be affected by
NetworkStack/CaptivePortalLogin updates anyway.

Bug: 211075897
Test: atest CtsNetTestCasesLatestSdk
Change-Id: I6163cd998fc78765b903fdb7acd21e652bc711c9
2022-01-18 16:55:44 +09:00
Remi NGUYEN VAN
8bc36966d4 Do not verify field count in tests used in CTS
Tests in tests/common and tests/cts are run as part of CtsNetTestCases.
Many used assertFieldCountEquals in parceling/unparceling tests to
ensure that unexpected fields were not added, or that they were not
missed when testing parceling/unparceling.

However with many of the classes updatable through module updates, the
field count may change in the future, breaking CTS tests.

Stop checking for the field count, as it would break on module releases,
and its value is lower than the maintenance cost.

Bug: 205901761
Test: atest CtsNetTestCases
Change-Id: I79854741f7e834574d4825bb737ef507785310fe
2022-01-18 16:55:32 +09:00
Lorenzo Colitti
7aac4ad2f7 Add an OWNERS_core_networking_xts for CTS/GTS/... and use it.
This uses a similar scheme to our existing OWNERS files, which
all come from a common location in the master branch.

Test: repo upload
Change-Id: I672070302789ac38a738ab6626f47ec9cbc75dd9
2022-01-18 01:42:39 +00:00
Lorenzo Colitti
be53da163c Add java defaults for mainline-presubmit as well.
Test: m
Change-Id: Ie5b7f48ff59af136edff272fad1d544585a911e6
2022-01-18 08:38:04 +09:00
Treehugger Robot
2fe71c70ab Merge "Don't pass non-const refs." 2022-01-17 15:57:35 +00:00
Lorenzo Colitti
da0c43e38f Run bpf_existence_test in mainline-postsubmit.
The TEST_MAPPING file already contains a mainline-postsubmit
stanza, but according to go/test-mapping-mainline-user-guide
this information also needs to be in AndroidTest.xml (or in
Android.bp, for tests that are not covered by an AndroidTest.xml
and where soong autogenerates the test config).

Test: m bpf_existence_test
Change-Id: I103f5fefbfefa6fd2b59ab6c209fbf1dceada4ba
2022-01-18 00:13:51 +09:00
Aaron Huang
63b5da9866 Merge "Use getter methods to verify the fields of Entry" 2022-01-17 09:31:55 +00:00
markchien
69681d65a5 Use new bluetooth API to enable/disable bt tethering after T
This change only apply to the device after T.
Use new bluetooth API to change bluetooth tethering settings and the
new API provide the callback to to notify Tethering when bluetooth
interface is ready. Tethering doesn't use bluetooth interface status
change event from netlink to add/remove IpServer anymore.

Tag: #feature
Bug: 190438212
Test: TetheringTest
Change-Id: Iae92d98d500f83b116da7282cf1130fb8fecf53d
2022-01-17 16:47:43 +08:00
Hungming Chen
f9d40ae77a Set the permission to file clatd and directory for-system
Set clatd privs to clat:clat:-r-sr-sr-x and set its parent
directory privs to root:system:dr-xr-x---. Makes sure that
only root and system group members can execute the binary.

Test: flash and check the file permission

$ adb shell ls -lZ /apex/com.android.tethering/bin
dr-xr-x--- 2 root system u:object_r:system_file:s0  4096 1970-01-01 08:00 for-system

$ adb shell ls -lZ /apex/com.android.tethering/bin/for-system
-r-sr-sr-x 1 clat clat u:object_r:clatd_exec:s0  24352 1970-01-01 08:00 clatd

Bug: 212345928
Test: test clat
1. Connect to ipv6-only wifi.
2. Make IPv4 traffic.
   $ ping 8.8.8.8

Change-Id: I9537d47b135e6e0324fb40ece2b9f7befb159244
2022-01-14 18:33:40 +08:00
markchien
68cfadc523 Fix some typos in comments
This is CL just fix comments without changing behavior.

Bug: 209935649
Test: m
Change-Id: Iac40477bd2a3c48ba2a3f75a9cdf1174bcc89c3c
2022-01-14 13:47:13 +08:00