Commit Graph

51731 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
8f31725a22 Delete libcom_android_net_module_util_jni
It is not used anywhere, as the sources are included via filegroup
in other libraries.

Test: m
Bug: 222234190
Change-Id: I23efe1382892a5493b8819cf05b5852305018d70
2022-04-11 02:22:43 +00:00
Bob Badour
03465246f6 [LSC] Add LOCAL_LICENSE_KINDS to packages/modules/Connectivity
Added SPDX-license-identifier-Apache-2.0 to:
  tests/native/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Change-Id: I0f883fa9c9d922766976c939565c6b368629915d
2022-04-07 10:36:04 -07:00
Treehugger Robot
49bcf60592 Merge "Set mark on non-offloaded ingress clat traffic" 2022-04-07 15:14:52 +00:00
Patrick Rohr
da294fc886 Merge "Use completeExceptionally instead of second future" 2022-04-07 12:12:32 +00:00
Chiachang Wang
5850372963 Merge "Update test for new IkeTunnelConnectionParams field" 2022-04-07 10:24:03 +00:00
Hungming Chen
6c0b1e85e9 Set mark on non-offloaded ingress clat traffic
As Maze@'s advice, we add a clat mark to clat packet in ingress bpf
and drop the duplicate packets in iptables via mark match.

Bug: 218407445
Test: manual test with unmerged aosp/1951099

0. Connect to IPv6-only wifi

1. Clatd test: ping 5 times and check that iptables drop 5 packets by
   mark 0xdeadc1a7.

$ adb shell ping 8.8.8.8
..
64 bytes from 8.8.8.8: icmp_seq=4 ttl=120 time=14.3 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=120 time=67.4 ms

$ adb shell ip6tables -t raw -L bw_raw_PREROUTING -v
Chain bw_raw_PREROUTING (1 references)
 pkts bytes target     prot opt in     out     source               destination
    5   520 DROP       all      any    any     anywhere             anywhere             mark match 0xdeadc1a7
    0     0 RETURN     all      ipsec+ any     anywhere             anywhere
    0     0 RETURN     all      any    any     anywhere             anywhere             policy match dir in pol ipsec
 1661 1239K            all      any    any     anywhere             anywhere            match bpf pinned /sys/fs/bpf/prog_netd_skfilter_ingress_xtbpf

2. Bpf test: run iperf to an IPv4 server and iptables doesn't see
   offloaded packet with mark 0xdeadc1a7. Drop packet count (5) is
   unchanged.

$ adb shell iperf3 -4 -c 117.102.109.186 -t1
Connecting to host 117.102.109.186, port 5201
[  5] local 192.0.0.4 port 56242 connected to 117.102.109.186 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec   622 KBytes  5.09 Mbits/sec    0   44.0 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-1.00   sec   622 KBytes  5.09 Mbits/sec    0             sender
[  5]   0.00-1.00   sec   201 KBytes  1.64 Mbits/sec                  receiver

$ adb shell ip6tables -t raw -L bw_raw_PREROUTING -v
Chain bw_raw_PREROUTING (1 references)
 pkts bytes target     prot opt in     out     source               destination
    5   520 DROP       all      any    any     anywhere             anywhere             mark match 0xdeadc1a7
    0     0 RETURN     all      ipsec+ any     anywhere             anywhere
    0     0 RETURN     all      any    any     anywhere             anywhere             policy match dir in pol ipsec
 1804 1280K            all      any    any     anywhere             anywhere            match bpf pinned /sys/fs/bpf/prog_netd_skfilter_ingress_xtbpf

3. Enable USB tethering. Do ping and iperf on tethered client.

4. Clatd test: ping 5 times and check that iptables drop 5 packets
   (count from 5 to 10) by mark 0xdeadc1a7.

$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
..
64 bytes from 8.8.8.8: icmp_seq=4 ttl=119 time=13.7 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=119 time=15.9 ms

