From acebffb966ddfedbc9e2a73f47940fefbdfeed73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Mon, 16 May 2022 16:05:15 -0700 Subject: [PATCH] add proper minimum bpfloader version annotations for block/clatd/dscp_policy/netd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In practice this doesn't actually really matter, since older versions of the bpfloader won't even look in the relevant directories: BpfLoader v0.9 is the first one that looks into '/apex/com.android.tethering/etc/bpf/net_shared', but it is only v0.12 that pins the resulting programs and maps correctly into /sys/fs/bpf/net_shared/ hence the annotations for block/clatd/dscp_policy. BpfLoader v0.13 is the first one that looks into '/apex/com.android.tethering/etc/bpf/netd_shared' subdirectory and pins into /sys/fs/bpf/netd_shared/ hence the annotation for netd. But it's best to explicitly document the intent. Note that in practice the mainline module will fail spectacularly on a T OS if it can't find the programs and maps (presumably due to the bpfloader being too old) but will work on S even though the bpfloader there is much older, because these programs/maps are not required on pre-T OS. This change is thus really only documentation. Bug: 218408035 Test: TreeHugger Signed-off-by: Maciej Żenczykowski Change-Id: I5ffa2faf83ca337b84e34b01df84436629989c58 --- bpf_progs/block.c | 3 +++ bpf_progs/clatd.c | 3 +++ bpf_progs/dscp_policy.c | 3 +++ bpf_progs/netd.c | 3 +++ 4 files changed, 12 insertions(+) diff --git a/bpf_progs/block.c b/bpf_progs/block.c index ddd9a1cbed..601b93281e 100644 --- a/bpf_progs/block.c +++ b/bpf_progs/block.c @@ -19,6 +19,9 @@ #include #include +// The resulting .o needs to load on the Android T bpfloader v0.12+ +#define BPFLOADER_MIN_VER 12u + #include "bpf_helpers.h" #define ALLOW 1 diff --git a/bpf_progs/clatd.c b/bpf_progs/clatd.c index 9a9d3373dc..87795f58ad 100644 --- a/bpf_progs/clatd.c +++ b/bpf_progs/clatd.c @@ -30,6 +30,9 @@ #define __kernel_udphdr udphdr #include +// The resulting .o needs to load on the Android T bpfloader v0.12+ +#define BPFLOADER_MIN_VER 12u + #include "bpf_helpers.h" #include "bpf_net_helpers.h" #include "bpf_shared.h" diff --git a/bpf_progs/dscp_policy.c b/bpf_progs/dscp_policy.c index d5df7ef6ba..7211f2b866 100644 --- a/bpf_progs/dscp_policy.c +++ b/bpf_progs/dscp_policy.c @@ -27,6 +27,9 @@ #include #include +// The resulting .o needs to load on the Android T bpfloader v0.12+ +#define BPFLOADER_MIN_VER 12u + #include "bpf_helpers.h" #include "dscp_policy.h" diff --git a/bpf_progs/netd.c b/bpf_progs/netd.c index f3f675fb87..e484010256 100644 --- a/bpf_progs/netd.c +++ b/bpf_progs/netd.c @@ -14,6 +14,9 @@ * limitations under the License. */ +// The resulting .o needs to load on the Android T Beta 3 bpfloader v0.13+ +#define BPFLOADER_MIN_VER 13u + #include #include #include