Commit graph

52,017 commits

Message SHA1
Add traffic_controller, networkstats, netd_updatable tests to MTS.
In order to get counted by mts code coverage, these native tests need to
be run as part of mts.

Bug: 233904825
Test: m mts && mts-tradefed run mts-tethering-coverage
Change-Id: I79313197b146c7043ffb5e164faa46c2e16dd1d2

Ken Chen   commited 2022-05-27 15:00:18 +00:00
b9266bf507
Merge "Assume all Ethernet interfaces have an MTU of 1500."
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-19 15:40:03 +00:00
bd77794547
Merge "Fix testUpdateConnectedClientsForLocalOnlyHotspot"
Mark Chien   authored and   Gerrit Code Review   commited 2022-05-19 15:20:34 +00:00
ee0cc41eaa
Merge "Changing automotive ethernet allowed UIDs check"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-19 13:29:16 +00:00
36cae536f0
Fix testUpdateConnectedClientsForLocalOnlyHotspot
testUpdateConnectedClientsForLocalOnlyHotspot should not run before T,
but it don't be ignored correctly because missing DevSdkIgnoreRule
setup.

Bug: 233077722
Test: TH
Change-Id: Ib2d241f927ccdc5d2bc392962481ecb86a223e09

Mark Chien   commited 2022-05-19 21:14:21 +08:00
7e4eab5153
Merge "bpf_existence_test: block & dscp_policy progs require 5.4+ kernel"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-05-19 11:25:37 +00:00
2adcebee36
bpf_existence_test: block & dscp_policy progs require 5.4+ kernel
Bug: 233119387
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8df3c0c1b9f4b60a55472d2402dcea368020985b

Maciej Żenczykowski   commited 2022-05-19 08:06:41 +00:00
93b8cc1556
Merge "Clat dump information improvement"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-19 06:35:16 +00:00
2438b2f5c6
Changing automotive ethernet allowed UIDs check
Updating the automotive allowed UIDs check to only work if the
capabilities have a single transport equal to ethernet.

Bug: 229419469
Test: atest FrameworksNetTests
Change-Id: I91e987d6b943a3c5986ab88553a6eef0d479b079

James Mattis   commited 2022-05-18 22:18:14 -07:00
4eff0efb57
Assume all Ethernet interfaces have an MTU of 1500.
This avoids races where NetworkInterface.getByName does not return the interface
right after it is created.

Change-Id: I17a5a22034bafc30023307d5480db18e918fc042
Test: test-only change
Bug: 227008268

Lorenzo Colitti   commited 2022-05-19 02:45:16 +00:00
d0ebb64ad1
Merge "Fix the ethernet setting API bug."
Patrick Rohr   authored and   Gerrit Code Review   commited 2022-05-18 20:56:34 +00:00
493ce14eaf
Merge changes Ide01c994,Ia9f12a7b
* changes:
  Revert "Autogenerate connectivity jarjar rules"
  Revert "Clarify comment in gen_jarjar.py"

Colin Cross   authored and   Gerrit Code Review   commited 2022-05-18 18:34:32 +00:00
708b1ab707
Revert "Autogenerate connectivity jarjar rules"
This reverts commit 53eb35cd82.

Reason for revert: b/233081774, caused long build times in FrameworkNetTests

Change-Id: Ide01c994f694b55fc0e87bb0e81584ac44196e68

Colin Cross   commited 2022-05-18 18:30:27 +00:00
ece3171cf0
Revert "Clarify comment in gen_jarjar.py"
This reverts commit 7d92b8b30f.

Reason for revert: b/233081774

Change-Id: Ia9f12a7b4eeecacf615f8783f35295fab98fa924

Colin Cross   commited 2022-05-18 18:30:05 +00:00
a8ce1aafbd
Clat dump information improvement
This is a followup commit for aosp/2017317.

1. Reorder the NAT464 information in dumpsys connectivity
2. Reword message when clat not started

Bug: 212345928
Test: dumpsys connectivity
Change-Id: I31c7066787dc7db8e5fe225f3918368b25bb7f5e

Hungming Chen   authored and   Nucca Chen   commited 2022-05-18 14:49:57 +00:00
c6e00ea74e
dscp_policy - use a more efficient v6_equal()
This is meant to optimize dscp_policy bpf verifier time at boot.

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

