1. Correct the API annotation.
2. The entry deletion failure causes the exception in cleanTestMap().
3. Use AtomicInteger to be the counter in the lambda.
Test: atest BpfMapTest
Change-Id: I4a56038881a38bda993ef5303b71f0e2a99f03d1
Move BaseNetdUnsolicitedEventListener to frameworks/libs/net and
create a new library - netd-client for using.
Also remove netd_aidl_interface-unstable-java since netd-client
links to the stable one.
Bug: 174837473
Test: Manual test and check the log.
Change-Id: Id65142b8c13a6cccbfe387d4ab757967497546e6
BT tethering is the only user of #tether and #untether API.
Enable BT tethering may fail by race between interface status change
and #tether call. In starting BT tethering flow, tethering may receive
pan interface DOWN and UP then PanService call #tether to request for
processing its pan interface. Tethering put interface status change
event into handler queue but it process #tether and #unether calls
right away without order them by queue. It makes tethering handle
binder call #tether before pan interface DOWN even DOWN event arrived
eailer. This cause BT tethering bring down by interface DOWN event
unexpectedly. Although this still can't fix all the race cases of
tethering, but at lesat this could fix the race mentioned above.
Bug: 173310882
Test: manual ON/OFF bt tethering
atest TetheringTests
Change-Id: I2411378aa36ad4371cca12423bb65542cb8df7a1
mForwardedDownstreams is the set of downstreams who wanted upstream.
In other word, it don't contains localOnly tethering(e.g. local only
hotspot, wifi p2p tethering). Changing the list from mForwardedDownstreams
to mNotifyList make both tethered and localOnly tethering have connected
clients callback.
Bug: 172290164
Test: atest TetheringTests
Change-Id: I58fdb28efc616b00d63a1c237ea93aee4d8f2dcd
When user restriction turns on, all tethering functions should
be disabled. But tethering functions still work after
restrication is on. Because tethering request would be removed
from mActiveTetheringRequests after starting tethering that
will result in Tethering#isTetheringActive() always returns
false. Thus, update the design to check tethered interface to
ensure that any of tethering function is working.
Bug: 169596583
Test: atest TetheringTests
Test: Manually test that tethering function would be disabled
and notification would show to user after restriction
was on.
Change-Id: Icb9649a5ecdec2d029ac763b5b9b80042ad50eb9
Also add MtsTetheringTest which only run if tethering mainline
module is installed.
Bug: 166057846
Bug: 170265597
Test: atest TetheringTests
Change-Id: I434dda81eb5fab700d873a8ff3429b4222f0c7e6
The downstream do not be tracked if PrivateAddressCoordinator just
return cached address. Then, PrivateAddressCoordinator would not notify
that downstream if conflict happen.
Also remove the null check in getDownstreamPrefix because:
- An IpServer is only added to mDownstreams by requestDownstreamAddress.
- That method will only add the IpServer to mDownstreams if it has an
IPv4 address.
- As soon as that method returns, the IpServer sets mIpv4Address to the
address that was returned.
- When an IpServer is torn down, mIpv4Address is set to null after
releaseDownstream is called.
So it should never be possible for this to return null.
Bug: 168169687
Test: atest CtsTetheringTest
atest TetheringTests
Change-Id: Ide5206b013acdc499344e1c839a830c5b245af41
Currently tethering only pick prefix from 192.168.0.0/16. There is no
aviable tethering address if the upstream address is 192.168.x.y/16.
This change allow tethering to pick prefix from any private address
rnages. Now it still pick from 192.168.0.0/16 only to avoid behavior
change. Will have follow up commit to change the configuration.
Bug: 166057846
Bug: 170265597
Test: atest TetheringTests
atest CtsTetheringTest
Change-Id: Ib6304eb8b4788e9196d0af48e72f00a6bda73a5f
Make the IP subnet persistent if it do not conflict with upstream.
It allow client to reuse its IP that usually reduce DHCP procedure.
Bug: 168169687
Test: atest TetheringTests
Change-Id: Iddc5304730dce7b11c5d124b7eddce057d752bbd
Add the netfilter generic message header to
the netlink req. This is needed so the kernel
won't ignore the request for invalid params.
Bug: 149109043
Test: ConntrackSocketTest
Change-Id: I1757fdeb11a0cac5821021a22323cbd74fe22bdc
If vpn app make its netmask as 0, PrivateAddressCoordinator
would not able to find suitable address for tethering downstream.
Since tethering do not support vpn as upstream, just ignore vpn
in PrivateAddressCoordinator.
Bug: 166365863
Test: atest TetheringTests
atest CtsTetheringTest
Change-Id: Iabe265467044fea9fa437674ca29ffc7bcdefe3b
TetheredClient callback would additional check whether caller has
NETWORK_SETTINGS or {MAINLINE_}NETWORK_STACK permission, but it do not
grant for self accessing. InProcessTethering run in system server, so
the services in system server would fail to call TetheredClient callback.
Grant permission for self process.
Bug: 169231588
Test: atest CtsTetheringTest
Change-Id: Ic04e44aef4df772c718ff25ed331bf02f5940c1d
This patch is still needed and should go in now that the
error is fixed.
The patch was submitted into rvc-dev and is already in
rvc-dev-plus-aosp (patch in in ag/11923559, revert
skipped in ag/12072199). A follow-up will remove the
unused services.net-module-wifi target.
Test: originally tested in aosp/1324109
Test: m; manual: flashed, wifi and telephony working
Test: atest NetworkStackCoverageTests
Change-Id: I1074eedb0b0f156a1135e11210ec102de15ea674
Merged-In: Icd141a992c46290c74929785e261a1cd57bc001b
Some exsting applications may expect wifi p2p use legacy
"192.168.49.1/24" address. Have a configuration for wifi p2p to
decide whether to use legacy dedicated address or random address.
Bug: 161520826
Test: atest TetheringTests
Change-Id: If79973416a6780ee19ee785c65772b1a2dc1fbf7
If dhcp server is obsolete, explicitly stop it to shut down its thread.
Bug: 161418295
Test: atest CtsTetheringTest
Change-Id: Ic5b876bd23711ec8d832879a7baee0495246b218
This reverts commit cf86031c12.
Reason for revert: Breaks the build b/160390899
Merged-In: Icd141a992c46290c74929785e261a1cd57bc001b
Change-Id: Ie10e66f61393602f17fbb61bf17230b176bf1f44
The classes should not be picked up from frameworks/base, as they are
part of several mainline modules.
Also refine comments in DhcpResults following feedback in previous
change.
(cherry-pick from internal branch skipping wifi classes; no other
conflict)
Bug: 151052811
Test: m; manual: flashed, wifi and telephony working
Test: atest NetworkStackCoverageTests
Merged-In: I7074651c6a2a7a6b11bcf13cc4bb03833d7d655f
Change-Id: I7074651c6a2a7a6b11bcf13cc4bb03833d7d655f
TetheringNotificationUpdater create a PendingIntent with
Intent#FLAG_ACTIVITY_NEW_TASK flag. But this flag is used for
Intent only. Thus, move this flag into Intent.
Bug: 158639789
Test: atest TetheringTests
Change-Id: I4c3af75c87b797bcde9356a94c835c7422dac1c6
This change is a combination of following changes:
1) Tethering: add TETHERING_WIGIG type
Currently both WIFI and WIGIG use the same tethering type,
TETHERING_WIFI. This causes conflicts between the frameworks,
when both WIFI and WIGIG SoftAPs are started, one or both will
not work.
Fix this by using a seperate tethering type for WIGIG.
2) Tethering: remove TETHERING_WIGIG state machine on interface down
The wigig state machine relies on a TETHERING_STATE_CHANGED broadcast
that is sent when the tethering state machine is first created, during
interface up. Currently the tethering state machine is not removed
on interface down except for TETHERING_BLUETOOTH, and as a result
wigig tethering only works the first time SoftAP is started.
In order to fix this, remove the tethering state machine on interface
down for TETHERING_WIGIG as well.
Bug: 143356416
Test: TetheringCoverageTests
Change-Id: Ic4d3aca0ed69234093af7f0206dab3335938c52a
There is a protection in Settings that Settings would gray out if
tethering requires entitlement check but the entitlement app is
invalid. Tethering resource is moved from framework to tethering
module, so Settings can not fetch entitlement app name anymore.
In this change, tethering module would check whether entitltement app
package name is exsited if entitlement check is needed. Tethering would
be not supported (Settings tethering option would be hidded) if
entitlement app is not installed.
After moving the protection into tethering module,
TetherUtil#isProvisioningNeeded is no longer needed. Because The
only use case is Settings wants to gray out tethering setting
when entitltement check is needed but entitlement app is invalid.
Bug: 146918263
Test: atest TetheringCoverageTests
Change-Id: I9a5ff5dbc1db3f3be7fcd7146862a16b373507e6
Merged-In: I9a5ff5dbc1db3f3be7fcd7146862a16b373507e6
Tethering resource configuration is move from framwork to tethering
module. Since tethering resource would not be accessible from outside
of tethering module, EntitlementManager would tell Settings the
entitlement configuration via intent extra when run entitlement check.
Bug: 146918263
Test: atest TetheringTests
Change-Id: I6f23553bb1da5f0b767f920b32a86fafb9e00b9e
Merged-In: I6f23553bb1da5f0b767f920b32a86fafb9e00b9e
When LAN link is changed for using ethernet interface from Ethernet tethering to Ethernet,
there is confiict as Ethernet Tethering is trying to make ethernet link down and Ethernet is trying to make ethernet link up.
So, this would make Ethernet only manage ethernet interface link state.
Test: manual
Bug: 130840861
Change-Id: I1cd40ae764bdeecbb59e3889e9399b7f4b05f9cc
1. When Wi-Fi enabled, ap0 interface is added and IpNeighborMonitor's
start() is invoked in IpServer's constructor.
2. There's no stop for IpNeighborMonitor when IpServer stop.
3. During overnight test for Wi-Fi, networkstack is too slow to
process request due to memory leak in IpNeighborMonitor and
binder buffer is blocked causing exception.
Solution: Invoke IpNeighborMonitor.stop() in UnavailableState.enter().
Bug: 159097215
Test: automatic, turn on and off Wi-Fi every 6 seconds overnight
Change-Id: I8f60c13706f05306e8f25a15f7861d7ecabbc10e