Commit graph

56,976 commits

Message SHA1
Merge "Replace buildTemplate* with NetworkTemplate.Builder"
Aaron Huang   authored and   Gerrit Code Review   commited 2022-07-20 02:56:33 +00:00
1ba1febf2b
Merge "bpf_existence_test: add a missed map and program"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-07-19 21:01:24 +00:00
89966f19b5
bpf_existence_test: add a missed map and program
Test: TreeHugger, atest bpf_existence_test
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I41c8a3c1764c1542f0d3e68a4713d8984ef58db0

Maciej Żenczykowski   commited 2022-07-19 06:19:31 -07:00
74b31cace5
Merge "Dedup *fragments information common to apex and sdk"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-07-19 08:32:05 +00:00
a79c227372
Merge "offload/test bpf: support InProcessTethering"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-07-19 07:12:13 +00:00
2b21c2510b
offload/test bpf: support InProcessTethering
InProcessTethering runs as system_server (uid/gid AID_SYSTEM)
instead of as the network_stack (uid/gid AID_NETWORK_STACK).

Additionally only the network_stack has access to the default
selinux context of /sys/fs/bpf/tethering, which is fs_bpf_tethering,
so we need to use 'fs_bpf_net_shared' instead.

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

Maciej Żenczykowski   commited 2022-07-18 09:05:32 -07:00
ccce4a3382
Merge "ethernet: fix receiving NetworkOffer callbacks on stale object"
Patrick Rohr   authored and   Gerrit Code Review   commited 2022-07-18 15:50:14 +00:00
b916ff898b
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
further bpf_existence_test code simplifications/clarifications
(mainly driven by the desire to make it clear this
is about *current* mainline state and not at-T-launch state
of things)

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

Maciej Żenczykowski   commited 2022-07-16 20:56:47 +00:00
e9e7741872
enable btf for offload.o & test.o
The objdump -x visible changes between old and new versions of the
mainline shipped .o files are really very minimal: just the inclusion
of a new .BTF section and changes/removals of some 'l' entries from
the symbol table.  However, it turns out a change to symbol ordering
is incompatible with BpfLoader <v0.10 which doesn't know to skip
non-function symbols, and as such enabling btf requires a little
bit of gymnastics.