$ adb shell ip6tables -t raw -L bw_raw_PREROUTING -v
Chain bw_raw_PREROUTING (1 references)
 pkts bytes target     prot opt in     out     source               destination
   10  1040 DROP       all      any    any     anywhere             anywhere             mark match 0xdeadc1a7
    0     0 RETURN     all      ipsec+ any     anywhere             anywhere
    0     0 RETURN     all      any    any     anywhere             anywhere             policy match dir in pol ipsec
 1900 1298K            all      any    any     anywhere             anywhere            match bpf pinned /sys/fs/bpf/prog_netd_skfilter_ingress_xtbpf

5. Bpf test: run iperf to an IPv4 server and iptables doesn't see
   offloaded packet with mark 0xdeadc1a7. Drop packet count (10) is
   unchanged.

$ iperf3 -4 -c 117.102.109.186 -t1
Connecting to host 117.102.109.186, port 5201
[  5] local 192.168.235.233 port 41602 connected to 117.102.109.186 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  3.19 MBytes  26.8 Mbits/sec    0    369 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-1.00   sec  3.19 MBytes  26.8 Mbits/sec    0             sender
[  5]   0.00-1.00   sec  2.58 MBytes  21.7 Mbits/sec                  receiver

$ adb shell ip6tables -t raw -L bw_raw_PREROUTING -v
Chain bw_raw_PREROUTING (1 references)
 pkts bytes target     prot opt in     out     source               destination
   10  1040 DROP       all      any    any     anywhere             anywhere             mark match 0xdeadc1a7
    0     0 RETURN     all      ipsec+ any     anywhere             anywhere
    0     0 RETURN     all      any    any     anywhere             anywhere             policy match dir in pol ipsec
 1978 1320K            all      any    any     anywhere             anywhere            match bpf pinned /sys/fs/bpf/prog_netd_skfilter_ingress_xtbpf

Change-Id: I180206bb15a1362c678f42fb980b60dfed6ce1ab
2022-04-07 11:49:59 +08:00
Xiao Ma
8e13391915 Merge "Remove unused empty filegroups from connectivityT package." 2022-04-07 03:45:45 +00:00
Paul Hu
09475308b7 Merge changes from topic "MDns_AIDL"
* changes:
  Use MDns aidl on NsdService
  Add MDnsManager
2022-04-07 02:06:35 +00:00
Remi NGUYEN VAN
1ae9c4ad07 Merge "ConnectivityCoverageTests refactoring" 2022-04-07 01:22:17 +00:00
Maciej Żenczykowski
189577cd8b add OWNERS for connectivity_native_test
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibb7bcf272a2ff258d2518b60589ecb8e16823777
2022-04-06 23:25:10 +00:00
markchien
e59f5e36e5 ConnectivityCoverageTests refactoring
ConnectivityCoverageTests is a combination of several test libs, which
are jarjared differently. It causes duplicated classes not to be counted
for coverage properly. Build the test suite directly and apply jarjar
only once on top of everything.

Bug: 227694415
Test: atest ConnectivityCoverageTests

Change-Id: I4350ebdbf98030944ec3857e1ef67d76f26c3b16
2022-04-06 19:35:28 +09:00
Mark Chien
60f25d6c5b Merge "Add config_p2p_leases_subnet_prefix_length configuration" 2022-04-06 09:14:19 +00:00
Lorenzo Colitti
a79559084b Merge "Allow the bluetooth UID to register network factories." 2022-04-06 09:08:47 +00:00
Paul Duffin
7327f2cc1f Remove tabs that have been removed downstream
Change https://r.android.com/2020995 was a cherry pick of a downstream
change that was updated to remove these tabs. Unfortunately, the
cherry pick was not updated to match making this change necessary to
ensure consistency.

Bug: 194063708
Test: m out/soong/hiddenapi/hiddenapi-flags.csv
Change-Id: Id03bbbb749eb91a4f26b5c12b77eed03a72a83c4
Merged-In: Iaa1207799a44ab892dc30b55f363c6e7deb94d86
2022-04-06 08:01:23 +01:00
Paul Duffin
a2e04105bb Merge "Remove implementation details from tethering hidden api flags" 2022-04-06 06:51:07 +00:00
Chiachang Wang
ed714f4d17 Merge "Add test for Ikev2VpnProfile.getIkeTunnelConnectionParams" 2022-04-06 05:28:56 +00:00
Lorenzo Colitti
d12af7ebfe Allow the bluetooth UID to register network factories.
This ensures that bluetooth can register bluetooth tethering
NetworkAgents without having to make NETWORK_FACTORY a privileged
or role permission.

