Commit Graph

66134 Commits

Author SHA1 Message Date
Junyu Lai
aa4ad8c2d1 Allow USE_RESTRICTED_NETWORKS for registerSystemDefaultNetworkCallback
Some callers (e.g. iwlan) need to learn about system default
network but they cannot have NETWORK_SETTINGS permission.
To allow them to use this API but prevent from misuse by
unprivileged apps, enforce USE_RESTRICTED_NETWORKS for this API.

Test: atest com.android.server.ConnectivityServiceTest#testRegisterPrivilegedDefaultCallbacksRequireNetworkSettings android.net.cts.ConnectivityManagerTest#testRegisterNetworkCallback
Fix: 242456635
Change-Id: I80ab27445af874328c9c0f4814a8fbf035ae5df4
2022-11-02 14:16:36 +08:00
Junyu Lai
3e7778805b Merge "Revert^2 "[ST02.2] Use the getters of DnsHeader"" 2022-09-22 02:39:42 +00:00
Xinyi Zhou
b1391d5d15 Merge "[CTS] Fix CTS failure in mainline train" into android13-tests-dev am: 2d3df1b225
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2222423

Change-Id: I3b27262819528d048be3352407a1759ce0526ce1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-21 21:34:10 +00:00
Patrick Rohr
1c40837525 [automerger skipped] Merge changes from topic "dscp-cts13-r2" into android13-tests-dev am: 68e3c3c634 -s ours
am skip reason: Merged-In I1d2bfd52e05c334f9808e60455c346b4dca18cf7 with SHA-1 1bba92f1bc is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2192826

Change-Id: I2533d44b3239192df5e033b986d242137d2bc003
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-21 21:33:50 +00:00
Patrick Rohr
62916eb8ce [automerger skipped] DscpPolicy: remove v6 default route as it is added by the RA am: e0196ea540 -s ours
am skip reason: Merged-In I1d2bfd52e05c334f9808e60455c346b4dca18cf7 with SHA-1 1bba92f1bc is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2192826

Change-Id: I2f5da0bbbf8011726b50420348d415cc2e9cf489
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-21 21:33:44 +00:00
Patrick Rohr
d837becc15 Merge changes I29f7d2b4,Ie2aa7529
* changes:
  Revert "Add SkipPresubmit to EthernetManagerTest"
  ethernet: reenable IPv6 provisioning delays
2022-09-21 21:30:00 +00:00
Patrick Rohr
0a822f8f41 Merge changes I0b88bc8b,I60d884db,I436858e7,Iaaace0e6,Ie7ee84c3, ...
* changes:
  ethernet: cleanup updateConfiguration tests
  ethernet: fix callbacks for running interfaces
  ethernet: test callbacks when adding running interface
  ethernet: ensure EthernetOutcomeReceiver receives only one result
  ethernet: fix enable/disableInterface result
  ethernet: remove enable/disable interface unit test
2022-09-21 19:08:02 +00:00
Patrick Rohr
68897055cd ethernet: cleanup updateConfiguration tests
Unfortunately, TestableNetworkCallback.expectCapabilitiesWith cannot be
used as it expects to be passed a HasNetwork object.

Test: atest EthernetManagerTest
Change-Id: I0b88bc8b51711db4464608a5075dec32a1fc8ef7
2022-09-21 12:03:15 -07:00
Patrick Rohr
cc2bf28207 ethernet: fix callbacks for running interfaces
updateInterfaceState(true) changes the interface state and triggers an
interface state callback. In addition, maybeTrackInterface() always
sends out a callback (which is correct, as for an interface that is
being added, maybeTrackInterface() would send the initial DOWN
callback). setTetheringInterfaceMode() (the other caller of
addInterface) also already sends its own callback.

Test: atest EthernetManagerTest
Change-Id: I60d884db5e788639b035cad1dd0d6c316e5836f7
2022-09-21 12:03:15 -07:00
Patrick Rohr
270211ddbf ethernet: test callbacks when adding running interface
Test: atest EthernetManagerTest
Change-Id: I436858e7aaa4d709df9115c1f8cdeb3e7c1c75e9
2022-09-21 12:03:15 -07:00
Patrick Rohr
bb320db199 ethernet: ensure EthernetOutcomeReceiver receives only one result
Sending multiple callbacks to one receiver is an easy trap to fall into.
Asserting that the future has not completed in EthernetOutcomeReceiver
should catch this mistake.

Test: atest EthernetManagerTest
Change-Id: Iaaace0e6604558bfc2fc1ae58c2744185e0b13ca
2022-09-21 12:03:15 -07:00
Patrick Rohr
d337299e66 ethernet: fix enable/disableInterface result
Calling enableInterface() / disableInterface() for an interface already
in the correct state used to return an error which is incorrect
according to the API specification in EthernetManager. onError() is now
only returned for untracked and server mode interfaces.

This change also fixes the updateInterfaceState() function signature.

