Commit graph android_packages_modules_Co.../Tethering/tests/unit/src
Message SHA1
TetheringTest: correct the comment in chooseDunUpstreamTestCommon
Bug: 243516306
Test: atest TetheringTest
Change-Id: I642722498357dfb8f1582de50701f213c49f3077

Hungming Chen   commited 2023-01-13 17:53:59 +08:00
f2abe15fe7
Merge "TetheringTest: fix assert{*}Equals order in TestTetheringEventCallback"
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-01-13 08:43:07 +00:00
8043d5d7af
Merge changes from topic "deprecate_connectivity_action_in_tethering"
* changes:
  Tethering: deprecate CONNECTIVITY_ACTION on U+ device
  Test: add tests to testChooseDunUpstreamByAutomaticMode_*
  TetheringTest: separate setup func from chooseDunUpstreamTestCommon

Treehugger Robot   authored and   Gerrit Code Review   commited 2023-01-13 08:41:20 +00:00
401f1ff2db
Merge "Fix TetheringServiceTest#testTetheringManagerLeak flaky"
KH Shi   authored and   Gerrit Code Review   commited 2023-01-13 05:44:17 +00:00
c91fbabd45
TetheringTest: fix assert{*}Equals order in TestTetheringEventCallback
TestTetheringEventCallback may use assertEquals(actual, expected)
but assertEquals(expected, actual).

It is confused while test is failed.

For example:

Code:
callback.expectUpstreamChanged(new Network[] {null} /* expected */);

Before:
java.lang.AssertionError: expected:<100> but was:<null>

After:
java.lang.AssertionError: expected:<null> but was:<100>

Bug: 243516306
Test: atest TetheringTest
Change-Id: I6a987e4dd1cccc5e79da7dda55f194291e0c4a60

Hungming Chen   commited 2023-01-12 17:48:04 +08:00
b4859d1ea1
Fix TetheringServiceTest#testTetheringManagerLeak flaky
This test relies on forceGc to free and finalize the TetheringManager
before perform validation checks. In some test suites, if there were
already too many unused objects accumulated in the system before
running the test, it might take more than 5 seconds to free them.
Increase the maximum retry time to 30 seconds to fix the flakiness.

Bug: 263335396
Test: atest TetheringServiceTest#testTetheringManagerLeak
      run the flaky test suite on ABTD with CL
Change-Id: I38bee3d43fbeb278993d113ccbe0645aedc5d75d

KH Shi   commited 2023-01-12 08:25:34 +00:00
0ed11f5a46
BpfCoordinator: publish upstream interface mtu to v4 offload rule
Respect the upstream interface mtu instead of always setting
mtu 1500.

Using upstream interface mtu is probably not the best solution
for tether offload pmtu but it at least respects the upstream
interface mtu which may be less than 1500.

Test: manual test
1. Connect to carrier Taiwan Star.
2. Enable tethering and check the mtu 1434 in dumpsys.
IPv4 Upstream: proto [inDstMac] iif(iface) src -> nat ->
dst [outDstMac] pmtu age
  udp [02:10:45:32:ef:35] 54(54) 192.168.72.125:39034
  -> 15(rmnet1) 100.83.189.11:39034
  -> 142.251.43.14:443 [00:00:00:00:00:00] 1434 69657ms
IPv4 Downstream: proto [inDstMac] iif(iface) src -> nat
  -> dst [outDstMac] pmtu age
  udp [00:00:00:00:00:00] 15(rmnet1) 142.251.43.14:443
  -> 54(54) 100.83.189.11:39034
  -> 192.168.72.125:39034 [9a:8a:4d:ec:a4:7c] 1434 69633ms

Bug: 262860312
Test: atest BpfCoordinatorTest
Change-Id: Ic6dcb95ed76d5306053e4645b6baebc67ff082cf