Test: m
Bug: 221949454
Change-Id: I24a5da444b10dde740c1e449c8630de56946d4e1
2022-04-06 11:15:12 +09:00
Maciej Żenczykowski
6097358382 Merge changes Iafa8979d,I44eac159,I27ad3298
* changes:
  Address EthernetManager javadoc review comments
  Update javadoc to match expectation for UnsupportedOperationException
  Fix linter errors
2022-04-06 00:39:28 +00:00
Andriy Naborskyy
f900a64af4 Merge "data saver test exception for wear" 2022-04-05 23:46:28 +00:00
Sudheer Shanka
63ef37647e Merge "Increase the temp-allowlist duration in tests" 2022-04-04 21:39:03 +00:00
paulhu
2b9ed95ae5 Use MDns aidl on NsdService
- Use MDns aidl to communicate with mdns service and register
  event listener to receive callback.
- Remove all NDC relevant code on NsdService.
- Use MDns aidl on NsdServiceTest.

Bug: 209894875
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I65929dee3838fef753396e86c665abd66b6fec81
2022-04-04 15:18:27 +00:00
Paul Duffin
a0c49bcc2c Remove implementation details from tethering hidden api flags
Ran the following to compute the set of split_packages and
package_prefixes properties.
    m analyze_bcpf &&
    analyze_bcpf --bcpf com.android.tethering-bootclasspath-fragment --apex framework-tethering --sdk tethering-module-sdk

Bug: 194063708
Test: m out/soong/hiddenapi/hiddenapi-flags.csv
Change-Id: Iaa1207799a44ab892dc30b55f363c6e7deb94d86
Merged-In: Iaa1207799a44ab892dc30b55f363c6e7deb94d86
2022-04-04 16:17:51 +01:00
paulhu
541b72d03b Add MDnsManager
- Have MDnsManager to manage mdns native service binder call.
- Register it as a system service for NsdService.
- NsdService will use aidl to communicate with mdns, so add the
  relevant lib to framework-connectivity
- Add jarjar rule for mdns-aidl-interface classes.

Bug: 209894875
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: Ibc8b726c01a15015b450caf94d0afed570117b7f
2022-04-04 15:02:17 +00:00
Patrick Rohr
fd87fb65fb Use completeExceptionally instead of second future
The onError callback can use the same future as the onResult callback by
calling completeExceptionally.
This change is also removing the test for a specific exception message.
Testing for a specific exception message would mean that tests break if we
ever were to update them. If we decide that there is value to
distinguish between different types of
EthernetNetworkManagementException we should probably subclass it
internally.

Test: atest EthernetNetworkFactoryTest
Change-Id: Ib6f8cf79fc26e0f856c880cbe505b101f12aa187
2022-04-04 14:59:42 +02:00
Patrick Rohr
50c470e308 Address EthernetManager javadoc review comments
Test: TH
Change-Id: Iafa8979d8e96ea4d078b017e56ee61334d33b5f5
2022-04-04 14:59:42 +02:00
Patrick Rohr
0f2cbe92f1 Update javadoc to match expectation for UnsupportedOperationException
Test: builds
Change-Id: I44eac15972ed099fc12599a78a71557a7b16d593
2022-04-04 14:59:42 +02:00
Patrick Rohr
ddc2622ec7 Fix linter errors
Test: TH
Change-Id: I27ad329811a4794050b25976e79909ce8c57d7a3
2022-04-04 14:59:31 +02:00
Remi NGUYEN VAN
82ef475266 Merge "Merge EthernetServiceTests into FrameworksNetTests" 2022-04-04 08:02:04 +00:00
Xiao Ma
f90f1efff4 Remove unused empty filegroups from connectivityT package.
connectivity-tiramisu-sources filegroup in the framework-t and service
folder is useless after moving all source files to updatable-sources
filegroup, delete them from f/b/packages/connectivityT.