Test: atest EthernetManagerTest
Change-Id: Ie7ee84c3756a8a0c489a38548214fd524352c8da
2022-09-21 12:03:15 -07:00
Patrick Rohr
faebf303a6 ethernet: remove enable/disable interface unit test
This unit test is not particularly useful and there is already coverage
in EthernetManagerTest.

Test: test only change.
Change-Id: I6f9d19d9603229553f44d562ff0276567cb0e26d
2022-09-21 12:03:11 -07:00
Maciej Żenczykowski
c502646e5c Move prohr@'s temp EthernetManagerTest.kt ownership so it will work.
(or at least try to)

Test: N/A
Change-Id: I33855ed29806c269dac0a6c5002c3f72d47ebd2c
2022-09-21 19:01:02 +00:00
Patrick Rohr
a3e6cc423b Merge "owners: grant prohr temporary owners for EthernetManagerTest" 2022-09-21 18:46:41 +00:00
Xinyi Zhou
2d3df1b225 Merge "[CTS] Fix CTS failure in mainline train" into android13-tests-dev 2022-09-21 18:32:05 +00:00
Xinyi Zhou
5500b3cda0 [CTS] Fix CTS failure in mainline train
- Delete test case from CTS. This would be moved to unit test
- Use reasonable key value in DataElementTest

Test: -m CtsNearbyFastPairTestCases
Bug: 244133414
Change-Id: Ia476c64ad5ebedd8eb007f7e0cb5b30a1d12dee5
2022-09-21 18:20:30 +00:00
Sorin Basca
f04e85aafc Merge "Fix errorprone 2.15.0 errors" 2022-09-21 14:42:58 +00:00
Chiachang Wang
90798f9a5a Merge "Update VpnTest to handle teardown-on-network-lost" 2022-09-21 14:22:33 +00:00
Sorin Basca
14343732c3 Fix errorprone 2.15.0 errors
Bug: 246761518
Test: RUN_ERROR_PRONE=true m javac-check lint-check dist
Change-Id: I4b81ef161fab5ee80a1713de87b89500a88e625e
2022-09-21 13:29:19 +01:00
Treehugger Robot
dd2dd2baa2 Merge "Start listening to telephony changes in #start()" 2022-09-21 12:24:28 +00:00
lucaslin
4b842678b1 Update VpnTest to handle teardown-on-network-lost
- Fix the wrong MOBIKE value set in
  testStartPlatformVpnHandlesNetworkLoss_mobikeEnabled.
- Verify the networkAgent is unregistered when the default
  network is lost

Bug: 231749077
Test: atest FrameworksNetTests:VpnTest
Change-Id: Idc6ebd42090eff1135dc5f96af4bc2fb268dd340
2022-09-21 11:30:49 +00:00
Chiachang Wang
3dca00e965 Merge "Update test on calling getAppExclusionList with restricted user" 2022-09-21 09:41:45 +00:00
Chalard Jean
f11ed8c699 Start listening to telephony changes in #start()
Starting to listen on the handler races with the rest of
the constructor. The class already has a #start() method
meant to start listening, so implement better practices
by leveraging this method.

Test: CtsNetTestCases
      FrameworksNetIntegrationTests
      FrameworksNetTests
Change-Id: I772f761d3ca5f9711b9d988e6330b0878814f491
2022-09-21 18:07:13 +09:00
Patrick Rohr
68e3c3c634 Merge changes from topic "dscp-cts13-r2" into android13-tests-dev
* changes:
  DscpPolicy: remove v6 default route as it is added by the RA
  deflake DscpPolicyTest
  Update DscpPolicyTest to use random IPv6 prefixes.
  DscpPolicyTest: annotate with ConnectivityModuleTest
  DscpPolicy BPF Add Checksum Validation to Test
  DscpPolicyTest: fix linter errors
2022-09-21 03:42:01 +00:00
Patrick Rohr
469643daf5 owners: grant prohr temporary owners for EthernetManagerTest
The .kt file this time.

Change-Id: Ic008456580f21924cefc70c65c5a7b15f4cdd1cb
Test: n/a
2022-09-21 03:12:57 +00:00
Patrick Rohr
97ed3368ee Merge "owners: grant prohr temporary ownership of EthernetManagerTest" 2022-09-21 03:05:14 +00:00
Patrick Rohr
79bd6d2aa5 owners: grant prohr temporary ownership of EthernetManagerTest
Test: owners file change
Change-Id: I9da5d915edaa17c784994876e6e3664fded90b5b
2022-09-21 02:40:50 +00:00
Treehugger Robot
75a819d9ff Merge "EthernetTetheringTest: test testTetherClatTcp on S+ device" 2022-09-21 02:03:45 +00:00
Krzysztof Kosiński
1fe9bf0de1 Merge "Remove Python enables identical to global defaults." 2022-09-20 16:19:18 +00:00
Hungming Chen
c79efc8e8e EthernetTetheringTest: test testTetherClatTcp on S+ device
Only test testTetherClatTcp on S+ device because R device test
is blocked on b/234727688.

