Commit Graph

73838 Commits

Author SHA1 Message Date
Maciej Żenczykowski
399c9f296e netd.c: simplify impossible code path
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I04f3f1b6ba1093f6543f6e80f62d978ebfee707d
2023-05-20 17:16:06 +00:00
Maciej Żenczykowski
f7939fa8d1 LinkProperties: use ordered comparison for P-CSCFs - only on U+
to make sure a mainline update doesn't break devices in the field

Test: TreeHugger
Bug: 268479036
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iadcd861509d31b3ed6352d452a159cd89af479dd
2023-05-18 05:57:51 +00:00
Mark Chien
adc6ab5c45 Merge "Add verifyHotspotClientUpdate helper function" 2023-05-18 05:57:39 +00:00
Motomu Utsumi
404636629a Merge "Revert ConnectivityServiceDependencies access modifier" 2023-05-18 05:54:32 +00:00
Motomu Utsumi
d54120344d Revert ConnectivityServiceDependencies access modifier
Address review comment on aosp/2490881

ConnectivityServiceDependencies was made public in aosp/2490881 to
verify destroyLiveTcpSockets call.
This CL reverts that change and updates tests to use mocked
DestroySocketsWrapper to verify destroy sockets call.

Bug: 270298713
Test: atest FrameworksNetTests
Change-Id: I101016399ea29bc5176b7559edf0447f0f7901ce
2023-05-18 12:31:44 +09:00
Treehugger Robot
8a3ac1254e Merge "Rename KernelVersion.h to KernelUtils.h" 2023-05-17 20:41:50 +00:00
Patrick Rohr
a7994902d9 Rename KernelVersion.h to KernelUtils.h
Test: TH
Change-Id: I541d015732179313a34872d3fdbeff636047c49b
2023-05-17 11:37:16 -07:00
Mark Chien
65a73dbf78 Merge "Fix entitlement recheck fail in U" 2023-05-17 05:54:39 +00:00
Treehugger Robot
c6522a0307 Merge "Update FrameworksNetTestsLib dependencies on VPN" 2023-05-17 03:04:20 +00:00
Remi NGUYEN VAN
05c7676acd Merge "Update ConnectivityCheckTargetPreparer references" 2023-05-17 02:55:56 +00:00
Remi NGUYEN VAN
43d33ee760 Update FrameworksNetTestsLib dependencies on VPN
In change ID: Ia2279bd1023296e3c949fa05bd74e921bf17da79,
ConnectivityServiceTest dependencies on VpnManagerService were removed,
adding a more limited dependency on LockdownVpnTracker instead. This
updates the "keep" rules for services.core-vpn to reflect that.

services.core-vpn is a subset of services.core that only includes the
classes in the "keep" rules, and their dependencies. This is because
ConnectivityServiceTests still depends on internal VPN classes, but
other usage of hidden API should not be added to the tests.

Using VpnManagerService causes problems for calculating coverage, as it
has indirect dependencies on many classes that end up included in the
test and show as uncovered in the dashboards including
NetworkPolicyManagerService.