Maciej Żenczykowski   commited 2022-05-18 09:05:32 +00:00
3fc472dd39
Fix the ethernet setting API bug.
After turning off the ethernet settings via api, the ethernet service
can still be started when plugging-in the cable. Improve the api by
ignoring the upcoming interface unsolicited event listener callbacks
and register new interface observer once the ethernet setting is enabled
again.

Bug: 231933028
Test: atest testListenEthernetStateChange_unsolicitedEventListener
Change-Id: I1b1cb7d157f023fca82d75592168bd360a6fa6e1

Xiao Ma   commited 2022-05-18 17:23:32 +09:00
94a00dfc64
Merge changes I03e7cda7,I675c4ef5
* changes:
  Allow ethernet on automotive to set allowed UIDs
  Updating Eth CTS to account for existing ifaces

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-18 02:52:24 +00:00
af7101ff0f
Allow ethernet on automotive to set allowed UIDs
Allow ethernet factories on automotive devices to set the allowed UIDs
on NetworkCapabilities.

Bug: 229419469
Test: atest FrameworksNetTests
Change-Id: I03e7cda75f1c530e0d0e4a756330bc9847a96668

James Mattis   commited 2022-05-17 15:32:13 -07:00
46491d7546
Merge "Add NetworkOfferCallback to NetworkInterfaceState"
Patrick Rohr   authored and   Gerrit Code Review   commited 2022-05-17 22:24:24 +00:00
a6f94a31b8
Merge changes I5ffa2faf,Id5f14d6e
* changes:
  add proper minimum bpfloader version annotations for block/clatd/dscp_policy/netd
  move netd maps and progs into /sys/fs/bpf/netd_shared/...

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-17 15:39:02 +00:00
b6ac308b50
Updating Eth CTS to account for existing ifaces
Updating EthernetManagerTest to account for existing ethernet
interfaces. Specifically, testCallbacks() assumed the test interface
created would be the only ethernet interface on the device. This would
cause the test to fail if other ethernet interfaces existed.

Bug: 230305098
Test: atest CtsNetTestCases:android.net.cts.EthernetManagerTest
Change-Id: I675c4ef5c2bd96d01a057bdfec1794d6bfcf82bb

James Mattis   commited 2022-05-17 07:43:33 -07:00
105962ed14
Merge "Register localOnly softapCallback for local only hotspot"
Mark Chien   authored and   Gerrit Code Review   commited 2022-05-17 09:07:38 +00:00
46c86bbf82
Merge "Add CTS for verifying non-ASCII characters on NsdService"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-17 06:51:46 +00:00
85cc09b6b4
Merge "Deal with non-ASCII characters on resolution info"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-17 06:51:46 +00:00
eca1e920e5
Merge "Prepare for refactoring wifi ipserver start/stop"
Mark Chien   authored and   Gerrit Code Review   commited 2022-05-17 02:56:33 +00:00
bf9d2fc1fe
Add NetworkOfferCallback to NetworkInterfaceState
The offer is currently not registered, so this won't do anything yet.

Test: atest EthernetServiceTests
Bug: 197548738
Change-Id: Ic0923708619019bb339d1343ff9027a6a670d11c

Patrick Rohr   commited 2022-05-17 02:42:34 +00:00
5511bf5024
Deal with non-ASCII characters on resolution info
The service name can include non-ASCII characters. So
NsdService need to have specific handling for these non-ASCII
characters that make resolution working properly.

Note: The unescape() method is the same one that was used in S,
but was removed by mistake.

Bug: 230698801
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I42fc5618aa2d549ceae25f516ad17c78930ea41d

paulhu   authored and   Paul Hu   commited 2022-05-17 02:29:08 +00:00
be186602f9
Add CTS for verifying non-ASCII characters on NsdService
Add an CTS test to verify that a service can still be registered
with non-ASCII characters. And the service info can be
resolved successfully.

Bug: 230698801
Test: atest CtsNetTestCases:android.net.cts.NsdManagerTest
Change-Id: I1cb9a558988af5f1264d0ae732ab4b62c0bb8cde

paulhu   authored and   Paul Hu   commited 2022-05-17 10:27:10 +08:00
77389f1c33
Merge changes If52ece61,Iedf344f6
* changes:
  Block incoming packets in VPN Lockdown mode.
  Refactor VPN interface filtering necessity check

Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-05-17 01:42:00 +00:00
f6131c483b
add proper minimum bpfloader version annotations for block/clatd/dscp_policy/netd
In practice this doesn't actually really matter, since older versions
of the bpfloader won't even look in the relevant directories:

