Commit graph

43,601 commits

Message SHA1
[CLATJ#20] ClatdCoordinator: stop bpf for clat
Remove eBPF offload at clat stopping if possible.

Bug: 212345928
Test: build only
because need to test with clatd launched

Change-Id: I6ace77694c0e6fe68d16e80e3c8198aa41385fd2

Hungming Chen   commited 2022-01-22 20:07:30 +08:00
fb676b58e0
[CLATJ#19] ClatdCoordinator: configure bpf for clat
Configure eBPF offload at clat starting if possible.

Bug: 212345928
Test: connect to ipv6 only network and check bpf entries
$adb shell dumpsys netd --short | grep Clat -A10
  ClatdController
    Trackers: iif[iface] nat64Prefix v6Addr -> v4Addr v4iif[v4iface] [fwmark]
    BPF ingress map: iif(iface) nat64Prefix v6Addr -> v4Addr oif(iface)
      47(wlan0) 64:ff9b::/96 2a00:79e1:abc:6f02:b7aa:ff3c:9220:595c -> 192.0.0.4 52(v4-wlan0)
    BPF egress map: iif(iface) v4Addr -> v6Addr nat64Prefix oif(iface)
      52(v4-wlan0) 192.0.0.4 -> 2a00:79e1:abc:6f02:b7aa:ff3c:9220:595c 64:ff9b::/96 47(wlan0) ether

Change-Id: I8ff77a2e3e86bfe6dbf43f4181414e444ba0da32

Hungming Chen   commited 2022-01-22 20:07:24 +08:00
b1d3ccbeb6
[CLATJ#18] libclat: move clat tc and bpf utilis from netd
Move native functions from ClatdController and TcUtils to libclat
for jni ClatdCoordinator.

Bug: 212345928
Test: atest libclat_test
Change-Id: Ia4b344b07537d57c3e4ff1285b0e7b17e0c63c3e

Hungming Chen   commited 2022-01-22 20:07:19 +08:00
8ebdb6f1fe
[CLATJ#17] bpf_connectivity_headers visible to libclat
Needed because ClatdController and clatd binary are moved
into apex. libclat is used for accessing BPF map.

Bug: 212345928
Test: build
Change-Id: I1be5d4c9cc2c9865ac99f2595443e54e7334c843

Hungming Chen   commited 2022-01-22 20:06:55 +08:00
99b9ae3787
Merge "Add cts test suite in connectivity/cts deps"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-01-21 07:36:08 +00:00
38276f1b9c
Merge changes from topic "connectivity-mainline-presubmit-defaults"
* changes:
  Add java defaults for mainline-presubmit as well.
  Run bpf_existence_test in mainline-postsubmit.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-01-21 07:07:41 +00:00
513180aae8
Merge "[NETD-TC#10] Create BpfNetMaps class"
Wayne Ma   authored and   Gerrit Code Review   commited 2022-01-21 07:06:09 +00:00
5314cc6590
Merge "Update the SDK for the tests with intended target in T+"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-01-21 06:34:29 +00:00
b04664d7a6
[NETD-TC#10] Create BpfNetMaps class
BpfNetMaps provide interfaces and native methods for
manipulating BPF maps by calling jni library of traffic controller.

DO NOT TOUCH BpfNetMaps before aosp/1945136 and aosp/1948169 get merged.

Bug: 202086915
Test: build and flash
Change-Id: Iaff8ac71100b3f76b444f3b83616556d0ee6eadf

Wayne Ma   commited 2022-01-21 13:19:29 +08:00
0ea3bdc88b
Merge "[MS57.2] Prepare APIs for data migration utility"
Junyu Lai   authored and   Gerrit Code Review   commited 2022-01-21 04:26:57 +00:00
015e5690af
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

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-01-21 02:54:21 +00:00
e0322e3fd1
Merge "Move netd.c to Tethering module"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-01-21 02:42:35 +00:00
1f36542d1e
Merge "Add proguard rules for TcUtils"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-01-21 01:52:48 +00:00
c060c2dd46
Merge "[MS41.2] Add unit test for query history APIs"
Junyu Lai   authored and   Gerrit Code Review   commited 2022-01-21 00:30:02 +00:00
606fb4f79f
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

Ken Chen   commited 2022-01-21 07:40:33 +08:00
587d4231fc
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

Patrick Rohr   commited 2022-01-20 22:11:57 +01:00
b194dfe04b
Add cts test suite in connectivity/cts deps
Test: atest CtsNetTestCases
Change-Id: Ib82b703145096a0b974aa602c7cdd505c333bca0

William Escande   commited 2022-01-20 17:52:03 +01:00
02fc79437b
[MS57.2] Prepare APIs for data migration utility
Test: atest NetworkStatsHistoryTest#testBuilder
Bug: 204830222
Change-Id: I938c3ed50eea0f2349ea92c3824c637eaa77d328

Junyu Lai   commited 2022-01-20 15:06:50 +00:00
56f4a9c3d1
[MS41.2] Add unit test for query history APIs
Test: atest NetworkStatsServiceTest NetworkStatsManagerTest
Bug: 204830222
Bug: 200768422
Change-Id: I1dce7d671c5524496e0451665f62447ef6e454ae

Junyu Lai   commited 2022-01-20 15:06:50 +00:00
7372824eca
[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

Hungming Chen   commited 2022-01-20 22:50:13 +08:00
050b6529c4
[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

Hungming Chen   commited 2022-01-20 22:50:13 +08:00
847b2ce4f9
[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

Hungming Chen   commited 2022-01-20 22:50:13 +08:00
2c3acb01c9
[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

Hungming Chen   commited 2022-01-20 22:50:13 +08:00
d292f45e16
[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

Hungming Chen   commited 2022-01-20 22:50:13 +08:00
79d34befb1
[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

Hungming Chen   commited 2022-01-20 22:50:13 +08:00
397ca65abb
[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

Hungming Chen   commited 2022-01-20 22:50:13 +08:00
7de1c49b74
[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

Hungming Chen   commited 2022-01-20 22:50:13 +08:00
46bbee1bfe
[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

Hungming Chen   commited 2022-01-20 22:50:13 +08:00
884c0a122c
[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

Hungming Chen   commited 2022-01-20 22:50:13 +08:00
e2cf055590
[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

Hungming Chen   commited 2022-01-20 22:50:12 +08:00
8ff032b990
[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

Hungming Chen   commited 2022-01-20 22:50:12 +08:00
86a56de609
[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

Hungming Chen   commited 2022-01-20 22:50:12 +08:00
2f623f381c
[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

Hungming Chen   commited 2022-01-20 22:50:12 +08:00
6139d87623
[CLATJ#2] libclat: Add libclat_test to postsubmit
Add native library libclat test to postsubmit.

Bug: 212345928
Test: atest libclat_test
Change-Id: Ied5e0796b01c384b3eee2d40c0c735859709be33

Hungming Chen   commited 2022-01-20 22:50:12 +08:00
aaa8bd8b74
[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

Hungming Chen   commited 2022-01-20 22:50:08 +08:00
ed7b4602b5
Merge "Prepare T build rules for backwards compatibility"
Paul Hu   authored and   Gerrit Code Review   commited 2022-01-20 10:44:48 +00:00
a6ee639dca
Merge "Fix some typos in comments"
Mark Chien   authored and   Gerrit Code Review   commited 2022-01-20 10:17:27 +00:00
0730625a31
Merge "Move LocalSocketTest out of packages/modules/Connectivity."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-01-20 09:43:04 +00:00
ab4c64329b
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

Remi NGUYEN VAN   authored and   paulhu   commited 2022-01-20 13:57:44 +08:00
24b3c37e0a
Merge "Add unit test for NetworkStats iterator"
Aaron Huang   authored and   Gerrit Code Review   commited 2022-01-20 04:09:00 +00:00
ccdf2a5838
Merge "Build framework-connectivity-tiramisu library"
Paul Hu   authored and   Gerrit Code Review   commited 2022-01-20 03:02:56 +00:00
a77cad355b
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

Chiachang Wang   commited 2022-01-20 10:30:19 +08:00
7212fbee14
Merge "Set the permission to file clatd and directory for-system"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-01-19 13:09:39 +00:00
fac8864d14
Add unit test for NetworkStats iterator
Bug: 210073043
Test: this
Change-Id: I2bcd80627c31e94ac040dbb4e7d38561d8f4c229

Aaron Huang   commited 2022-01-19 17:10:44 +08:00
2ae5921bc8
Merge "Mark connectivity module tests as such"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-01-19 06:49:39 +00:00
6c232e9b49
Merge "Do not verify field count in tests used in CTS"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-01-19 06:49:28 +00:00
0ac9163620
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

William Escande   authored and   Lorenzo Colitti   commited 2022-01-19 04:03:26 +00:00
5fd2c7033a
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

Chiachang Wang   commited 2022-01-18 11:25:03 +00:00
af7c44cc4e
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

Remi NGUYEN VAN   commited 2022-01-18 16:55:44 +09:00
e347301890
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

Remi NGUYEN VAN   commited 2022-01-18 16:55:32 +09:00
8bc36966d4