Commit graph

56,944 commits

Message SHA1
Replace buildTemplate* with NetworkTemplate.Builder
Use Builder API which was provided in Android T to
build a template.

Bug: 238843364
Test: build, FrameworksNetTests:NetworkStatsManagerTest
Change-Id: Ibf1ac16541d6f3ddaf9b241e2f47ae04acbedf93

Aaron Huang   commited 2022-07-18 17:16:49 +08:00
a4fcb8b4cf
Merge "Use common methods to check/enforece mutiple permissions"
Paul Hu   authored and   Gerrit Code Review   commited 2022-07-14 06:19:54 +00:00
6d74747445
Merge "Make Tethering module depend on net-utils-device-common-ip."
Xiao Ma   authored and   Gerrit Code Review   commited 2022-07-14 03:06:05 +00:00
c02e565aac
Merge "Revert QosCallbackException constant values"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-07-14 02:50:09 +00:00
fc307eab4b
Revert QosCallbackException constant values
The constants are used for the NetworkAgent.sendQosCallbackError system
API, so changing their values changes the behavior of that API. This is
observed when running S CTS against the latest version of the
connectivity module: testQosCallbackOnError fails because a
SocketNotConnectedException ends up being reported, instead of an
UnsupportedOperationException.

Revert the constants to their values before change ID:
I7102ae9ba7cb9e1cc8d06b252aad4dad75860f3e

Bug: 238061856
Test: cts-tradefed run cts -m CtsNetTestCases \
          -t android.net.cts.NetworkAgentTest
      using a CTS v12.1 package.
Change-Id: Iaa12729d9e7dc627a6654a6fa47b8248e0cd3049

Remi NGUYEN VAN   commited 2022-07-14 02:49:29 +00:00
bd7a485826
Use java BpfMap in removeUidInterfaceRules
Bug: 217624062
Test: atest BpfNetMapsTest HostsideVpnTests#testBlockIncomingPacket
Change-Id: I253c75aaeabe138a4f9d57c226744f5766ef1006

Motomu Utsumi   commited 2022-07-13 11:12:19 +00:00
599c4e5cf4
Use java BpfMap in BpfNetMaps#addUidInterfaceRules
Bug: 217624062
Test: atest BpfNetMapsTest HostsideVpnTests#testBlockIncomingPacket
Change-Id: I8aeb4712c852167d553eb331f32d770582199b13

Motomu Utsumi   commited 2022-07-13 11:11:59 +00:00
5f52f4f2fb
Make Tethering module depend on net-utils-device-common-ip.
NetworkStack module utils are duplicated to net-utils-device-common-ip,
delete the module utils source code and use net-utils-device-common-ip
instead.

Bug: 235901424
Test: atest TetheringTests
Change-Id: I19fe72a92d6de1084963c2b3a38d094f8da2a91e

Xiao Ma   commited 2022-07-13 04:32:28 +00:00
c81c066958
Merge "Revert "Add onSupportedTetheringType callback""
Mark Chien   authored and   Gerrit Code Review   commited 2022-07-12 07:30:50 +00:00
370ba4f3c5
Merge changes I58cd6145,I32299ce8,I0433459e
* changes:
  Use java BpfMap in updateUidLockdownRule
  Use java BpfMap in BpfNetMaps#addNiceApp
  Use java BpfMap in BpfNetMaps#removeNiceApp

Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-07-12 03:00:28 +00:00
fabb53a881
Revert "Add onSupportedTetheringType callback"
This reverts commit ae3d303344.

Reason for revert: this cause GTS fail
Bug: 238038401

Change-Id: I3e21321e931f60208cb0befaed38e58b088ff966

Mark Chien   commited 2022-07-12 02:11:48 +00:00
4bf22ae076
Merge "DscpPolicy BPF IPv4 Checksum Offset, DSCP Value Storage"
Patrick Rohr   authored and   Gerrit Code Review   commited 2022-07-12 00:27:13 +00:00
5711788ea8
DscpPolicy BPF IPv4 Checksum Offset, DSCP Value Storage
Use the correct offset for the eth header when calculating the
checksum.