BpfLoader v0.9 is the first one that looks into
  '/apex/com.android.tethering/etc/bpf/net_shared',
but it is only v0.12 that pins the resulting programs and maps
correctly into
  /sys/fs/bpf/net_shared/
hence the annotations for block/clatd/dscp_policy.

BpfLoader v0.13 is the first one that looks into
  '/apex/com.android.tethering/etc/bpf/netd_shared'
subdirectory and pins into
  /sys/fs/bpf/netd_shared/
hence the annotation for netd.

But it's best to explicitly document the intent.

Note that in practice the mainline module will fail spectacularly
on a T OS if it can't find the programs and maps
(presumably due to the bpfloader being too old)
but will work on S even though the bpfloader there is much older,
because these programs/maps are not required on pre-T OS.

This change is thus really only documentation.

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

Maciej Żenczykowski   commited 2022-05-16 17:09:58 -07:00
acebffb966
Merge "drop support for pre-4.14 kernels"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-16 23:49:00 +00:00
ae30d8c052
move netd maps and progs into /sys/fs/bpf/netd_shared/...
(out of current /sys/fs/bpf/net_shared/...)

This will allow genfscon regexp changes in a followup selinux commit.

Note that this has a hard dependency on system/bpf change
  'bpfloader: add support for netd_shared and net_private subdirs'
which also bumps bpfloader to v0.13.

This was merged May 12, 2022 (into both aosp/master and tm-dev)
and it is in Android T starting with Beta 3 release.

This isn't really an issue since amusingly T Beta 2 is already
incompatible with current mainline releases due to the snap
reverting a previous required bpfloader system/bpf change:
  move net_shared bpf programs into net_shared subdirectory
See: http://b/232050459#comment14

So this doesn't break T Beta1/2, since they already don't work,
and Beta3 will work.

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

Maciej Żenczykowski   commited 2022-05-16 23:24:37 +00:00
6d116d0f38
drop support for pre-4.14 kernels
S had a minimum kernel requirement of 4.9,
T bumps this up to 4.14, which adds net cgroup bpf support.

It's important to ship T with this otherwise we'll be forced
into trying to somehow support 4.9 kernels with T mainline
module updates for years and years, when we no longer have
any tests of the old code paths...

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

Maciej Żenczykowski   commited 2022-05-16 11:04:22 -07:00
6ed2ab9b57
Merge "Clarify comment in gen_jarjar.py"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-16 14:39:41 +00:00
080974233c
Prepare for refactoring wifi ipserver start/stop
This is a preparing change.
1) In enableWifiIpServing, replace
   ensureIpServerStarted(ifname) +
   changeInterfaceState(ifname, ipServingMode)
   with enableIpServing(TETHERING_WIFI, ifname, ipServingMode).

   And checking whether corresponding wifi or p2p feature is
   avaialble before enableWifiIpServing. Note: If the wifi or p2p
   feature wasn't supported before, it would still call
   changeInterfaceState without ipServer created but
   changeInterfaceState would be no-op because there is no
   corresponding ipServer for changing state.

2) Splitting enableWifiIpServing into enableWifiIpServing and
   enableWifiP2pIpServing.

3) No longer guess the interface name after T. WIFI_AP_STATE_CHANGED
   intent should always include ifname and it should be tracked by
   mTetherStates. If OEM have modification in wifi framework to send
   empty ifname, tethering no longer support this after T.

4) After T, tethering always trust the ifname which pass by wifi or p2p
   intent broadcast and treat it as TETHERING_WIFI or
   TETHERING_WIFI_P2P. This allow tethering to deprecate wifi/p2p regexs
   after T.

Bug: 189410000
Bug: 178116595
Bug: 185451791
Bug: 190145323
Bug: 176048959

Test: atest TetheringTests

Change-Id: Ia5f69ddf2d842536ce0df75eeae57866f56df571

markchien   commited 2022-05-16 21:17:40 +08:00
f2e9409f55
Merge "Fix LinkPropertiesTest on *-user builds"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-05-16 13:00:13 +00:00
da53636d7c
Merge "Add setter/getter methods test for DscpPolicy.Builder"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-16 12:45:02 +00:00
56fc1be1df
Merge changes Idaca34fb,I2b4ca568
* changes:
  Add CtsNetTestCasesLatestSdk to presubmit
  Fix running CtsNetTestCasesLatestSdk errors on NsdManagerTest

