From: Zbigniew Jędrzejewski-Szmek Date: Wed, 18 Jun 2025 14:36:03 +0000 (+0200) Subject: shared/bus-unit-util: add helper for IPIngressFilterPath=/IPEgressFilterPath= X-Git-Tag: v258-rc1~183^2~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f17f68bc52554afad19579ede03c475c08cc7c7;p=thirdparty%2Fsystemd.git shared/bus-unit-util: add helper for IPIngressFilterPath=/IPEgressFilterPath= --- diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index e04beb1fd49..1235cf1eede 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -823,6 +823,19 @@ static int bus_append_parse_ip_address_filter(sd_bus_message *m, const char *fie return 1; } +static int bus_append_ip_filter_path(sd_bus_message *m, const char *field, const char *eq) { + int r; + + if (isempty(eq)) + r = sd_bus_message_append(m, "(sv)", field, "as", 0); + else + r = sd_bus_message_append(m, "(sv)", field, "as", 1, eq); + if (r < 0) + return bus_log_create_error(r); + + return 1; +} + static int bus_append_nft_set(sd_bus_message *m, const char *field, const char *eq) { int r; @@ -985,17 +998,8 @@ static int bus_append_cgroup_property(sd_bus_message *m, const char *field, cons return bus_append_parse_ip_address_filter(m, field, eq); if (STR_IN_SET(field, "IPIngressFilterPath", - "IPEgressFilterPath")) { - if (isempty(eq)) - r = sd_bus_message_append(m, "(sv)", field, "as", 0); - else - r = sd_bus_message_append(m, "(sv)", field, "as", 1, eq); - - if (r < 0) - return bus_log_create_error(r); - - return 1; - } + "IPEgressFilterPath")) + return bus_append_ip_filter_path(m, field, eq); if (streq(field, "BPFProgram")) { if (isempty(eq))