Issue: When device is in bond mode and booting up, there is a probability of set bond MAC address failed due to `Device or resource busy` error. In systemd-networkd, set MAC address steps are: 1. Try to set MAC address to device. 2. If failed with `Device or resource busy`, then `Down` the device. 3. Try to set MAC address to device again. Currently, Even down the bond device, the bond device is still return `Device or resource busy` error. So the MAC address set failed. The root cause is that this not enough to down the bond device. We need to down all the slaves of the bond device. About this descprition, we could use those commands to check: ```shell We have two network devices: eth0, bond1, eth0 is slave of bond1. They are all up. 1. Down bond1, and set MAC address to bond1. ~# ip link set bond1 down ~# ip link set bond1 address 00:11:22:33:44:55 ip: SIOCSIFHWADDR: Device or resource busy 2. Down eth0, and set MAC address to bond1. ~# ip link set eth0 down ~# ip link set bond1 address 00:11:22:33:44:55 Set okay. ``` Fix: When setting the mac for the second time, if the device kind is bond, then we need to down the slave devices of bond device. Tested: Verified in a long time test( reboot cycles ). Fixes: #25627 Signed-off-by: Jian Zhang <zhangjian.3032@bytedance.com>
30 lines
887 B
C
30 lines
887 B
C
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
#pragma once
|
|
|
|
#include <inttypes.h>
|
|
#include <stdbool.h>
|
|
|
|
typedef struct Link Link;
|
|
|
|
int link_request_to_set_addrgen_mode(Link *link);
|
|
int link_request_to_set_bond(Link *link);
|
|
int link_request_to_set_bridge(Link *link);
|
|
int link_request_to_set_bridge_vlan(Link *link);
|
|
int link_request_to_set_can(Link *link);
|
|
int link_request_to_set_flags(Link *link);
|
|
int link_request_to_set_group(Link *link);
|
|
int link_request_to_set_mac(Link *link, bool allow_retry);
|
|
int link_request_to_set_ipoib(Link *link);
|
|
int link_request_to_set_master(Link *link);
|
|
int link_request_to_set_mtu(Link *link, uint32_t mtu);
|
|
|
|
int link_configure_mtu(Link *link);
|
|
|
|
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);
|