Paul Hu   authored and   Gerrit Code Review   commited 2022-05-16 12:02:33 +00:00
2a17c5e624
Merge "Remove Ikev2VpnProfile shims usage"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-05-16 11:47:23 +00:00
8cc7a49a1e
Block incoming packets in VPN Lockdown mode.
Currently, even when VPN Lockdown mode is enabled, incoming packets are
not dropped if VPN is not connected.

This commit fixed this issue.
After this commit, If VPN Lockdown mode is enabled, incoming packets
are dropped regardless of the VPN connectivity.

Bug: 206482423
Test: atest TrafficControllerTest ConnectivityServiceTest PermissionMonitorTest
Change-Id: If52ece613c8aac1073355e43b6fb9cb3fcc87d1d

Motomu Utsumi   commited 2022-05-16 10:40:59 +00:00
b08654ca04
Refactor VPN interface filtering necessity check
Test: atest ConnectivityServiceTest
Change-Id: Iedf344f6275d4c6b23716eb11e3eecf54c6a2f9a

Motomu Utsumi   commited 2022-05-16 10:38:01 +00:00
77a794868f
Clarify comment in gen_jarjar.py
Document that --prefix should not end with a dot.

Bug: 217129444
Change-Id: I8506afc207975b5fbc912b91820682b8d9b7221b

Remi NGUYEN VAN   commited 2022-05-16 09:10:37 +00:00
7d92b8b30f
Merge "Autogenerate connectivity jarjar rules"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-05-16 09:06:33 +00:00
4cd92adf0e
Add CtsNetTestCasesLatestSdk to presubmit
CtsNetTestCases is already run in presubmit, but
CtsNetTestCasesLatestSdk should also pass on HEAD. The only differences
are the target SDK and the shims used (LatestSdk uses latest stable
shims, CtsNetTestCases uses unstable shims). Thus, add
CtsNetTestCasesLatestSdk to presubmit to ensure the tests keep
passing.

Bug: 228286975
Test: atest CtsNetTestCasesLatestSdk
Change-Id: Idaca34fb8a907a6f0017747b47ca89d5306f3ecc

Paul Hu   commited 2022-05-16 15:51:46 +08:00
206e5f0882
Fix running CtsNetTestCasesLatestSdk errors on NsdManagerTest
- All tests in NsdManagerTest would be ignored when running
  CtsNetTestCasesLatestSdk on android S devices. But
  NsdManagerTest#testNsdManager is existed before android T, it
  should not be ignored on android S devices. Besides, those
  tests can only run after android T have guarded by
  ConstantsShim check. Thus, remove DevSdkIgnoreRule on
  NsdManagerTest.
- In the legacy NsdManagerTest that covers older APIs, do not use
  newer APIs that use executors, and use only older APIs instead.

Bug: 228286975
Test: atest CtsNetTestCasesLatestSdk:android.net.cts.\
      NsdManagerTest
Change-Id: I2b4ca568e9819dc0f476f66e43072ddbcfd75a02

Paul Hu   commited 2022-05-16 15:46:07 +08:00
9e2c6a4564
Merge "Use stable shims in service-connectivity"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-16 07:11:46 +00:00
853d3f2ce9
Register localOnly softapCallback for local only hotspot
Before T, wifi local only mode won't update onConnectedClientsChanged.
To support updating tethered client information for localOnly hotspot,
register localOnly softap callback to get connected wifi client update.

Bug: 171928468
Test: atest TetheringTests

Change-Id: I0e974feea9497809ea02a4138c7b9c2c584a8a45

markchien   commited 2022-05-16 15:09:10 +08:00
4ccb419602
Remove Ikev2VpnProfile shims usage
Remove usage of Ikev2VpnProfileShim and Ikev2VpnProfileBuilderShim.

Both were used to allow the test to build in branches that do not have T
APIs, but all downstream branches now do.

The shims would throw checked exceptions when unsupported methods were
used, not providing fallback behavior, so they can just be replaced by
direct calls in any case.

Bug: 232251248
Test: atest Ikev2VpnTest
Change-Id: I1d5418206fab9f35403eb3baf81363b1286b0b3b

Remi NGUYEN VAN   commited 2022-05-16 15:32:57 +09:00
17f3af5fd8
Merge changes from topic "tethering_metrics"
* changes:
  Add tethering stats into statsd
  Injecting tethering stats into statsd

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-16 05:06:01 +00:00
42f38d0bdf