Hungming Chen   commited 2023-01-03 23:36:30 +08:00
5c985e2cdd
Merge "BpfCoordinatorTest: renumber the test interface indices"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-12-30 20:46:16 +00:00
53e8697d39
BpfCoordinatorTest: renumber the test interface indices
This is a preparation to add new interface index.

Test: atest BpfCoordinatorTest
Change-Id: I758c2e7142099d74099fb8203f41ffec9b1182ee

Hungming Chen   commited 2022-12-28 21:47:11 +08:00
46767ff62e
Test: add tests to testChooseDunUpstreamByAutomaticMode_*
Add dun network test cases as follows.

Overall test coverage:
- testChooseDunUpstreamByAutomaticMode (original):
  common, test#1, test#2
- testChooseDunUpstreamByAutomaticMode_defaultNetworkWifi (new):
  test#3, test#4
- testChooseDunUpstreamByAutomaticMode_loseDefaultNetworkWifi (new):
  test#5
- testChooseDunUpstreamByAutomaticMode_defaultNetworkCell (new):
  test#5, test#7
- testChooseDunUpstreamByAutomaticMode_loseAndRegainDun (new):
  test#8
- testChooseDunUpstreamByAutomaticMode_switchDefaultFromWifiToCell
  (new):
  test#9, test#10

Overall test cases:
+-------+-------+-------+-------+-------+
| Test  | WiFi  | Cellu |  Dun  | Expec |
| Case  |       | alr   |       | ted   |
|   #   |       |       |       | Upstr |
|       |       |       |       | eam   |
+-------+-------+-------+-------+-------+
|   -   |       |       |       |   -   | --+
+-------+-------+-------+-------+-------+   |
|   -   |       |   V   |       |   -   |   |
+-------+-------+-------+-------+-------+   |   Implemented
|   -   |       |   V   |   O   |  Dun  |   +-- in chooseDun
+-------+-------+-------+-------+-------+   |   UpstreamTest
|   -   |   V   |   O   |   O   |  WiFi |   |   Common()
+-------+-------+-------+-------+-------+   |
|   -   |   V   |   O   |       |  WiFi | --+
+-------+-------+-------+-------+-------+
|       |   O   |   V   |       |   -   |
|   1   +-------+-------+-------+-------+
|       |   O   |   V   |   O   |  Dun  |
+-------+-------+-------+-------+-------+
|       |   O   |   V   |       |   -   |
|   2   +-------+-------+-------+-------+
|       |   O   |   V   |   O   |  Dun  |
+-------+-------+-------+-------+-------+
|   3   |   V   |   O   |       |  WiFi | (new)
+-------+-------+-------+-------+-------+
|   4   |   V   |       |       |  WiFi | (new)
+-------+-------+-------+-------+-------+
|   5   |       |       |   O   |  Dun  | (new)
+-------+-------+-------+-------+-------+
|   6   |       |   V   |   O   |  Dun  | (new)
+-------+-------+-------+-------+-------+
|   7   |       |       |   O   |  Dun  | (new)
+-------+-------+-------+-------+-------+
|       |       |       |       |   -   | (new)
|   8   +-------+-------+-------+-------+
|       |       |       |   O   |  Dun  |
+-------+-------+-------+-------+-------+
|       |   V   |       |   O   |  WiFi | (new)
|   9   +-------+-------+-------+-------+
|       |   V   |       |       |  WiFi |
+-------+-------+-------+-------+-------+
|       |   O   |   V   |       |   -   | (new)
|   10  +-------+-------+-------+-------+
|       |   O   |   V   |   O   |  Dun  |
+-------+-------+-------+-------+-------+

Annotation:
1. "V" means that the given network is connected and
   it is default network.
2. "O" means that the given network is connected and
   it is not default network.

Bug: 257408654
Test: atest ConnectivityCoverageTests
Change-Id: Ie7beda1a8fcfd2a3f2600ca601f58d869144d275

Hungming Chen   authored and   Nucca Chen   commited 2022-12-28 02:28:00 +00:00
4c8c35748f
TetheringTest: separate setup func from chooseDunUpstreamTestCommon
Prepare to share setup function to more dun network tests.
No operation is changed.

