This CL also adds SOCK_DESTROY constants.
These changes will be used by upcoming CLs that implement socket destroy
in ConnectivityService.
Bug: 270298713
Test: atest NetworkStaticLibTests
Change-Id: Ief507b3f8cc4fe23c08699e7fc8f3f62e5acfcdc
Before this CL, StructInetDiagSockId.parse convert v4-mapped v6 address
to Inet4Address that is inconsistent with the value in
inet_diag_msg.idiag_family.
Also, due to this behavior, input of parse and output of pack could be
different.
This is the issue specifically when SOCK_DESTROY request is populated
based on the InetDiagMessage from the kernel.
Bug: 270298713
Test: atest NetworkStaticLibTests
Change-Id: I45256bb1069cfc4e01662b3a533077933f3f019a
StructInetDiagMsg#parse used absolute position to parse id and idiag_uid
fields.
This causes an issue when byte buffer contains multiple netlink messages
and parsed netlink message starts from the middle of byte buffer.
This CL fixes above issue and adds test for the case that single byte
buffer contains multiple netlink messages.
Test: atest NetworkStaticLibTests
Change-Id: I771daf17b4a606915d5edefd9f0e90ef01abf168
NLM_F_REPLACE is helpful when we only want to update the preferred and
valid lifetime for a specific IPv6 address. DHCPv6 prefix delegation
gives a concrete example, once client refreshes the delegated prefix
successfully in RENEW or REBIND state, it also needs to extend the
preferred and valid lifetime of an IPv6 address, otherwise, it becomes
depreacated when the lifetime expires. Add the NLM_F_REPLACE flag to
replace the existing matching address object with updated fields.
Bug: 260934173
Test: atest NetworkStaticLibsTests
Change-Id: Ic001ddf9cfb031a586bbe177819e7666eaf7cde0
This method is better removed, because it doesn't follow the
naming conventions we want to keep in this file. It also isn't
useful :
• There is only one use of it outside tests, and it's in the
same file. It's trivial to inline it.
• The method has a unit test, which becomes useless once the
method is inlined.
• There is a corresponding command in the interpreter, but it's
only used by the unit test and therefore can be removed once
the unit test is removed.
Test: TH
Bug: 157405399
Change-Id: Ib5b1369ac28e4577adc98204e42ff2f27729e64c
This is not clearer than using the base method.
Test: ConnectivityServiceTest NetworkStaticLibTests
Bug: 157405399
Change-Id: Iac9aeffb563d0a1cb6c1287b46b9bbfffc0c75ca
In aosp, getModuleVersion would always throw since there is
no meta-info for modules. Currently it would make
isFeatureEnabled method return false, which is not
a right thing for features are default enabled.
Change it to return default value when throwed.
Test: atest NetworkStaticLibTests
Bug: 263219497
Change-Id: Iadcdcedac1f1da7d894e03b76b3e985f87ca8b0e
no need to use U32, of which uses I'd like to eliminate wherever possible
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8c0a2df73c4153b21d33ee7a8f5d434f0fc80103
This is a helper function that lets a caller make sure the
side effects of a piece of code are visible both on a handler
thread and in the caller thread before continuing.
Also move HandlerUtilsTests to the tests directory of
frameworks/libs/net from the NetworkStack where it used to be
Test: NetworkStaticLibTests
Change-Id: Icf1bd8bbe1216777c52b73cfbd0a46b647b72260
Move code to common lib to support coming TCP socket polling
design in connectivity module to prevent code duplication.
Bug: 259000745
Test: atest FrameworksNetTests
Change-Id: I89ca1c19122c3b4306b93a6a253e0ea67259eb77
This is re-upload of aosp/1390056, CL that fixes test is separated
in a follow-up CL that submit at the same time.
Bug: 139774492
Test: atest DnsAnswerProviderTest TestDnsServerTest
Change-Id: Ia72975f3044f009ebb0f4564a527830268a4a157
- address flags preferrence, support u32 flags
- assert IP address should not be null
- add unit tests for the update.
Bug: 260934173
Test: atest NetworkStaticLibTests
Change-Id: I18b3a717a9602748617cad279f65c0fefd5dec48
Revert "[ST03.1] Add DnsAnswerProviderTest"
Revert submission 1390056-st03
Reason for revert: test failed in presubmit, still under checking.
Reverted Changes:
Ia5039a47f:[ST03] Add test dns server for integration tests
I9157e030c:[ST03.1] Add DnsAnswerProviderTest
Change-Id: I1ff291ca62e2209343ed5c5e4aa3bf3e93229f47
Sometimes the tests are run under high load, e.g. immediately
after boot while all apps that listen for the boot completed
broadcast run their listeners. Under these circumstances,
40ms of leeway is tight ; on recent Android devices HZ is
commonly 100 too, meaning a general time unit of 60 will give
a little bit of air.
The drawback in this is that the test is less stringent on
TrackRecord, which as a multi-thread primitive should have
really tight tests to make sure that a non-threading primitive
(e.g. a polling implementation) doesn't pass. This patch makes
the testing on that front a little bit less reliable.
Note that this patch won't actually fix all flakes in that it
isn't really possible to guarantee the device will have any
CPU time to run the test at all anyway, but this should make
most failures go away.
Also, the argument for the time unit is never used, and can
be removed ; at least, the possibility of the timeArg() func
not using the same value as the sleep directive is scary, so
that possibility should be removed. If the time unit argument
is ever needed it can be added back, but considering the arg
has been available for years and never used, it's unlikely.
Test: NetworkStaticLibTests
Fixes: 254188131
Change-Id: Ia7a4fe775942484dcd7dc223c7710e82a8329beb
In Java, "poll" methods return null when the collection is
empty. Respect this convention.
Bug: 157405399
Test: FrameworksNetTests
Change-Id: I3b17908f9ce1f60b18908605a645da3199c010b9
The default timeout for expectEventually is 30 seconds, so this
test used to take one minute. With this change, it now only takes
50ms, with virtually no change in safety.
Test: NetworkStaticLibTests
Change-Id: Id8d6a738ea6a70f7d901a7659b2160c2f3d7d2c0
This tests a utility in f/l/n, so it should live together with
it and not in the network stack tests
Test: NetworkStaticLibTests NetworkStackTests
Change-Id: I90d12933e3a82eba4b565022d3df1e7c1d503f56