1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-02 13:47:27 +03:00

Merge pull request #30407 from yuwata/network-clean-exit

network: make networkd exit cleanly
This commit is contained in:
Luca Boccassi 2023-12-10 12:54:17 +00:00 committed by GitHub
commit 65ea0d9e75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -585,6 +585,12 @@ int sd_ipv4acd_start(sd_ipv4acd *acd, bool reset_conflicts) {
assert_return(!ether_addr_is_null(&acd->mac_addr), -EINVAL);
assert_return(acd->state == IPV4ACD_STATE_INIT, -EBUSY);
r = sd_event_get_state(acd->event);
if (r < 0)
return r;
if (r == SD_EVENT_FINISHED)
return -ESTALE;
r = arp_network_bind_raw_socket(acd->ifindex, &acd->address, &acd->mac_addr);
if (r < 0)
return r;

View File

@ -1181,7 +1181,7 @@ static int dhcp4_handler(sd_dhcp_client *client, int event, void *userdata) {
}
r = sd_ipv4ll_start(link->ipv4ll);
if (r < 0)
if (r < 0 && r != -ESTALE) /* On exit, we cannot and should not start sd-ipv4ll. */
return log_link_warning_errno(link, r, "Could not acquire IPv4 link-local address: %m");
}

View File

@ -718,6 +718,8 @@ def stop_networkd(show_logs=True):
check_output('systemctl stop systemd-networkd.service')
if show_logs:
print(read_networkd_log(invocation_id))
# Check if networkd exits cleanly.
assert call_quiet('systemctl is-failed -q systemd-networkd.service') == 1
def start_networkd():
check_output('systemctl start systemd-networkd')