This patch tries to change accept_ra_rt_info_max_plen to 64 from its
default value of 0 on kernels that support router advertisements with
route information options. The code fails silently on older unsupported
platforms.
Also factor existing startIPv6() code into a self documenting function
enableInterfaceIpv6PrivacyExtensions()
Bug: 33333670
Test: as follows
- build sailfish
- flashed
- booted
- runtest frameworks-net passes
- runtest frameworks-wifi passes
Change-Id: I10ec83b9e04836089477d74417b7222499820066
This patch adds a few missing counters to APF events:
- an actual lifetime duration to ApfProgramEvent.
- counters for total number of updates to ApfStatistics.
ApfProgramEvents are now recorded at program removal in order to
populate the actual lifetime of the program. ApfProgramEvents whose
actual lifetime was less than 1 second are filtered out.
Finally, instance fields of ApfProgramEvent and ApfStats classes are
made mutable to allow for simple record-like creation. This was not
possible when these classes were tagged @SystemApi.
Test: - manually verified output of $ dumpsys connmetrics list
- unit tests updated.
Bug: 34901696
Change-Id: I02694ebb9421ce1c2aa757fa6aa209d19a654dcd
This allows an application that knows how to provide seamless
network connectivity (e.g., using QUIC multipath) to find out if
doing so is desired.
Test: builds, boots, runtest frameworks-net passes.
Bug: 34630278
Change-Id: Ic7fd0b9e1cd879fdfaf84009d7125391895e9087
Rename the class and ensure that all code related to bad wifi
avoidance has names that reflect its purpose. This will allow us
to reuse most of the the code for other purposes in future CLs.
Test: runtest frameworks-net passes
Bug: 34630278
Change-Id: Ida190e5a79e7a12f4eec07e1a3e4d9d138e83bcd
testApfFilterRa is failing with probabiliy 1/10 ~ 1/15 on the following
assert: assertDrop(program, packet, lifetime/6), for lifetime values
that are multiple of 6, where 6 is the hardcoded fraction of RA lifetime
to filter in ApfFilter.java.
When the lifetime is not a multiple of 6, the remainder of 1 to 5
seconds gives enough margin so that when the APF program is simulated
the faked lifetime of the program is less than lifetime/6 away and the
packet is dropped.
However for lifetimes which are exact multiples of 6, this margin is
always 0s and that result in nondeterminism in the result. This is
consistent with the obervation that the only failed assert was for a
lifetime of 300s, the only multiple of 6.
This can be observed by detecting the age limit at which the filter
stops dropping packet oscillating between lifetime/6 and lifetime/6 + 1
for lifetimes which are multiple of 6.
This patch fixes the flakyness by freezing the flow of time in tests so
that the expected filter age threshold is consistent and stable.
Test: no failure observed in 1000 runs.
Bug: 32561414
Change-Id: I5251d047039f34b82ce8a5d20ae46563e1e0cce8
This patch replaces System.currentTimeMillis() with
SystemClock.elapsedRealTime() to make RA lifetime computation more
resilient to various external events inducing jumps in
currentTimeMillis().
Test: ApfTest passes.
(cherry picked from commit 305af8e98a4fce712c1a93daf3b050dac2e8b91a)
Change-Id: Idbde700025fecfecefb8162d66b94194a87829d5
This patch adds a getUint8 getter for ByteBuffers and changes ApfFilter
to make uses of getUint8/16/32 everywhere.
The return types of getUint16 is also changed from long to int, which
will expand gracefully to long as an unsigned int as it is guaranteed to
be positive after getUint16.
Test: ApfTest passes
(cherry picked from commit 995dd94673005b43d32456e2de5fda0090b23576)
Change-Id: Idde3c9d03d39fbdf6f9b84d398f3fe8ea371483d
Network usage is tracked by the kernel at the UID level, which is
granular enough for normal apps, but large components (such as the
system server) are impossible to debug without adding additional
socket tagging to help identify subsystems within a UID.
To help ensure that system components tag all their network traffic,
this change offers a new StrictMode option to detect and report
untagged sockets.
Test: builds, boots, all common traffic tagged
Bug: 30943431, 30414041
Change-Id: I825c7941076054732264690247de2863342638e2
Test: as follows
- built
- flashed
- booted
- runtest frameworks-wifi passes (though no test covers this code yet)
Bug: 34210527
Change-Id: I2d44445982dfb3221f7b6394daf0479c1fa8a6e1
Test: as follows
- built
- flashed
- booted
- runtest frameworks-wifi passes (though no test covers this code yet)
Bug: 34210527
Change-Id: I2d44445982dfb3221f7b6394daf0479c1fa8a6e1
During IpManager startup, anything sending messages to the state machine
must not begin doing so until after the state machine has been started.
Reorder the constructor accordingly.
During shutdown, AvoidBadWifiTracker needs to unregister the registered
BroadcastReceiver and might as well also unregister the ContentObserver.
Test: backport from internal
Bug: 33388922
Change-Id: I58e07f7ccddaab160c153bcfb69fd45f50bb8710
During IpManager startup, anything sending messages to the state machine
must not begin doing so until after the state machine has been started.
Reorder the constructor accordingly.
During shutdown, AvoidBadWifiTracker needs to unregister the registered
BroadcastReceiver and might as well also unregister the ContentObserver.
Bug: 33388922
Change-Id: I58e07f7ccddaab160c153bcfb69fd45f50bb8710
Per https://tools.ietf.org/html/rfc7844#section-3.7
When using the anonymity profile, DHCP clients SHOULD NOT send the
Host Name option.
Once the net.hostname property is removed and ensured unset via CTS
this option will no longer be sent.
Test: as follows
- build, flashed
- connected to v4-only and dualstack networks, verified v4 works
- android.net.dhcp.DhcpPacketTest passes
- setprop net.hostname "" and verified no hostname option
Bug: 30979015
Change-Id: Ieab3f04ea38e176d9147bb788742a5397762c2e4
Test: new unit test + $ runtest franeworks-net
Bug: 32833400
(cherry picked from commit f98182ef5e80ede5de7f2c2a5f40fc92a46c9704)
Change-Id: I4c46304b9dc8105123fc02a29f99dbc835248eb0
Test: new unit test + $ runtest franeworks-net
Bug: 32833400
(cherry picked from commit f98182ef5e80ede5de7f2c2a5f40fc92a46c9704)
Change-Id: Ifaf6e778c811c7d865c790a293b1fce3f43cad1c
This patch replaces System.currentTimeMillis() with
SystemClock.elapsedRealTime() to make RA lifetime computation more
resilient to various external events inducing jumps in
currentTimeMillis().
Test: ApfTest passes.
(cherry picked from commit 305af8e98a4fce712c1a93daf3b050dac2e8b91a)
Change-Id: If19011fc0c905948f2e42b975cfcc5f8672a95fb
This patch removes the synchronization around the private variable
mRunning inside of IpReachabilityMonitor and instead qualifeis the field
as volatile.
Synchronization is not needed for reads/writes on native fields or
object references because they are already guaranteed to be atomic.
Synchronization here was used for enforcing memory visibility across
concurrent threads indirectly through monitor acquire/release.
The volatile keyword achieves this in a more explicit way.
Also, this patch changes the way that probeAll() copies the
IpReachabilityMonitor's mIpWatchList by temporary holding mIpWatchList
keys into an ArrayList instead of a more expensive HashSet. Since Java
HashSet are just degenerated HashMaps, and that key iteration order is
based on key hash, the iteration order over this temporary collection
will be consistent for the same mIpWatchList.
Test: refactoring CL. Existing unit tests still pass.
(cherry picked from commit b0f1186c034c4df9eb54ed29944d16ce6d7ade56)
Change-Id: I48d2b4d837a459150cd431b400ec01b87b48c014
This patch adds a getUint8 getter for ByteBuffers and changes ApfFilter
to make uses of getUint8/16/32 everywhere.
The return types of getUint16 is also changed from long to int, which
will expand gracefully to long as an unsigned int as it is guaranteed to
be positive after getUint16.
Test: ApfTest passes
(cherry picked from commit 995dd94673005b43d32456e2de5fda0090b23576)
Change-Id: I606ebc5aedfcacde400d27cc6bc37145769b122c