]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: only warn about BPF/cgroup missing once per runtime (#7319)
authorLennart Poettering <lennart@poettering.net>
Mon, 13 Nov 2017 21:02:51 +0000 (22:02 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 13 Nov 2017 21:02:51 +0000 (22:02 +0100)
Let's reduce the amount of noise a bit, there's little point in
complaining loudly about every single unit like this, let's complain
only about the first one, and then downgrade the log level to LOG_DEBUG
for the other cases.

Fixes: #7188
src/core/dbus-cgroup.c
src/core/ip-address-access.c

index bef70b6f84e237c1c76bdf33baf6f8aa2031abc1..dd8aa183636d7ce9582d72d0f76805d72db2cde7 100644 (file)
@@ -1409,9 +1409,15 @@ int bus_cgroup_set_property(
                                 r = bpf_firewall_supported();
                                 if (r < 0)
                                         return r;
-                                if (r == 0)
-                                        log_warning("Transient unit %s configures an IP firewall, but the local system does not support BPF/cgroup firewalling.\n"
-                                                    "Proceeding WITHOUT firewalling in effect!", u->id);
+                                if (r == 0) {
+                                        static bool warned = false;
+
+                                        log_full(warned ? LOG_DEBUG : LOG_WARNING,
+                                                 "Transient unit %s configures an IP firewall, but the local system does not support BPF/cgroup firewalling.\n"
+                                                 "Proceeding WITHOUT firewalling in effect! (This warning is only shown for the first started transient unit using IP firewalling.)", u->id);
+
+                                        warned = true;
+                                }
                         }
                 }
 
index 3012de4bc7c9443a411f18f92059c3cb59ee8c78..a17620567d19b29746a8015572aea370c08ad91b 100644 (file)
@@ -155,9 +155,15 @@ int config_parse_ip_address_access(
                 r = bpf_firewall_supported();
                 if (r < 0)
                         return r;
-                if (r == 0)
-                        log_warning("File %s:%u configures an IP firewall (%s=%s), but the local system does not support BPF/cgroup based firewalling.\n"
-                                    "Proceeding WITHOUT firewalling in effect!", filename, line, lvalue, rvalue);
+                if (r == 0) {
+                        static bool warned = false;
+
+                        log_full(warned ? LOG_DEBUG : LOG_WARNING,
+                                 "File %s:%u configures an IP firewall (%s=%s), but the local system does not support BPF/cgroup based firewalling.\n"
+                                 "Proceeding WITHOUT firewalling in effect! (This warning is only shown for the first loaded unit using IP firewalling.)", filename, line, lvalue, rvalue);
+
+                        warned = true;
+                }
         }
 
         return 0;