From aa624f299bed7635507c896405931d9a5c6c5097 Mon Sep 17 00:00:00 2001 From: Patrick Rohr Date: Tue, 28 Mar 2023 15:36:11 -0700 Subject: [PATCH] bpfloader: add support for connect4 / connect6 progs These should be useful for producing onConnectEvent events from mainline bpf code. BPF_PROG_TYPE_CGROUP_SOCK_ADDR requires the attach type to be explicitly specified at load time. Test: builds Bug: 270905383 Bug: 259000745 Change-Id: Ida57c6eb632b8bb406ee4cadf0a30e47d9c422ff --- libbpf_android/Loader.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libbpf_android/Loader.cpp b/libbpf_android/Loader.cpp index 99c160a..b5474e9 100644 --- a/libbpf_android/Loader.cpp +++ b/libbpf_android/Loader.cpp @@ -30,13 +30,13 @@ #include #include -// This is BpfLoader v0.34 +// This is BpfLoader v0.35 // WARNING: If you ever hit cherrypick conflicts here you're doing it wrong: // You are NOT allowed to cherrypick bpfloader related patches out of order. // (indeed: cherrypicking is probably a bad idea and you should merge instead) // Mainline supports ONLY the published versions of the bpfloader for each Android release. #define BPFLOADER_VERSION_MAJOR 0u -#define BPFLOADER_VERSION_MINOR 34u +#define BPFLOADER_VERSION_MINOR 35u #define BPFLOADER_VERSION ((BPFLOADER_VERSION_MAJOR << 16) | BPFLOADER_VERSION_MINOR) #include "BpfSyscallWrappers.h" @@ -189,6 +189,8 @@ sectionType sectionNameTypes[] = { {"bind6/", BPF_PROG_TYPE_CGROUP_SOCK_ADDR, BPF_CGROUP_INET6_BIND}, {"cgroupskb/", BPF_PROG_TYPE_CGROUP_SKB, BPF_ATTACH_TYPE_UNSPEC}, {"cgroupsock/", BPF_PROG_TYPE_CGROUP_SOCK, BPF_ATTACH_TYPE_UNSPEC}, + {"connect4/", BPF_PROG_TYPE_CGROUP_SOCK_ADDR, BPF_CGROUP_INET4_CONNECT}, + {"connect6/", BPF_PROG_TYPE_CGROUP_SOCK_ADDR, BPF_CGROUP_INET6_CONNECT}, {"kprobe/", BPF_PROG_TYPE_KPROBE, BPF_ATTACH_TYPE_UNSPEC}, {"perf_event/", BPF_PROG_TYPE_PERF_EVENT, BPF_ATTACH_TYPE_UNSPEC}, {"schedact/", BPF_PROG_TYPE_SCHED_ACT, BPF_ATTACH_TYPE_UNSPEC},