After:
  $ adbz shell ls -l /apex/com.android.tethering/etc/bpf/*.o
  -rw-r--r-- 1 system system 118352 1969-12-31 16:00 /apex/com.android.tethering/etc/bpf/offload.o
  -rw-r--r-- 1 system system 123424 1969-12-31 16:00 /apex/com.android.tethering/etc/bpf/offload@btf.o
  -rw-r--r-- 1 system system   2232 1969-12-31 16:00 /apex/com.android.tethering/etc/bpf/test.o
  -rw-r--r-- 1 system system   6376 1969-12-31 16:00 /apex/com.android.tethering/etc/bpf/test@btf.o

$ adbz shell logcat -d | egrep offload.*[.]o
07-15 13:10:43.358     0     0 D LibBpfLoader: Loading critical for tethering ELF object /apex/com.android.tethering/etc/bpf/offload.o with license Apache 2.0
07-15 13:10:43.359     0     0 I LibBpfLoader: BpfLoader version 0x00019 ignoring ELF object /apex/com.android.tethering/etc/bpf/offload.o with max ver 0x00019
07-15 13:10:43.359     0     0 I bpfloader: Loaded object: /apex/com.android.tethering/etc/bpf/offload.o
07-15 13:10:43.374     0     0 D LibBpfLoader: Loading critical for tethering ELF object /apex/com.android.tethering/etc/bpf/offload@btf.o with license Apache 2.0
07-15 13:10:43.375     0     0 I LibBpfLoader: BpfLoader version 0x00019 processing ELF object /apex/com.android.tethering/etc/bpf/offload@btf.o with ver [0x00019,0x10000)
07-15 13:10:43.452     0     0 D LibBpfLoader: map_fd found at 0 is 6 in /apex/com.android.tethering/etc/bpf/offload@btf.o
...

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

Maciej Żenczykowski   commited 2022-07-16 05:35:15 +00:00
07d3013b0d
Merge "Revert EXCLUDED_ROUTES to only keep RTN_UNICAST"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-07-16 01:43:04 +00:00
16e244ed0f
Merge "all active branches are now T aware"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-07-15 23:21:15 +00:00
d7c57379e7
Merge "Tethering: add in-process vs out-of-process flag"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-07-15 22:53:52 +00:00
d5fa0dc65a
ethernet: fix receiving NetworkOffer callbacks on stale object
unregisterNetworkOffer() does not execute synchronously, so it is
possible that NetworkOffer callbacks are received after the offer was
unregistered.

Test: atest EthernetManagerTest && atest EthernetNetworkFactoryTest
Bug: 171872016
Change-Id: I2c50b01176e4968c31f83148f1831b55f8b06908

Patrick Rohr   commited 2022-07-15 10:32:25 -07:00
7c4e2a918c
try to make bpf_existence_test saner
The core idea here is everything starts unexpected,
and then things are either removed from unexpected
and added to expected, or the reverse.

Test: TreeHugger, but not really, since too many combinations, hopefully any bugs will be found later...
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I44915e2ba459a8c90d9e706d46c6b89d85f0edd7

Maciej Żenczykowski   commited 2022-07-15 09:31:16 +00:00
d6bcd58efd
all active branches are now T aware
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I77f00ba5d4044153f8e52c71ddc1384fccd00af2

Maciej Żenczykowski   commited 2022-07-15 09:21:25 +00:00
1b4c8a78f1
Revert EXCLUDED_ROUTES to only keep RTN_UNICAST
Revert the previous change to filter out all non-RTN_THROW routes when
EXCLUDED_ROUTES is disabled, as that behavior is CTS tested for T, and
has been used by T for a while. The previous change already ensured that
there is no behavior change on S, so this is the safest approach.

This fixes HostsideLinkPropertiesGatingTests.

Bug: 239046959
Test: atest LinkPropertiesTest CtsHostsideNetworkTests
Change-Id: I55e078cdc06341f4957fe7bc743c0022b2c7d3da

Remi NGUYEN VAN   commited 2022-07-15 16:46:14 +09:00
48380e4132
Merge "Correct javadoc usage"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-07-15 07:41:33 +00:00
b7f81e4a6d
Correct javadoc usage
"{@see" aren't rendered properly. Replace them with "See {@link"
or @see depending on the usage.

Bug: 238753273
Test: make doc-comment-check-docs ; Check the doc result
Change-Id: I70cb2f36e7c5fa8102b5949054df5184d755202c

chiachangwang   commited 2022-07-15 03:44:46 +00:00
9473c59980
Merge "Use java BpfMap in BpfNetMaps#setUidRule"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-07-15 01:06:48 +00:00
fe72021c06
Merge "Adjust bpf_existence_test.cpp for dscp_policy 5.15+ change"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-07-14 16:15:14 +00:00
26df963836
Merge "Let LinkProperties#getRoutes() keeps returning all routes before T"
Natasha Lee   authored and   Gerrit Code Review   commited 2022-07-14 14:12:55 +00:00
5006349209
Merge "Deprecate filegroup tethering-module-utils-srcs in tethering."
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-07-14 11:14:56 +00:00
babce39a12
Let LinkProperties#getRoutes() keeps returning all routes before T
Starting from T, VpnService supports exclude routes, which will
make the caller to get both of include routes and exclude routes
from LinkProperties#getRoutes(), and it's not expected to get the
exclude routes before T in production code even though the code
returns all routes.

But there is a CTS - LinkPropertiesTest#testRouteAddWithSameKey()
will try to add an exclude route and check if the result of
LinkProperties#getRoutes() contains that exclude route or not.
And the test is failed now since LinkProperties#getRoutes() will
only return include route if compat feature - EXCLUDED_ROUTES is
disabled. (EXCLUDED_ROUTES is enabled starting from target SDK T)

To fix this test failure, let LinkProperties#getRoutes() keeps
returning all routes if SDK is before T. This avoids changing
behavior on S, and even though there is still a behavior change
when upgrading to T, apps are unlikely to be relying on such
behavior, especially outside of tests.

Bug: 238061814
Test: Run "atest CtsNetTestCases:LinkPropertiesTest" on S build
      with mainline module which contains this patch.
Change-Id: Iac4362c4fe347ee3f06d5b21b0325fa69a7f27b6

Remi NGUYEN VAN   commited 2022-07-14 18:54:05 +09:00
66c27c18a2
Adjust bpf_existence_test.cpp for dscp_policy 5.15+ change
The minimal required kernel version was changed in:
  https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2141233
  'DscpPolicy Move to kernel 5.15'

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

Maciej Żenczykowski   commited 2022-07-14 08:33:22 +00:00
b73da9658c
Merge "Correct javadoc for ConnectivityManager#requestNetwork"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-07-14 08:18:44 +00:00
1c7f6f89b2
Merge "Add common parameters to reduce duplicated code"
Paul Hu   authored and   Gerrit Code Review   commited 2022-07-14 08:00:16 +00:00
0ce40ac75d
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
Deprecate filegroup tethering-module-utils-srcs in tethering.
tethering-module-utils-srcs filegroup only contains NetdUtils.java
class, import this class from netd-client static lib instead.

Bug: 238960524
Test: m
Change-Id: I7547c3a3a13e564408cdf8e702f3438530763381

Xiao Ma   commited 2022-07-14 13:30:27 +09:00
59819aeb0e
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
Correct javadoc for ConnectivityManager#requestNetwork
Fix: 238753273
Test: make doc-comment-check-docs ; Check the doc result
Change-Id: I41c35b9cb31dcf3a372a61ad84f19295b0bc0ceb

chiachangwang   commited 2022-07-14 02:43:03 +00:00
e9c44ce718
Add common parameters to reduce duplicated code
This is a no-op and test only change. Some parameters use many
times, so add common parameters to reduce duplicated code.

Bug: 236788977
Test: atest FrameworksNetTests
Change-Id: I94370817ea87d1da5c30ea2ed467c1746edecba3

Paul Hu   commited 2022-07-14 02:21:41 +00:00
601644c8a7
Use java BpfMap in BpfNetMaps#setUidRule
Bug: 217624062
Test: atest BpfNetMapsTest
android.net.cts.ConnectivityManagerTest#testFirewallBlocking

Change-Id: I79745231edac77d07571fa1909da5b9e811a69c4

Motomu Utsumi   commited 2022-07-14 02:12:34 +00:00
40230beb5f
Dedup *fragments information common to apex and sdk
Previously, both the sdk and apex had to specify the same *fragments
property to ensure that building a system image from a prebuilt
version of the module (both APEX and sdk snapshots) would work.

This change avoids the duplication by adding the apex to the sdk which
allows the sdk to automatically export any APIs and related information
provided by the APEX. At the moment that just includes information from
*fragments properties but may expand in future.

Bug: 232401814
Test: # Build snapshots with a fixed build number
      BUILD_NUMBER=fixed packages/modules/common/build/mainline_modules_sdks.sh
      # Remove api diff files as they contain file stamps of generated files so
      # differ every time they are generated.
      find out/dist/mainline-sdks -name \*txt | xargs rm
      # Save the snapshots away.
      mv out/dist/mainline-sdks before-changes
      # Apply this change.
      # Repeat the first two steps above and then run the following to verify
      # that this change had no effect on the generated snapshot contents.
      meld before-changes out/dist/mainline-sdks
Change-Id: Id98a645a2cdb20bc4bcdc18de565691f1ce7f799

Paul Duffin   commited 2022-07-13 13:07:46 +00:00
1514c032f5
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