Commit Graph

9 Commits

Author SHA1 Message Date
Maciej Żenczykowski
f3440dd85e clat: switch to relative cbpf filter
Needed to support AF_PACKET/SOCK_RAW sockets

Test: TreeHugger, ping on ipv6-only wifi works
Bug: 265591307
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If324ee1e97a90b1a0a2ee0fabe1d91ef0603fdac
2023-03-10 23:46:15 +00:00
Hungming Chen
14575d38cc Add native test libclat_test to MTS.
In order to get counted by mts code coverage, this native test needs to
be run as part of mts.

Bug: 233904825
Test: m mts && mts-tradefed run mts-tethering-coverage
Change-Id: I4ec7108577a8a50d4419bbf387535f92f2f6d099
2022-05-30 15:37:25 +08:00
Hungming Chen
b4bec86e0b Remove unused TcUtils{, Test}, bpfhelper from libclat
Don't need anymore since ClatCoordinator uses common lib to access
clat bpf prog/map.

Test: atest libclat_test
Change-Id: I2c3242f8b14b0058420ccfd85bb5728062c852bc
2022-03-31 16:04:42 +08:00
Maciej Żenczykowski
2f7dac1bad remove spurious headers
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
2022-02-02 16:38:36 -08:00
Maciej Żenczykowski
0bbe3d2ce4 libclat only depends on libbase_headers not libbase itself
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iad66f0d4bed4100261e8aa7d135e62336cdd1ae8
2022-02-02 16:38:36 -08:00
Hungming Chen
8ebdb6f1fe [CLATJ#18] libclat: move clat tc and bpf utilis from netd
Move native functions from ClatdController and TcUtils to libclat
for jni ClatdCoordinator.

Bug: 212345928
Test: atest libclat_test
Change-Id: Ia4b344b07537d57c3e4ff1285b0e7b17e0c63c3e
2022-01-22 20:07:19 +08:00
Hungming Chen
8ff032b990 [CLATJ#6] libclat: move configure_packet_socket() from netd to apex
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
2022-01-20 22:50:12 +08:00
Hungming Chen
86a56de609 [CLATJ#5] libclat: move detect_mtu() from netd to apex
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
2022-01-20 22:50:12 +08:00
Hungming Chen
ed7b4602b5 [CLATJ#1] libclat: move makeChecksumNeutral() from netd to apex
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
2022-01-20 22:50:08 +08:00