The dependency on NPMS was found by looking at coverage reports and
unzipping services.core-vpn.jar. The fact that it is included due to
indirect dependencies from VpnManagerService was discovered by running a
dependency analysis tool (https://depfind.sourceforge.io/) on
services.core-vpn.jar in the out/ directory, with:

$ bin/DependencyExtractor services.core-vpn.jar > /tmp/graph.xml
$ bin/c2c /tmp/graph.xml -show-inbounds > /tmp/inbounds.txt

And running a script on the /tmp/inbounds.txt graph to find the path
from VpnManagerService to NPMS.

Bug: 259632671
Test: m
Change-Id: Idc6c9e6e998dbf968fd97582f904cb7aed56b5b5
2023-05-17 11:52:38 +09:00
Motomu Utsumi
ec4511c8aa Merge "Fix agents disconnecting in SUSPENDED state." 2023-05-17 01:59:18 +00:00
Xiao Ma
5a44770232 Merge "Update the integration test to verify zero-length DHCP packet." 2023-05-17 01:12:52 +00:00
Treehugger Robot
ad5ee4b578 Merge "remove out-of-process flag" 2023-05-16 20:53:09 +00:00
Treehugger Robot
e22bffecda Merge "ConnectivityDiagnosticsManagerTest: Raise timeout to 10s" 2023-05-16 19:17:58 +00:00
Patrick Rohr
94fd10fde5 ConnectivityDiagnosticsManagerTest: Raise timeout to 10s
In rare cases, ACTION_CARRIER_CONFIG_CHANGED arrives right around the 5s
mark at which the test times out.

Bug: 275217887
Test: TH
Change-Id: I737bd40f0cddf6cdea9a4c5afbb50e13aad74af2
2023-05-16 17:43:08 +00:00
Patrick Rohr
a1e4289eeb IpSecManagerTest: clean up assertion for better error reporting
See the following flaky failure:
https://android-build.corp.google.com/test_investigate/?invocationId=I59900010160325881&testResultId=TR98428662107002537

Bug: 270193575
Test: TH
Change-Id: I90dfbbec49d86fbf61d378f0ae98ddde5f27bf1f
2023-05-16 17:17:08 +00:00
Motomu Utsumi
d15b397606 Merge "Check clatd does not stop when suspended network is disconnected" 2023-05-16 08:50:06 +00:00
Paul Hu
d0ebd7023f Merge changes from topic "MdnsDM_running_on_looper_thread"
* changes:
  Pass NsdService thread looper to MdnsDiscoveryManager
  Ensure MdnsDiscoveryManager calls to ServiceTypeClients on looper thread
2023-05-16 08:46:13 +00:00
Mark
e86fb5ef56 Fix entitlement recheck fail in U
Starting with U, only explicit intents will be allowed to
launch non-exported internal components. Set package name
to entitlement recheck intent so that the intent could be
delivered to tethering itself successfully.

Bug: 278482046
Test: atest TetheringTests
      manual verify entitlement recheck work in U
Change-Id: Ife30eee13fe39509ccb5786d2a76fbb7baa022a8
2023-05-16 07:59:32 +00:00
Yuyang Huang
c61c5788fe Merge "Use case-insensitive matching in discovery/advertising" 2023-05-16 07:56:21 +00:00
Yuyang Huang
92ca0b703d Merge "Add Log.wtf when transports are missing" 2023-05-16 07:56:05 +00:00
wangshengrjxtjcb
fd5d3d90e1 Fix agents disconnecting in SUSPENDED state.
Network state is not changed to disconnected when a networkagent
is disconnected and network state is SUSPENDED.

So the function requiresClat return true. Clat is not stoped.

Bug: 277682237
Test: atest FrameworksNetTests

Change-Id: I5edfcf64aca5d2d34325d722dd29fab41bcf2600
2023-05-16 16:35:03 +09:00
Paul Hu
7f0af78c5e Pass NsdService thread looper to MdnsDiscoveryManager
MdnsDiscoveryManager should use the same thread that create on
NsdService that is used on other mDns components. Thus, pass that
thread loop to MdnsDiscoveryManager.

Bug: 265787401
Test: atest FrameworksNetTests
Change-Id: Icc23994c3ebc99da6043ed2d93540c44f53a150b
2023-05-16 14:39:09 +08:00
Paul Hu
bd4140ea91 Ensure MdnsDiscoveryManager calls to ServiceTypeClients on looper thread
ServiceTypeClients will store/access services on MdnsServiceCache
in subsequent changes. And MdnsServiceCache can be accessed from
looper thread only. So ensure MdnsDiscoveryManager calls to
ServiceTypeClients on the looper thread.

Bug: 265787401
Test: atest FrameworksNetTests
Change-Id: I05e73140da58c029b49057bb0ccfdb8ed7818dfc
2023-05-16 14:38:36 +08:00
Remi NGUYEN VAN
89570aca44 Update ConnectivityCheckTargetPreparer references
Use the new ConnectivityTestTargetPreparer name instead, as the preparer
is being made more generic.

Bug: 263665773
Test: m
Merged-In: I520e92c449f366c51cda2f8b33fe9a354a8c0445
Change-Id: I520e92c449f366c51cda2f8b33fe9a354a8c0445
2023-05-16 15:15:55 +09:00
Remi NGUYEN VAN
3623306ccd Merge "Stop MdnsServiceTypeClient send on socket destroy" 2023-05-16 04:03:42 +00:00
Remi NGUYEN VAN
76bd680f3d Merge "Do not send socket destroyed on unregistration" 2023-05-16 04:03:31 +00:00
Motomu Utsumi
4a5b06559f Check clatd does not stop when suspended network is disconnected
Currently, clatd is not stopped when suspended network is disconnected
and aosp/2583410 fixes this issue.
This CL adds test for current behavior, aosp/2583410 can update
testDisconnectSuspendedNetworkStopClatd to call verifyClatdStop instead
of verifyNeverClatdStop

Test: atest FrameworksNetTests
Bug: 277682237
Change-Id: I345e097ce8e114800d77c5f44d38d7ae4938935c
2023-05-16 12:32:52 +09:00
Yuyang Huang
73772f325d Use case-insensitive matching in discovery/advertising
mDNS is supposed to be case-insensitive (like DNS). Both advertising and
discovery logic should use case-insensitive matching instead of
case-sensitive matching.

The case sensitive matching can be found by grepping the String.equals()
and Arrays.equals() check across the whole code base. Each occurrence is
analyzed carefully to list up all necessary fixes.

Bug: 272194544
Test: atest FrameworksNetTests
Change-Id: I7c10878129663549c9171c1420b6f399930df2cb
2023-05-16 11:50:07 +09:00
Remi NGUYEN VAN
3d66b0432d Stop MdnsServiceTypeClient send on socket destroy
MdnsServiceTypeClient should stop sending when it is removed due to its
socket being destroyed.

On null networks (downstream interfaces) that may have multiple sockets,
this should only happen once the last socket used by the (null) network
has been destroyed.

Bug: 278635632
Test: atest
Change-Id: Ie1808840bd68678f2af7b71bdd8f3be377c14424
2023-05-16 10:45:36 +09:00
Maciej Żenczykowski
2da7535246 remove out-of-process flag
The logic dealing with in vs out-of-process tethering flags
was added in aosp/master once it was already not merging to tm-dev,
thus ending up only in udc-dev, it was later removed in aosp/master,
and then cherrypicked to udc-dev.

As such there is no shipping version of the bpfloader
(besides early U developer previews and betas)
with this requirement.

This will make September+ releases of the tethering apex incompatible
with U developer previews and betas 1 and 2.

(ie. any U build not including https://googleplex-android-review.git.corp.google.com/c/platform/system/bpf/+/23214402
which was merged into udc-dev on May 14th @ 18:00)

This change has a dependency on
https://googleplex-android-review.git.corp.google.com/c/platform/vendor/google/modules/TetheringGoogle/+/23243439

Test: TreeHugger
Bug: 279942846
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I52d0ea706a8e2cb5c37874ed54f199035c14966c
2023-05-15 19:29:20 +00:00
Maciej Żenczykowski
3bf75ef193 deflake - bump TestCloseSocketWithoutUntag 50ms test timeout to 5s
Bug: 282170301
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic432da1ffe3951955401a0f547522dd0ab96b67c
2023-05-15 18:49:12 +00:00
Maciej Żenczykowski
7428de995b Merge "LinkProperties: use ordered comparison for P-CSCFs." 2023-05-15 17:32:01 +00:00
Xiao Ma
d5020111ce Update the integration test to verify zero-length DHCP packet.
DHCP packet listener doesn't close socket any more upon receiving a
zero-length DHCP packet with a fix, instead, just ignore the zero-length
packet and continue reading. Also update the integration test logic to
verify the new behavior, i.e. we can send DHCPDISCOVER from a second device
with different mac address to verify the upstream DHCP server doesn't close
the listening socket, and then we will receive the response from server e.g.
DHCPOFFER packet.

Bug: 269692093
Test: atest TetheringIntegrationTests
Change-Id: I183da43ce5a6511714d293318fe6c60ea55999c0
2023-05-15 13:27:16 +00:00
Remi NGUYEN VAN
5fe9bacc63 Do not send socket destroyed on unregistration
When a SocketCallback is unregistered from MdnsSocketProvider, do not
send socket destroyed callbacks. Callers may not expect getting
callbacks after unregistration, and the current callbacks are also
broken when an unrequested socket is still in use by another requester.

MdnsAdvertiser already does not depend on getting this callback, as it
only unregisters the SocketCallback after it is done using the socket.
This change fixes MdnsMultinetworkSocketClient to destroy the socket by
itself when unrequesting.

Bug: 276177548
Test: atest
Change-Id: If95f833e293f3aab91128aab1c9852ebfd41995d
2023-05-15 17:52:22 +09:00
Yuyang Huang
58c7dceb49 Add Log.wtf when transports are missing
Because onCapabilitiesChanged will always be called, transports should
always exist in the map. If the transports are missing, error should be
report through Log.wtf.

Bug: 282587998
Test: atest MdnsSocketProviderTest
Change-Id: Ie2a93217542bfa6ee30bf3b9f73eb4ae8473fd09
2023-05-15 11:34:01 +09:00
Maciej Żenczykowski
024cbc3418 remove inprocess tethering
(unused leftover cruft)

Test: TreeHugger
Bug: 279942846
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia66e4795a4544330aaf499fff8defb07248f5edd
2023-05-13 22:13:44 +00:00
Ryan Zuklie
80d705566b Try to fix and diagnose Perfetto flush errors.
Around 10% of the traces with Nettrace have "traced_final_flush_failed"
errors. It is believed that Network Tracing isn't writing enough data to
fill one "Chunk" in Perfetto's buffer. Although this should still be
saved by Perfetto, it doesn't seem to be.

This change records the number of packets read from the ring buffer to
understand whether the error coincided with low-data cases. It also
tries to flush the data OnStop to potentially fix the issue.

Test: flash and run trace
Change-Id: I92c8d2d8d47d1ed123585e1cfdde802d286f120f
2023-05-12 18:12:00 -07:00
Patrick Rohr
f128ba3461 Merge changes from topic "delete-cronet-disabled-support"
* changes:
  cronet: Move cronet defaults to framework/Android.bp
  cronet: delete option to disable cronet in tm-mainline-prod
2023-05-12 22:37:29 +00:00
Patrick Rohr
740b1d4ac3 cronet: Move cronet defaults to framework/Android.bp
Since cronet has moved out of the tethering jar.

Test: TH
Change-Id: Ibf476c0afd72863b26188dae6838825e6762976a
2023-05-12 10:15:01 -07:00
Patrick Rohr
2e3e2955b8 cronet: delete option to disable cronet in tm-mainline-prod
With the release cut of the July train and the recent automerger
cutover, tm-mainline-prod is now officially an abandoned branch.

This change deletes (most) infrastructure that was put in place to
disable cronet on tm-mainline-prod.

Test: builds
Change-Id: I078f2114b736a634f08d8f704c19beb2224ef645
2023-05-12 10:15:01 -07:00
Treehugger Robot
4bcc151bf4 Merge "Do not immediately send new queries on cache hit" 2023-05-12 14:50:09 +00:00
Remi NGUYEN VAN
94a4149a8f Merge changes I09e780af,I21367c66
* changes:
  Implement proper subtype advertising
  Implement proper discovery with subtypes
2023-05-12 13:31:19 +00:00
Motomu Utsumi
179d18b3ad Merge changes from topic "firewall_socket_destroy"
* changes:
  Close sockets from ConnectivityService#setFirewallChainEnabled
  Add test to verify socket close when firewall is enabled
2023-05-12 09:18:40 +00:00
Remi NGUYEN VAN
58bb0a129a Do not immediately send new queries on cache hit
If a listener request is fulfilled immediately from cache, do not
restart queries immediately, but just schedule the next run.

This avoids doubling the number of queries when discovery, then resolve
is requested.

Bug: 281793453
Test: atest
Change-Id: Ibe41ee20427068a1ccdbc1f04525988a89a58899
2023-05-12 16:23:28 +09:00
Remi NGUYEN VAN
ce44beb7aa Implement proper subtype advertising
Implement subtype advertising by advertising an additional PTR record if
subtype advertising was requested.

For an advertiser a subtype is just an additional PTR record, so this
just involves plumbing the subtype down to MdnsRecordRepository, which
includes the additional record in the service registration.

Bug: 266167702
Test: atest
Change-Id: I09e780af25149162f16bd75410ddc50f160a0dab
2023-05-12 13:34:27 +09:00
Remi NGUYEN VAN
f2d064112c Implement proper discovery with subtypes
Apps may want to discover a particular subtype, such as
_color._sub._printer._tcp.local, which may return services like
Printer1._printer._tcp.local. The previous code was trying to discover,
and would return service types named _color._sub._printer._tcp.local,
even though the actual service type is still _printer._tcp.local. This
is a regression compared to S/T.

Fix this by passing the subtype to MdnsDiscoveryManager in its options
instead of the service type, and ensure that MdnsDiscoveryManager only
sends callbacks to callers that have requested the given subtype (a
color that asked for _color._sub._printer._tcp.local should not receive
BlackAndWhite._printer._tcp.local).

Bug: 266167702
Test: atest
Change-Id: I21367c66534078667718a9b54dfc858b12ba7103
2023-05-12 13:29:20 +09:00
Remi NGUYEN VAN
2f82fcdd6c Ensure service type ends with a dot in discovery
Historical behavior of onServiceFound is to include a dot at the end of
the service type. To avoid inconsistencies between behavior of new and
older backend, which would be hard to predict/handle for apps, ensure
that the same format is used. This means a dot must be added when using
the new backend.

Implement this by creating the callback service types based on
MdnsServiceInfo obtained from MdnsDiscoveryManager, rather than the
service type that was provided by the calling app. This avoids
inconsistencies as the calling app may or may not include dots
originally, and it may use subtypes ("_sub._type._tcp.local" or even
"_type._tcp.local,_sub"), which would result in callbacks giving invalid
service types, or inconsistent with S/T behavior.

Fixes: 281776253
Test: atest
Change-Id: I677ee885d1ee8e6a09773f21e4dd53e96faee748
2023-05-12 10:35:36 +09:00
Paul Hu
6f47b7d501 Merge "Remove the ServiceTypeClient after socket destroyed" 2023-05-11 11:50:57 +00:00