summaryrefslogtreecommitdiff
path: root/src/network/networkd-setlink.h
Commit message (Collapse)AuthorAgeFilesLines
* network: Fix set bond device MAC address failedJian Zhang2022-12-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* network: re-design request queueYu Watanabe2022-03-111-5/+0
| | | | | | | | This makes Request object takes hash, compare, free, and process functions. With this change, the logic in networkd-queue.c can be mostly independent of the type of the request or the object (e.g. Address) assigned to the request, and it becomes simpler.
* network: merge RequestType and SetLinkOperationYu Watanabe2022-03-111-21/+2
| | | | | These two enum indicate how we process the request. Hence, it is not necessary to introduce two separated indicators.
* network: make request_process_address() and friends take Link and ↵Yu Watanabe2022-03-111-2/+2
| | | | | | | | | | | | | | | | | corresponding object This also renames e.g. request_process_address() -> address_process_request(). Also, this drops type checks such as `assert(req->type == REQUEST_TYPE_ADDRESS)`, as in the later commits, the function of processing request, e.g. `address_process_request()`, will be assigned to the Request object when it is created. And the request type will be used to distinguish and to avoid deduplicating requests which do not have any assigned objects, like REQUEST_TYPE_DHCP4_CLIENT. Hence, the type checks in process functions are mostly not necessary and redundant. This is mostly cleanups and preparation for later commits, and should not change any behavior.
* network: make link_down() independent of link_up_or_down()Yu Watanabe2022-02-251-2/+1
| | | | | And rename it to link_down_now() to emphasize it does not use request queue.
* network: introduce link_remove()Yu Watanabe2021-12-071-0/+2
|
* network: add support to configure IPoIB interfacesYu Watanabe2021-12-051-0/+2
|
* network: use void* to correctly store SetLinkOperation in RequestYu Watanabe2021-06-151-0/+4
| | | | | | | | | | Previously, when `link_request_queue()` is called in link_request_set_link(), `SetLinkOperation` is casted with INT_TO_PTR(), and the value is assigned to `void *object`. However the value was read directly through the member `SetLinkOperation set_link_operation` of the union which `object` beloging to. Thus, read value was always 0 on big-endian systems. Fixes configuring link issue on s390x systems.
* network: try to bring down before setting MAC addressYu Watanabe2021-06-141-1/+1
| | | | | | | | Most real network devices refuse to set MAC address when its operstate is not down. So, setting MAC address once failed, then let's bring down the interface and retry to set. Closes #6696.
* network: use request queue to handle always-up or -down activation policyYu Watanabe2021-06-091-1/+0
|
* network: use request queue to handle bound_to listYu Watanabe2021-06-091-0/+3
|
* network: use request queue to configure CAN interfacesYu Watanabe2021-06-091-1/+3
| | | | | This also makes SR-IOV configurations are ignored for CAN interfaces, as CAN interfaces seem not to support SR-IOV features.
* network: introduce link_request_to_activate()Yu Watanabe2021-06-081-0/+6
| | | | | The request will be processed after all setlink requests are processed. The function will be used in later commits.
* network: introduce link_request_to_set_bridge_vlan()Yu Watanabe2021-06-081-0/+2
| | | | This will be used in later commits.
* network: introduce link_request_to_set_bond()Yu Watanabe2021-06-081-0/+2
| | | | This will be used in later commits.
* network: introduce link_request_to_set_bridge()Yu Watanabe2021-06-081-0/+2
| | | | This will be used in later commits.
* network: introduce link_request_to_set_master()Yu Watanabe2021-06-081-0/+2
| | | | The function will be used later.
* network: use request queue to set IPv6LL address generation modeYu Watanabe2021-06-081-0/+2
|
* network: use request queue to set interface groupYu Watanabe2021-06-081-0/+2
|
* network: use request queue to set MAC addressYu Watanabe2021-06-081-0/+2
|
* network: use request queue to set link flagsYu Watanabe2021-06-081-0/+2
|
* network: use request queue to set MTUYu Watanabe2021-06-081-0/+19