| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This allows clat to initialize properly when VPNs are configured
with "Block connections without VPN", rather than to error out with
"no IPv6 addresses were available for clat".
This issue primarily affects particular mobile networks configured
with NAT64 (without direct IPv4 connectivity).
Issue: calyxos#1288
Bug: 255040839
Change-Id: I4a8ee0295e0f5d1e330f7529856347b8bd10360c
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This eliminates the need for netd_updatable BpfHandler.cpp
to initialize the hash map with a zero.
On startup the map will be freshly initialized and thus zero.
On restart it might not be empty, but it doesn't matter to netd.
Furthermore the mainline component of the system server will
re-initialize it again anyway:
see service/native/TrafficController.cpp initMaps()
This does remove the ability to call deleteValue on a key,
since that would always return -EINVAL, but since we don't
currently do that, that's really a feature.
(It does suggest though that we should have a BpfMapNonNullable
class which is writeable, but without a deleteValue() function)
Additionally BpfMap arrays are more efficient for the kernel bpf jit
compiler, as - on newer kernels - it can optimize the read/write
into a simple memory access (as opposed to a bpf helper call).
Before:
$ adb shell ls -l /sys/fs/bpf/netd_shared/map_netd_configuration_map
-rw-rw---- 1 root net_bw_acct 0 2022-06-11 08:20 /sys/fs/bpf/netd_shared/ map_netd_configuration_map
After:
$ adbz shell ls -l /sys/fs/bpf/netd_shared/map_netd_configuration_map
-r--rw---- 1 root net_bw_acct 0 2022-06-16 15:03 /sys/fs/bpf/netd_shared/map_netd_configuration_map
Bug: 218408035
Bug: 235590615
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I21730e4fa22fbf0c94ab0ca5c5db03aa000b7680
(cherry picked from commit b10e055f4b63ef5ae12585069481558b93ecd87f)
Merged-In: I21730e4fa22fbf0c94ab0ca5c5db03aa000b7680
|
| |
|
|
|
|
|
|
|
| |
Bug: 235778483
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ife3ad35b2e5451727a3795a0e78dd820293c0eae
(cherry picked from commit ce9108f01a3713a11a1831d36f60aaa5d169cf11)
Merged-In: Ife3ad35b2e5451727a3795a0e78dd820293c0eae
|
| |\
| |
| |
| |
| |
| |
| |
| |
| | |
"cherrypicker-L06100000954878020:N56300001270177780" into tm-dev
* changes:
tests: simplify BpfMap.reset(createMap()) -> BpfMap.resetMap()
TrafficControllerTest - trivial simplification
simplify bpf tests and check type correctness
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
BpfMap.reset(createMap()) is equivalent to newly added BpfMap.resetMap(),
except that the latter makes it impossible to screw up the Key/Value sizes.
Bug: 235286176
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I290986e9ae8660f3fc6f73b086d33f4ab93d6095
(cherry picked from commit 439bac2e566eb8b52981a229e4be88a05b58149c)
Merged-In: I290986e9ae8660f3fc6f73b086d33f4ab93d6095
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
Bug: 235286176
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I25158126c968707f44f595f731547a8bd9bb503d
(cherry picked from commit ced3531ad5124234909b2e29d46b222197739134)
Merged-In: I25158126c968707f44f595f731547a8bd9bb503d
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We notice that:
BpfMap.reset(dupFd_with_cloexec(BpfMap.getMap())
is equivalent to
BpfMap = BpfMap
due to the current implementation of the BpfMap assignment operator.
Except the latter also verifies BpfMap<K,V> template types match.
Bug: 235286176
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I99fcf77bc6aa360b6a19e22c2cd58d67a1e62976
(cherry picked from commit 55ab87aa4937f562e6952c5b88e90eae6eca41c4)
Merged-In: I99fcf77bc6aa360b6a19e22c2cd58d67a1e62976
|
| |/
|
|
|
|
|
|
|
|
|
| |
Bug: 208371987
Test: atest
CtsNetTestCases:android.net.cts.ConnectivityManagerTest#testFirewallBlocking
ConnectivityServiceTest
Change-Id: Ib521fa02f6a19270cb88a3d85321bda822516c78
(cherry picked from commit 1d9054ba5fbbf86c821e0a74a5a2f9d3c9865e67)
Merged-In: Ib521fa02f6a19270cb88a3d85321bda822516c78
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Bug: 207773349
Bug: 208371987
Test: atest
CtsNetTestCases:android.net.cts.ConnectivityManagerTest#testFirewallBlocking
--iterations 50 && atest ConnectivityServiceTest --iterations 10
Change-Id: I60d5540821abcced03356f366775f16ee369d7f9
(cherry picked from commit d980149817948d11de0631caee8aee3172e4e159)
Merged-In: I60d5540821abcced03356f366775f16ee369d7f9
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the BPF code, per-UID network access (e.g., for doze mode,
standby, etc.) is stored in UidOwnerValue structures. Each of
these stores that UID's rules in a 32-bit bitmask of
UidOwnerMatchType values, so the code can support ~31 match
types.
However, which match types are enabled is stored in
configuration_map at index UID_RULES_CONFIGURATION_KEY, and
configuration_map only stores 8-bit values. So it's not
possible to define more than 7 match types.
Widen configuration_map to from 8 to 32 bits to match the width
of UidOwnerValue.rule. This doesn't impact memory because
configuration_map only has 2 entries.
Bug: 208371987
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7e1eee2daedd66d27965a2dd4ce6b4c3667892f7
(cherry picked from commit 60cbed385dcf3c640674c48b7cd4d60967047cf0)
Merged-In: I7e1eee2daedd66d27965a2dd4ce6b4c3667892f7
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, even when VPN Lockdown mode is enabled, incoming packets are
not dropped if VPN is not connected.
This commit fixed this issue.
After this commit, If VPN Lockdown mode is enabled, incoming packets
are dropped regardless of the VPN connectivity.
Bug: 206482423
Test: atest TrafficControllerTest ConnectivityServiceTest PermissionMonitorTest
Change-Id: If52ece613c8aac1073355e43b6fb9cb3fcc87d1d
(cherry picked from commit b08654ca0450d021da709a762ab509a8d4f87d40)
Merged-In: If52ece613c8aac1073355e43b6fb9cb3fcc87d1d
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Match type is also used in configuration_map at index
UID_RULES_CONFIGURATION_KEY.
However, this commit does not extend configuration_map and we can
not still use more than 8 match type in configuration_map.
Bug: 206482423
Test: m
Change-Id: I0f20cc8034551806b5cb3da322a0ea7861983095
(cherry picked from commit 42edc60627899989335dafa568f6bf724ea1a104)
Merged-In: I0f20cc8034551806b5cb3da322a0ea7861983095
|
| |
|
|
|
|
|
|
| |
Don't need anymore since ClatCoordinator uses common lib to access
clat bpf prog/map.
Test: atest libclat_test
Change-Id: I2c3242f8b14b0058420ccfd85bb5728062c852bc
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This a preparation to replace duplicated native functions with the
existing Java class.
Bug: 221213090
Test: atest FrameworksNetTests
Test: manual check
Steps:
1. Connect wlan and check map content {iface index, v4addr, v6addr, pfx96} manually
after clat started.
$ adb shell dumpsys netd
ClatdController
BPF ingress map: iif(iface) nat64Prefix v6Addr -> v4Addr oif(iface)
47(wlan0) 64:ff9b::/96 2a00:79e1:abc:6f02:2479:2f51:25a9:28f1 -> 192.0.0.4 53(v4-wlan0)
BPF egress map: iif(iface) v4Addr -> v6Addr nat64Prefix oif(iface)
53(v4-wlan0) 192.0.0.4 -> 2a00:79e1:abc:6f02:2479:2f51:25a9:28f1 64:ff9b::/96 47(wlan0) ether
2. Disconnect wlan and check the bpf map is removed.
$ adb shell dumpsys netd
ClatdController
BPF ingress map: iif(iface) nat64Prefix v6Addr -> v4Addr oif(iface)
BPF egress map: iif(iface) v4Addr -> v6Addr nat64Prefix oif(iface)
Change-Id: Ia0c90c7104c4a42d34a28a5ddf3cf13a289f8c76
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This a preparation to replace duplicated native functions with the
existing Java class.
Bug: 221213090
Test: atest FrameworksNetTests
Test: check map content {iface index, v4addr, v6addr, pfx96} manually.
The map fileds are the same as "ip addr" and clatd logging.
$ adb shell dumpsys netd
ClatdController
BPF ingress map: iif(iface) nat64Prefix v6Addr -> v4Addr oif(iface)
47(wlan0) 64:ff9b::/96 2a00:79e1:abc:6f02:f9e1:8c2d:604e:bc06 -> 192.0.0.4 53(v4-wlan0)
BPF egress map: iif(iface) v4Addr -> v6Addr nat64Prefix oif(iface)
53(v4-wlan0) 192.0.0.4 -> 2a00:79e1:abc:6f02:f9e1:8c2d:604e:bc06 64:ff9b::/96 47(wlan0) ether
$ adb shell ip addr
47: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ..
53: v4-wlan0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1472 ..
03-14 18:35:04.822 30852 30852 I clatd : Starting clat version 1.5 on wlan0 plat=64:ff9b:: v4=192.0.0.4 v6=2a00:79e1:abc:6f02:f9e1:8c2d:604e:bc06
Change-Id: I91d0cb6e76c4ef7bacf91b996786308ff4918f35
|
| |
|
|
|
|
| |
Test: presubmit
Bug: 219872355
Change-Id: Ie4fc87e5231e31799644c26943bbc13000091e92
|
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Enable ConnectivityService to dump BPF maps from libtraffic_controller.
Bug: 202086915
Test: adb shell dumpsys connectivity trafficcontroller
Test: atest CtsNetTestCases:ConnectivityManagerTest#testDumpBpfNetMaps
Test: run CTS in I021789813f116940d581e2c4a1fd357ff47bfa08
Change-Id: Ib0e935ee2b714ac61daceba6d13fa7a20f97f68f
|
| |/
|
|
|
|
|
|
| |
They are already under the same namespace.
Test: presubmit
Bug: 219872355
Change-Id: I5f51cf2c38755c99f220870c2ffe66ee8c454514
|
| |
|
|
|
|
|
|
| |
native_deleteTagData and native_setCounterSet is replaced as BpfMap java
implementation inside NetworkStatsService.java
Test: atest traffic_controller_unit_test
Change-Id: Ic33ca9d9887380d39becbd0dc3a0e159b3dc82a2
|
| |\
| |
| |
| |
| |
| |
| |
| |
| | |
* changes:
jni - dynamically link C++ - saves 43 kB
libservice-connectivity - dynamically link c++ - saves 600 kB
link libbase & libnetdutils dynamically - save ~17.5 kiB
remove spurious headers
libclat only depends on libbase_headers not libbase itself
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Before:
$ adbz root && adbz wait-for-device && adbz shell ls -l /apex/com.android.tethering/{bin/for-system,lib,liv64}
/apex/com.android.tethering/bin/for-system:
= -rwsr-sr-x 1 clat clat 18412 1969-12-31 16:00 clatd
/apex/com.android.tethering/lib:
= -rw-r--r-- 1 system system 64560 1969-12-31 16:00 libandroid_net_connectivity_com_android_net_module_util_jni.so
= -rw-r--r-- 1 system system 713636 1969-12-31 16:00 libc++.so
= -rw-r--r-- 1 system system 13596 1969-12-31 16:00 libframework-connectivity-jni.so
d -rw-r--r-- 1 system system 212624 1969-12-31 16:00 libnetd_updatable.so
d -rw-r--r-- 1 system system 948044 1969-12-31 16:00 libservice-connectivity.so
After:
$ adbz root && adbz wait-for-device && adbz shell ls -l /apex/com.android.
/apex/com.android.tethering/bin/for-system:
= -rwsr-sr-x 1 clat clat 18412 1969-12-31 16:00 clatd
/apex/com.android.tethering/lib:
= -rw-r--r-- 1 system system 64560 1969-12-31 16:00 libandroid_net_connectivity_com_android_net_module_util_jni.so
+ -rw-r--r-- 1 system system 251404 1969-12-31 16:00 libbase.so
= -rw-r--r-- 1 system system 713636 1969-12-31 16:00 libc++.so
= -rw-r--r-- 1 system system 13596 1969-12-31 16:00 libframework-connectivity-jni.so
d -rw-r--r-- 1 system system 45584 1969-12-31 16:00 libnetd_updatable.so
+ -rw-r--r-- 1 system system 95872 1969-12-31 16:00 libnetdutils.so
d -rw-r--r-- 1 system system 749980 1969-12-31 16:00 libservice-connectivity.so
Delta: -212624-948044+251404+45584+95872+749980 == -17828
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id88468442c4f3f24d5bca96b75effb69f20038bf
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
bpf_connectivity_headers already pulls in bpf_headers,
which already pulls in bpf_syscall_wrappers.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib22da8d433bd3187349f06f41ec064360c38982f
|
| | |
| |
| |
| |
| |
| | |
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iad66f0d4bed4100261e8aa7d135e62336cdd1ae8
|
| |/
|
|
|
|
| |
Bug: 190822356
Test: atest TrafficControllerTest
Change-Id: I84a95081ab6e6a86543fe2cddf0efdab16c90d72
|
| |
|
|
|
|
|
|
| |
netlink_listener_test tests the socket destroy listener, so it makes
sense to just merge it into the TrafficControllerTest.
Test: atest traffic_controller_unit_test
Change-Id: Ibc0b483203150aa2d7898a761fa4715dce6f4218
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
We are ready to remove traffic controller from netd, so
TrafficController::start() should be called from the system server.
This reverts commit c2984fdca83de11a6a4990576aab1596ef94909b.
Test: atest FrameworksNetTests FrameworksNetIntegrationTests
CtsNetTestCases:android.net.TrafficStatsTest NetworkUsageStatsTest
CtsHostsideNetworkTests
Change-Id: Ic324ad0c064271977ab35d7f55badee00098e196
|
| |
|
|
|
|
|
|
|
| |
TrafficController is currently still started by netd, and this should
not happen in two places. Instead, native_init should init (open) the
maps.
Test: atest FrameworksNetTests
Change-Id: Ifd6be50aa5f62e59a5b1c5c0a97550389fd0e7e1
|
| |
|
|
|
|
|
| |
Remove libutils dependency.
Test: m
Change-Id: I857e40c984bcce2931b5068b3b96d2c9dd69693c
|
| |
|
|
|
|
|
|
|
|
|
| |
There is not really a point to separate these two as they are all used
in ConnectivityService.
As a future TODO, we might want to rename libservice-connectivity to
libcom_android_server_jni to be more inline with the jarjar'ed jni lib
versions.
Test: atest FrameworksNetTests:ConnectivityServiceTest
Change-Id: I1b9f4fde345038bda6b3ffcf8e3f47cf9262e052
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Added SPDX-license-identifier-Apache-2.0 to:
service/native/Android.bp
Bug: 68860345
Bug: 151177513
Bug: 151953481
Test: m all
Change-Id: Ibfaed81348fca9e5cf313a4d29fd0b72bc746e06
|
| |\
| |
| |
| |
| |
| | |
* changes:
Rename libnetdbpf to libnetworkstats
Copy libnetdbpf from system/net to tethering module
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Two reason for renaming:
1. Avoid module name collision in sc-mainline-prod branch.
2. The libnetdbpf was misnamed before.
Bug: 202086915
Test: atest libnetworkstats_test FrameworksNetTests
ConnectivityCoverageTests FrameworksNetSmokeTests
CtsAppOpsTestCases
Change-Id: I87fcf4b1a9d58780a45743a9aa91b9b936e54266
|
| |\ \
| |/
|/|
| |
| |
| |
| |
| | |
* changes:
[CLATJ#20] ClatdCoordinator: stop bpf for clat
[CLATJ#19] ClatdCoordinator: configure bpf for clat
[CLATJ#18] libclat: move clat tc and bpf utilis from netd
[CLATJ#17] bpf_connectivity_headers visible to libclat
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
Move native functions from ClatdController and TcUtils to libclat
for jni ClatdCoordinator.
Bug: 212345928
Test: atest libclat_test
Change-Id: Ia4b344b07537d57c3e4ff1285b0e7b17e0c63c3e
|
| | |
| |
| |
| |
| |
| |
| |
| | |
This CL provides native methods to access BPF maps via a native library.
Bug: 202086915
Test: m; flash; boot;
Change-Id: I2e5d03d0c2e31ba11996d1b28ead9b552397fe29
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Delete tagSocket(), privilegedTagSocket() and untagSocket() revelant
test cases since thay are moved out of TrafficController in
aosp/1849156.
Bug: 202086915
Test: atest traffic_controller_unit_test passed
Change-Id: I605577ee4d7076f0c8ad75888a4d32bff90f6104
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Tethering module.
Delete tagSocket(), privilegedTagSocket() and untagSocket() since
they are moved out of TrafficController in aosp/1849156.
Bug: 202086915
Test: m; flash; boot;
Change-Id: Ifeaeb060fbf1add9f06748e7846b9e11e0345bda
|
| | |
| |
| |
| |
| |
| |
| |
| | |
Delete tagSocket(), privilegedTagSocket() and untagSocket() since
they are moved out of TrafficController in aosp/1849156.
Test: m
Change-Id: I6162c758446f597eb79734e00348dc8b1fe2d422
|
| |/
|
|
|
|
|
|
|
|
|
| |
git diff packages/modules/Connectivity/service/native/TrafficController.cpp system/netd/server/TrafficController.cpp
git diff packages/modules/Connectivity/service/native/TrafficControllerTest.cpp system/netd/server/TrafficControllerTest.cpp
git diff packages/modules/Connectivity/service/native/include/TrafficController.h system/netd/server/TrafficController.h
Test: m
No-Typo-Check: clean move
BYPASS_INCLUSIVE_LANGUAGE_REASON= clean move
Change-Id: I7c0200e28e5e4459477d370912277fa1281b786b
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
configure_packet_socket() is moved from ClatdController. Only change
the failure return value from errno to -errno. The remaining parts
are the same.
The test is modified from ClatdControllerTest::ConfigureIpv6Address.
Simply set socket filter to an interface and check that the packet
socket is bound to the interface. We can't check the socket filter
because there is no way to fetch it from the kernel.
Bug: 212345928
Test: build and boot
atest libclat_test
Change-Id: Ia33c21051b040829c7d2aa55ed5b7de8766c98c5
|
| |
|
|
|
|
|
|
|
|
|
| |
detect_mtu() is moved from ClatdController without behavior
change. The unique_fd for socket fd is replaced by primitive int
because libbase is not supported in mainline.
Bug: 212345928
Test: build and boot
atest libclat_test
Change-Id: Ib9c1a9d4b9e1c141d88164e8489c5044fdf70685
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
netd to apex
isIpv4AddressFree() is moved from ClatdController without behavior
change.
selectIpv4Address() and its test are moved from ClatdController as well.
They have been refactored slightly for testing because function pointer
of isIpv4AddressFreeFunc is not a global variable anymore. We can't set
global function pointer to change selectIpv4Address() behavior for
testing. Instead isIpv4AddressFree is sent as an argument of function
pointer. For public caller, selectIpv4Address() has no behavior change.
For test caller, they can call an internal selectIpv4AddressInternal
(.., fn) to change isIpv4AddrFreeFn function pointer for testing.
Bug: 212345928
Test: build and boot
atest libclat_test
Change-Id: Iab5e6fd5ebbccf10e7b3be2251b45949cf3f3464
|
| |
|
|
|
|
|
|
|
|
|
| |
generateIpv6Address() is moved from ClatdController without behavior
change. The unique_fd for socket fd is replaced by primitive int
because libbase is not supported in mainline.
Bug: 212345928
Test: build and boot
atest libclat_test
Change-Id: I42e152e6fe3ad577a0274e1d55e737318f61176d
|
|
|
Introduce the library libclat to implement clat functions for jni.
It is helpful for unit test.
makeChecksumNeutral() and its test are moved from ClatdController
without behavior change.
Bug: 212345928
Test: build and boot
atest libclat_test
Change-Id: I1c0981d98141fc1cc07b2d3a0f3cbddf38683ff3
|