Bug: 257408654
Test: TetheringTest
Change-Id: I29f08d8bc3cf83aa9d03f5d2819a1c67466b7bcc

Hungming Chen   commited 2022-12-26 19:25:16 +08:00
ecfe710805
Merge "TestOnly: disable some UpstreamNetworkMonitor tests after T"
Mark Chien   authored and   Gerrit Code Review   commited 2022-12-21 06:27:02 +00:00
09cb20d8a8
TestOnly: disable some UpstreamNetworkMonitor tests after T
The legacy upstream selection flow is never called after T. Stop the
related test cases after T also.

Bug: 257408654
Test: atest TetheringTests
Change-Id: I62692bb9a49dde432d31bece41b4cff442a327d1

Mark   authored and   Mark Chien   commited 2022-12-21 06:26:37 +00:00
2657da3cbf
Replace NetlinkSocket with NetlinkUtils
Those static method and constants are better to fit in
NetlinkUitls. Replace the usage.

Test: m
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: I81e27b8264e39764a44a4ba87344e9ac940d920a

chiachangwang   commited 2022-12-19 06:39:31 +00:00
e97aed4847
bpf_tethering.h -> offload.h
match header file with bpf program

Locations to change found via:
  https://source.corp.google.com/search?q=p:aosp-master%20(%5E%7C%5B%5E_%5D)bpf_tethering.h

Core reasoning for this will be to match the .h naming
that we'll have for netd.c and clatd.c once we get rid of bpf_shared.h

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

Maciej Żenczykowski   commited 2022-12-08 13:04:45 +00:00
4e3321ed3b
TetheringConfiguration: force to select upstream automatically on U+
Simply the upstream selection since U+ device for tethering refactor.

Changes:
1. Support automatic mode only on U+ device.

2. Add two tethering tests to make sure that the resource config can't
   control automatic mode anymore. Expect that always automatic mode
   on U+ device. Also limit some existing tethering tests for R, S,
   or T.
   Changes of TetheringTest:
   - testAutomaticUpstreamSelectionWithConfigDisabled (U+) [new]
   - testLegacyUpstreamSelection (T-)
   - testChooseDunUpstreamByLegacyMode (T-)
   - testChooseDunUpstreamByAutomaticModeWithConfigDisabled (U+) [new]

3. Add two tethering configuration tests to make sure that automatic
   mode is always enabled no mater what the resource config or flag
   are on U+ device. Also limit some existing tethering tests for R,
   S, or T.
   Changes of TetheringConfiguration:
   - testChooseUpstreamAutomatically (T-)
   - testChooseUpstreamAutomaticallyAfterT (U+) [new]
   - testChooseUpstreamAutomatically_FlagOverride (R)
   - testChooseUpstreamAutomatically_FlagOverrideOnSAndT (S, T)
     (Renamed from testChooseUpstreamAutomatically_FlagOverrideAfterR)
   - testChooseUpstreamAutomatically_FlagOverrideAfterT (U+) [new]

Bug: 257941865
Bug: 257408654
Test: atest TetheringTest
Change-Id: I7ace317a1529177a84557741dc07d732b7f8cf89

Hungming Chen   commited 2022-11-15 22:14:21 +08:00
d15eb88619
Merge "Add isTetheringFeatureEnabled which use tethering namespace"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-11-15 08:58:23 +00:00
6660d2375f
Add isTetheringFeatureEnabled which use tethering namespace
This is no-op change. Tethering shouldn't use connectivity namespace
because it already be used for NetworkStack module. The new feature
should check isTetheringFeatureEnabled instead.

Bug: 238274852
Test: atest TetheringTests
Change-Id: I009f654d0bf8df7051b822e666e3206dd70a5523

Mark   authored and   Mark Chien   commited 2022-11-14 15:51:55 +00:00
25d3ac54fe
Fix errorprone warnings that should be errors
This commit is part of a large scale change to fix errorprone
errors that have been downgraded to warnings in the android
source tree, so that they can be promoted to errors again.
The full list of changes include the following, but not all
will be present in any one individual commit:

