This code is used by the DNS resolver mainline module, so it
should be in a directory that is automerged to sc-mainline-prod,
not in /system/core.
Test: m
Change-Id: I2d953afa3d2766ca2b4529e9e49151c098b466aa
Android Lint doesn't handle API change from @SystemApi to public API
correctly (see b/193460475). We have to manually suppress those
warnings for now.
This CL suppresses warnings related to:
- IpPrefix(InetAddress, int)
- RouteInfo#getType
Bug: 186082280
Test: presubmit
Change-Id: Ib24b2d3fb21b86bd9e3555316a5a5bcb94434c00
Android Lint doesn't handle API change from @SystemApi to public API
correctly (see b/193460475). We have to manually suppress those
warnings for now.
This CL suppresses warnings related to:
- IpPrefix(InetAddress, int)
- RouteInfo#getType
Bug: 186082280
Test: presubmit
Change-Id: Ib24b2d3fb21b86bd9e3555316a5a5bcb94434c00
Added SPDX-license-identifier-Apache-2.0 to:
common/native/bpf_map_utils/Android.bp
Bug: 68860345
Bug: 151177513
Bug: 151953481
Test: m all
Change-Id: I4f254c63df574bcce60aa5854107fccbb888f424
* changes:
Add StructUdpHeader class to parse UDP header from a packet
Add StructTcpHeader class to parse TCP header from a packet
Add StructIpv4Header class to parse IPv4 header from a packet
libconn_for_netd.so in tethering module needs utilities in libnetdutils,
e.g. Status class.
Bug: 202086915
Test: m
Change-Id: Idb7f11d146570972f2467b7faa624f41bd859062
retrieveProgram() in bpf_syscall_wrappers is used by libnetd_mainline.
Bug: 202086915
Test: m; flash; boot
Change-Id: I69573a6925fd9f5fcd65935d681e7a340ee73f17
This is useful for some tests that need to make sure a few
things all happen, but some of them may throw an exception.
In vanilla Java you'd say
try {
...
} finally {
try {
...
} finally {
try {
...
} finally {
...
}
}
}
With this patch, you can pass a list of blocks to clean.
Kotlin :
tryTest {
...
} cleanupStep {
...
} cleanupStep {
...
} cleanup {
...
}
Java :
tryAndCleanup(() -> {
...
}, () -> {
...
}, () -> {
...
})
This keeps the semantics of tryTest{} of throwing any
exception that was thrown in tryTest{} and adding the
exception in the cleanup steps as suppressed.
Test: new tests for this
Change-Id: Ie26b802cb4893e13a70646aa0b7887701dee1ec6
1. Move BPF map definition and utilities to a common place that easy to
be referenced from both mainline module and platform code.
2. Create cc_library_headers bpf_map_utils which includes BPF map
definition and utils.
Bug: 202086915
Test: m; flash; boot
Test: cd system/netd/ && atest
Test: cd packages/modules/Connectivity && atest
Test: m gpuservice_unittest libtimeinstate_test bpf_module_test
CtsAppOpsTestCases libbpf_load_test VtsBootconfigTest
vts_test_binary_bpf_module bpf_benchmark libbpf_load_test
libbpf_android_test
Change-Id: I4d54b0d69029f593b8da3099d7ae16279692dabd
The FUSE daemon in MediaProvider needs to access the file descriptor of
its pinned BPF program.
The BPF syscall wrappers are handy and would avoid code duplication,
thus extend this project visibility to MediaProvider.
Bug: 202785178
Test: adb logcat FuseDaemon:V \*:S (in git_master)
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: I406c760bb96d74597ca7d8f701cd12c3bd318f68
- Allows clients of DnsRecordParser to explicitly mention
whether name compression is supported.
Test: atest NetworkStaticLibTests
Bug: b/207710965
Change-Id: Iac92f062a16f8f28f58cb180ab27e7626a9bd701
This is the same thing try{} does, and allows to lift
return out of tryTest.
This allows syntaxes like :
fun foo() = try {
"Foo";
} cleanup {
doSomeCleanup()
}
}
val network = try {
registerNetworkCallback
callback.getNetwork()
} cleanup {
unregisterNetworkCallback
}
}
Note: bypassing ktlint because of b/185077240
Test: FrameworksNetTests
Change-Id: Ib8f6fde7ccfd62fdcb3c1e3b7b03909ed94d4b23
Non-local returns will prevent the execution of the cleanup{}
block, which is too much of a footgun to allow. See the bug
for details of how it happens.
There doesn't seem to be a way to keep the nice syntax, allow
non-local returns and still guarantee execution of the cleanup
block in all cases. Thus, forbid non-local returns. Users can
still use return@tryTest to accomplish almost the same thing,
and the next patch will also let tryTest{} return its last
evaluated value, fixing remaining cases.
E.g.
tryTest {
foo()
if (condition) return result
bar()
} cleanup {
doCleanup()
}
can always be written
return tryTest {
foo()
if (condition) return@tryTest result
bar()
} cleanup {
doCleanup()
}
...and it's a rare case, so the additional syntax is acceptable.
Test: NetworkStaticLibTests
Bug: 207358921
Change-Id: I40443acf7e4d86813641adc877e27fb2334d0daf
In fact the test already passes, because addSuppressed contains
an explicit test that if this === argument, then it doesn't add
it. But otherwise that's a bug in tryCleanup
Test: NetworkStaticLibTests
Change-Id: I202790bbe8d82445c5affdd9076561c2c6ea9b59
- Packages that don't need the entire 'net-utils-framework-common'
library can depend on this lightweight library.
- This library does not depend on 'framework-annotations' which
was a problem for the mainline modularization team in allowing
other libs to depend on it.
- Spins off the DnsRecord parsing logic into its own class so that
custom DNS resolvers can re-use it.
Test: atest NetworkStaticLibTests
Bug: 193442330
Change-Id: I27d6ee4591d8ab126b7df31f0df8377794fa50f1
Some tests need to create a Context with assigned user and
should delegate to orignal Context. Thus, add
ContextUtils#mockContextAsUser to factorize the usage.
Bug: 170593746
Test: atest FrameworksNetTests
Change-Id: I93f64a141709e181276ed4b5195811c36100c1d0
libnetdutils is referenced by netd.c and TrafficController.cpp, which
are going to be mainlined. Therefore, move libnetdutils to a common
place where both mainline module and platform code (Netd) can refer to.
Bug: 202086915
Test: build; flash; cd system/netd; atest
No-Typo-Check: Clean code move with no other changes.
BYPASS_INCLUSIVE_LANGUAGE_REASON=Clean code move with no other changes.
Merged-In: I645bfe35f6543149c9a9f894cd4158d27a481abe
Change-Id: I645bfe35f6543149c9a9f894cd4158d27a481abe
Move test classes that were not in the same com.android.module.util
package as their associated class into the right package, and make
net-utils-service-common visible to tests.
Bug: 207020032
Test: atest ConnectivityCoverageTests
Change-Id: Iabe86a7d4c2437b3d01d68d53fb01d4e3c05a02b
Enable the strict_updatability_linting here first as a prior
commit to enable strict_updatability_linting in connectivity
modules.
Bug: 188851968
Test: m lint-check ; atest NetworkStaticLibTests
Change-Id: Idac98a1c85bf5bb86269b1daad2b444cfb58db8a