]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/bpf-firewall: make bpf_firewall_supported() always set unsupported reason when... 21591/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 1 Dec 2021 12:07:22 +0000 (21:07 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 1 Dec 2021 12:39:21 +0000 (21:39 +0900)
Otherwise, log_unit_full_errno() in emit_bpf_firewall_warning() will
trigger an assertion.

src/core/bpf-firewall.c

index 2c202f1ea60431cbaad2472fa384450751fddfd4..2d154710e02a16176bd48693c2ac69443be6c635 100644 (file)
@@ -872,7 +872,10 @@ int bpf_firewall_supported(void) {
 
                 /* YAY! */
         } else {
-                log_debug("Wut? Kernel accepted our invalid BPF_PROG_DETACH call? Something is weird, assuming BPF firewalling is broken and hence not supported.");
+                bpf_firewall_unsupported_reason =
+                        log_debug_errno(SYNTHETIC_ERRNO(EBADE),
+                                        "Wut? Kernel accepted our invalid BPF_PROG_DETACH call? "
+                                        "Something is weird, assuming BPF firewalling is broken and hence not supported.");
                 return supported = BPF_FIREWALL_UNSUPPORTED;
         }
 
@@ -900,7 +903,10 @@ int bpf_firewall_supported(void) {
 
                 return supported = BPF_FIREWALL_SUPPORTED;
         } else {
-                log_debug("Wut? Kernel accepted our invalid BPF_PROG_ATTACH+BPF_F_ALLOW_MULTI call? Something is weird, assuming BPF firewalling is broken and hence not supported.");
+                bpf_firewall_unsupported_reason =
+                        log_debug_errno(SYNTHETIC_ERRNO(EBADE),
+                                        "Wut? Kernel accepted our invalid BPF_PROG_ATTACH+BPF_F_ALLOW_MULTI call? "
+                                        "Something is weird, assuming BPF firewalling is broken and hence not supported.");
                 return supported = BPF_FIREWALL_UNSUPPORTED;
         }
 }