Commit graph android_packages_modules_Co.../clatd
Message SHA1
clatd: remove DEVICEPREFIX single use define
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibbeb4775f1b8484c7fb8ebb90f2a165af7ad031f

Maciej Żenczykowski   commited 2025-08-05 12:15:16 -07:00
7001d85a89
clatd: no need for argument parsing via getopt
as we always pass in all of them in a well defined order

Test: TreeHugger, manually
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I93c4a9883983645cbe7d11101aa749dc2faf9d6d

Maciej Żenczykowski   commited 2025-08-05 12:15:03 -07:00
1d2360adec
clatd: x86-32 allow socketcall()
32-bit x86 has a crazy networking calling convention and instead of using
individual system calls has a single multiplexed socketcall()

bionic hasn't finished transitioning to the individual calls yet
which were added to Linux kernels around the 4.10-4.14-ish timeframe.

This does open a bit of security hole, since it effectively allows
all 20-ish networking system calls, but oh well, better than constantly
allowing & logging.

I don't think we'll ever want to enable KILL mode on x86-32 any way.

Test: TreeHugger
Flag: EXEMPT mainline & disabled code
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7228132cfbf716592607d010f64d5adeeb4419aa

Maciej Żenczykowski   commited 2025-08-05 12:14:42 -07:00
2d26f46559
clatd: disable seccomp
Bug: 418375944
Test: TreeHugger
Flag: EXEMPT mainline, bug fix, disable codepath
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5c36a89c12d4cf836ee1b434b582a6ad2256037e

Maciej Żenczykowski   commited 2025-06-04 00:54:30 -07:00
c0a87bd9c0
clatd: disable AARCH64 specific seccomp kill filter
(while investigating observed failures)

Bug: 418375944
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1b34d172eb4fd5d631046db47c3d9be39d21b903

Maciej Żenczykowski   commited 2025-06-03 15:14:05 -07:00
2fba8b1a7a
clatd: fix endianness of multicast drop
This is a *critical* fix for http://go/aog/3514294
  'Drop egress multicast on clat interface'

Bug: 404457155
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If14ef730f78c7e991842a678260dd20df607b1ec

Maciej Żenczykowski   commited 2025-03-21 12:55:32 -07:00
30020a513a
clatd: implement seccomp system call protection
but only enable it in enforcing mode on aarch64,
since that gets good test coverage via Pixel
on GoogleGuest ipv6-only wifi network
and (for example) T-Mobile US cellular.

For other architectures this will only result
in (automatically ratelimitted to at most 5/s)
audit logs for any 'unusual' system calls.

Test: TreeHugger, manually on Pixel on GoogleGuest wifi
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id14c6d9db8d7b4652c7358cac101a82ef09843e0

Maciej Żenczykowski   commited 2025-03-18 02:57:06 -07:00
5ae193ae36
clatd: drop system real uid/gid in favour of clat
(minor security improvement)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibe2a75d83f7fa48ff555d80a4b9cbb0ab68ab8a8

Maciej Żenczykowski   commited 2025-03-18 00:51:59 -07:00
19199ca688
clatd: one less shutdown log line
less spam

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id80bfca1d2988928c6c3b56f9783d7414830d104

Maciej Żenczykowski   commited 2025-03-17 22:53:38 -07:00
0372f296b5
clatd: rework sigterm & error handling
Separate 'running' flag out into 'running' and 'sigterm',
and make SIGTERM handler the only thing that sets 'sigterm'.

running is cleared via catastrophic errors, ie. EOF and ENETDOWN

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8254c3f4643d60feff1cb32aaa9784dca18e138c

Maciej Żenczykowski   commited 2025-03-17 22:53:32 -07:00
b984f31e55
clatd: move send_dad out of event_loop() into main()
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id74ad4adf861182d928676213c77a24675c358a4

Maciej Żenczykowski   commited 2025-03-17 22:53:26 -07:00
2f96f2c242
clatd: embed CLATD_VERSION directly in log string
Allows for:
  adbz shell strings /apex/com.android.tethering/bin/for-system/clatd | grep 'clat version'
to print:
  Starting clat version 1.7 on %s plat=%s v4=%s v6=%s
instead of:
  Starting clat version %s on %s plat=%s v4=%s v6=%s

(which is more useful for rapid development)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4ba7458287837cb014950927f3c8ff18dac268fc

Maciej Żenczykowski   commited 2025-03-17 22:53:26 -07:00
1961f673d1
Drop egress multicast on clat interface
Multicast packets on the clat interface are not supported,
so drop them in both clatd and its associated bpf offload.
This is required because NsdManager will start sending mDNS
packets on the clat interface as the check for
IFF_POINTOPOINT was removed.

Ingress multicast packets are already dropped elsewhere.

Test: TH
Change-Id: Icd22ca7f263ea5ff5244c17276ebb1002f72e842

Patrick Rohr   commited 2025-02-27 12:45:26 -08:00
bb08d8083e
Fix a function pointer type mismatch for C23.
Conveniently, the C++ style "just don't name the argument if you're not going to use it" syntax is in C23. Inconveniently, given that this has already been by far the most troublesome C update ever, I'm assuming that the switch is likely to bounce, so this change goes with backwards-compatible syntax.

Change-Id: Ic67398042cb70c22a833b8bf8a745177a50dd9cd

Elliott Hughes   commited 2024-12-18 11:22:10 -08:00
bd12ffbebe
[DON'T BLOCK] Test ownership migration rules
This CL is created as a best effort to migrate test targets
to the new android ownership model. If you find incorrect or unnecessary
attribution in this CL, please create a separate CL to fix that.

For more details please refer to the link below,
<add g3 doc link>

Bug: 304529413
Test: N/A
Change-Id: I243f17b3f0ad7af9ffa15ca242456e36688733f5
Merged-In: I243f17b3f0ad7af9ffa15ca242456e36688733f5

Aditya Choudhary   commited 2024-01-31 12:34:50 +00:00
01b5ede2b2
remove clatd OWNERS
(equivalent OWNERS file is already present in root directory of p/m/C)

Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4a4da3cd13bcf4497a210aae44618681ed43fd64

Maciej Żenczykowski   commited 2023-09-12 11:48:34 -07:00
d5f91e76a0
Add 'clatd/' from commit '2007830075'
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I18ccf19024f0617778799f548c8707a518eefadc
git-subtree-dir: clatd
git-subtree-mainline: 655d0850ac
git-subtree-split: 2007830075

Maciej Żenczykowski   commited 2023-09-12 11:48:08 -07:00
d89d5884eb