BadAnnotationImplementation
BadShiftAmount
BanJNDI
BoxedPrimitiveEquality
ComparableType
ComplexBooleanConstant
CollectionToArraySafeParameter
ConditionalExpressionNumericPromotion
DangerousLiteralNull
DoubleBraceInitialization
DurationFrom
DurationTemporalUnit
EmptyTopLevelDeclaration
EqualsNull
EqualsReference
FormatString
FromTemporalAccessor
GetClassOnAnnotation
GetClassOnClass
HashtableContains
IdentityBinaryExpression
IdentityHashMapBoxing
InstantTemporalUnit
InvalidTimeZoneID
InvalidZoneId
IsInstanceIncompatibleType
JUnitParameterMethodNotFound
LockOnBoxedPrimitive
MathRoundIntLong
MislabeledAndroidString
MisusedDayOfYear
MissingSuperCall
MisusedWeekYear
ModifyingCollectionWithItself
NoCanIgnoreReturnValueOnClasses
NonRuntimeAnnotation
NullableOnContainingClass
NullTernary
OverridesJavaxInjectableMethod
ParcelableCreator
PeriodFrom
PreconditionsInvalidPlaceholder
ProtoBuilderReturnValueIgnored
ProtoFieldNullComparison
RandomModInteger
RectIntersectReturnValueIgnored
ReturnValueIgnored
SelfAssignment
SelfComparison
SelfEquals
SizeGreaterThanOrEqualsZero
StringBuilderInitWithChar
TreeToString
TryFailThrowable
UnnecessaryCheckNotNull
UnusedCollectionModifiedInPlace
XorPower

See https://errorprone.info/bugpatterns for more
information on the checks.

Bug: 253827323
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I7625fa386afe93823b97cb2ecb8fd09a5856c05b

Cole Faust   commited 2022-11-02 10:13:14 -07:00
22f05839f5
Merge changes I63467371,Id4405b70
* changes:
  BpfCoordinatorTest: add testDumpDoesNotCrash
  Move error count BPF map initialization into class Dependencies

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-10-27 07:27:08 +00:00
319c97705f
Merge "IpServerTest: add test addRemoveTetherClient"
Nucca Chen   authored and   Gerrit Code Review   commited 2022-10-26 06:49:22 +00:00
db4ac8ea40
BpfCoordinatorTest: add testDumpDoesNotCrash
Simple dump test for improving tethering test coverage.

Bug: 255466740
Test: atest BpfCoordinatorTest
Test: dump the content of testDump

Output:
mIsBpfEnabled: true
Polling not started
Stats provider registered
Upstream quota: {}
Polling interval: 5000 ms
Bpf shim: mBpfDownstream6Map{OK}, mBpfUpstream6Map{OK}, mBpfDownstream4Map{OK}, mBpfUpstream4Map{OK}, mBpfStatsMap{OK}, mBpfLimitMap{OK}, mBpfDevMap{OK}
Forwarding stats:
 <empty>
BPF stats:
 ifindex: 1001: rxPackets: 0, rxBytes: 0, rxErrors: 0, txPackets: 0, txBytes: 0, txErrors: 0

