Give slack time for waiting UDP stream mode because handling conntrack
event in user space may not in precise time. Used to reduce the flaky
rate.
Bug: 243314243
Test: atest EthernetTetheringTest
Change-Id: I7aee1a45d9a4d4fecf09739488dcaadeb7e86655
SkDestroyListener monitors the destroy of IPv4/IPv6 TCP/UDP sockets and
removes CookieTagMap entries.
SkDestroyListenerTest closes 100 sockets at once and check all the
entries are removed from the CookieTagMap.
Bug: 217624062
Test: atest MtsTetheringTestLatestSdk
Change-Id: I161006f4ae5bd83085e68bf8de260f04f3da0ea0
No DHCPACK received in DHCP process. Because previous DISCOVER/OFFER
steps have done, it implies that DHCP server is launched and
client/server can transmit data to each other. Assume that DHCP server
can reply DHCPACK and CF may need more than 100ms.
Extend the timeout from 100ms to 500ms. Monitor if receiving DHCPACK
timeout is found.
Bug: 243314243
Test: atest EthernetTetheringTest
Change-Id: Id8bb0e03ae1e853beb6242a1c35b977ace9ca190
The tracking interface of EthernetTracker(mTetheringInterface) is
stopped to track only when it is removed. There is race condition in
EthernetTetheringTest that the new test start ethernet tethering with
previous test interface name because EthernetTracker still tracking
previous test interface.
Destroy test interface then listen untether callback without calling
stopTethering. If EthernetTracker stop tracking test interface, it would
call onUnavailable callback to stop tethering. So the test can check
whether tethering is stopped to ensure the test interface is not tracked
anymore before test finish.
Bug: 191826409
Bug: 243222655
Test: atest TetheringIntegrationTests
Change-Id: I618983d981cd3a707dcb7723cdbb20ba5bf8bd2e
Currently, production code uses BpfMap type and TestBpfMap extends
BpfMap but this makes it diffcult to test because TestBpfMap loads the
JNI.
This CL updates to use IBpfMap type in the production code.
Upcoming CL updates TestBpfMap to implement IBpfMap instead of extending
BpfMap so that test can still use TestBpfMap but tests do not need to
load JNI.
Bug: 217624062
Test: atest BpfCoordinatorTest BpfNetMapsTest
Change-Id: Ie67e14bf5519fb4427474ecc0fda441877a9555f
There are three configuration could affect tethering allowed:
1. user restriction
2. tether_supported settings
3. ro.tether.denied system properties
When user restricted or tether supported setting change, updating
supported downstreams.
ro.tether.denied is read only properties, so it won't be changed runtime.
Also correct the unit test that there is no TetheringConfiguration change when settings or user restriction change.
Bug: 184996041
Bug: 239500515
Test: atest TetheringTests
Change-Id: I8dfcc42de9787a5e9ba19b69db9444c14ace56f0
aosp/2179274 adds fromBase64EncodedString to BpfDump.
This CL updates EthernetTetheringTest to use this function instead of
parseMapKeyValue in EthernetTetheringTest.
Bug: 217624062
Test: atest EthernetTetheringTest
Change-Id: I56b3cd875e16bee6174f0aacd468562ae482cef9
These are allocated in order by the kernel, if we go
over 2 billion, we've got other problems... besides
U32 to S32 conversion will work just fine anyway.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ifbb7139e9118dd2d0c52e83c5874132e03760b30
* changes:
UpstreamNetworkMonitor: add NOTIFY_TEST_NETWORK_AVAILABLE
EthernetTetheringTest: obtain the required permissions when needed
Use TetheredInterfaceRequester to check available tethering interface
Because of race condition inside tethering module, restart tethering is
not reliable when address conflict. Manual start it for testing if it
doesn't restart automatically.
Bug: 176048959
Bug: 240878641
Bug: 178560045
Bug: 178116595
Test: atest MtsTetheringTestLatestSdk
Change-Id: Id1473b968cd20afde70bca1903114df6f0b510a8
Used for test interface upstream can replace existing non-test
upstream interface, like ethernet on cuttlefish.
This helps to fix the flaky test when we are using test interface on
cuttlefish. Because the ethernet and test interface upstream update
event order can't be guaranteed.
Bug: 237369591
Bug: 242067530
Test: atest ConnectivityCoverageTests
Change-Id: I9da71ee116bf1ebc9831f61f25acf42e328a8370
Don't adopt all permission in setup, instead obtain permission when
needed. It helps to avoid unexpected permission dropping in functions.
Bug: 237369591
Bug: 242067530
Test: atest EthernetTetheringTest
Change-Id: I1215278271ca6b48e097d7f2cf160416d5411655
Used for deciding what test needs to be run. Moreover, the
EthernetManager#isAvailable is not used for this purpose
anymore. The restricted networks permission is not required
as well.
Bug: 237369591
Bug: 242067530
Test: atest EthernetTetheringTest
Change-Id: I1215278271ca6b48e097d7f2cf160416d54116f2
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
Using send{Download, Upload}PacketUdp() in test
{testTetherUdpV4*, testTetherClatUdp} helps reduce the redundant
codes.
Bug: 237369591
Test: atest EthernetTetheringTest
Change-Id: Id1676567b9a9885ce8f65ff86a682653910ea150
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