Currently, debugging the tethering programs is not easy because
in case of any failure they simply return TC_ACT_OK. This CL adds
a number of counters that the program can increment in the case
of interesting events such as malformed packets.
At the moment the counters are stored in a global tethering error
map, which is an ARRAY map of 32-bit counters. This should not
take up much space because there are only a dozen of these.
We might not need all of these counters. In future CLs we can
reduce the number of counters, or perhaps move them to a map of
maps so as to have separate counters on a per-interface basis.
Test: manual
Change-Id: I3fcd7eb8d318700092949ff2f39987bf4ba3656c
This provides a place to store common definitions that can be
used by both the programs and by JNI code in the tethering
module.
Over time much of the tethering-specific code in bpf_shared.h
could move here.
Test: m
Bug: 177884581
Change-Id: I4bf2c762d61cd5db003d59880e6bf7d107ff1a07
This CL bypass adding NOT_VCN_MANAGED on R device. And add TODOs
for refactoring and adding test coverage.
Test: atest CtsNetTestCasesLatestSdk:NetworkRequestTest on R device
Bug: 175662146
Change-Id: Id09b19c13f9a74e25d45689d2211418172dfaec8
This would allow us to run both metered and unmetered networkpolicy
related tests when the device is on a cellular network.
Bug: 165343126
Test: atest CtsHostsideNetworkTests:HostsideRestrictBackgroundNetworkTests
Test: atest CtsHostsideNetworkTests:HostsideNetworkCallbackTests
Change-Id: Id70856dffc920e74bda28583dba4dd851a832397
Merged-In: Id70856dffc920e74bda28583dba4dd851a832397
Add NetdStaticLibTestsLib into Tethering MTS , so that the tests
under client-libs can also be run when running tethering MTS.
Bug: 170598012
Test: atest TetheringCoverageTests
Change-Id: Idd47becaa4254ab80b74ad5f3ddcdd4b017a5e69
Add code to BpfCoordinator to dump upstream IPv4 and IPv6 rules.
For IPv4, currently only the upstream map is printed, because the
downstream map is expected to be symmetrical.
Example output:
=============
21(21) -> 12(rmnet_data2) 86dd 00:00:00:00:00:00 00:00:00:00:00:00
[wlan1]: iif(iface) oif(iface) v6addr srcmac dstmac
12(rmnet_data2) 21(wlan1) /2001:240:2425:b5dc:21a9:995d:bc57:bc37 b2:b5:e0:24:21:c2 ca:06:8d:54:99:ad
[IPv4]: iif(iface) oif(iface) src nat dst
21(21) 12(rmnet_data2) 192.168.16.247:41544 -> 100.101.80.108:41544 -> 216.239.36.135:443
21(21) 12(rmnet_data2) 192.168.16.247:42028 -> 100.101.80.108:42028 -> 8.8.4.4:853
21(21) 12(rmnet_data2) 192.168.16.247:42032 -> 100.101.80.108:42032 -> 8.8.4.4:853
21(21) 12(rmnet_data2) 192.168.16.247:42042 -> 100.101.80.108:42042 -> 8.8.4.4:853
21(21) 12(rmnet_data2) 192.168.16.247:41816 -> 100.101.80.108:41816 -> 8.8.8.8:853
21(21) 12(rmnet_data2) 192.168.16.247:42040 -> 100.101.80.108:42040 -> 8.8.4.4:853
=============
Also make it possible to do "dumpsys tethering bpf" and get only
the BPF dump.
Test: manual
Change-Id: I2aaa2fdda7d724994090c26feff585f24cd3283b
- Add methods to start and stop IPv6 forwarding upstream
- Populate the upstream IPv6 map when the first rule for any
upstream/downstream pair is created.
- Clear the upstream IPv6 map when the last rule for any
upstream/downstream pair is deleted.
Test: Added coverage to IpServerTest and BpfCoordinatorTest
Change-Id: Ib041081e95f5f449489ab63138de034222ffac8f
The two value types are identical so there is no need to have
separate classes for them.
Test: atest TetheringTests
Change-Id: Ia622b082d0a44373d21f51222f5e675e5bde08e0
These are read-only intents and should not be mutated by any
app receiving them.
Bug: 178324405
Bug: 178249531
Test: atest TetheringTests TetheringCoverageTests GtsTetheringTestCases
Change-Id: I5395e7c19e6453640ad790f2b9a9ba22bbcefa88
The keys are identical, and the values nearly so, this will make everyone's life easier.
Test: git grep 'Tether(Down|Up)stream4(Key|Value)' finds nothing
(note this requires follow up commits)
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ifbff2c617ac5834ea80f827eaf89ca81e862baec
Access the IPv4 downstream and upstream BPF map with the built rules.
Test: atest TetheringCoverageTests
Change-Id: I8cd6e49b377c72250988019eea57f93cccd78309
All sources for the connectivity module are being moved to
frameworks/base/packages/Connectivity, so that they can all be moved to
packages/modules/Connectivity in one move keeping history.
INetworkAgent and INetworkAgentRegistry were created in
packages/modules/Connectivity directly, but this makes managing the
sources until the move harder as the module needs to pull sources from
two different locations. Considering that they do not have history to
move, just move them to frameworks/base/packages/Connectivity without
the commit history.
Bug: 171540887
Test: m
Change-Id: I1c7e83267014bff29eb938c002d6441332101248
* changes:
[NFCT.TETHER.8] Prepare the upstream information for IPv4 offload rule
[NFCT.TETHER.7] Prepare the downstream information for IPv4 offload rule
We want connection establishment/shutdown to flow through
the kernel code path so connection tracking state is at least
somewhat correct.
Test: atest, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iee97baa65750188f3436937b16c9b320f0495a5a
Build the upstream and upstream rules when the conntrack event is
received.
Test: atest TetheringCoverageTests
Change-Id: Ibb52c7b75812bd586091d809e260bc9206c06262
Add upstream interface index and its IPv4 address mapping
Required for building IPv4 forwarding rule when a conntrack event is
received.
Test: atest TetheringCoverageTests
Change-Id: I73f304777704f09481b80d18751e0bab5bab2edc
Add and remove downstream client information to BpfCoordinator
Required for building IPv4 forwarding rule when a conntrack event is
received. The IpServer provides the following elements of a rule which
is not included in conntrack event:
- Downstream interface index
- Downstream Mac address
- Client IP address to Client Mac address
Test: atest TetheringCoverageTests
Change-Id: I84db13acc047ace5730d17f0d3dd99544f516084