mirror of
https://github.com/systemd/systemd
synced 2026-03-25 16:25:04 +01:00
Compare commits
14 Commits
f6e40037a0
...
bdbb61f69f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdbb61f69f | ||
|
|
66e093def8 | ||
|
|
e9aee93240 | ||
|
|
ecfcf0244a | ||
|
|
21ee8eda50 | ||
|
|
406041b7de | ||
|
|
91546abf9e | ||
|
|
c4f7a34756 | ||
|
|
7ce05a8d66 | ||
|
|
5cf9069f08 | ||
|
|
5ea859ef01 | ||
|
|
74614801f6 | ||
|
|
6de7fa8759 | ||
|
|
d1429d8f78 |
@ -6,21 +6,17 @@ layout: default
|
||||
|
||||
# Portable Services Introduction
|
||||
|
||||
This systemd version includes a preview of the "portable service"
|
||||
concept. "Portable Services" are supposed to be an incremental improvement over
|
||||
traditional system services, making two specific facets of container management
|
||||
available to system services more readily. Specifically:
|
||||
systemd (since version 239) supports a concept of "Portable Services".
|
||||
"Portable Services" are a delivery method for system services that uses
|
||||
two specific features of container management:
|
||||
|
||||
1. The bundling of applications, i.e. packing up multiple services, their
|
||||
binaries and all their dependencies in an image, and running them
|
||||
directly from it.
|
||||
1. Applications are bundled. I.e. multiple services, their binaries and all
|
||||
their dependencies are packaged in an image, and are run directly from it.
|
||||
|
||||
2. Stricter default security policies, i.e. sand-boxing of applications.
|
||||
|
||||
The primary tool for interfacing with "portable services" is the new
|
||||
"portablectl" program. It's currently shipped in /usr/lib/systemd/portablectl
|
||||
(i.e. not in the `$PATH`), since it's not yet considered part of the officially
|
||||
supported systemd interfaces — it's a preview still after all.
|
||||
The primary tool for interacting with Portable Services is `portablectl`,
|
||||
and they are managed by the `systemd-portabled` service.
|
||||
|
||||
Portable services don't bring anything inherently new to the table. All they do
|
||||
is put together known concepts in a slightly nicer way to cover a specific set
|
||||
|
||||
@ -80,7 +80,7 @@
|
||||
<filename>/etc/hosts</filename>.</para>
|
||||
|
||||
<para>Please keep in mind that <command>nss-myhostname</command> (and <command>nss-resolve</command>) also resolve
|
||||
in the other direction — from locally attached IP adresses to
|
||||
in the other direction — from locally attached IP addresses to
|
||||
hostnames. If you rely on that lookup being provided by DNS, you might
|
||||
want to order things differently.
|
||||
</para>
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
<command>systemd-resolved</command> is not running.</para>
|
||||
|
||||
<para>Please keep in mind that <command>nss-myhostname</command> (and <command>nss-resolve</command>) also resolve
|
||||
in the other direction — from locally attached IP adresses to
|
||||
in the other direction — from locally attached IP addresses to
|
||||
hostnames. If you rely on that lookup being provided by DNS, you might
|
||||
want to order things differently.
|
||||
</para>
|
||||
|
||||
@ -1706,7 +1706,7 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly b DefaultDependencies = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly s OnSuccesJobMode = '...';
|
||||
readonly s OnSuccessJobMode = '...';
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly s OnFailureJobMode = '...';
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
@ -1815,7 +1815,7 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
|
||||
<!--property CanFreeze is not documented!-->
|
||||
|
||||
<!--property OnSuccesJobMode is not documented!-->
|
||||
<!--property OnSuccessJobMode is not documented!-->
|
||||
|
||||
<!--property OnFailureJobMode is not documented!-->
|
||||
|
||||
@ -2019,7 +2019,7 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="DefaultDependencies"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="OnSuccesJobMode"/>
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="OnSuccessJobMode"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="OnFailureJobMode"/>
|
||||
|
||||
|
||||
@ -735,29 +735,33 @@
|
||||
<varlistentry>
|
||||
<term><varname>RxBufferSize=</varname></term>
|
||||
<listitem>
|
||||
<para>Takes an integer. Specifies the maximum number of pending packets in the NIC receive buffer.
|
||||
When unset, the kernel's default will be used.</para>
|
||||
<para>Takes an integer or <literal>max</literal>. Specifies the maximum number of pending packets
|
||||
in the NIC receive buffer. When unset, the kernel's default will be used. If set to
|
||||
<literal>max</literal>, the hardware's advertised maximum size will be used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>RxMiniBufferSize=</varname></term>
|
||||
<listitem>
|
||||
<para>Takes an integer. Specifies the maximum number of pending packets in the NIC mini receive buffer.
|
||||
When unset, the kernel's default will be used.</para>
|
||||
<para>Takes an integer or <literal>max</literal>. Specifies the maximum number of pending packets
|
||||
in the NIC mini receive buffer. When unset, the kernel's default will be used. If set to
|
||||
<literal>max</literal>, the hardware's advertised maximum size will be used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>RxJumboBufferSize=</varname></term>
|
||||
<listitem>
|
||||
<para>Takes an integer. Specifies the maximum number of pending packets in the NIC jumbo receive buffer.
|
||||
When unset, the kernel's default will be used.</para>
|
||||
<para>Takes an integer or <literal>max</literal>. Specifies the maximum number of pending packets
|
||||
in the NIC jumbo receive buffer. When unset, the kernel's default will be used. If set to
|
||||
<literal>max</literal>, the hardware's advertised maximum size will be used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>TxBufferSize=</varname></term>
|
||||
<listitem>
|
||||
<para>Takes an integer. Specifies the maximum number of pending packets in the NIC transmit buffer.
|
||||
When unset, the kernel's default will be used.</para>
|
||||
<para>Takes an integer or <literal>max</literal>. Specifies the maximum number of pending packets
|
||||
in the NIC transmit buffer. When unset, the kernel's default will be used. If set to
|
||||
<literal>max</literal>, the hardware's advertised maximum size will be used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
|
||||
@ -187,6 +187,8 @@
|
||||
<listitem>
|
||||
<para>Takes a boolean. If set to true, promiscuous mode of the interface is enabled.
|
||||
Defaults to unset.</para>
|
||||
<para>If this is set to false for the underlying link of a <literal>passthru</literal> mode MACVLAN/MACVTAP,
|
||||
the virtual interface will be created with the <literal>nopromisc</literal> flag set.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@ -1239,7 +1241,9 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
|
||||
<term><varname>Priority=</varname></term>
|
||||
<listitem>
|
||||
<para>Specifies the priority of this rule. <varname>Priority=</varname> is an unsigned
|
||||
integer. Higher number means lower priority, and rules get processed in order of increasing number.</para>
|
||||
integer in the range 0…4294967295. Higher number means lower priority, and rules get
|
||||
processed in order of increasing number. Defaults to unset, and the kernel will pick
|
||||
a value dynamically.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@ -1879,8 +1883,9 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
|
||||
<varlistentry>
|
||||
<term><varname>RouteMetric=</varname></term>
|
||||
<listitem>
|
||||
<para>Set the routing metric for routes specified by the DHCP server. Takes an unsigned
|
||||
integer in the range 0…4294967295. Defaults to 1024.</para>
|
||||
<para>Set the routing metric for routes specified by the DHCP server (including the prefix
|
||||
route added for the specified prefix). Takes an unsigned integer in the range 0…4294967295.
|
||||
Defaults to 1024.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
@ -619,6 +619,18 @@
|
||||
for device <replaceable>DEVPATH</replaceable>, and print debug
|
||||
output.</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>-a</option></term>
|
||||
<term><option>--action=<replaceable>ACTION</replaceable></option></term>
|
||||
<listitem>
|
||||
<para>Type of event to be simulated. Possible actions are <literal>add</literal>,
|
||||
<literal>remove</literal>, <literal>change</literal>, <literal>move</literal>,
|
||||
<literal>online</literal>, <literal>offline</literal>, <literal>bind</literal>,
|
||||
and <literal>unbind</literal>. Also, the special value <literal>help</literal> can be used
|
||||
to list the possible actions. The default value is <literal>add</literal>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<xi:include href="standard-options.xml" xpointer="help" />
|
||||
</variablelist>
|
||||
</refsect2>
|
||||
|
||||
@ -61,6 +61,7 @@ _udevadm() {
|
||||
[MONITOR_STANDALONE]='-k --kernel -u --udev -p --property'
|
||||
[MONITOR_ARG]='-s --subsystem-match -t --tag-match'
|
||||
[TEST]='-a --action -N --resolve-names'
|
||||
[TEST_BUILTIN]='-a --action'
|
||||
)
|
||||
|
||||
local verbs=(info trigger settle control monitor test-builtin test)
|
||||
@ -215,6 +216,16 @@ _udevadm() {
|
||||
;;
|
||||
|
||||
'test-builtin')
|
||||
if __contains_word "$prev" ${OPTS[TEST_BUILTIN]}; then
|
||||
case $prev in
|
||||
-a|--action)
|
||||
comps=$( udevadm test-builtin --action help )
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
for ((i=0; i < COMP_CWORD; i++)); do
|
||||
if __contains_word "${COMP_WORDS[i]}" "${builtins[@]}"; then
|
||||
builtin=${COMP_WORDS[i]}
|
||||
@ -225,7 +236,7 @@ _udevadm() {
|
||||
if [[ -z $builtin ]]; then
|
||||
comps="${builtins[@]}"
|
||||
elif [[ $cur = -* ]]; then
|
||||
comps="${OPTS[COMMON]}"
|
||||
comps="${OPTS[COMMON]} ${OPTS[TEST_BUILTIN]}"
|
||||
else
|
||||
comps=$( __get_all_sysdevs )
|
||||
local IFS=$'\n'
|
||||
|
||||
@ -23,7 +23,7 @@ _udevadm_trigger(){
|
||||
'--dry-run[Do not actually trigger the event.]' \
|
||||
'--quiet[Suppress error logging in triggering events.]' \
|
||||
'--type=[Trigger a specific type of devices.]:types:(devices subsystems failed)' \
|
||||
'--action=[Type of event to be triggered.]:actions:(add change remove)' \
|
||||
'--action=[Type of event to be triggered.]:actions:(add change remove move online offline bind unbind)' \
|
||||
'--subsystem-match=[Trigger events for devices which belong to a matching subsystem.]' \
|
||||
'--subsystem-nomatch=[Do not trigger events for devices which belong to a matching subsystem.]' \
|
||||
'--attr-match=attribute=[Trigger events for devices with a matching sysfs attribute.]' \
|
||||
@ -74,7 +74,7 @@ _udevadm_monitor(){
|
||||
(( $+functions[_udevadm_test] )) ||
|
||||
_udevadm_test(){
|
||||
_arguments \
|
||||
'--action=[The action string.]:actions:(add change remove)' \
|
||||
'--action=[The action string.]:actions:(add change remove move online offline bind unbind)' \
|
||||
'--subsystem=[The subsystem string.]' \
|
||||
'--help[Print help text.]' \
|
||||
'*::devpath:_files -P /sys/ -W /sys'
|
||||
@ -84,14 +84,17 @@ _udevadm_test(){
|
||||
_udevadm_test-builtin(){
|
||||
if (( CURRENT == 2 )); then
|
||||
_arguments \
|
||||
'--action=[The action string.]:actions:(add change remove move online offline bind unbind)' \
|
||||
'--help[Print help text]' \
|
||||
'*::builtins:(blkid btrfs hwdb input_id net_id net_setup_link kmod path_id usb_id uaccess)'
|
||||
elif (( CURRENT == 3 )); then
|
||||
_arguments \
|
||||
'--action=[The action string.]:actions:(add change remove move online offline bind unbind)' \
|
||||
'--help[Print help text]' \
|
||||
'*::syspath:_files -P /sys -W /sys'
|
||||
else
|
||||
_arguments \
|
||||
'--action=[The action string.]:actions:(add change remove move online offline bind unbind)' \
|
||||
'--help[Print help text]'
|
||||
fi
|
||||
}
|
||||
|
||||
@ -905,7 +905,8 @@ const sd_bus_vtable bus_unit_vtable[] = {
|
||||
SD_BUS_PROPERTY("RefuseManualStop", "b", bus_property_get_bool, offsetof(Unit, refuse_manual_stop), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("AllowIsolate", "b", bus_property_get_bool, offsetof(Unit, allow_isolate), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("DefaultDependencies", "b", bus_property_get_bool, offsetof(Unit, default_dependencies), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("OnSuccesJobMode", "s", property_get_job_mode, offsetof(Unit, on_success_job_mode), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("OnSuccesJobMode", "s", property_get_job_mode, offsetof(Unit, on_success_job_mode), SD_BUS_VTABLE_PROPERTY_CONST|SD_BUS_VTABLE_HIDDEN), /* deprecated */
|
||||
SD_BUS_PROPERTY("OnSuccessJobMode", "s", property_get_job_mode, offsetof(Unit, on_success_job_mode), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("OnFailureJobMode", "s", property_get_job_mode, offsetof(Unit, on_failure_job_mode), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("IgnoreOnIsolate", "b", bus_property_get_bool, offsetof(Unit, ignore_on_isolate), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("NeedDaemonReload", "b", property_get_need_daemon_reload, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
|
||||
@ -43,7 +43,7 @@ static int log_debug_open_error(struct crypt_device *cd, int r) {
|
||||
* (alternatively: name is set to null, flags contains CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY
|
||||
* and token is assigned to at least single keyslot).
|
||||
*
|
||||
* - if plugin defines validate funtion (see cryptsetup_token_validate below) it must have
|
||||
* - if plugin defines validate function (see cryptsetup_token_validate below) it must have
|
||||
* passed the check (aka return 0)
|
||||
*/
|
||||
_public_ int cryptsetup_token_open(
|
||||
@ -110,7 +110,7 @@ _public_ int cryptsetup_token_open(
|
||||
if (r < 0)
|
||||
return log_debug_open_error(cd, r);
|
||||
|
||||
/* free'd automaticaly by libcryptsetup */
|
||||
/* free'd automatically by libcryptsetup */
|
||||
*password_len = strlen(base64_encoded);
|
||||
*password = TAKE_PTR(base64_encoded);
|
||||
|
||||
|
||||
@ -434,7 +434,8 @@ static int add_mount(
|
||||
|
||||
/* Order the mount unit we generate relative to the post unit, so that DefaultDependencies= on the
|
||||
* target unit won't affect us. */
|
||||
if (post && !FLAGS_SET(flags, MOUNT_AUTOMOUNT) && !FLAGS_SET(flags, MOUNT_NOAUTO))
|
||||
if (post && !FLAGS_SET(flags, MOUNT_AUTOMOUNT) && !FLAGS_SET(flags, MOUNT_NOAUTO) &&
|
||||
!FLAGS_SET(flags, MOUNT_NOFAIL))
|
||||
fprintf(f, "Before=%s\n", post);
|
||||
|
||||
if (passno != 0) {
|
||||
|
||||
@ -349,7 +349,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
char *hh;
|
||||
size_t n;
|
||||
|
||||
/* If this is not a vaid verification mode, maybe it's a literally specified
|
||||
/* If this is not a valid verification mode, maybe it's a literally specified
|
||||
* SHA256 hash? We can handle that too... */
|
||||
|
||||
r = unhexmem(optarg, (size_t) -1, &h, &n);
|
||||
|
||||
@ -163,7 +163,9 @@ void routing_policy_rule_hash_func(const RoutingPolicyRule *rule, struct siphash
|
||||
siphash24_compress(&rule->type, sizeof(rule->type), state);
|
||||
siphash24_compress(&rule->fwmark, sizeof(rule->fwmark), state);
|
||||
siphash24_compress(&rule->fwmask, sizeof(rule->fwmask), state);
|
||||
siphash24_compress(&rule->priority, sizeof(rule->priority), state);
|
||||
siphash24_compress_boolean(rule->priority_set, state);
|
||||
if (rule->priority_set)
|
||||
siphash24_compress(&rule->priority, sizeof(rule->priority), state);
|
||||
siphash24_compress(&rule->table, sizeof(rule->table), state);
|
||||
siphash24_compress(&rule->suppress_prefixlen, sizeof(rule->suppress_prefixlen), state);
|
||||
|
||||
@ -229,10 +231,16 @@ int routing_policy_rule_compare_func(const RoutingPolicyRule *a, const RoutingPo
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
r = CMP(a->priority, b->priority);
|
||||
r = CMP(a->priority_set, b->priority_set);
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
if (a->priority_set) {
|
||||
r = CMP(a->priority, b->priority);
|
||||
if (r != 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
r = CMP(a->table, b->table);
|
||||
if (r != 0)
|
||||
return r;
|
||||
@ -293,8 +301,9 @@ DEFINE_PRIVATE_HASH_OPS_WITH_KEY_DESTRUCTOR(
|
||||
routing_policy_rule_compare_func,
|
||||
routing_policy_rule_free);
|
||||
|
||||
static int routing_policy_rule_get(Manager *m, const RoutingPolicyRule *rule, RoutingPolicyRule **ret) {
|
||||
static int routing_policy_rule_get(Manager *m, const RoutingPolicyRule *rule, bool require_priority, RoutingPolicyRule **ret) {
|
||||
RoutingPolicyRule *existing;
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
|
||||
@ -312,6 +321,23 @@ static int routing_policy_rule_get(Manager *m, const RoutingPolicyRule *rule, Ro
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!require_priority && rule->priority_set) {
|
||||
_cleanup_(routing_policy_rule_freep) RoutingPolicyRule *tmp = NULL;
|
||||
|
||||
r = routing_policy_rule_dup(rule, &tmp);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
tmp->priority_set = false;
|
||||
|
||||
existing = set_get(m->rules, tmp);
|
||||
if (existing) {
|
||||
if (ret)
|
||||
*ret = existing;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
@ -328,7 +354,7 @@ static int routing_policy_rule_add(Manager *m, const RoutingPolicyRule *in, Rout
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = routing_policy_rule_get(m, rule, &existing);
|
||||
r = routing_policy_rule_get(m, rule, true, &existing);
|
||||
if (r == -ENOENT) {
|
||||
/* Rule does not exist, use a new one. */
|
||||
r = set_ensure_put(&m->rules, &routing_policy_rule_hash_ops, rule);
|
||||
@ -371,6 +397,32 @@ static int routing_policy_rule_consume_foreign(Manager *m, RoutingPolicyRule *ru
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int routing_policy_rule_update_priority(RoutingPolicyRule *rule, uint32_t priority) {
|
||||
int r;
|
||||
|
||||
assert(rule);
|
||||
assert(rule->manager);
|
||||
|
||||
if (rule->priority_set)
|
||||
return 0;
|
||||
|
||||
if (!set_remove(rule->manager->rules, rule))
|
||||
return -ENOENT;
|
||||
|
||||
rule->priority = priority;
|
||||
rule->priority_set = true;
|
||||
|
||||
r = set_put(rule->manager->rules, rule);
|
||||
if (r <= 0) {
|
||||
/* Undo */
|
||||
rule->priority_set = false;
|
||||
assert_se(set_put(rule->manager->rules, rule) > 0);
|
||||
return r == 0 ? -EEXIST : r;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void log_routing_policy_rule_debug(const RoutingPolicyRule *rule, const char *str, const Link *link, const Manager *m) {
|
||||
_cleanup_free_ char *from = NULL, *to = NULL, *table = NULL;
|
||||
|
||||
@ -422,9 +474,11 @@ static int routing_policy_rule_set_netlink_message(const RoutingPolicyRule *rule
|
||||
return log_link_error_errno(link, r, "Could not set destination prefix length: %m");
|
||||
}
|
||||
|
||||
r = sd_netlink_message_append_u32(m, FRA_PRIORITY, rule->priority);
|
||||
if (r < 0)
|
||||
return log_link_error_errno(link, r, "Could not append FRA_PRIORITY attribute: %m");
|
||||
if (rule->priority_set) {
|
||||
r = sd_netlink_message_append_u32(m, FRA_PRIORITY, rule->priority);
|
||||
if (r < 0)
|
||||
return log_link_error_errno(link, r, "Could not append FRA_PRIORITY attribute: %m");
|
||||
}
|
||||
|
||||
if (rule->tos > 0) {
|
||||
r = sd_rtnl_message_routing_policy_rule_set_tos(m, rule->tos);
|
||||
@ -662,6 +716,28 @@ int manager_drop_routing_policy_rules_internal(Manager *m, bool foreign, const L
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!foreign) {
|
||||
_cleanup_(routing_policy_rule_freep) RoutingPolicyRule *tmp = NULL;
|
||||
|
||||
/* The rule may be configured without priority. Try to find without priority. */
|
||||
|
||||
k = routing_policy_rule_dup(rule, &tmp);
|
||||
if (k < 0) {
|
||||
if (r >= 0)
|
||||
r = k;
|
||||
continue;
|
||||
}
|
||||
|
||||
tmp->priority_set = false;
|
||||
|
||||
k = links_have_routing_policy_rule(m, tmp, except);
|
||||
if (k != 0) {
|
||||
if (k < 0 && r >= 0)
|
||||
r = k;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
k = routing_policy_rule_remove(rule, m);
|
||||
if (k < 0 && r >= 0)
|
||||
r = k;
|
||||
@ -821,11 +897,11 @@ int request_process_routing_policy_rule(Request *req) {
|
||||
}
|
||||
|
||||
static const RoutingPolicyRule kernel_rules[] = {
|
||||
{ .family = AF_INET, .priority = 0, .table = RT_TABLE_LOCAL, .type = FR_ACT_TO_TBL, .uid_range.start = UID_INVALID, .uid_range.end = UID_INVALID, .suppress_prefixlen = -1, },
|
||||
{ .family = AF_INET, .priority = 32766, .table = RT_TABLE_MAIN, .type = FR_ACT_TO_TBL, .uid_range.start = UID_INVALID, .uid_range.end = UID_INVALID, .suppress_prefixlen = -1, },
|
||||
{ .family = AF_INET, .priority = 32767, .table = RT_TABLE_DEFAULT, .type = FR_ACT_TO_TBL, .uid_range.start = UID_INVALID, .uid_range.end = UID_INVALID, .suppress_prefixlen = -1, },
|
||||
{ .family = AF_INET6, .priority = 0, .table = RT_TABLE_LOCAL, .type = FR_ACT_TO_TBL, .uid_range.start = UID_INVALID, .uid_range.end = UID_INVALID, .suppress_prefixlen = -1, },
|
||||
{ .family = AF_INET6, .priority = 32766, .table = RT_TABLE_MAIN, .type = FR_ACT_TO_TBL, .uid_range.start = UID_INVALID, .uid_range.end = UID_INVALID, .suppress_prefixlen = -1, },
|
||||
{ .family = AF_INET, .priority_set = true, .priority = 0, .table = RT_TABLE_LOCAL, .type = FR_ACT_TO_TBL, .uid_range.start = UID_INVALID, .uid_range.end = UID_INVALID, .suppress_prefixlen = -1, },
|
||||
{ .family = AF_INET, .priority_set = true, .priority = 32766, .table = RT_TABLE_MAIN, .type = FR_ACT_TO_TBL, .uid_range.start = UID_INVALID, .uid_range.end = UID_INVALID, .suppress_prefixlen = -1, },
|
||||
{ .family = AF_INET, .priority_set = true, .priority = 32767, .table = RT_TABLE_DEFAULT, .type = FR_ACT_TO_TBL, .uid_range.start = UID_INVALID, .uid_range.end = UID_INVALID, .suppress_prefixlen = -1, },
|
||||
{ .family = AF_INET6, .priority_set = true, .priority = 0, .table = RT_TABLE_LOCAL, .type = FR_ACT_TO_TBL, .uid_range.start = UID_INVALID, .uid_range.end = UID_INVALID, .suppress_prefixlen = -1, },
|
||||
{ .family = AF_INET6, .priority_set = true, .priority = 32766, .table = RT_TABLE_MAIN, .type = FR_ACT_TO_TBL, .uid_range.start = UID_INVALID, .uid_range.end = UID_INVALID, .suppress_prefixlen = -1, },
|
||||
};
|
||||
|
||||
static bool routing_policy_rule_is_created_by_kernel(const RoutingPolicyRule *rule) {
|
||||
@ -936,6 +1012,9 @@ int manager_rtnl_process_rule(sd_netlink *rtnl, sd_netlink_message *message, Man
|
||||
log_warning_errno(r, "rtnl: could not get FRA_PRIORITY attribute, ignoring: %m");
|
||||
return 0;
|
||||
}
|
||||
/* The kernel does not send priority if priority is zero. So, the flag below must be always set
|
||||
* even if the message does not contain FRA_PRIORITY. */
|
||||
tmp->priority_set = true;
|
||||
|
||||
r = sd_netlink_message_read_u32(message, FRA_TABLE, &tmp->table);
|
||||
if (r < 0 && r != -ENODATA) {
|
||||
@ -1027,13 +1106,16 @@ int manager_rtnl_process_rule(sd_netlink *rtnl, sd_netlink_message *message, Man
|
||||
* protocol of the received rule is RTPROT_KERNEL or RTPROT_STATIC. */
|
||||
tmp->protocol = routing_policy_rule_is_created_by_kernel(tmp) ? RTPROT_KERNEL : RTPROT_STATIC;
|
||||
|
||||
(void) routing_policy_rule_get(m, tmp, &rule);
|
||||
(void) routing_policy_rule_get(m, tmp, false, &rule);
|
||||
|
||||
switch (type) {
|
||||
case RTM_NEWRULE:
|
||||
if (rule)
|
||||
if (rule) {
|
||||
log_routing_policy_rule_debug(tmp, "Received remembered", NULL, m);
|
||||
else if (!m->manage_foreign_routes)
|
||||
r = routing_policy_rule_update_priority(rule, tmp->priority);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to update priority of remembered routing policy rule, ignoring: %m");
|
||||
} else if (!m->manage_foreign_routes)
|
||||
log_routing_policy_rule_debug(tmp, "Ignoring received foreign", NULL, m);
|
||||
else {
|
||||
log_routing_policy_rule_debug(tmp, "Remembering foreign", NULL, m);
|
||||
@ -1155,11 +1237,19 @@ int config_parse_routing_policy_rule_priority(
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
n->priority = 0;
|
||||
n->priority_set = false;
|
||||
TAKE_PTR(n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = safe_atou32(rvalue, &n->priority);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse RPDB rule priority, ignoring: %s", rvalue);
|
||||
return 0;
|
||||
}
|
||||
n->priority_set = true;
|
||||
|
||||
TAKE_PTR(n);
|
||||
return 0;
|
||||
|
||||
@ -20,6 +20,7 @@ typedef struct RoutingPolicyRule {
|
||||
NetworkConfigSection *section;
|
||||
|
||||
bool invert_rule;
|
||||
bool priority_set;
|
||||
|
||||
uint8_t tos;
|
||||
uint8_t type;
|
||||
|
||||
@ -399,16 +399,24 @@ int ethtool_set_nic_buffer_size(int *ethtool_fd, const char *ifname, const netde
|
||||
return -errno;
|
||||
|
||||
if (ring->rx_pending_set)
|
||||
UPDATE(ecmd.rx_pending, ring->rx_pending, need_update);
|
||||
UPDATE(ecmd.rx_pending,
|
||||
ring->rx_pending == 0 ? ecmd.rx_max_pending : ring->rx_pending,
|
||||
need_update);
|
||||
|
||||
if (ring->rx_mini_pending_set)
|
||||
UPDATE(ecmd.rx_mini_pending, ring->rx_mini_pending, need_update);
|
||||
UPDATE(ecmd.rx_mini_pending,
|
||||
ring->rx_mini_pending == 0 ? ecmd.rx_mini_max_pending : ring->rx_mini_pending,
|
||||
need_update);
|
||||
|
||||
if (ring->rx_jumbo_pending_set)
|
||||
UPDATE(ecmd.rx_jumbo_pending, ring->rx_jumbo_pending, need_update);
|
||||
UPDATE(ecmd.rx_jumbo_pending,
|
||||
ring->rx_jumbo_pending == 0 ? ecmd.rx_jumbo_max_pending : ring->rx_jumbo_pending,
|
||||
need_update);
|
||||
|
||||
if (ring->tx_pending_set)
|
||||
UPDATE(ecmd.tx_pending, ring->tx_pending, need_update);
|
||||
UPDATE(ecmd.tx_pending,
|
||||
ring->tx_pending == 0 ? ecmd.tx_max_pending : ring->tx_pending,
|
||||
need_update);
|
||||
|
||||
if (!need_update)
|
||||
return 0;
|
||||
@ -1047,16 +1055,20 @@ int config_parse_nic_buffer_size(
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
r = safe_atou32(rvalue, &k);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"Failed to parse interface buffer value, ignoring: %s", rvalue);
|
||||
return 0;
|
||||
}
|
||||
if (k < 1) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, 0,
|
||||
"Invalid %s= value, ignoring: %s", lvalue, rvalue);
|
||||
return 0;
|
||||
if (streq(rvalue, "max"))
|
||||
k = 0;
|
||||
else {
|
||||
r = safe_atou32(rvalue, &k);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"Failed to parse interface buffer value, ignoring: %s", rvalue);
|
||||
return 0;
|
||||
}
|
||||
if (k < 1) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, 0,
|
||||
"Invalid %s= value, ignoring: %s", lvalue, rvalue);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (streq(lvalue, "RxBufferSize")) {
|
||||
|
||||
@ -70,6 +70,8 @@ typedef struct netdev_channels {
|
||||
} netdev_channels;
|
||||
|
||||
typedef struct netdev_ring_param {
|
||||
/* For any of the 4 following settings, a value of 0 indicates the hardware advertised maximum should
|
||||
* be used. */
|
||||
uint32_t rx_pending;
|
||||
uint32_t rx_mini_pending;
|
||||
uint32_t rx_jumbo_pending;
|
||||
|
||||
@ -19,9 +19,9 @@
|
||||
#include "stat-util.h"
|
||||
#include "string-util.h"
|
||||
|
||||
/* We treat tmpfs/ramfs + cgroupfs as non-physical file sytems. cgroupfs is similar to tmpfs in a way after
|
||||
* all: we can create arbitrary directory hierarchies in it, and hence can also use rm_rf() on it to remove
|
||||
* those again. */
|
||||
/* We treat tmpfs/ramfs + cgroupfs as non-physical file systems. cgroupfs is similar to tmpfs in a way
|
||||
* after all: we can create arbitrary directory hierarchies in it, and hence can also use rm_rf() on it
|
||||
* to remove those again. */
|
||||
static bool is_physical_fs(const struct statfs *sfs) {
|
||||
return !is_temporary_fs(sfs) && !is_cgroup_fs(sfs);
|
||||
}
|
||||
|
||||
@ -353,7 +353,7 @@ static int tpm2_get_best_pcr_bank(
|
||||
|
||||
assert_cc(TPM2_PCRS_MAX % 8 == 0);
|
||||
|
||||
/* It's not enought to check how many PCRs there are, we also need to check that the 24 are
|
||||
/* It's not enough to check how many PCRs there are, we also need to check that the 24 are
|
||||
* enabled for this bank. Otherwise this TPM doesn't qualify. */
|
||||
for (size_t j = 0; j < TPM2_PCRS_MAX/8; j++)
|
||||
if (pcap->data.assignedPCR.pcrSelections[i].pcrSelect[j] != 0xFF) {
|
||||
@ -411,7 +411,7 @@ static int tpm2_make_pcr_session(
|
||||
};
|
||||
TPML_PCR_SELECTION pcr_selection = {
|
||||
.count = 1,
|
||||
.pcrSelections[0].hash = TPM2_ALG_SHA256, /* overriden below, depending on TPM2 capabilities */
|
||||
.pcrSelections[0].hash = TPM2_ALG_SHA256, /* overridden below, depending on TPM2 capabilities */
|
||||
.pcrSelections[0].sizeofSelect = 3,
|
||||
.pcrSelections[0].pcrSelect[0] = pcr_mask & 0xFF,
|
||||
.pcrSelections[0].pcrSelect[1] = (pcr_mask >> 8) & 0xFF,
|
||||
|
||||
@ -11,14 +11,16 @@
|
||||
#include "udevadm.h"
|
||||
#include "udevadm-util.h"
|
||||
|
||||
static sd_device_action_t arg_action = SD_DEVICE_ADD;
|
||||
static const char *arg_command = NULL;
|
||||
static const char *arg_syspath = NULL;
|
||||
|
||||
static int help(void) {
|
||||
printf("%s test-builtin [OPTIONS] COMMAND DEVPATH\n\n"
|
||||
"Test a built-in command.\n\n"
|
||||
" -h --help Print this message\n"
|
||||
" -V --version Print version of the program\n\n"
|
||||
" -h --help Print this message\n"
|
||||
" -V --version Print version of the program\n\n"
|
||||
" -a --action=ACTION|help Set action string\n"
|
||||
"Commands:\n",
|
||||
program_invocation_short_name);
|
||||
|
||||
@ -29,15 +31,23 @@ static int help(void) {
|
||||
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
static const struct option options[] = {
|
||||
{ "version", no_argument, NULL, 'V' },
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{ "action", required_argument, NULL, 'a' },
|
||||
{ "version", no_argument, NULL, 'V' },
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{}
|
||||
};
|
||||
|
||||
int c;
|
||||
int r, c;
|
||||
|
||||
while ((c = getopt_long(argc, argv, "Vh", options, NULL)) >= 0)
|
||||
while ((c = getopt_long(argc, argv, "a:Vh", options, NULL)) >= 0)
|
||||
switch (c) {
|
||||
case 'a':
|
||||
r = parse_device_action(optarg, &arg_action);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Invalid action '%s'", optarg);
|
||||
if (r == 0)
|
||||
return 0;
|
||||
break;
|
||||
case 'V':
|
||||
return print_version();
|
||||
case 'h':
|
||||
@ -81,7 +91,7 @@ int builtin_main(int argc, char *argv[], void *userdata) {
|
||||
goto finish;
|
||||
}
|
||||
|
||||
r = find_device(arg_syspath, "/sys", &dev);
|
||||
r = find_device_with_action(arg_syspath, arg_action, &dev);
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Failed to open device '%s': %m", arg_syspath);
|
||||
goto finish;
|
||||
|
||||
@ -21,11 +21,12 @@
|
||||
#include "strxcpyx.h"
|
||||
#include "udev-builtin.h"
|
||||
#include "udev-event.h"
|
||||
#include "udevadm-util.h"
|
||||
#include "udevadm.h"
|
||||
|
||||
static const char *arg_action = "add";
|
||||
static sd_device_action_t arg_action = SD_DEVICE_ADD;
|
||||
static ResolveNameTiming arg_resolve_name_timing = RESOLVE_NAME_EARLY;
|
||||
static char arg_syspath[UDEV_PATH_SIZE] = {};
|
||||
static const char *arg_syspath = NULL;
|
||||
|
||||
static int help(void) {
|
||||
|
||||
@ -49,25 +50,17 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
{}
|
||||
};
|
||||
|
||||
int c;
|
||||
int r, c;
|
||||
|
||||
while ((c = getopt_long(argc, argv, "a:N:Vh", options, NULL)) >= 0)
|
||||
switch (c) {
|
||||
case 'a': {
|
||||
sd_device_action_t a;
|
||||
|
||||
if (streq(optarg, "help")) {
|
||||
dump_device_action_table();
|
||||
case 'a':
|
||||
r = parse_device_action(optarg, &arg_action);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Invalid action '%s'", optarg);
|
||||
if (r == 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
a = device_action_from_string(optarg);
|
||||
if (a < 0)
|
||||
return log_error_errno(a, "Invalid action '%s'", optarg);
|
||||
|
||||
arg_action = device_action_to_string(a);
|
||||
break;
|
||||
}
|
||||
case 'N':
|
||||
arg_resolve_name_timing = resolve_name_timing_from_string(optarg);
|
||||
if (arg_resolve_name_timing < 0)
|
||||
@ -84,15 +77,9 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (!argv[optind])
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"syspath parameter missing.");
|
||||
|
||||
/* add /sys if needed */
|
||||
if (!path_startswith(argv[optind], "/sys"))
|
||||
strscpyl(arg_syspath, sizeof(arg_syspath), "/sys", argv[optind], NULL);
|
||||
else
|
||||
strscpy(arg_syspath, sizeof(arg_syspath), argv[optind]);
|
||||
arg_syspath = argv[optind];
|
||||
if (!arg_syspath)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "syspath parameter missing.");
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -127,7 +114,7 @@ int test_main(int argc, char *argv[], void *userdata) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
r = device_new_from_synthetic_event(&dev, arg_syspath, arg_action);
|
||||
r = find_device_with_action(arg_syspath, arg_action, &dev);
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Failed to open device '%s': %m", arg_syspath);
|
||||
goto out;
|
||||
|
||||
@ -312,17 +312,13 @@ int trigger_main(int argc, char *argv[], void *userdata) {
|
||||
else
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Unknown type --type=%s", optarg);
|
||||
break;
|
||||
case 'c': {
|
||||
if (streq(optarg, "help")) {
|
||||
dump_device_action_table();
|
||||
case 'c':
|
||||
r = parse_device_action(optarg, &action);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Unknown action '%s'", optarg);
|
||||
if (r == 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
action = device_action_from_string(optarg);
|
||||
if (action < 0)
|
||||
return log_error_errno(action, "Unknown action '%s'", optarg);
|
||||
break;
|
||||
}
|
||||
case 's':
|
||||
r = sd_device_enumerator_add_match_subsystem(e, optarg, true);
|
||||
if (r < 0)
|
||||
|
||||
@ -93,3 +93,39 @@ int find_device(const char *id, const char *prefix, sd_device **ret) {
|
||||
|
||||
return find_device_from_path(id, ret);
|
||||
}
|
||||
|
||||
int find_device_with_action(const char *id, sd_device_action_t action, sd_device **ret) {
|
||||
_cleanup_free_ char *path = NULL;
|
||||
|
||||
assert(id);
|
||||
assert(ret);
|
||||
assert(action >= 0 && action < _SD_DEVICE_ACTION_MAX);
|
||||
|
||||
if (!path_startswith(id, "/sys")) {
|
||||
path = path_join("/sys", id);
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
id = path;
|
||||
}
|
||||
|
||||
return device_new_from_synthetic_event(ret, id, device_action_to_string(action));
|
||||
}
|
||||
|
||||
int parse_device_action(const char *str, sd_device_action_t *action) {
|
||||
sd_device_action_t a;
|
||||
|
||||
assert(str);
|
||||
assert(action);
|
||||
|
||||
if (streq(str, "help")) {
|
||||
dump_device_action_table();
|
||||
return 0;
|
||||
}
|
||||
|
||||
a = device_action_from_string(str);
|
||||
if (a < 0)
|
||||
return a;
|
||||
|
||||
*action = a;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -4,3 +4,5 @@
|
||||
#include "sd-device.h"
|
||||
|
||||
int find_device(const char *id, const char *prefix, sd_device **ret);
|
||||
int find_device_with_action(const char *id, sd_device_action_t action, sd_device **ret);
|
||||
int parse_device_action(const char *str, sd_device_action_t *action);
|
||||
|
||||
@ -3719,7 +3719,7 @@ class NetworkdBridgeTests(unittest.TestCase, Utilities):
|
||||
|
||||
output = check_output('ip rule list table 100')
|
||||
print(output)
|
||||
self.assertIn('0: from all to 8.8.8.8 lookup 100', output)
|
||||
self.assertIn('from all to 8.8.8.8 lookup 100', output)
|
||||
|
||||
class NetworkdLLDPTests(unittest.TestCase, Utilities):
|
||||
links = ['veth99']
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user