network: check link state with link_is_ready_to_configure() before configuring DHCP client or friends
Otherwise, DHCP client or friends may started before link-layer properties, e.g. MAC address, being configured or the link being activated.
This commit is contained in:
@@ -292,7 +292,7 @@ static int l2tp_get_local_address(NetDev *netdev, union in_addr_union *ret) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
|
||||
if (!link_is_ready_to_configure(link, /* allow_unmanaged = */ false))
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ static int l2tp_get_local_address(NetDev *netdev, union in_addr_union *ret) {
|
||||
return link_get_l2tp_local_address(link, t, ret);
|
||||
|
||||
HASHMAP_FOREACH(link, netdev->manager->links_by_index) {
|
||||
if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
|
||||
if (!link_is_ready_to_configure(link, /* allow_unmanaged = */ false))
|
||||
continue;
|
||||
|
||||
if (link_get_l2tp_local_address(link, t, ret) >= 0)
|
||||
|
||||
@@ -51,7 +51,7 @@ int link_get_local_address(
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
|
||||
if (!link_is_ready_to_configure(link, /* allow_unmanaged = */ false))
|
||||
return -EBUSY;
|
||||
|
||||
SET_FOREACH(a, link->addresses) {
|
||||
|
||||
Reference in New Issue
Block a user