Forwarding rules:
 IPv6 Forwarding rules by downstream interface:
  [null]: iif(iface) oif(iface) v6addr [srcmac] [dstmac]
   1001(rmnet0) 1003(1003) 2001:db8::1 [12:34:56:78:90:ab] [00:00:00:00:00:0a]
 IPv6 Upstream: iif(iface) [inDstMac] -> oif(iface) etherType [outSrcMac] [outDstMac]
  1003(1003) [12:34:56:78:90:ab] -> 1001(rmnet0) 86dd [00:00:00:00:00:00] [00:00:00:00:00:00]
 IPv6 Downstream: iif(iface) [inDstMac] neigh6 -> oif(iface) etherType [outSrcMac] [outDstMac]
  1001(rmnet0) [00:00:00:00:00:00] 2001:db8::1 -> 1003(1003) 86dd [12:34:56:78:90:ab] [00:00:00:00:00:0a]
 IPv4 Upstream: proto [inDstMac] iif(iface) src -> nat -> dst [outDstMac] age
  tcp [12:34:56:78:90:ab] 1003(1003) 192.168.80.12:-3087 -> 1001(rmnet0) 1.0.0.1:-3087 -> 140.112.8.116:443 [00:00:00:00:00:00] -
 IPv4 Downstream: proto [inDstMac] iif(iface) src -> nat -> dst [outDstMac] age
  tcp [00:00:00:00:00:00] 1001(rmnet0) 140.112.8.116:443 -> 1003(1003) 1.0.0.1:-3087 -> 192.168.80.12:-3087 [00:00:00:00:00:0a] -

Device map:
 ifindex (iface) -> ifindex (iface)
  1001 (rmnet0) -> 1001 (rmnet0)
Client Information:
 <empty>
IPv4 Upstream Indices:
 <empty>

Forwarding counters:
 INVALID_IPV4_VERSION: 1000

Change-Id: I6346737157936cff7e164bbfe78d9a98dab3395a

Hungming Chen   authored and   Nucca Chen   commited 2022-10-26 05:48:03 +00:00
df57abfd4b
Move error count BPF map initialization into class Dependencies
The preparation for testing BpfCoordinator#dump().
Used to wrap error count BPF map access to avoid SYS_SECCOMP on some
test device. Ex: cuttlefish.
https://android-build.googleplex.com/builds/tests/view?invocationId=I01200010101524265&testResultId=TR03228338750686157

Bug: 255466740
Test: atest BpfCoordinatorTest

Change-Id: Id4405b70bc6d500b35943b4f81b88e7515fff3b0

Hungming Chen   commited 2022-10-26 13:47:19 +08:00
771bc597b6
Merge "Remove unused TetheringConfigurationParcel fileds"
Mark Chien   authored and   Gerrit Code Review   commited 2022-10-21 07:50:23 +00:00
381e339647
Merge "Add toString() to Ipv6ForwardingRule"
Nucca Chen   authored and   Gerrit Code Review   commited 2022-10-14 07:27:03 +00:00
df46aeb098
Add new fields - |upstream_events| and |duration_millis| in stats.proto
Revise annotations in previous fields and deprecate |upstream_type|.

Ignore-AOSP-First: Merge conflict if submits in AOSP first.
Bug: 153942334
Test: statsd_testdrive 303
Change-Id: Id4d594f9238e18266dce5bf2ba238c1f86f655db
(cherry picked from commit 71c8495cea)
Merged-In: Id4d594f9238e18266dce5bf2ba238c1f86f655db

Wayne Ma   commited 2022-10-12 05:32:12 +00:00
fe6ecc6333
IpServerTest: add test addRemoveTetherClient
Bug: 250552545
Test: atest IpServerTest
Change-Id: Id8e801ccbf9a958c6b82de6022165d921761a86f

Hungming Chen   commited 2022-10-04 23:14:55 +08:00
afdf104d68
Add toString() to Ipv6ForwardingRule
Needed because default Ipv6ForwardingRule#toString doesn't dump
actual data. It is hard to know why two rule comparison failed
in the test failure.

Bug: 250552545
Test: atest BpfCoordinatorTest
Change-Id: Iaf29c888238573c7c9a0a4e0bd65fbe468084e51

Hungming Chen   commited 2022-10-04 23:14:55 +08:00
de5fb7370b
BpfCoordinator: ignore stopping event monitoring if never started
Ignore stopping monitoring if the monitor has never started
for a given IpServer.

Also fix the related bug in
BpfCoordinator#testStartStopConntrackMonitoring.

