The forwarding pairs may use the same downstream. Ex: 464xlat
tethering has rmnet0:ncm0, v4-rmnet0:ncm0 forwarding pairs.
Need to avoid duplicate downstream program.
Bug: 241106456
Test: atest BpfCoordinatorTest
Change-Id: Ic41b3ad856e4876808f8497a760081afcfd04988
TetheringIntegrationTests is not in MTS (it is not part of the tests
list XML); but CtsTetheringTestLatestSdk contains all its tests and is
part of MTS.
Remove the mts-tethering tag to avoid confusion and get faster build
times.
Change-Id: Ic68fad48179cbf206a8867b81afc76e89f085772
Test: m
Refactor test testTetherUdpV4* into basic tethering test and tethering
BPF offload tests which breakdown into three tests:
- testTetherUdpV4_VerifyBpf
- testKernelSupportBpfOffloadUdpV4
- testTetherConfigBpfOffloadEnabled
These tests provide a easy way to know if BPF offload is verified or
which condition caused a skip.
Example:
Disable offload in tethering config
packages/modules/Connectivity/Tethering/res/values/config.xml
config_tether_enable_bpf_offload: false
[..] testTetherUdpV4: PASSED (229ms)
[..] testTetherUdpV4_VerifyBpf: ASSUMPTION_FAILED (2ms)
[..] testKernelSupportBpfOffloadUdpV4: PASSED (1ms)
[..] testTetherConfigBpfOffloadEnabled: ASSUMPTION_FAILED (13ms)
Bug: 237369591
Bug: 238288883
Test: atest EthernetTetheringTest
Change-Id: I99bd5c9d6be9a67cdeb809d46c907754f21ca5eb
Hungming Chenauthored and Nucca Chencommited 2022-07-29 05:41:09 +00:00
Using send{Download, Upload}PacketUdp() in test
{testTetherUdpV4*, testTetherClatUdp} helps reduce the redundant
codes.
Bug: 237369591
Test: atest EthernetTetheringTest
Change-Id: Id1676567b9a9885ce8f65ff86a682653910ea150
Hungming Chenauthored and Nucca Chencommited 2022-07-29 05:40:19 +00:00
Add tethering IPv6 UDP test and fix a bug which may apply wrong
ethernet type to ethernet header builder.
Bug: 237369591
Test: atest EthernetTetheringTest
Change-Id: I0d619b6e338d082366d5b2c305047d8f2ebf630d
To backward compatible existing behavior, make tethering APIs
unsupported synchronously when tethering is disallowed. There
are two APIs register/unregisterTetheringEventCallback still
supported even tethering is disallowed.
This could avoid some existing tests flaky. The test assume
startTethering would fail right away after tethering restricted
apply.
Bug: 184996041
Bug: 239500515
Test: atest TetheringTests
Change-Id: I41ae1d61647c9baf69bcb246965e8d9b4a89b497
Test that there is no fd leak with persistent fd cache.
Bug: 236320567
Test: atest BpfMapTest#testNoFdLeaks (cached fd) [PASSED]
Test: atest BpfMapTest#testNoFdLeaks (noncached fd) [FAILED] (as expected)
[8/14] com.android.networkstack.tethering.BpfMapTest#testNoFdLeaks: FAILED (241ms)
STACKTRACE:
java.lang.AssertionError: Fd leak after 1000 iterations: expected:<89> but was:<1089>
at org.junit.Assert.fail(Assert.java:89)
at org.junit.Assert.failNotEquals(Assert.java:835)
at org.junit.Assert.assertEquals(Assert.java:647)
at com.android.networkstack.tethering.BpfMapTest.testNoFdLeaks(BpfMapTest.java:420)
Test Code:
fd noncached BpfMap
frameworks/libs/net/common/device/com/android/net/module/util/BpfMap.java
@@ -97,7 +97,7 @@ public class BpfMap<K extends Struct, V extends Struct> implements IBpfMap<K, V>
*/
public BpfMap(@NonNull final String path, final int flag, final Class<K> key,
final Class<V> value) throws ErrnoException, NullPointerException {
- mMapFd = cachedBpfFdGet(path, flag);
+ mMapFd = ParcelFileDescriptor.adoptFd(nativeBpfFdGet(path, flag));
Change-Id: I66f477fd1c291c56bccc97d385b2a554c2367b5a
Hungming Chenauthored and Nucca Chencommited 2022-07-26 14:23:29 +00:00
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
Using adoptShellPermissionIdentity in setUp to use the shell permission
idnetity in whole test make the test not easy to
development. If the test want to use the library which would also
start/stop shell permission identity, this let the test lose shell
identify unexpectly after using that library. Only adopt shell permission
idnetity when necessary instead.
Test: atest CtsTetheringTest
Change-Id: I6cf24e6cbf227944bc914446337a247dc350562a
Needed because these struct classes should not be exposed.
Only used for the connectivity module and its tests.
Bug: 234160319
Test: atest ConnectivityCoverageTests
The moved files are identical.
diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/ClatEgress4Key.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/ClatEgress4Key.java
diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/ClatEgress4Value.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/ClatEgress4Value.java
diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/ClatIngress6Key.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/ClatIngress6Key.java
diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/ClatIngress6Value.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/ClatIngress6Value.java
diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/Tether4Key.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/Tether4Key.java
diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/Tether4Value.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/Tether4Value.java
diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/TetherStatsKey.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/TetherStatsKey.java
diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/TetherStatsValue.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/TetherStatsValue.java
diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/ClatEgress4Key.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/ClatEgress4Key.java
(no diff)
Change-Id: I4ce8045150bdbf04c63c5262c58a0ebcc30d395c
Hungming Chenauthored and Nucca Chencommited 2022-06-29 11:34:19 +00:00
There is a bug in TetheringMetrics that the on-going builders would be
cleared when creating new builder. This means if multiple tethering
created at the same time, only latest tethering would have metrics.
Bug: 153942334
Test: atest TetheringTests
Change-Id: I16a66790bc19072d8ffe570348bcbafa91263573
Markauthored and Mark Chiencommited 2022-06-28 10:31:02 +00:00
Move base64 related bpf map function and constant to f/l/n.
This is preparation for testing BPF map in ClatCoordinator.
Test: atest EthernetTetheringTest
Change-Id: Ieb1e0a0f128c9aa0d7c9f043e90eecf3c61252f5
If tethering's upstream have ipv6, the #initTetheringTester
would make sure ipv6 tethering connectivity is ready for testing.
Test: atest EthernentTetheringTest
Change-Id: Iade99eeb95fa94483248799eb852a81662bbb1e0
isExpectedUdpPacket and isIcmpv6Type is similar util, put them in the
same place and have isExpectedIpPacket to share the ip/eth parsing code.
Test: atest EthernetTetheringTest
Change-Id: I3ede46f5ff1799f575fad7aca277f2bc0bf6c391
This is no-op change. Originally RemoteResponder design for providing a
base responder that user could extend it like DnsServerResponder,
TcpResponder, UdpResponder. But actually user could just simply extend
TetheringTester that make RemoteResponder useless. Thus, remove it to
simply the code.
Test: atest EthernetTetheringTest
Change-Id: I47b22a1460ca312c678778143033aadf5e3e0b82
Mark Chienauthored and Markcommited 2022-06-13 09:00:27 +00:00
Note: to avoid missing some dependeices change only happen in T+, below
testing verification is perform by internal branch.
Test: atest TetheringTests
atest TetheringIntegrationTests
atest CtsTetheringTest
atest MtsTetheringLatestSdk
manually change entitlement check recheck period to 1 min and
monitor schedule alarm works.
Dogfood this change personally 7 days, major use hotspot sharing network to notebook to work.
Bug: 232193147
Change-Id: I3cba98f42ac1a9c0c1db4b2ad036aff714a428f3
Use three-part kernel version numbers to check which device
needs to verify BPF offload. Only check major and minor number
is not enough. Ex: mixed build T + R may have an unsupported kernel
version 4.19.160 (require 4.19.176+). Now check the subminor
number as well.
For UDPv4 support, kernel require 4.14.222+ 4.19.176+ 5.4.98+, 5.8.0+
Test: atest EthernetTetheringTest (raven @ internal master build)
Test: cts test (bramble @ T + R mixed build)
> run cts-on-gsi -m CtsTetheringTest -t android.net.EthernetTetheringTest#testTetherUdpV4AfterR
Bug: 232332847
Change-Id: I466df73b0fa35b086a2c5e11f8624c84eb79c8fd
testUpdateConnectedClientsForLocalOnlyHotspot should not run before T,
but it don't be ignored correctly because missing DevSdkIgnoreRule
setup.
Bug: 233077722
Test: TH
Change-Id: Ib2d241f927ccdc5d2bc392962481ecb86a223e09
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
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