mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-02-09 09:57:26 +03:00
Merge pull request #25628 from zhangjian3032/dev/fix-set-bond-mac-failed
network: Fix set bond device MAC address failed
This commit is contained in:
commit
bf9afd7b31
@ -502,6 +502,14 @@ static int link_is_ready_to_set_link(Link *link, Request *req) {
|
||||
r = link_down_now(link);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
/* If the kind of the link is "bond", we need
|
||||
* set the slave link down as well. */
|
||||
if (streq_ptr(link->kind, "bond")) {
|
||||
r = link_down_slave_links(link);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1226,6 +1234,21 @@ int link_down_now(Link *link) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int link_down_slave_links(Link *link) {
|
||||
Link *slave;
|
||||
int r;
|
||||
|
||||
assert(link);
|
||||
|
||||
SET_FOREACH(slave, link->slaves) {
|
||||
r = link_down_now(slave);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int link_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
int r;
|
||||
|
||||
|
@ -25,4 +25,5 @@ int link_request_to_activate(Link *link);
|
||||
int link_request_to_bring_up_or_down(Link *link, bool up);
|
||||
|
||||
int link_down_now(Link *link);
|
||||
int link_down_slave_links(Link *link);
|
||||
int link_remove(Link *link);
|
||||
|
@ -4,3 +4,6 @@ Name=bond199
|
||||
|
||||
[Network]
|
||||
IPv6AcceptRA=no
|
||||
|
||||
[Link]
|
||||
MACAddress=00:11:22:33:44:55
|
||||
|
@ -3881,6 +3881,7 @@ class NetworkdBondTests(unittest.TestCase, Utilities):
|
||||
output = check_output('ip -d link show bond199')
|
||||
print(output)
|
||||
self.assertRegex(output, 'primary dummy98')
|
||||
self.assertIn('link/ether 00:11:22:33:44:55', output)
|
||||
|
||||
def test_bond_operstate(self):
|
||||
copy_network_unit('25-bond.netdev', '11-dummy.netdev', '12-dummy.netdev',
|
||||
|
Loading…
x
Reference in New Issue
Block a user