]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/cgroup: fix IPAddressAllow=/IPAddressDeny= set through DBus
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 16 Oct 2024 03:45:34 +0000 (12:45 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 16 Oct 2024 05:31:49 +0000 (14:31 +0900)
Fixes a regression caused by 84ebe6f01381c21b88e37e856956c9c9ee6781d6 (v250).
Fixes #34773.

src/core/dbus-cgroup.c

index 459fa6f774c3247a8790e2b3cd48c9f6926917d1..a145afab193e18f5137d890d9d504a8a73165f22 100644 (file)
@@ -1977,11 +1977,12 @@ int bus_cgroup_set_property(
                         prefixes = streq(name, "IPAddressAllow") ? &c->ip_address_allow : &c->ip_address_deny;
                         reduced = streq(name, "IPAddressAllow") ? &c->ip_address_allow_reduced : &c->ip_address_deny_reduced;
 
+                        fputs(name, f);
+                        fputs("=\n", f);
+
                         if (n == 0) {
                                 *reduced = true;
                                 *prefixes = set_free(*prefixes);
-                                fputs(name, f);
-                                fputs("=\n", f);
                         } else {
                                 *reduced = false;
 
@@ -1990,7 +1991,7 @@ int bus_cgroup_set_property(
                                         return r;
 
                                 const struct in_addr_prefix *p;
-                                SET_FOREACH(p, new_prefixes)
+                                SET_FOREACH(p, *prefixes)
                                         fprintf(f, "%s=%s\n", name,
                                                 IN_ADDR_PREFIX_TO_STRING(p->family, &p->address, p->prefixlen));
                         }