Returning the number of the file descriptor isn't actually useful since
it doesn't really tell you anything once the program has terminated.
(most logs we look at are long after the fact)
However, it does involve a fair bit of string processing to generate
the errors. This is particularly an issue for things we constantly
call and sometimes expect to fail. For example it is normal for
getNextKey() to fail with ENOENT at the end of iteration...
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib94037440b5fcaa34cc8aa01b165431efabeb377
This change adds the test coverage for DnsSvcbRecord
and DnsSvcbPacket.
Bug: 240259333
Test: atest ConnectivityCoverageTests
Change-Id: I0b6328337fd61c5ac2e5f6b3737238f7d678245a
DnsSvcbPacket will be used to parse DNS packet of type SVCB.
Bug: 240259333
Test: will add some tests in a follow-up change
Change-Id: Icb13d50f2d95a898b3b7ea373db876f41690723a
This change is an initial implementation of DNS SVCB Record. It
can parse an SVCB Record in wire format.
The RDATA field of a SVCB Record is formatted as follows:
- SvcPriority: 2-byte field
- TargetName: a domain name that follows RFC1035 section 5.1
- SvcParams (optional): a list of SvcParam
This initial implementation focuses on the SvcParams related to DDR,
including alpn, port, ipv4hint, ipv6hint, and dohpath. For the other
SvcParams, such as mandatory and ech, this change doesn't check
whether their value is valid.
Bug: 240259333
Test: atest ConnectivityCoverageTests
Test: No test for DnsSvcbRecord for now. will add some tests in a
follow-up change
Change-Id: Icfe9b623eda8390c40b106123a718cdd2af3af99
This is needed by the callers to determine if the Tethering
module is new enough to support the API that get whether
the network is blocked for the given uid and conditions.
Test: adb shell cmd network_stack is-uid-networking-blocked <uid> <metered>
Bug: 297836825
Change-Id: Ie79eacb1e63ff60291ad4f0ef6e8bba5ab0bdb07
This is no longer used out of this file, and should not be.
Test: Build
Change-Id: I531191b4afbda39a5fbaf1f483d13068f86d17f1
Merged-In: Ief0a79883bcc2c5493807c548cb71ef655abed23
(mostly to improve code coverage)
We can always revert if it ever turns out this is useful,
but I'd prefer for cgroup attach to be a once-at-boot
thing and handled either from bpfloader or the netd updatable
which are both directly C++ code.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I79b5ca8a47388cb6b9189234942e74ab6056aab9
* changes:
Add toString for more consistent logging to IaPrefixOption
Create IpPrefix in IaPrefixOption constructor
Add @Computed annotation to Struct
Remove check that preferred lifetime >= t2
Remove IA prefix option option-code from public constructor
The constructor is invoked during Struct#parse() at which point we might
as well try to create the IpPrefix object which will be used later. If
this fails for some reason (UnknownHostException or ClassCastException),
the prefix is bogus and should not be used.
Test: TH
Change-Id: I7e0090735022d017ba11aa85266ba19e65807da7
@Computed will ignore "computed" fields from struct parsing. Fields
cannot both be annotated by @Computed and @Field (though there
currently is no check for this).
Test: builds
Change-Id: I29fe506c5e3be4cc50fdaf3a07fc5e922111165b
For a single address, DHCPv6 won't work well (i.e. potentially lose provisioning) if
the preferred lifetime is lower than t2. However, this might be a valid
scenario in a renumbering event in the presence of multiple prefixes.
Additionally, in DHCPv6 it is up to the server to configure the client
correctly.
Test: TH
Change-Id: I37b2a0b89deda85b3f7be29c8f02f685aa6e65f8
Since it is constant. Struct.parse() still requires a constructor that
includes the code field, so it is marked protected.
Test: TH
Change-Id: Iccb4e3ec4078e0dcc73836f0d1b721146153da50
A helper class to *read* java BpfMaps. This is designed to
provide direct bpf access in the caller process through
ConnectivityManager APIs.
The change also removes any statical link to
net-utils-device-common-struct from service-connectivity.
This is because net-utils-device-common-struct is already
included in framework-connectivity. Including it again in
service-connectivity would create a r8 build fail by circular
dependency.
Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.net.module.util.StructTest
Test: atest FrameworksNetTests:android.net.connectivity.android.net.BpfNetMapsReaderTest
Bug: 297836825
Change-Id: I7a6d2eb816d0dc7343167bddd672806b199f44fe
There are only three calls to this method, and two of them
are with a list of 1 address which means it's simpler inlined.
The last call will be replaced with calls to RouteController
in a followup, meaning we addRoutesToLocalNetwork can be removed.
Test: RouterAdvertisementDaemonTest
NetdUtilsTest
Change-Id: I3b6ee1db40f09954b336321000735a66306bf000