Bug: 210586283
Test: m
Change-Id: I22e9a70a04929144488380d1530cd7baa78ce056
2022-04-04 07:00:59 +00:00
Sudheer Shanka
5b63b6c107 Increase the temp-allowlist duration in tests
It is possible there is a delay in app getting to
the background state and then initiating network
activity. We need the app to stay in the
temp allowlist until then.

Fixes: 227418169
Test: atest tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: I6a98cc17a40cfb54bf3e12f51b5584159e69be0c
2022-04-02 21:05:51 +00:00
Lorenzo Colitti
6de87582c1 Merge changes from topic "block_port"
* changes:
  Add connectivity_native_test to Presubmit
  Vendor AIDL interface for port blocking via eBPF
2022-04-01 21:46:37 +00:00
Remi NGUYEN VAN
40da62da48 Merge EthernetServiceTests into FrameworksNetTests
As per the TODO, merge EthernetServiceTests into the larger
FrameworksNetTests suite.

Similarly to NetworkStats, NSD or IpSec tests, the tests are also marked
as "non-connectivity-module-test", where "module" actually refers to
modules being built for release (from an S-based branch) today. This is
necessary as the tests and associated code cannot build without T APIs.

Also add FrameworksNetTests to presubmit as non-connectivity-module
tests are not run in presubmit without this.

Test: TH
Merged-In: Id533cdb4ac184b963f570af299dea04754ba88e9
Change-Id: I9950fcb49fdc2217134a59e993941cbe5da0b556
2022-04-01 15:12:18 +09:00
Wayne Ma
075dd6f8ff Merge "Adding Tethering proto" 2022-03-31 16:24:16 +00:00
markchien
fb65dfeb8d Add config_p2p_leases_subnet_prefix_length configuration
Add new rro configuration which can be used to make the p2p dhcp
prefix length larger to reserve the address range outside of leases
subnet prefix length for EAPOL-Key feature. This configuration only
valid if its value larger than dhcp server address prefix length and
config_tether_enable_legacy_wifi_p2p_dedicated_ip is true.
E.g.:leaseSubnetPrefixLength = 25, p2p static address = 192.168.49.1/24
dhcp range: 192.168.49.0 ~ 192.168.49.127 (192.168.49.1/25), reserved
192.168.49.128 ~ 192.168.49.255 for EAPOL-Key feature.

Bug: 170056953
Test: atest TetheringTests

Change-Id: I1319efd871796da7234383a29ab64a1623101ae7
2022-03-31 16:32:55 +08:00
Chiachang Wang
69aa988090 Update test for new IkeTunnelConnectionParams field
Bug: 184750836
Test: atest FrameworksNetTests
Change-Id: Iab55eba74b94f295a358c6e8474ebf9230c9b019
2022-03-31 14:45:59 +08:00
Remi NGUYEN VAN
86bbfe9271 Remove connectivity-tiramisu-updatable-sources
The filegroup is now unnecessary as files are all in the service-t/src
directory.