Store the DSCP value in BPF map for subsequent skb's instead
of the TOS so the calculation and checksum is correct.

Bug: 234808633

Change-Id: Ib40d4575455f34a8970eca8751b590319e2ee1ad

Tyler Wear   commited 2022-07-11 13:13:57 -07:00
11f494faa6
Merge "Improve javadoc description for recoverAndDeleteData()"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-07-11 10:49:02 +00:00
1744833dc5
Use java BpfMap in updateUidLockdownRule
Bug: 217624062
Test: atest BpfNetMapsTest HostsideVpnTests#testBlockIncomingPacket
Change-Id: I58cd614575a98c4b5a8f9c34d47dd2dfff187b26

Motomu Utsumi   commited 2022-07-11 07:19:05 +00:00
697b299e3a
Merge changes I69a2970d,Ibfb3ae48,Ie595cf1f
* changes:
  Use java BpfMap in BpfNetMaps#addNaughtyApp
  Use java BpfMap in BpfNetMaps#removeNaughtyApp
  Add bpf map and lock for UidOwnerMap

Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-07-11 07:14:53 +00:00
9ab777b5d5
Merge "Update error handling in BpfNetMaps"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-07-11 06:28:50 +00:00
f2eca2f13a
Use java BpfMap in BpfNetMaps#addNiceApp
Bug: 217624062
Test: atest BpfNetMapsTest HostsideRestrictBackgroundNetworkTests
Change-Id: I32299ce8cde34d46999ecb966c3305c966c0509f

Motomu Utsumi   commited 2022-07-11 03:14:07 +00:00
55630d0dc8
Use java BpfMap in BpfNetMaps#addNaughtyApp
Bug: 217624062
Test: atest BpfNetMapsTest HostsideRestrictBackgroundNetworkTests
Change-Id: I69a2970d20be41431b774273bc0902bd325421f4

Motomu Utsumi   commited 2022-07-11 03:14:07 +00:00
389278ec8b
Use java BpfMap in BpfNetMaps#removeNiceApp
Bug: 217624062
Test: atest BpfNetMapsTest HostsideRestrictBackgroundNetworkTests
Change-Id: I0433459ec43b6a84c4417152884d10fae5fecee6

Motomu Utsumi   commited 2022-07-11 03:14:07 +00:00
7392eb4f4c
Use java BpfMap in BpfNetMaps#removeNaughtyApp
Bug: 217624062
Test: atest BpfNetMapsTest HostsideRestrictBackgroundNetworkTests
Change-Id: Ibfb3ae48427b7dc5d06708e63f4a16f7527ce86c

Motomu Utsumi   commited 2022-07-11 03:14:07 +00:00
60ed3be43b
Add bpf map and lock for UidOwnerMap
This commit is a preparation for replacing JNI codes that modify
UidOwnerMap by Java.

Bug: 217624062
Test: atest BpfNetMapsTest HostsideRestrictBackgroundNetworkTests
android.net.cts.ConnectivityManagerTest#testFirewallBlocking

Change-Id: Ie595cf1f77a3ed86addbcdaea1a1be972e0265b3

Motomu Utsumi   commited 2022-07-11 03:14:05 +00:00
5a68a21926
Update error handling in BpfNetMaps
Address review comments from aosp/2117045
Throw AssertionError if bpf map init get error
Update tests to avoid getting AssertionError

Bug: 217624062
Test: atest BpfNetMapsTest
Change-Id: I2194b825aa73b88d5334077d17acb9abbd367c69

Motomu Utsumi   commited 2022-07-11 03:13:04 +00:00
305975ffb0
Merge "Verify calling thread for intent receiver"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-07-11 01:25:32 +00:00
11781f84b6
Merge changes from topics "RefactorIR", "appExclusionPrefix", "reStartVpnProfile"
* changes:
  Refactor to mock package add and remove event
  Test reconnect VpnManager VPN with always on enabled
  Update the prefix of VPN_APP_EXCLUDED in the test
  Add tests to verify getProvisionedVpnProfileState

