mirror of
https://github.com/systemd/systemd
synced 2026-03-24 15:55:00 +01:00
Compare commits
9 Commits
801cf85935
...
32a2ee2bb4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32a2ee2bb4 | ||
|
|
d7799877a0 | ||
|
|
fa55e7b338 | ||
|
|
6178e2f889 | ||
|
|
0cddb53c85 | ||
|
|
c347a98272 | ||
|
|
988b0660aa | ||
|
|
1171f3f030 | ||
|
|
17d808a8bf |
@ -9,6 +9,7 @@
|
||||
#include "fileio.h"
|
||||
#include "nulstr-util.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
#include "stat-util.h"
|
||||
#include "stdio-util.h"
|
||||
#include "string-util.h"
|
||||
@ -260,7 +261,7 @@ int bpf_devices_apply_policy(
|
||||
r = bpf_program_cgroup_attach(prog, BPF_CGROUP_DEVICE, controller_path, BPF_F_ALLOW_MULTI);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Attaching device control BPF program to cgroup %s failed: %m",
|
||||
cgroup_path);
|
||||
empty_to_root(cgroup_path));
|
||||
|
||||
finish:
|
||||
/* Unref the old BPF program (which will implicitly detach it) right before attaching the new program. */
|
||||
|
||||
@ -84,7 +84,7 @@ static int set_attribute_and_warn(Unit *u, const char *controller, const char *a
|
||||
r = cg_set_attribute(controller, u->cgroup_path, attribute, value);
|
||||
if (r < 0)
|
||||
log_unit_full_errno(u, LOG_LEVEL_CGROUP_WRITE(r), r, "Failed to set '%s' attribute on '%s' to '%.*s': %m",
|
||||
strna(attribute), isempty(u->cgroup_path) ? "/" : u->cgroup_path, (int) strcspn(value, NEWLINE), value);
|
||||
strna(attribute), empty_to_root(u->cgroup_path), (int) strcspn(value, NEWLINE), value);
|
||||
|
||||
return r;
|
||||
}
|
||||
@ -706,25 +706,25 @@ void cgroup_oomd_xattr_apply(Unit *u, const char *cgroup_path) {
|
||||
if (c->moom_preference == MANAGED_OOM_PREFERENCE_OMIT) {
|
||||
r = cg_set_xattr(SYSTEMD_CGROUP_CONTROLLER, cgroup_path, "user.oomd_omit", "1", 1, 0);
|
||||
if (r < 0)
|
||||
log_unit_debug_errno(u, r, "Failed to set oomd_omit flag on control group %s, ignoring: %m", cgroup_path);
|
||||
log_unit_debug_errno(u, r, "Failed to set oomd_omit flag on control group %s, ignoring: %m", empty_to_root(cgroup_path));
|
||||
}
|
||||
|
||||
if (c->moom_preference == MANAGED_OOM_PREFERENCE_AVOID) {
|
||||
r = cg_set_xattr(SYSTEMD_CGROUP_CONTROLLER, cgroup_path, "user.oomd_avoid", "1", 1, 0);
|
||||
if (r < 0)
|
||||
log_unit_debug_errno(u, r, "Failed to set oomd_avoid flag on control group %s, ignoring: %m", cgroup_path);
|
||||
log_unit_debug_errno(u, r, "Failed to set oomd_avoid flag on control group %s, ignoring: %m", empty_to_root(cgroup_path));
|
||||
}
|
||||
|
||||
if (c->moom_preference != MANAGED_OOM_PREFERENCE_AVOID) {
|
||||
r = cg_remove_xattr(SYSTEMD_CGROUP_CONTROLLER, cgroup_path, "user.oomd_avoid");
|
||||
if (r != -ENODATA)
|
||||
log_unit_debug_errno(u, r, "Failed to remove oomd_avoid flag on control group %s, ignoring: %m", cgroup_path);
|
||||
if (r < 0 && r != -ENODATA)
|
||||
log_unit_debug_errno(u, r, "Failed to remove oomd_avoid flag on control group %s, ignoring: %m", empty_to_root(cgroup_path));
|
||||
}
|
||||
|
||||
if (c->moom_preference != MANAGED_OOM_PREFERENCE_OMIT) {
|
||||
r = cg_remove_xattr(SYSTEMD_CGROUP_CONTROLLER, cgroup_path, "user.oomd_omit");
|
||||
if (r != -ENODATA)
|
||||
log_unit_debug_errno(u, r, "Failed to remove oomd_omit flag on control group %s, ignoring: %m", cgroup_path);
|
||||
if (r < 0 && r != -ENODATA)
|
||||
log_unit_debug_errno(u, r, "Failed to remove oomd_omit flag on control group %s, ignoring: %m", empty_to_root(cgroup_path));
|
||||
}
|
||||
}
|
||||
|
||||
@ -743,7 +743,7 @@ static void cgroup_xattr_apply(Unit *u) {
|
||||
sd_id128_to_string(u->invocation_id, ids), 32,
|
||||
0);
|
||||
if (r < 0)
|
||||
log_unit_debug_errno(u, r, "Failed to set invocation ID on control group %s, ignoring: %m", u->cgroup_path);
|
||||
log_unit_debug_errno(u, r, "Failed to set invocation ID on control group %s, ignoring: %m", empty_to_root(u->cgroup_path));
|
||||
}
|
||||
|
||||
if (unit_cgroup_delegate(u)) {
|
||||
@ -752,11 +752,11 @@ static void cgroup_xattr_apply(Unit *u) {
|
||||
"1", 1,
|
||||
0);
|
||||
if (r < 0)
|
||||
log_unit_debug_errno(u, r, "Failed to set delegate flag on control group %s, ignoring: %m", u->cgroup_path);
|
||||
log_unit_debug_errno(u, r, "Failed to set delegate flag on control group %s, ignoring: %m", empty_to_root(u->cgroup_path));
|
||||
} else {
|
||||
r = cg_remove_xattr(SYSTEMD_CGROUP_CONTROLLER, u->cgroup_path, "trusted.delegate");
|
||||
if (r != -ENODATA)
|
||||
log_unit_debug_errno(u, r, "Failed to remove delegate flag on control group %s, ignoring: %m", u->cgroup_path);
|
||||
if (r < 0 && r != -ENODATA)
|
||||
log_unit_debug_errno(u, r, "Failed to remove delegate flag on control group %s, ignoring: %m", empty_to_root(u->cgroup_path));
|
||||
}
|
||||
|
||||
cgroup_oomd_xattr_apply(u, u->cgroup_path);
|
||||
@ -1913,12 +1913,12 @@ int unit_watch_cgroup(Unit *u) {
|
||||
* is not an error */
|
||||
return 0;
|
||||
|
||||
return log_unit_error_errno(u, errno, "Failed to add control inotify watch descriptor for control group %s: %m", u->cgroup_path);
|
||||
return log_unit_error_errno(u, errno, "Failed to add control inotify watch descriptor for control group %s: %m", empty_to_root(u->cgroup_path));
|
||||
}
|
||||
|
||||
r = hashmap_put(u->manager->cgroup_control_inotify_wd_unit, INT_TO_PTR(u->cgroup_control_inotify_wd), u);
|
||||
if (r < 0)
|
||||
return log_unit_error_errno(u, r, "Failed to add control inotify watch descriptor to hash map: %m");
|
||||
return log_unit_error_errno(u, r, "Failed to add control inotify watch descriptor for control group %s to hash map: %m", empty_to_root(u->cgroup_path));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1976,12 +1976,12 @@ int unit_watch_cgroup_memory(Unit *u) {
|
||||
* is not an error */
|
||||
return 0;
|
||||
|
||||
return log_unit_error_errno(u, errno, "Failed to add memory inotify watch descriptor for control group %s: %m", u->cgroup_path);
|
||||
return log_unit_error_errno(u, errno, "Failed to add memory inotify watch descriptor for control group %s: %m", empty_to_root(u->cgroup_path));
|
||||
}
|
||||
|
||||
r = hashmap_put(u->manager->cgroup_memory_inotify_wd_unit, INT_TO_PTR(u->cgroup_memory_inotify_wd), u);
|
||||
if (r < 0)
|
||||
return log_unit_error_errno(u, r, "Failed to add memory inotify watch descriptor to hash map: %m");
|
||||
return log_unit_error_errno(u, r, "Failed to add memory inotify watch descriptor for control group %s to hash map: %m", empty_to_root(u->cgroup_path));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2004,9 +2004,9 @@ int unit_pick_cgroup_path(Unit *u) {
|
||||
|
||||
r = unit_set_cgroup_path(u, path);
|
||||
if (r == -EEXIST)
|
||||
return log_unit_error_errno(u, r, "Control group %s exists already.", path);
|
||||
return log_unit_error_errno(u, r, "Control group %s exists already.", empty_to_root(path));
|
||||
if (r < 0)
|
||||
return log_unit_error_errno(u, r, "Failed to set unit's control group path to %s: %m", path);
|
||||
return log_unit_error_errno(u, r, "Failed to set unit's control group path to %s: %m", empty_to_root(path));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2034,7 +2034,7 @@ static int unit_update_cgroup(
|
||||
/* First, create our own group */
|
||||
r = cg_create_everywhere(u->manager->cgroup_supported, target_mask, u->cgroup_path);
|
||||
if (r < 0)
|
||||
return log_unit_error_errno(u, r, "Failed to create cgroup %s: %m", u->cgroup_path);
|
||||
return log_unit_error_errno(u, r, "Failed to create cgroup %s: %m", empty_to_root(u->cgroup_path));
|
||||
created = r;
|
||||
|
||||
/* Start watching it */
|
||||
@ -2050,7 +2050,7 @@ static int unit_update_cgroup(
|
||||
/* Enable all controllers we need */
|
||||
r = cg_enable_everywhere(u->manager->cgroup_supported, enable_mask, u->cgroup_path, &result_mask);
|
||||
if (r < 0)
|
||||
log_unit_warning_errno(u, r, "Failed to enable/disable controllers on cgroup %s, ignoring: %m", u->cgroup_path);
|
||||
log_unit_warning_errno(u, r, "Failed to enable/disable controllers on cgroup %s, ignoring: %m", empty_to_root(u->cgroup_path));
|
||||
|
||||
/* Remember what's actually enabled now */
|
||||
u->cgroup_enabled_mask = result_mask;
|
||||
@ -2072,12 +2072,12 @@ static int unit_update_cgroup(
|
||||
if (cg_all_unified() == 0) {
|
||||
r = cg_migrate_v1_controllers(u->manager->cgroup_supported, migrate_mask, u->cgroup_path, migrate_callback, u);
|
||||
if (r < 0)
|
||||
log_unit_warning_errno(u, r, "Failed to migrate controller cgroups from %s, ignoring: %m", u->cgroup_path);
|
||||
log_unit_warning_errno(u, r, "Failed to migrate controller cgroups from %s, ignoring: %m", empty_to_root(u->cgroup_path));
|
||||
|
||||
is_root_slice = unit_has_name(u, SPECIAL_ROOT_SLICE);
|
||||
r = cg_trim_v1_controllers(u->manager->cgroup_supported, ~target_mask, u->cgroup_path, !is_root_slice);
|
||||
if (r < 0)
|
||||
log_unit_warning_errno(u, r, "Failed to delete controller cgroups %s, ignoring: %m", u->cgroup_path);
|
||||
log_unit_warning_errno(u, r, "Failed to delete controller cgroups %s, ignoring: %m", empty_to_root(u->cgroup_path));
|
||||
}
|
||||
|
||||
/* Set attributes */
|
||||
@ -2167,7 +2167,7 @@ int unit_attach_pids_to_cgroup(Unit *u, Set *pids, const char *suffix_path) {
|
||||
|
||||
log_unit_full_errno(u, again ? LOG_DEBUG : LOG_INFO, q,
|
||||
"Couldn't move process "PID_FMT" to%s requested cgroup '%s': %m",
|
||||
pid, again ? " directly" : "", p);
|
||||
pid, again ? " directly" : "", empty_to_root(p));
|
||||
|
||||
if (again) {
|
||||
int z;
|
||||
@ -2179,7 +2179,7 @@ int unit_attach_pids_to_cgroup(Unit *u, Set *pids, const char *suffix_path) {
|
||||
|
||||
z = unit_attach_pid_to_cgroup_via_bus(u, pid, suffix_path);
|
||||
if (z < 0)
|
||||
log_unit_info_errno(u, z, "Couldn't move process "PID_FMT" to requested cgroup '%s' (directly or via the system bus): %m", pid, p);
|
||||
log_unit_info_errno(u, z, "Couldn't move process "PID_FMT" to requested cgroup '%s' (directly or via the system bus): %m", pid, empty_to_root(p));
|
||||
else
|
||||
continue; /* When the bus thing worked via the bus we are fully done for this PID. */
|
||||
}
|
||||
@ -2213,7 +2213,7 @@ int unit_attach_pids_to_cgroup(Unit *u, Set *pids, const char *suffix_path) {
|
||||
continue; /* Success! */
|
||||
|
||||
log_unit_debug_errno(u, q, "Failed to attach PID " PID_FMT " to requested cgroup %s in controller %s, falling back to unit's cgroup: %m",
|
||||
pid, p, cgroup_controller_to_string(c));
|
||||
pid, empty_to_root(p), cgroup_controller_to_string(c));
|
||||
}
|
||||
|
||||
/* So this controller is either not delegate or realized, or something else weird happened. In
|
||||
@ -2648,7 +2648,7 @@ void unit_prune_cgroup(Unit *u) {
|
||||
* the containing slice is stopped. So even if we failed now, this unit shouldn't assume
|
||||
* that the cgroup is still realized the next time it is started. Do not return early
|
||||
* on error, continue cleanup. */
|
||||
log_unit_full_errno(u, r == -EBUSY ? LOG_DEBUG : LOG_WARNING, r, "Failed to destroy cgroup %s, ignoring: %m", u->cgroup_path);
|
||||
log_unit_full_errno(u, r == -EBUSY ? LOG_DEBUG : LOG_WARNING, r, "Failed to destroy cgroup %s, ignoring: %m", empty_to_root(u->cgroup_path));
|
||||
|
||||
if (is_root_slice)
|
||||
return;
|
||||
@ -2861,7 +2861,7 @@ void unit_add_to_cgroup_empty_queue(Unit *u) {
|
||||
|
||||
r = cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, u->cgroup_path);
|
||||
if (r < 0) {
|
||||
log_unit_debug_errno(u, r, "Failed to determine whether cgroup %s is empty: %m", u->cgroup_path);
|
||||
log_unit_debug_errno(u, r, "Failed to determine whether cgroup %s is empty: %m", empty_to_root(u->cgroup_path));
|
||||
return;
|
||||
}
|
||||
if (r == 0)
|
||||
|
||||
@ -427,7 +427,7 @@ bool unit_may_gc(Unit *u) {
|
||||
|
||||
r = cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, u->cgroup_path);
|
||||
if (r < 0)
|
||||
log_unit_debug_errno(u, r, "Failed to determine whether cgroup %s is empty: %m", u->cgroup_path);
|
||||
log_unit_debug_errno(u, r, "Failed to determine whether cgroup %s is empty: %m", empty_to_root(u->cgroup_path));
|
||||
if (r <= 0)
|
||||
return false;
|
||||
}
|
||||
@ -4548,7 +4548,7 @@ int unit_kill_context(
|
||||
log_func, u);
|
||||
if (r < 0) {
|
||||
if (!IN_SET(r, -EAGAIN, -ESRCH, -ENOENT))
|
||||
log_unit_warning_errno(u, r, "Failed to kill control group %s, ignoring: %m", u->cgroup_path);
|
||||
log_unit_warning_errno(u, r, "Failed to kill control group %s, ignoring: %m", empty_to_root(u->cgroup_path));
|
||||
|
||||
} else if (r > 0) {
|
||||
|
||||
@ -5006,7 +5006,7 @@ int unit_fork_helper_process(Unit *u, const char *name, pid_t *ret) {
|
||||
if (u->cgroup_path) {
|
||||
r = cg_attach_everywhere(u->manager->cgroup_supported, u->cgroup_path, 0, NULL, NULL);
|
||||
if (r < 0) {
|
||||
log_unit_error_errno(u, r, "Failed to join unit cgroup %s: %m", u->cgroup_path);
|
||||
log_unit_error_errno(u, r, "Failed to join unit cgroup %s: %m", empty_to_root(u->cgroup_path));
|
||||
_exit(EXIT_CGROUP);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1479,15 +1479,16 @@ static int client_receive_message(
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (client->transaction_id != (message->transaction_id &
|
||||
htobe32(0x00ffffff)))
|
||||
if (client->transaction_id != (message->transaction_id & htobe32(0x00ffffff)))
|
||||
return 0;
|
||||
|
||||
switch (client->state) {
|
||||
case DHCP6_STATE_INFORMATION_REQUEST:
|
||||
r = client_receive_reply(client, message, len);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
log_dhcp6_client_errno(client, r, "Failed to process received reply message, ignoring: %m");
|
||||
return 0;
|
||||
}
|
||||
|
||||
client_notify(client, SD_DHCP6_CLIENT_EVENT_INFORMATION_REQUEST);
|
||||
|
||||
@ -1497,10 +1498,13 @@ static int client_receive_message(
|
||||
|
||||
case DHCP6_STATE_SOLICITATION:
|
||||
r = client_receive_advertise(client, message, len);
|
||||
if (r < 0) {
|
||||
log_dhcp6_client_errno(client, r, "Failed to process received advertise message, ignoring: %m");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (r == DHCP6_STATE_REQUEST) {
|
||||
client_start(client, r);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1510,11 +1514,12 @@ static int client_receive_message(
|
||||
case DHCP6_STATE_REBIND:
|
||||
|
||||
r = client_receive_reply(client, message, len);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
log_dhcp6_client_errno(client, r, "Failed to process received reply message, ignoring: %m");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (r == DHCP6_STATE_BOUND) {
|
||||
|
||||
r = client_start(client, DHCP6_STATE_BOUND);
|
||||
if (r < 0) {
|
||||
client_stop(client, r);
|
||||
|
||||
@ -95,9 +95,16 @@ static int set_link_handler_internal(
|
||||
return 1;
|
||||
|
||||
on_error:
|
||||
if (op == SET_LINK_FLAGS) {
|
||||
switch (op) {
|
||||
case SET_LINK_FLAGS:
|
||||
assert(link->set_flags_messages > 0);
|
||||
link->set_flags_messages--;
|
||||
break;
|
||||
case SET_LINK_MASTER:
|
||||
link->master_set = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -106,7 +113,7 @@ on_error:
|
||||
static int link_set_addrgen_mode_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
int r;
|
||||
|
||||
r = set_link_handler_internal(rtnl, m, link, SET_LINK_ADDRESS_GENERATION_MODE, true, NULL);
|
||||
r = set_link_handler_internal(rtnl, m, link, SET_LINK_ADDRESS_GENERATION_MODE, /* ignore = */ true, NULL);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
@ -120,31 +127,31 @@ static int link_set_addrgen_mode_handler(sd_netlink *rtnl, sd_netlink_message *m
|
||||
}
|
||||
|
||||
static int link_set_bond_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
return set_link_handler_internal(rtnl, m, link, SET_LINK_BOND, false, NULL);
|
||||
return set_link_handler_internal(rtnl, m, link, SET_LINK_BOND, /* ignore = */ false, NULL);
|
||||
}
|
||||
|
||||
static int link_set_bridge_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
return set_link_handler_internal(rtnl, m, link, SET_LINK_BRIDGE, false, NULL);
|
||||
return set_link_handler_internal(rtnl, m, link, SET_LINK_BRIDGE, /* ignore = */ true, NULL);
|
||||
}
|
||||
|
||||
static int link_set_bridge_vlan_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
return set_link_handler_internal(rtnl, m, link, SET_LINK_BRIDGE_VLAN, false, NULL);
|
||||
return set_link_handler_internal(rtnl, m, link, SET_LINK_BRIDGE_VLAN, /* ignore = */ false, NULL);
|
||||
}
|
||||
|
||||
static int link_set_can_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
return set_link_handler_internal(rtnl, m, link, SET_LINK_CAN, false, NULL);
|
||||
return set_link_handler_internal(rtnl, m, link, SET_LINK_CAN, /* ignore = */ false, NULL);
|
||||
}
|
||||
|
||||
static int link_set_flags_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
return set_link_handler_internal(rtnl, m, link, SET_LINK_FLAGS, false, get_link_update_flag_handler);
|
||||
return set_link_handler_internal(rtnl, m, link, SET_LINK_FLAGS, /* ignore = */ false, get_link_update_flag_handler);
|
||||
}
|
||||
|
||||
static int link_set_group_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
return set_link_handler_internal(rtnl, m, link, SET_LINK_GROUP, false, NULL);
|
||||
return set_link_handler_internal(rtnl, m, link, SET_LINK_GROUP, /* ignore = */ false, NULL);
|
||||
}
|
||||
|
||||
static int link_set_mac_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
return set_link_handler_internal(rtnl, m, link, SET_LINK_MAC, true, get_link_default_handler);
|
||||
return set_link_handler_internal(rtnl, m, link, SET_LINK_MAC, /* ignore = */ true, get_link_default_handler);
|
||||
}
|
||||
|
||||
static int link_set_mac_allow_retry_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
@ -180,13 +187,18 @@ static int link_set_mac_allow_retry_handler(sd_netlink *rtnl, sd_netlink_message
|
||||
}
|
||||
|
||||
static int link_set_master_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
return set_link_handler_internal(rtnl, m, link, SET_LINK_MASTER, false, get_link_master_handler);
|
||||
return set_link_handler_internal(rtnl, m, link, SET_LINK_MASTER, /* ignore = */ false, get_link_master_handler);
|
||||
}
|
||||
|
||||
static int link_unset_master_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
/* Some devices do not support setting master ifindex. Let's ignore error on unsetting master ifindex. */
|
||||
return set_link_handler_internal(rtnl, m, link, SET_LINK_MASTER, /* ignore = */ true, get_link_master_handler);
|
||||
}
|
||||
|
||||
static int link_set_mtu_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
int r;
|
||||
|
||||
r = set_link_handler_internal(rtnl, m, link, SET_LINK_MTU, true, get_link_default_handler);
|
||||
r = set_link_handler_internal(rtnl, m, link, SET_LINK_MTU, /* ignore = */ true, get_link_default_handler);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
@ -745,10 +757,14 @@ int link_request_to_set_mac(Link *link, bool allow_retry) {
|
||||
|
||||
int link_request_to_set_master(Link *link) {
|
||||
assert(link);
|
||||
assert(link->network);
|
||||
|
||||
link->master_set = false;
|
||||
|
||||
return link_request_set_link(link, SET_LINK_MASTER, link_set_master_handler, NULL);
|
||||
if (link->network->batadv || link->network->bond || link->network->bridge || link->network->vrf)
|
||||
return link_request_set_link(link, SET_LINK_MASTER, link_set_master_handler, NULL);
|
||||
else
|
||||
return link_request_set_link(link, SET_LINK_MASTER, link_unset_master_handler, NULL);
|
||||
}
|
||||
|
||||
int link_request_to_set_mtu(Link *link, uint32_t mtu) {
|
||||
|
||||
12
test/test-network/conf/26-bridge-issue-20373.netdev
Normal file
12
test/test-network/conf/26-bridge-issue-20373.netdev
Normal file
@ -0,0 +1,12 @@
|
||||
[NetDev]
|
||||
Name=bridge99
|
||||
Kind=bridge
|
||||
|
||||
[Bridge]
|
||||
MulticastQuerier=yes
|
||||
MulticastSnooping=yes
|
||||
Priority=10
|
||||
STP=yes
|
||||
ForwardDelaySec=5
|
||||
MulticastIGMPVersion=2
|
||||
VLANFiltering=yes
|
||||
@ -0,0 +1,20 @@
|
||||
[Match]
|
||||
Name=bridge99
|
||||
|
||||
[Network]
|
||||
VLAN=vlan99
|
||||
IPForward=yes
|
||||
ConfigureWithoutCarrier=yes
|
||||
LLDP=yes
|
||||
IPv6AcceptRA=false
|
||||
|
||||
[Bridge]
|
||||
Learning=yes
|
||||
MulticastRouter=no
|
||||
UseBPDU=yes
|
||||
|
||||
[BridgeVLAN]
|
||||
VLAN=100
|
||||
|
||||
[BridgeVLAN]
|
||||
VLAN=600
|
||||
@ -0,0 +1,29 @@
|
||||
[Match]
|
||||
Name=test1
|
||||
|
||||
[Network]
|
||||
IPv6AcceptRA=no
|
||||
IPForward=yes
|
||||
Bridge=bridge99
|
||||
LinkLocalAddressing=no
|
||||
EmitLLDP=nearest-bridge
|
||||
LLDP=yes
|
||||
|
||||
[Link]
|
||||
RequiredForOnline=no
|
||||
|
||||
[Bridge]
|
||||
Learning=yes
|
||||
MulticastRouter=query
|
||||
UseBPDU=yes
|
||||
|
||||
[BridgeVLAN]
|
||||
VLAN=100
|
||||
EgressUntagged=100
|
||||
PVID=100
|
||||
|
||||
[BridgeVLAN]
|
||||
VLAN=560
|
||||
|
||||
[BridgeVLAN]
|
||||
VLAN=600
|
||||
@ -3425,21 +3425,29 @@ class NetworkdBridgeTests(unittest.TestCase, Utilities):
|
||||
links = [
|
||||
'bridge99',
|
||||
'dummy98',
|
||||
'test1']
|
||||
'test1',
|
||||
'vlan99',
|
||||
]
|
||||
|
||||
units = [
|
||||
'11-dummy.netdev',
|
||||
'12-dummy.netdev',
|
||||
'21-vlan.netdev',
|
||||
'21-vlan.network',
|
||||
'26-bridge.netdev',
|
||||
'26-bridge-configure-without-carrier.network',
|
||||
'26-bridge-issue-20373.netdev',
|
||||
'26-bridge-mdb-master.network',
|
||||
'26-bridge-mdb-slave.network',
|
||||
'26-bridge-slave-interface-1.network',
|
||||
'26-bridge-slave-interface-2.network',
|
||||
'26-bridge-vlan-master-issue-20373.network',
|
||||
'26-bridge-vlan-master.network',
|
||||
'26-bridge-vlan-slave-issue-20373.network',
|
||||
'26-bridge-vlan-slave.network',
|
||||
'bridge99-ignore-carrier-loss.network',
|
||||
'bridge99.network']
|
||||
'bridge99.network'
|
||||
]
|
||||
|
||||
routing_policy_rule_tables = ['100']
|
||||
|
||||
@ -3474,6 +3482,25 @@ class NetworkdBridgeTests(unittest.TestCase, Utilities):
|
||||
self.assertRegex(output, f'{i}')
|
||||
self.assertNotRegex(output, '4095')
|
||||
|
||||
def test_bridge_vlan_issue_20373(self):
|
||||
copy_unit_to_networkd_unit_path('11-dummy.netdev', '26-bridge-vlan-slave-issue-20373.network',
|
||||
'26-bridge-issue-20373.netdev', '26-bridge-vlan-master-issue-20373.network',
|
||||
'21-vlan.netdev', '21-vlan.network')
|
||||
start_networkd()
|
||||
self.wait_online(['test1:enslaved', 'bridge99:degraded', 'vlan99:routable'])
|
||||
|
||||
output = check_output('bridge vlan show dev test1')
|
||||
print(output)
|
||||
self.assertIn('100 PVID Egress Untagged', output)
|
||||
self.assertIn('560', output)
|
||||
self.assertIn('600', output)
|
||||
|
||||
output = check_output('bridge vlan show dev bridge99')
|
||||
print(output)
|
||||
self.assertIn('1 PVID Egress Untagged', output)
|
||||
self.assertIn('100', output)
|
||||
self.assertIn('600', output)
|
||||
|
||||
def test_bridge_mdb(self):
|
||||
copy_unit_to_networkd_unit_path('11-dummy.netdev', '26-bridge-mdb-slave.network',
|
||||
'26-bridge.netdev', '26-bridge-mdb-master.network')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user