Bug: 234727688
Test: atest EthernetTetheringTest
Change-Id: I65a4a8c4fe13b8320b036380b9038af094ac95a5
2022-09-20 10:24:32 +00:00
chiachangwang
8dae9343bb Update test on calling getAppExclusionList with restricted user
Bug: 247344442
Test: atest VpnTest
Change-Id: I3b847f13162f8702013b23cabefce8d98b62f5c6
2022-09-20 08:58:50 +00:00
Jean Chalard
0172361ad4 Merge "Add a reevaluate command to ConnectivityService" 2022-09-20 05:38:47 +00:00
Lorenzo Colitti
605c4e3ecc Merge "Verify converting to Vpnprofile with IkeTunnelConnectionParams set" 2022-09-20 02:32:55 +00:00
Krzysztof Kosiński
07c27856e8 Remove Python enables identical to global defaults.
Bug: 245854393
Test: presubmit
Change-Id: I4db094cf9d15ee55f660557e84b9540f85b9a2ea
2022-09-20 00:49:23 +00:00
Treehugger Robot
b624b0f539 Merge "BpfNetMaps.java - array index U32 -> S32" 2022-09-19 17:27:56 +00:00
Treehugger Robot
714fd251a1 Merge "BpfNetMaps.java - uid U32 -> S32" 2022-09-19 17:27:17 +00:00
Nucca Chen
e729389bd2 Merge "EthernetTetheringTest: add testTetherClatTcp" 2022-09-19 15:55:13 +00:00
Nucca Chen
19adc7adbc Merge changes from topic "test-tethering-icmp"
* changes:
  EthernetTetheringTest: add testTetherTcpV6
  EthernetTetheringTest: add testTetherTcpV4
  EthernetTetheringTest: add testIcmpv4Echo
  EthernetTetheringTest: add testTetherClatIcmp
2022-09-19 15:53:43 +00:00
Hungming Chen
b4f8a08825 EthernetTetheringTest: add testTetherClatTcp
Bug: 237369591
Test: atest EthernetTetheringTest
Change-Id: Ic66c22040ca8aa29b8399fabed066107a736e842
2022-09-19 19:43:34 +08:00
Hungming Chen
2ef51d11eb EthernetTetheringTest: add testTetherTcpV6
Bug: 237369591
Test: atest EthernetTetheringTest
Change-Id: I476a8d984eb8ccb6b2e64d6c36dbb455029a4c51
2022-09-19 19:43:30 +08:00
Hungming Chen
53ce3df628 EthernetTetheringTest: add testTetherTcpV4
Bug: 237369591
Test: atest EthernetTetheringTest
Change-Id: I411ac8dc0a36413e2e65633375218b25c412e004
2022-09-19 19:43:14 +08:00
Hungming Chen
e2fb681aec EthernetTetheringTest: add testIcmpv4Echo
Bug: 237369591
Test: atest EthernetTetheringTest
Change-Id: I96278c17ce97b63860b9379675c6ac2941b4016f
2022-09-19 15:53:15 +08:00
Hungming Chen
90551145ae EthernetTetheringTest: add testTetherClatIcmp
Bug: 237369591
Test: atest EthernetTetheringTest
Change-Id: I9dad9b559e0963a2d3a3f6a4c8d3b159a185801d
2022-09-19 15:53:11 +08:00
Paul Hu
f6ebf58e82 Merge "Fix test flake on IpConnectivityLogTest" 2022-09-19 01:04:26 +00:00
Treehugger Robot
afebcc8608 Merge "Revert "Log BPF programs & maps in bugreport"" 2022-09-18 19:17:32 +00:00
Jean Chalard
ecb0b3cab3 Merge "Rework unvalidated prompt into first eval timeout" 2022-09-17 12:52:52 +00:00
Treehugger Robot
b202c7a96b Merge "CookieTagMapValue.java - uid U32 -> S32" 2022-09-17 08:27:31 +00:00
Maciej Żenczykowski
dc88622eb8 BpfNetMaps.java - array index U32 -> S32
This converts the key, which is an index in an array, of sConfigurationMap from U32 to S32.

Since the array has exactly 2 elements, there's no real difference.
In addition while the kernel does indeed index arrays with U32s,
it doesn't matter, because you'd need to have over 2 billion
elements in the bpf map (at which point you'd need GBs of ram for
the bpf map itself)...

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If17efc25d910af642e519f9ecb6d0e8695c38d42
2022-09-17 06:16:34 +00:00
Maciej Żenczykowski
785793fe19 BpfNetMaps.java - uid U32 -> S32
This converts the key, which is a uid, of sUidOwnerMap & sUidPermissionMap from U32 to S32.

The kernel is actually not consistent in whether uids & gids
are signed or unsigned, and neither is our Java code, which
also commonly uses just 'int' for uid.  In practice values
greater or equal to 2**31 often don't quite work right.
For example icmp sockets are enabled via a sysctl that
takes a minimum and maximum gid - and these are signed int32s.

It's worth pointing out that these functions already accept int's
as arguments, so when converting them to U32 (and thus long) they
technically previously did the wrong thing (though it's unlikely
it ever mattered).

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7b389a1cf822c56134b20df5ded269963f5bf69f
2022-09-17 06:06:23 +00:00