This change allows building all sources including ethernet by
referencing src/**. This is done by using a general filegroup
service-connectivity-tiramisu-sources, so that branches that cannot
build the T+ code can change its contents without introducing merge
conflicts in the rest of the build rules.

Also change visibility rules to allow building the moved ethernet code,
and add a filegroup to allow building its tests.

Bug: 222234190
Test: TH
Merged-In: I770bf8db3f4c18467934eb2184f5dc2408fc28ec
Merged-In: I3e5df1bd44defbb9dd0c382c625a21e176368f2a
Change-Id: I8f23a45800b1086cc5a765fd24d734ca82c339a8
2022-03-31 15:14:39 +09:00
Remi NGUYEN VAN
e99dcfd4dd Merge history of opt/net/ethernet
Renamed files/directories:
java/ --> service-t/src/
tests/ --> tests/ethernet/
Android.bp --> (removed)
OWNERS --> (removed)
.gitignore --> (removed)

BUG: 222234190
TEST: TH
Merged-In: I770bf8db3f4c18467934eb2184f5dc2408fc28ec
Merged-In: I3e5df1bd44defbb9dd0c382c625a21e176368f2a
Change-Id: Ifc02784499d114e12d8ad64ba011dd23b97fb78b
2022-03-31 15:14:28 +09:00
Michael Groover
3e712761a4 Merge "Revert "Use RECEIVER_NOT_EXPORTED in CarrierPrivilegeAuthenticator."" 2022-03-31 01:39:28 +00:00
Sewook Seo
2304205a58 Merge "Support QosCallback with UDP socket" 2022-03-30 20:01:45 +00:00
Hungming Chen
dad664748a Add test for tetherOffloadClient{Add, Remove, Clear}
also remove the redundant constructor definition in
test key/value class builder.

Test: atest TetheringCoverageTests
Change-Id: Icf93d4f196846c82c3a1c2b2b8697f4a5156ea92
2022-03-30 16:28:11 +08:00
Hungming Chen
fa3942c7e7 Add test for tetherOffloadRule4Clear
Test that clear IPv4 offload rules once tethering stopped

Test: atest TetheringCoverageTests
Change-Id: I107b15bef2a15f7c85236f2801c43288fe7d0f4d
2022-03-30 16:28:11 +08:00
Chiachang Wang
1703c97098 Add test for Ikev2VpnProfile.getIkeTunnelConnectionParams
Bug: 226628416
Test: atest ctsNetTestCases
Test: atest CtsNetTestCasesLatestSdk in R/Q
Change-Id: Ie8f589f687946c863e1c2fd2afdf6665c719e581
2022-03-30 13:39:51 +08:00
Lucas Lin
fda6032eae Merge "Add @AppModeFull for those tests which will bind socket" 2022-03-29 15:35:30 +00:00
Lucas Lin
41ed965e68 Merge "Add @RequiresPermission for setUnderlyingNetworks" 2022-03-29 15:34:17 +00:00
lucaslin
0451366cd5 Add @AppModeFull for those tests which will bind socket
In instant mode, the test doesn't have permission to bind socket.
Add @AppModeFull to stop them running in the instant mode.

Bug: 225937472
Test: atest --instant CtsNetTestCases:NetworkAgentTest
Change-Id: Iccd3f3b1c8e8173eead12e4d0c6e3a9189d3746a
2022-03-29 12:15:28 +00:00
Lorenzo Colitti
644fe232cd Merge "Don't throw in FullScore#policyNameOf." 2022-03-29 08:38:21 +00:00
Lorenzo Colitti
1727d9f1f2 Don't throw in FullScore#policyNameOf.
This code is correct on userdebug builds, but it is dangerous on
user builds because proguard might strip out the POLICY_*
constants and that would lead to crashes.

For now just log a wtf if an invalid policy name is found. A
better solution would be to make MessageUtils robust to this
problem, e.g., by having it store the SparseArray internally and
providing getters that do not throw, instead of the current
behaviour that returns the SparseArray. That is left to a future
CL.

Fix: 227161413
Test: atest FullScoreTest
Change-Id: I68b69ee9dd84773018e62c9a8f43e754ae04c486
2022-03-29 08:38:06 +00:00
markchien
011a7f51c1 Improve JavaDoc for FirewallRule constants
Bug: 226946569
Test: TH
Change-Id: I8366bd58194e24da7ea74bf398aae196482d0151
2022-03-29 12:28:25 +08:00
Treehugger Robot
3d4de57752 Merge "Api review: change updateFirewallRule to setUidFirewallRule" 2022-03-29 03:41:02 +00:00
sewookseo
82657d70d7 Support QosCallback with UDP socket
Add a constructor for QosSocketInfo using DatagramSocket.

Bug: 203146631
Test: atest & verified on LTE test equipment
Change-Id: I85c091a65610a96d721e4f0b07631867cda4db8a
2022-03-29 02:38:05 +00:00