Chiachang Wang   authored and   Gerrit Code Review   commited 2022-07-11 01:24:28 +00:00
ff41ecc64d
Merge "TestNetworkManager: add support for configuring tap link addresses"
Patrick Rohr   authored and   Gerrit Code Review   commited 2022-07-09 02:08:36 +00:00
e548be264b
Merge "NetworkProvider: Do not propagate callbacks for unregistered offers"
Patrick Rohr   authored and   Gerrit Code Review   commited 2022-07-08 21:27:37 +00:00
1c37d3e7b0
Merge "Use frameworks/libs/net version of SharedLog"
Xiao Ma   authored and   Gerrit Code Review   commited 2022-07-08 06:55:04 +00:00
d5c6a891b4
Merge "Setting apex version to the placeholder value"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-07-08 02:27:29 +00:00
0dce8e551e
NetworkProvider: Do not propagate callbacks for unregistered offers
Previously, after calling unregisterNetworkOffer(), onNetworkNeeded() /
onNetworkUnneeded callbacks are still being called until CS's handler
thread has finished running. While this behavior could be taken care of
in the network provider implemention (e.g. the ethernet service), it is
much simpler to deal with in NetworkProvider.java.

As NetworkProvider.java wraps the passed callback object inside a proxy
that it forwards to CS, it should be as simple as adding a boolean to
the proxy that is checked inside the executor thread before the
implementation's callback is called. Since for every call to
registerNetworkOffer() with a new callback object a new proxy object is
created, this should be safe. Even if the callback object is reused on
the user side (such as ethernet service does right now), this should be
okay, as the implementation will only receive callbacks from the active
proxy.

Test: atest NetworkProviderTest
Bug: 171872016
Change-Id: Iaf84b5801ad3ee44895e933763927151ea5824dd

Patrick Rohr   commited 2022-07-07 13:48:52 -07:00
546c722511
NetworkProvider: add missing synchronization
Adding missing lock to unregisterNetworkOffer() call.

Test: TH
Change-Id: Ia54664caaecb63e0bfa737903b48d08856fb4877

Patrick Rohr   commited 2022-07-07 13:48:52 -07:00
aecfab5f72
Use frameworks/libs/net version of SharedLog
Test: m
Bug: 235901424
Change-Id: Ibfa7821c68c41036a47e765f15078cd5d195afb8

Patrick Rohr   commited 2022-07-07 12:52:58 -07:00
b873e25ab4
Setting apex version to the placeholder value
When the apex version is set to 0, the version number will be replaced by the build system to the default value for the current branch.
The default value for mainline module manifest version is stored in the defaultManifestVersion constant: https://android.googlesource.com/platform/build/soong/+/refs/heads/master/apex/constants.go#36

The version should not be changed manually in the manifest. Release tooling will set this version to the release version on the release branches.

Test: presubmit
Bug: 231691643
Change-Id: I30b5b486bca521ebdeed17dba7afc61f2c529ab8
Merged-In: I30b5b486bca521ebdeed17dba7afc61f2c529ab8

Alexei Nicoara   commited 2022-07-07 11:29:39 +01:00
b02a2266cd
Verify calling thread for intent receiver
Bug: 230548427
Test: atest VpnManagerServiceTest
Change-Id: Ibe5f7aba8e31dfecfb2eaac3fb109eb442879ede

chiachangwang   commited 2022-07-07 08:54:52 +00:00
826f0b01d2
Refactor to mock package add and remove event
Use mock intent receiver to handle intent related events instead
of exposing the private methods even for testing only.

The visibility for onPackageAdded, onPackageRemoved and
onUserStarted were exposed for testing only in former commit.
The test coverage for intent receiver part may be missed.
The other intent related methods will be verified in the
follow up commits. This refactor will also help to not to
expose further private methods.

Bug: 230548427
Test: atest VpnManagerServiceTest
Change-Id: If2aa88d8d5c1643e8bd4937673aa792186047fd8

chiachangwang   commited 2022-07-07 08:54:27 +00:00
26de58ea79
Test reconnect VpnManager VPN with always on enabled
Verify reconnect using startVpnProfile with the same package with
always-on package should work without exception.