Bug: 250552545
Test: atest BpfCoordinatorTest
Change-Id: I7ac71f0ed52bf52244aadaa3c90ca8df239873e4

Hungming Chen   authored and   Nucca Chen   commited 2022-10-03 11:56:38 +00:00
09d163dfa8
Fix errorprone 2.15.0 errors
Bug: 246761518
Test: RUN_ERROR_PRONE=true m javac-check lint-check dist
Change-Id: I4b81ef161fab5ee80a1713de87b89500a88e625e

Sorin Basca   commited 2022-09-21 13:29:19 +01:00
14343732c3
Merge "Revert "UpstreamNetworkMonitor: add NOTIFY_TEST_NETWORK_AVAILABLE""
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-09-14 14:25:13 +00:00
1949d98e81
Merge "Fix TetheringServiceTest#testTetheringManagerLeak flaky"
KH Shi   authored and   Gerrit Code Review   commited 2022-09-13 11:16:13 +00:00
b259ee802f
Fix TetheringServiceTest#testTetheringManagerLeak flaky
The clearance of the weak reference to TetheringManager can't be a
confirmation check of the completion running of its finalization.
The weak references to a weakly-reachable object will be cleared
before it becomes eligible for finalization. Calling of
System.runFinalization() method doesn't guarantee finalizers are
executed synchronously. In fact, finalizer of TetheringManager is
running in a different thread in this test.

GCs and finalizers behaviors could be vary on different JVMs.
Due to the unsynchronization, besides the weak reference of
TetheringManager, we need to add retries to the checking of
unregister Tethering internal callback as well.

Bug: 243340454
Test: atest TetheringServiceTest#testTetheringManagerLeak --iterations 10000
Change-Id: I8231146f26deb0825dadb70d8d0dbdc963989558

KH Shi   commited 2022-09-13 05:56:29 +00:00
b254987348
Revert "UpstreamNetworkMonitor: add NOTIFY_TEST_NETWORK_AVAILABLE"
This reverts commit 82e7733909.

Reason for revert: don't modify production code for testing only

Change-Id: I19826c3308774ce6f62a2748b4e038500aec33e2

Nucca Chen   commited 2022-09-05 03:25:33 +00:00
6cafe04787
Use IBpfMap type instead of BpfMap type
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

Motomu Utsumi   commited 2022-08-24 23:31:19 +09:00
73599a5f5d
Merge "updateSupportedDownstreams when tethering allowed is changed"
Mark Chien   authored and   Gerrit Code Review   commited 2022-08-22 15:15:11 +00:00
0d3c8b692d
updateSupportedDownstreams when tethering allowed is changed
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

Mark   commited 2022-08-18 05:42:05 +00:00
c2cc1b42b8
replace U32 ifindex with S32
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

Maciej Żenczykowski   commited 2022-08-18 01:07:11 +00:00
09813ced3e
Merge changes from topic "ethernet-tethering-test-on-cf"
* changes:
  UpstreamNetworkMonitor: add NOTIFY_TEST_NETWORK_AVAILABLE
  EthernetTetheringTest: obtain the required permissions when needed
  Use TetheredInterfaceRequester to check available tethering interface

Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-08-17 17:50:40 +00:00
91f7d6d906
Remove unused TetheringConfigurationParcel fileds
Bug: 237338640
Test: atest TetheringTests

Change-Id: Ic851e2e9ed16b5be6f5b1380f6b905fcc1e131cf

Mark Chien   authored and   Mark   commited 2022-08-16 15:58:44 +00:00
40caeb78f3
UpstreamNetworkMonitor: add NOTIFY_TEST_NETWORK_AVAILABLE
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

Hungming Chen   commited 2022-08-15 17:38:06 +08:00
82e7733909
Merge "TestOnly: reduce duplicated start/stop hotspot verification"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-08-10 16:13:51 +00:00
b40cbad40c
TestOnly: reduce duplicated start/stop hotspot verification
Test: atest TetheringTests
Change-Id: Id6469c5be4a424a68e370bea475dc7399a0037ac

