Needed because the BPF maps offloads IPv4 traffic. The kernel can't
trace the offloaded traffic to keep the conntrack entry.
Bug: 190783768
Test: atest TetheringCoverageTests
Change-Id: Idbcf686c9b2124b192944156ac5111be741744fb
The condition for deleting IPv4 forwarding rules.
1. When the tethering client has gone, deletes the client and its
rules.
2. When the upstream has gone, deletes all rules.
3. When the upstream has changed, deletes all rules.
Test: atest TetheringCoverageTests and check IPv4 offload rules
via dumpsys tethering in the following test cases.
Bug: 190783768
Test cases:
a. Loss upstream interface while tethering
1. Enable WIFI tethering
2. Disable upstream interface
3. Check the rules are removed.
b. Loss downstream interfaces while tethering
1. Enable WIFI tethering
2. Enable BT tethering
3. Disable BT tethering
4. Check the BT tether rules are removed.
5. Disable WIFI tethering
6. Check the WIFI tether rules are removed.
c. Switch upstream interface while tethering
1. Enable WIFI tethering
2. Enable BT tethering
3. Switch upstream interface from cellular to wifi.
4. Check all rules are removed.
d. Enable NAT failure (manual)
Log:
The rule deletion in each case.
- IpServer#stopIPv4: case b and case d.
- BpfCoordinator#updateUpstreamNetworkState: case a and case c.
Test case a
06-23 09:58:59.245 [...] Tethering: [BpfCoordinator]
updateUpstreamNetworkState tetherOffloadRule4Clear wlan2
Test case b
06-07 22:17:51.886 [..] Tethering: [bt-pan] cleanupUpstream bt-pan
06-07 22:17:51.888 [..] Tethering: [bt-pan] stopIPv4 bt-pan
06-07 22:18:23.769 [..] Tethering: [wlan2] cleanupUpstream wlan2
06-07 22:18:23.772 [..] Tethering: [wlan2] stopIPv4 wlan2
Test case c
06-08 11:11:48.277 [..] Tethering: [BpfCoordinator]
updateUpstreamNetworkState tetherOffloadRule4Clear bt-pan
06-08 11:11:48.396 [..] Tethering: [BpfCoordinator]
updateUpstreamNetworkState tetherOffloadRule4Clear wlan2
06-08 11:11:48.579 [..] Tethering: [wlan2] cleanupUpstreamInterface
wlan2
06-08 11:11:48.808 [..] Tethering: [bt-pan] cleanupUpstreamInterface
bt-pan
Enabling NAT failure
06-08 13:04:18.117 [..] Tethering: [wlan2] Exception enabling NAT [..]
06-08 13:04:18.234 [..] Tethering: [wlan2] cleanupUpstream wlan2
06-08 13:04:18.246 [..] Tethering: [wlan2] stopIPv4 wlan2
Change-Id: Id505a3deb277bbe0f44403234d8ca8bbf01eec80
Adding the configuration to decide using rndis or ncm for usb tethering.
If ncm is configured for TETHEIRNG_USB, then TETHERING_NCM is not
available.
Bug: 162920185
Test: atest TetheringTests
manul testing usb tethering
Change-Id: Ifc7eee2457a950a0e2d1c3cc89a3373a7ad23c9c
The coverage tests will allow measuring code coverage for all
Connectivity+Tethering code.
This is a combination of the current TetheringCoverageTests, and
FrameworksNetTests.
Adding min_sdk_version to the test prevents it from using deprecated
IoUtils utilities. Replace it with the non-deprecated alternative.
Test: atest ConnectivityCoverageTests
Change-Id: I5366e1cc9cd6ddb41f24718246381cc2b1cc1383
The test will currently fail if it is run in a package that has
ACCESS_NETWORK_STATE. Add utilities to mock permissions, and mock the
ACCESS_NETWORK_STATE permission to be denied.
Bug: 187935317
Test: atest TetheringServiceTest
Change-Id: I8df5f2ac21bf0314098e8c2e5ba583676ae8ab38
The stable connectivity shims are updated to now contain S API, so
tethering tests that assumed that compatibility R behavior was used need
to be updated.
To avoid such failures Tethering tests should have a test target using
updated shims (TetheringNextTests), but this was not done in S
timeframe.
Ignore-AOSP-First: topic needs differences in AOSP
Bug: 189581241
Test: atest TetheringTests
Change-Id: Ibc04e64a1e9d82b67aff10d1a6d77f9e6b1bbdfb
startTrackDefaultNetwork was allowed to called multiple times
before even though there is no one actually do it. However,
in the TetheringTest#verifyDefaultNetworkRequestFiled, a
manual invocation is used to ensure that function supports
multiple entrance.
But with aosp/1697371, startTrackDefaultNetwork is no longer
allowed to be called multiple times, it would lead to log.wtf
and crash system in eng build.
Since the manual invocation of startTrackDefaultNetwork is not
realistic and no longer valid anymore, remove the invocation
that caused the trouble.
Test: atest TetheringCoverageTests
Bug: 188613493
Merged-In: I61f6088783d521fd17ae1e87370842b4239fbe75
Change-Id: I61f6088783d521fd17ae1e87370842b4239fbe75
(cherry-picked from aosp/1711433)
The existing isWifiTetheringSupported only check if tethering side
supports wifi tethering or not but not wifi side. A expected
behavior should include both of them, so add the wifi side check
into the helper function. Also update in the existing caller side
due to a new parameter added.
Bug: 186061922
Test: atest MtsTetheringTestLatestSdk
Megred-In: Id69ac1d30ab2bbf23e870193335b139f54672636
Change-Id: Id69ac1d30ab2bbf23e870193335b139f54672636
Ignore-AOSP-First: cherry-pick
The existing isWifiTetheringSupported only check if tethering side
supports wifi tethering or not but not wifi side. A expected
behavior should include both of them, so add the wifi side check
into the helper function. Also update in the existing caller side
due to a new parameter added.
Bug: 186061922
Test: atest MtsTetheringTestLatestSdk
Change-Id: Id69ac1d30ab2bbf23e870193335b139f54672636
The old callback only report interface list, new callback could provide
the mapping of interface and type. Replace old callback usage in cts
with new callback and check whether old callback could get the correct
interface list by comparing the result between old and new callback.
Bug: 162920185
Bug: 152203943
Test: atest CtsTetheringTest on S
atest CtsTetheringTestLatestSdk on R
atest MtsTetheringTestLatestSdk on S and R
Merged-In: I2a0b8c43fb340c3eaed7f0f90464199222a24280
Change-Id: I2a0b8c43fb340c3eaed7f0f90464199222a24280
Before this change, tethering always report a list of tethered
interfaces and the caller need to use each tethering type's interface
regex to matching tethered list to manual implement the mapping of
tethering type and interface. This change allow caller to get rid of
tethering interface regex.
Bug: 162920185
Bug: 152203943
Test: atest CtsTetheringTest on S
Merged-In: I91bcccd676d109c1b974497ac29bd366a41b8899
Change-Id: I91bcccd676d109c1b974497ac29bd366a41b8899
tryCell configuration would not be force disabled UpstreamMonitor stop.
If tethering stop with using mobile upstream and swap with SIM fron no
dun to dun supported, dun request would be filed even tethering is not
active.
Bug: 173068192
Test: atest TetheringTests
Change-Id: I5505655f52da9fdca2fd43a58e043a9ab727741d
The old callback only report interface list, new callback could provide
the mapping of interface and type. Replace old callback usage in cts
with new callback and check whether old callback could get the correct
interface list by comparing the result between old and new callback.
Bug: 162920185
Bug: 152203943
Test: atest CtsTetheringTest on S
atest CtsTetheringTestLatestSdk on R
atest MtsTetheringTestLatestSdk on S and R
Ignore-AOSP-First: Its dependences CL is not in aosp currently.
Change-Id: I2a0b8c43fb340c3eaed7f0f90464199222a24280
The change aosp/1708088 break tethering unit test in R.
Bug: 187946226
Test: atest TetheringTests in R and S
Change-Id: I4eb4b757f6d7cd3458964c81310dcf0687a4f091
Merged-In: I4eb4b757f6d7cd3458964c81310dcf0687a4f091
The change aosp/1708088 break tethering unit test in R.
Bug: 187946226
Test: atest TetheringTests in R and S
Change-Id: I4eb4b757f6d7cd3458964c81310dcf0687a4f091
startTrackDefaultNetwork was allowed to called multiple times
before even though there is no one actually do it. However,
in the TetheringTest#verifyDefaultNetworkRequestFiled, a
manual invocation is used to ensure that function supports
multiple entrance.
But with aosp/1697371, startTrackDefaultNetwork is no longer
allowed to be called multiple times, it would lead to log.wtf
and crash system in eng build.
Since the manual invocation of startTrackDefaultNetwork is not
realistic and no longer valid anymore, remove the invocation
that caused the trouble.
Test: atest TetheringCoverageTests
Bug: 188613493
Change-Id: I61f6088783d521fd17ae1e87370842b4239fbe75
Before this change, tethering always report a list of tethered
interfaces and the caller need to use each tethering type's interface
regex to matching tethered list to manual implement the mapping of
tethering type and interface. This change allow caller to get rid of
tethering interface regex.
Bug: 162920185
Bug: 152203943
Test: atest CtsTetheringTest on S
Ignore-AOSP-First: Currently aosp would automerge to mainlne-prod, merge
to sc-dev first to avoid adding new API to mainline-prod
CTS-Coverage-Bug: I already add cts test(ag/14622456), but Lint
still complaint because my cts is under packages/modules/Connectivity/
but it only check whether CL touching platform/cts
Change-Id: I91bcccd676d109c1b974497ac29bd366a41b8899
E.g. Accessing hidden method
Landroid/net/TetheringManager$TetheringInterfaceRegexps;
->getTetherableWifiRegexs()Ljava/util/List; (blacklist, linking, denied)
Bug: 183459282
Test: atest MtsTetheringTest on both R and S platform
Ignore-AOSP-First: change already in AOSP.
Change-Id: I3c5f08615fcf897fac59f2493be5337f78c2fdc7
This is supported by:
1. Utilize the new API from both NetworkStatsProvider
and IOffloadControl to send data warning quota to hardware.
And pass the warning reached notification back to NPMS.
2. Disable software solution introduced in R release for
V1.1+ hardware, since now we can fully offload data warning
and limit notification to hardware.
Test: atest TetheringTests
Fix: 149467454
Ignore-AOSP-First: avoid long automerger delay
Change-Id: Ie49461694d77ab7f25a549433b01b5b0167bd489
This is a no-op change that just adapt new API from
NetworkStatsProvider to get warning and limit bytes at the same
time. This change also stores them locally for subsequent
patches to set warning bytes to hardware.
Test: Will be included in the subsequent patch.
Bug: 149467454
Ignore-AOSP-First: avoid long automerger delay
Change-Id: Iec01cb01fd1ce481ce0bd736762baddde1e38084
This is a no-op change that redirect both V1.0 and V1.1 callback
events to the same handling function. Since the V1.1 callback
is extended from V1.0 callback, we can safely use V1.1
callback for both V1.0 and V1.1 control.
The change also provides interface for subsequent
OffloadController changes to set warning and limit at the
same time.
Test: atest TetheringTests
Bug: 149467454
Ignore-AOSP-First: avoid long automerger delay
Change-Id: I6505a04de8c57357dd1fa9ce898c13395e497816