1
0
mirror of https://github.com/systemd/systemd synced 2026-04-11 17:44:58 +02:00

Compare commits

..

No commits in common. "b9f27a0567886379666d8548ae105201d6759bbf" and "a6293b0541681f1297cfd100bfbb507d5e6f0c3b" have entirely different histories.

9 changed files with 50 additions and 125 deletions

View File

@ -9357,10 +9357,6 @@ node /org/freedesktop/systemd1/unit/cups_2epath {
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly u DirectoryMode = ...; readonly u DirectoryMode = ...;
readonly s Result = '...'; readonly s Result = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly t TriggerLimitIntervalUSec = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly u TriggerLimitBurst = ...;
}; };
interface org.freedesktop.DBus.Peer { ... }; interface org.freedesktop.DBus.Peer { ... };
interface org.freedesktop.DBus.Introspectable { ... }; interface org.freedesktop.DBus.Introspectable { ... };
@ -9373,10 +9369,6 @@ node /org/freedesktop/systemd1/unit/cups_2epath {
<!--property DirectoryMode is not documented!--> <!--property DirectoryMode is not documented!-->
<!--property TriggerLimitIntervalUSec is not documented!-->
<!--property TriggerLimitBurst is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit--> <!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.systemd1.Unit"/> <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.systemd1.Unit"/>
@ -9397,10 +9389,6 @@ node /org/freedesktop/systemd1/unit/cups_2epath {
<variablelist class="dbus-property" generated="True" extra-ref="Result"/> <variablelist class="dbus-property" generated="True" extra-ref="Result"/>
<variablelist class="dbus-property" generated="True" extra-ref="TriggerLimitIntervalUSec"/>
<variablelist class="dbus-property" generated="True" extra-ref="TriggerLimitBurst"/>
<!--End of Autogenerated section--> <!--End of Autogenerated section-->
<refsect2> <refsect2>

View File

@ -186,21 +186,6 @@
in question. Takes an access mode in octal notation. Defaults in question. Takes an access mode in octal notation. Defaults
to <option>0755</option>.</para></listitem> to <option>0755</option>.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><varname>TriggerLimitIntervalSec=</varname></term>
<term><varname>TriggerLimitBurst=</varname></term>
<listitem><para>Configures a limit on how often this path unit may be activated within a specific time
interval. The <varname>TriggerLimitIntervalSec=</varname> may be used to configure the length of the time
interval in the usual time units <literal>us</literal>, <literal>ms</literal>, <literal>s</literal>,
<literal>min</literal>, <literal>h</literal>, … and defaults to 2s (See
<citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry> for details on
the various time units understood). The <varname>TriggerLimitBurst=</varname> setting takes a positive integer
value and specifies the number of permitted activations per time interval, and defaults to 200. Set either to
0 to disable any form of trigger rate limiting. If the limit is hit, the unit is placed into a failure mode,
and will not watch the path(s) anymore until restarted. Note that this limit is enforced before the service
activation is enqueued.</para></listitem>
</varlistentry>
</variablelist> </variablelist>
<xi:include href="systemd.service.xml" xpointer="shared-unit-options" /> <xi:include href="systemd.service.xml" xpointer="shared-unit-options" />

View File

@ -824,7 +824,7 @@
<term><varname>TriggerLimitIntervalSec=</varname></term> <term><varname>TriggerLimitIntervalSec=</varname></term>
<term><varname>TriggerLimitBurst=</varname></term> <term><varname>TriggerLimitBurst=</varname></term>
<listitem><para>Configures a limit on how often this socket unit may be activated within a specific time <listitem><para>Configures a limit on how often this socket unit my be activated within a specific time
interval. The <varname>TriggerLimitIntervalSec=</varname> may be used to configure the length of the time interval. The <varname>TriggerLimitIntervalSec=</varname> may be used to configure the length of the time
interval in the usual time units <literal>us</literal>, <literal>ms</literal>, <literal>s</literal>, interval in the usual time units <literal>us</literal>, <literal>ms</literal>, <literal>s</literal>,
<literal>min</literal>, <literal>h</literal>, … and defaults to 2s (See <literal>min</literal>, <literal>h</literal>, … and defaults to 2s (See

View File

@ -49,8 +49,6 @@ const sd_bus_vtable bus_path_vtable[] = {
SD_BUS_PROPERTY("MakeDirectory", "b", bus_property_get_bool, offsetof(Path, make_directory), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("MakeDirectory", "b", bus_property_get_bool, offsetof(Path, make_directory), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("DirectoryMode", "u", bus_property_get_mode, offsetof(Path, directory_mode), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("DirectoryMode", "u", bus_property_get_mode, offsetof(Path, directory_mode), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Path, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Path, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("TriggerLimitIntervalUSec", "t", bus_property_get_usec, offsetof(Path, trigger_limit.interval), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("TriggerLimitBurst", "u", bus_property_get_unsigned, offsetof(Path, trigger_limit.burst), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_VTABLE_END SD_BUS_VTABLE_END
}; };
@ -138,12 +136,6 @@ static int bus_path_set_transient_property(
return 1; return 1;
} }
if (streq(name, "TriggerLimitBurst"))
return bus_set_transient_unsigned(u, name, &p->trigger_limit.burst, message, flags, error);
if (streq(name, "TriggerLimitIntervalUSec"))
return bus_set_transient_usec(u, name, &p->trigger_limit.interval, message, flags, error);
return 0; return 0;
} }

View File

@ -542,8 +542,6 @@ Path.DirectoryNotEmpty, config_parse_path_spec,
Path.Unit, config_parse_trigger_unit, 0, 0 Path.Unit, config_parse_trigger_unit, 0, 0
Path.MakeDirectory, config_parse_bool, 0, offsetof(Path, make_directory) Path.MakeDirectory, config_parse_bool, 0, offsetof(Path, make_directory)
Path.DirectoryMode, config_parse_mode, 0, offsetof(Path, directory_mode) Path.DirectoryMode, config_parse_mode, 0, offsetof(Path, directory_mode)
Path.TriggerLimitIntervalSec, config_parse_sec, 0, offsetof(Path, trigger_limit.interval)
Path.TriggerLimitBurst, config_parse_unsigned, 0, offsetof(Path, trigger_limit.burst)
{{ CGROUP_CONTEXT_CONFIG_ITEMS('Slice') }} {{ CGROUP_CONTEXT_CONFIG_ITEMS('Slice') }}
{{ CGROUP_CONTEXT_CONFIG_ITEMS('Scope') }} {{ CGROUP_CONTEXT_CONFIG_ITEMS('Scope') }}
{{ KILL_CONTEXT_CONFIG_ITEMS('Scope') }} {{ KILL_CONTEXT_CONFIG_ITEMS('Scope') }}

View File

@ -266,8 +266,8 @@ static void path_init(Unit *u) {
p->directory_mode = 0755; p->directory_mode = 0755;
p->trigger_limit.interval = USEC_INFINITY; p->trigger_limit.interval = 2 * USEC_PER_SEC;
p->trigger_limit.burst = UINT_MAX; p->trigger_limit.burst = 200;
} }
void path_free_specs(Path *p) { void path_free_specs(Path *p) {
@ -356,16 +356,6 @@ static int path_add_trigger_dependencies(Path *p) {
static int path_add_extras(Path *p) { static int path_add_extras(Path *p) {
int r; int r;
assert(p);
/* To avoid getting pid1 in a busy-loop state (eg: failed condition on associated service),
* set a default trigger limit if the user didn't specify any. */
if (p->trigger_limit.interval == USEC_INFINITY)
p->trigger_limit.interval = 2 * USEC_PER_SEC;
if (p->trigger_limit.burst == UINT_MAX)
p->trigger_limit.burst = 200;
r = path_add_trigger_dependencies(p); r = path_add_trigger_dependencies(p);
if (r < 0) if (r < 0)
return r; return r;
@ -413,16 +403,12 @@ static void path_dump(Unit *u, FILE *f, const char *prefix) {
"%sResult: %s\n" "%sResult: %s\n"
"%sUnit: %s\n" "%sUnit: %s\n"
"%sMakeDirectory: %s\n" "%sMakeDirectory: %s\n"
"%sDirectoryMode: %04o\n" "%sDirectoryMode: %04o\n",
"%sTriggerLimitIntervalSec: %s\n"
"%sTriggerLimitBurst: %u\n",
prefix, path_state_to_string(p->state), prefix, path_state_to_string(p->state),
prefix, path_result_to_string(p->result), prefix, path_result_to_string(p->result),
prefix, trigger ? trigger->id : "n/a", prefix, trigger ? trigger->id : "n/a",
prefix, yes_no(p->make_directory), prefix, yes_no(p->make_directory),
prefix, p->directory_mode, prefix, p->directory_mode);
prefix, FORMAT_TIMESPAN(p->trigger_limit.interval, USEC_PER_SEC),
prefix, p->trigger_limit.burst);
LIST_FOREACH(spec, s, p->specs) LIST_FOREACH(spec, s, p->specs)
path_spec_dump(s, f, prefix); path_spec_dump(s, f, prefix);

View File

@ -579,7 +579,6 @@ int sd_radv_set_preference(sd_radv *ra, unsigned preference) {
int sd_radv_add_prefix(sd_radv *ra, sd_radv_prefix *p) { int sd_radv_add_prefix(sd_radv *ra, sd_radv_prefix *p) {
_cleanup_free_ char *addr_p = NULL; _cleanup_free_ char *addr_p = NULL;
sd_radv_prefix *cur; sd_radv_prefix *cur;
bool update = false;
int r; int r;
assert_return(ra, -EINVAL); assert_return(ra, -EINVAL);
@ -604,21 +603,7 @@ int sd_radv_add_prefix(sd_radv *ra, sd_radv_prefix *p) {
continue; continue;
if (cur->opt.prefixlen == p->opt.prefixlen) { if (cur->opt.prefixlen == p->opt.prefixlen) {
update = true; /* p and cur may be equivalent. First increment the counter. */
break;
}
_cleanup_free_ char *addr_cur = NULL;
(void) in6_addr_prefix_to_string(&cur->opt.in6_addr, cur->opt.prefixlen, &addr_cur);
return log_radv_errno(ra, SYNTHETIC_ERRNO(EEXIST),
"IPv6 prefix %s conflicts with %s, ignoring.",
strna(addr_p), strna(addr_cur));
}
if (update) {
assert(cur);
/* p and cur may be equivalent. First increment the reference counter. */
sd_radv_prefix_ref(p); sd_radv_prefix_ref(p);
/* Then, remove the old entry. */ /* Then, remove the old entry. */
@ -632,29 +617,36 @@ int sd_radv_add_prefix(sd_radv *ra, sd_radv_prefix *p) {
strna(addr_p), strna(addr_p),
FORMAT_TIMESPAN(p->lifetime_preferred_usec, USEC_PER_SEC), FORMAT_TIMESPAN(p->lifetime_preferred_usec, USEC_PER_SEC),
FORMAT_TIMESPAN(p->lifetime_valid_usec, USEC_PER_SEC)); FORMAT_TIMESPAN(p->lifetime_valid_usec, USEC_PER_SEC));
} else {
/* The prefix is new. Let's simply add it. */ goto announce;
}
_cleanup_free_ char *addr_cur = NULL;
(void) in6_addr_prefix_to_string(&cur->opt.in6_addr, cur->opt.prefixlen, &addr_cur);
return log_radv_errno(ra, SYNTHETIC_ERRNO(EEXIST),
"IPv6 prefix %s conflicts with %s, ignoring.",
strna(addr_p), strna(addr_cur));
}
sd_radv_prefix_ref(p); sd_radv_prefix_ref(p);
LIST_APPEND(prefix, ra->prefixes, p); LIST_APPEND(prefix, ra->prefixes, p);
ra->n_prefixes++; ra->n_prefixes++;
log_radv(ra, "Added prefix %s", strna(addr_p)); log_radv(ra, "Added prefix %s", strna(addr_p));
}
if (ra->state == RADV_STATE_IDLE) if (ra->state == RADV_STATE_IDLE)
return 0; return 0;
announce:
if (ra->ra_sent == 0) if (ra->ra_sent == 0)
return 0; return 0;
/* If RAs have already been sent, send an RA immediately to announce the newly-added prefix */ /* If RAs have already been sent, send an RA immediately to announce the newly-added prefix */
r = radv_send(ra, NULL, ra->lifetime_usec); r = radv_send(ra, NULL, ra->lifetime_usec);
if (r < 0) if (r < 0)
log_radv_errno(ra, r, "Unable to send Router Advertisement for added prefix %s: %m", log_radv_errno(ra, r, "Unable to send Router Advertisement for added prefix: %m");
strna(addr_p));
else else
log_radv(ra, "Sent Router Advertisement for added/updated prefix %s.", strna(addr_p)); log_radv(ra, "Sent Router Advertisement for added/updated prefix");
return 0; return 0;
} }
@ -687,7 +679,6 @@ sd_radv_prefix *sd_radv_remove_prefix(sd_radv *ra,
int sd_radv_add_route_prefix(sd_radv *ra, sd_radv_route_prefix *p) { int sd_radv_add_route_prefix(sd_radv *ra, sd_radv_route_prefix *p) {
_cleanup_free_ char *addr_p = NULL; _cleanup_free_ char *addr_p = NULL;
sd_radv_route_prefix *cur; sd_radv_route_prefix *cur;
bool update = false;
int r; int r;
assert_return(ra, -EINVAL); assert_return(ra, -EINVAL);
@ -708,21 +699,7 @@ int sd_radv_add_route_prefix(sd_radv *ra, sd_radv_route_prefix *p) {
continue; continue;
if (cur->opt.prefixlen == p->opt.prefixlen) { if (cur->opt.prefixlen == p->opt.prefixlen) {
update = true; /* p and cur may be equivalent. First increment the counter. */
break;
}
_cleanup_free_ char *addr_cur = NULL;
(void) in6_addr_prefix_to_string(&cur->opt.in6_addr, cur->opt.prefixlen, &addr_cur);
return log_radv_errno(ra, SYNTHETIC_ERRNO(EEXIST),
"IPv6 route prefix %s conflicts with %s, ignoring.",
strna(addr_p), strna(addr_cur));
}
if (update) {
assert(cur);
/* p and cur may be equivalent. First increment the reference counter. */
sd_radv_route_prefix_ref(p); sd_radv_route_prefix_ref(p);
/* Then, remove the old entry. */ /* Then, remove the old entry. */
@ -735,29 +712,36 @@ int sd_radv_add_route_prefix(sd_radv *ra, sd_radv_route_prefix *p) {
log_radv(ra, "Updated/replaced IPv6 route prefix %s (lifetime: %s)", log_radv(ra, "Updated/replaced IPv6 route prefix %s (lifetime: %s)",
strna(addr_p), strna(addr_p),
FORMAT_TIMESPAN(p->lifetime_usec, USEC_PER_SEC)); FORMAT_TIMESPAN(p->lifetime_usec, USEC_PER_SEC));
} else {
/* The route prefix is new. Let's simply add it. */ goto announce;
}
_cleanup_free_ char *addr_cur = NULL;
(void) in6_addr_prefix_to_string(&cur->opt.in6_addr, cur->opt.prefixlen, &addr_cur);
return log_radv_errno(ra, SYNTHETIC_ERRNO(EEXIST),
"IPv6 route prefix %s conflicts with %s, ignoring.",
strna(addr_p), strna(addr_cur));
}
sd_radv_route_prefix_ref(p); sd_radv_route_prefix_ref(p);
LIST_APPEND(prefix, ra->route_prefixes, p); LIST_APPEND(prefix, ra->route_prefixes, p);
ra->n_route_prefixes++; ra->n_route_prefixes++;
log_radv(ra, "Added route prefix %s", strna(addr_p)); log_radv(ra, "Added route prefix %s", strna(addr_p));
}
if (ra->state == RADV_STATE_IDLE) if (ra->state == RADV_STATE_IDLE)
return 0; return 0;
announce:
if (ra->ra_sent == 0) if (ra->ra_sent == 0)
return 0; return 0;
/* If RAs have already been sent, send an RA immediately to announce the newly-added route prefix */ /* If RAs have already been sent, send an RA immediately to announce the newly-added route prefix */
r = radv_send(ra, NULL, ra->lifetime_usec); r = radv_send(ra, NULL, ra->lifetime_usec);
if (r < 0) if (r < 0)
log_radv_errno(ra, r, "Unable to send Router Advertisement for added route prefix %s: %m", log_radv_errno(ra, r, "Unable to send Router Advertisement for added route prefix: %m");
strna(addr_p));
else else
log_radv(ra, "Sent Router Advertisement for added route prefix %s.", strna(addr_p)); log_radv(ra, "Sent Router Advertisement for added route prefix");
return 0; return 0;
} }

View File

@ -2113,12 +2113,6 @@ static int bus_append_path_property(sd_bus_message *m, const char *field, const
return 1; return 1;
} }
if (streq(field, "TriggerLimitBurst"))
return bus_append_safe_atou(m, field, eq);
if (streq(field, "TriggerLimitIntervalSec"))
return bus_append_parse_sec_rename(m, field, eq);
return 0; return 0;
} }

View File

@ -7,6 +7,4 @@ PathChanged=
PathExists= PathExists=
PathExistsGlob= PathExistsGlob=
PathModified= PathModified=
TriggerLimitBurst=
TriggerLimitIntervalSec=
Unit= Unit=