Mark   commited 2022-08-10 12:24:13 +00:00
0a1a97250d
BpfCoordinator: avoid attach/deatach ipv6 program on 464xlat interface
464xlat interface v4-* doesn't have IPv6 address. IPv6 program should
not be attached/deatached on v4-* interface.

Bug: 241106456
Test: atest BpfCoordinatorTest
Test: manual test

Use IPv6-only wifi to test because there is no IPv6-only live
cellular environment here.

1. Patch TetheringInterfaceUtils.allowIpv6Tethering to allow WIFI.
2. Connect to IPv6-only wifi Google-Guest.
3. Enable USB tethering.
4. Check that v4-wlan0 doesn't have IPv6 program.

$ adb shell tc filter show dev wlan0 ingress;
filter protocol ipv6 pref 2 bpf chain 0
filter protocol ipv6 pref 2 bpf chain 0 handle 0x1 prog_offload_schedcls_tether_downstream6_ether:[*fsobj] direct-action not_in_hw id 2 tag 7d9be9d02d02e8d8
filter protocol ip pref 3 bpf chain 0
filter protocol ip pref 3 bpf chain 0 handle 0x1 prog_offload_schedcls_tether_downstream4_ether:[*fsobj] direct-action not_in_hw id 8 tag 434b3ecac7968bb3
filter protocol ipv6 pref 4 bpf chain 0
filter protocol ipv6 pref 4 bpf chain 0 handle 0x1 prog_clatd_schedcls_ingress6_clat_ether:[*fsobj] direct-action not_in_hw id 24 tag 06763574e0e1f984

$ adb shell tc filter show dev v4-wlan0 ingress;
filter protocol ip pref 3 bpf chain 0
filter protocol ip pref 3 bpf chain 0 handle 0x1 prog_offload_schedcls_tether_downstream4_rawip:[*fsobj] direct-action not_in_hw id 6 tag 9e6e587e0c6cf0bc

$ adb shell tc filter show dev v4-wlan0 egress;
filter protocol ip pref 4 bpf chain 0
filter protocol ip pref 4 bpf chain 0 handle 0x1 prog_clatd_schedcls_egress4_clat_rawip:[*fsobj] direct-action not_in_hw id 27 tag 9158397a2869247e

$ adb shell tc filter show dev ncm0 ingress;
filter protocol ipv6 pref 2 bpf chain 0
filter protocol ipv6 pref 2 bpf chain 0 handle 0x1 prog_offload_schedcls_tether_upstream6_ether:[*fsobj] direct-action not_in_hw id 3 tag 5f70a4f42dffe899
filter protocol ip pref 3 bpf chain 0
filter protocol ip pref 3 bpf chain 0 handle 0x1 prog_offload_schedcls_tether_upstream4_ether:[*fsobj] direct-action not_in_hw id 9 tag 26f324113d54c30a

Change-Id: Ic1c1cfc7646b4d4004856850b66428e4651d42ab

Hungming Chen   commited 2022-08-08 20:56:50 +08:00
1668b2da03
BpfCoordinator: avoid attach/deatach duplicate downstream program
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

Hungming Chen   commited 2022-08-05 20:56:04 +08:00
6f54391340
Merge changes I41ae1d61,I334860af
* changes:
  Make tethering APIs unsupported synchronously when disallowed
  Revert "Revert "Add onSupportedTetheringType callback""

Mark Chien   authored and   Gerrit Code Review   commited 2022-07-28 02:22:07 +00:00
794d04d779
Make tethering APIs unsupported synchronously when disallowed
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

Mark   commited 2022-07-27 09:41:42 +00:00
cf230301e3
Revert "Revert "Add onSupportedTetheringType callback""
This reverts commit 4bf22ae076.

Reason for revert: land the change again

Change-Id: I334860af201ce0faa09f1dbb8935bc9fddd66c50

Mark Chien   authored and   Mark   commited 2022-07-20 06:18:13 +00:00
874a3e273e
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