From: Yu Watanabe Date: Tue, 29 Apr 2025 20:13:26 +0000 (+0900) Subject: core/bpf: drop unnecessary check for probing program type X-Git-Tag: v258-rc1~653^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb9991962d38a54decd75269ebe5d52677c1792a;p=thirdparty%2Fsystemd.git core/bpf: drop unnecessary check for probing program type BPF_PROG_TYPE_CGROUP_SKB is supported since kernel v4.10 (0e33661de493db325435d565a4a722120ae4cbf3) and BPF_PROG_TYPE_CGROUP_SOCK_ADDR is supported since kernel v4.17 (4fbac77d2d092b475dda9eea66da674369665427). Our baseline on the kernel is v5.4. The check is not necessary. --- diff --git a/src/core/bpf-restrict-ifaces.c b/src/core/bpf-restrict-ifaces.c index e5f9a3c53e4..e97682a19cd 100644 --- a/src/core/bpf-restrict-ifaces.c +++ b/src/core/bpf-restrict-ifaces.c @@ -83,11 +83,6 @@ int bpf_restrict_ifaces_supported(void) { if (dlopen_bpf_full(LOG_WARNING) < 0) return (supported = false); - if (!compat_libbpf_probe_bpf_prog_type(BPF_PROG_TYPE_CGROUP_SKB, /*opts=*/NULL)) { - log_debug("restrict-interfaces: BPF program type cgroup_skb is not supported"); - return (supported = false); - } - r = prepare_restrict_ifaces_bpf(NULL, true, NULL, &obj); if (r < 0) { log_debug_errno(r, "restrict-interfaces: Failed to load BPF object: %m"); diff --git a/src/core/bpf-socket-bind.c b/src/core/bpf-socket-bind.c index 374e684f04c..ce5f5c2f107 100644 --- a/src/core/bpf-socket-bind.c +++ b/src/core/bpf-socket-bind.c @@ -129,11 +129,6 @@ int bpf_socket_bind_supported(void) { if (dlopen_bpf_full(LOG_WARNING) < 0) return false; - if (!compat_libbpf_probe_bpf_prog_type(BPF_PROG_TYPE_CGROUP_SOCK_ADDR, /*opts=*/NULL)) { - log_debug("bpf-socket-bind: BPF program type cgroup_sock_addr is not supported"); - return false; - } - r = prepare_socket_bind_bpf(/*unit=*/NULL, /*allow_rules=*/NULL, /*deny_rules=*/NULL, &obj); if (r < 0) { log_debug_errno(r, "bpf-socket-bind: socket bind filtering is not supported: %m");