mirror of
https://github.com/systemd/systemd.git
synced 2024-12-26 03:22:00 +03:00
network: introduce link_is_ready_to_configure() helper function
This will be used in later commits.
This commit is contained in:
parent
19d9a5adf0
commit
7191a57a0e
@ -134,6 +134,25 @@ bool link_ipv6_enabled(Link *link) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool link_is_ready_to_configure(Link *link, bool allow_unmanaged) {
|
||||||
|
assert(link);
|
||||||
|
|
||||||
|
if (!link->network || link->network->unmanaged) {
|
||||||
|
if (!allow_unmanaged)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return link_has_carrier(link);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!link_has_carrier(link) && !link->network->configure_without_carrier)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static bool link_is_enslaved(Link *link) {
|
static bool link_is_enslaved(Link *link) {
|
||||||
if (link->flags & IFF_SLAVE)
|
if (link->flags & IFF_SLAVE)
|
||||||
/* Even if the link is not managed by networkd, honor IFF_SLAVE flag. */
|
/* Even if the link is not managed by networkd, honor IFF_SLAVE flag. */
|
||||||
|
@ -199,6 +199,8 @@ typedef struct Link {
|
|||||||
|
|
||||||
typedef int (*link_netlink_message_handler_t)(sd_netlink*, sd_netlink_message*, Link*);
|
typedef int (*link_netlink_message_handler_t)(sd_netlink*, sd_netlink_message*, Link*);
|
||||||
|
|
||||||
|
bool link_is_ready_to_configure(Link *link, bool allow_unmanaged);
|
||||||
|
|
||||||
void link_ntp_settings_clear(Link *link);
|
void link_ntp_settings_clear(Link *link);
|
||||||
void link_dns_settings_clear(Link *link);
|
void link_dns_settings_clear(Link *link);
|
||||||
Link *link_unref(Link *link);
|
Link *link_unref(Link *link);
|
||||||
|
Loading…
Reference in New Issue
Block a user