Bug: 235322391
Test: atest FrameworksNetTests
Change-Id: I9a780d970208032e2468e9c5b3334373627c6a20

chiachangwang   commited 2022-07-07 06:46:15 +00:00
a412026c6b
Update the prefix of VPN_APP_EXCLUDED in the test
Update the string according to the change in Vpn.java

Bug: 237345836
Test: atest FrameworksNetTests
Change-Id: I9bfe0a1fad29ba1435eeb8b8b2cffa9d385b1cb5

chiachangwang   commited 2022-07-07 06:46:08 +00:00
9460f45c04
Add tests to verify getProvisionedVpnProfileState
Add tests to verify that calling getProvisionedVpnProfileState works
normally from the same package but gets a security exception from a
differnet package.

Bug: 230548427
Test: atest FrameworksNetTests
Change-Id: I0132c42dce1b8269859fca8d0143304142162838

chiachangwang   commited 2022-07-07 06:45:55 +00:00
72fe97ea1c
Merge "BpfNetworkStats - remove spurious code & use static maps"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-07-06 20:45:33 +00:00
567b664d90
Merge "Use BpfDump.toBase64EncodedString to dump raw map"
Nucca Chen   authored and   Gerrit Code Review   commited 2022-07-06 12:04:54 +00:00
bf28a595f2
Merge "Reword comment for language quality"
Paul Hu   authored and   Gerrit Code Review   commited 2022-07-06 01:52:06 +00:00
e79157578b
Reword comment for language quality
This addresses a leftover comment to aosp/1919251

Bug: 238139913
Test: comment-only
Change-Id: Icfd054a1f9a4b928b222fb1a74af066c36c886b0

Chalard Jean   authored and   Paul Hu   commited 2022-07-06 01:51:35 +00:00
2ddcf603e2
Merge "ClatCoordinator: Dump ClatdTracker information"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-07-05 15:01:11 +00:00
78cf7c5e29
ClatCoordinator: Dump ClatdTracker information
Test: atest ClatCoordinatorTest
Change-Id: I6bb47c84321e1323496b728f2db939ee8d74504a

Hungming Chen   commited 2022-07-05 15:30:50 +08:00
a760a10474
Merge "Remove unnecessary null check"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-07-04 18:37:07 +00:00
daced9e4b8
Merge "Add @RequiresApi to LocationPermissionChecker"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-07-04 14:01:20 +00:00
07bb1d41d8
Merge "Move struct {Clat*, Tether4*, TetherStats*} to connectivity module"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-07-04 12:17:20 +00:00
7722b024a1
Use common methods to check/enforece mutiple permissions
Use PermissionUtils methods to check/enforece mutiple permissions
to avoid inconsistent behavior and duplicated code.

Bug: 177187957
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I0850a2c8b15e0dfc6d21298c5599ad36bb2056dc

paulhu   authored and   Paul Hu   commited 2022-07-04 10:42:06 +00:00
3ffffe71c7
Remove unnecessary null check
Address review comments from aosp/2131752 and aosp/2117045
sConfigurationMap must have a entry for UID_RULES_CONFIGURATION_KEY
because this bpf map is an array

Bug: 217624062
Test: atest BpfNetMapsTest
Change-Id: Ic52623e11c1f53e363416d57c0d8705d5510ef04

Motomu Utsumi   commited 2022-07-04 09:20:23 +00:00
1f73fedfef
Log BPF programs & maps in bugreport
Currently (T+), BPF program and map status are only dumped on demand.
$ adb shell dumpsys connectivity trafficcontroller

The information can be useful for issue debugging, especially on Data
Usage and NetworkPolicyManagerService. It should be logged in bugreport
dumpsys connectivity section as Android S (which is handled by netd).

Bug: 237954856
Test: adb bugreport
Change-Id: Ic02a58ff2ebdbf375d9df0917e8218ab8faa96da

Ken Chen   commited 2022-07-04 11:32:44 +08:00
daf5cb64cc