sd-network: rename state INITALIZING to PENDING and expose as any other state
This is the state when we are waiting for udev to initialize the device, and waiting for libudev and rtnl to be in sync. In the future we probably will also be waiting for nl80211. At this point we do not yet have enough information to know whether or not networkd should be handling the device.
This commit is contained in:
parent
90ab504273
commit
8434fd5cf2
|
@ -109,8 +109,6 @@ _public_ int sd_network_get_link_state(int ifindex, char **state) {
|
|||
return r;
|
||||
if (isempty(s))
|
||||
return -ENODATA;
|
||||
if (streq(s, "initializing"))
|
||||
return -EBUSY;
|
||||
|
||||
*state = s;
|
||||
s = NULL;
|
||||
|
|
|
@ -67,7 +67,7 @@ static int link_new(Manager *manager, sd_rtnl_message *message, Link **ret) {
|
|||
|
||||
link->n_ref = 1;
|
||||
link->manager = manager;
|
||||
link->state = LINK_STATE_INITIALIZING;
|
||||
link->state = LINK_STATE_PENDING;
|
||||
link->ifindex = ifindex;
|
||||
link->ifname = strdup(ifname);
|
||||
if (!link->ifname)
|
||||
|
@ -1106,7 +1106,7 @@ static int link_enter_join_netdev(Link *link) {
|
|||
|
||||
assert(link);
|
||||
assert(link->network);
|
||||
assert(link->state == LINK_STATE_INITIALIZING);
|
||||
assert(link->state == LINK_STATE_PENDING);
|
||||
|
||||
link->state = LINK_STATE_ENSLAVING;
|
||||
|
||||
|
@ -1196,7 +1196,7 @@ static int link_configure(Link *link) {
|
|||
|
||||
assert(link);
|
||||
assert(link->network);
|
||||
assert(link->state == LINK_STATE_INITIALIZING);
|
||||
assert(link->state == LINK_STATE_PENDING);
|
||||
|
||||
if (link->network->ipv4ll) {
|
||||
r = ipv4ll_configure(link);
|
||||
|
@ -1265,7 +1265,7 @@ static int link_initialized_and_synced(sd_rtnl *rtnl, sd_rtnl_message *m,
|
|||
assert(link->ifname);
|
||||
assert(link->manager);
|
||||
|
||||
if (link->state != LINK_STATE_INITIALIZING)
|
||||
if (link->state != LINK_STATE_PENDING)
|
||||
return 1;
|
||||
|
||||
log_debug_link(link, "link state is up-to-date");
|
||||
|
@ -1298,7 +1298,7 @@ int link_initialized(Link *link, struct udev_device *device) {
|
|||
assert(link->manager->rtnl);
|
||||
assert(device);
|
||||
|
||||
if (link->state != LINK_STATE_INITIALIZING)
|
||||
if (link->state != LINK_STATE_PENDING)
|
||||
return 0;
|
||||
|
||||
if (link->udev_device)
|
||||
|
@ -1509,7 +1509,7 @@ int link_add(Manager *m, sd_rtnl_message *message, Link **ret) {
|
|||
|
||||
if (udev_device_get_is_initialized(device) <= 0) {
|
||||
/* not yet ready */
|
||||
log_debug_link(link, "udev initializing link...");
|
||||
log_debug_link(link, "link pending udev initialization...");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1780,7 +1780,7 @@ fail:
|
|||
}
|
||||
|
||||
static const char* const link_state_table[_LINK_STATE_MAX] = {
|
||||
[LINK_STATE_INITIALIZING] = "initializing",
|
||||
[LINK_STATE_PENDING] = "pending",
|
||||
[LINK_STATE_ENSLAVING] = "configuring",
|
||||
[LINK_STATE_SETTING_ADDRESSES] = "configuring",
|
||||
[LINK_STATE_SETTING_ROUTES] = "configuring",
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "networkd.h"
|
||||
|
||||
typedef enum LinkState {
|
||||
LINK_STATE_INITIALIZING,
|
||||
LINK_STATE_PENDING,
|
||||
LINK_STATE_ENSLAVING,
|
||||
LINK_STATE_SETTING_ADDRESSES,
|
||||
LINK_STATE_SETTING_ROUTES,
|
||||
|
|
|
@ -65,10 +65,15 @@ int sd_network_get_dns(char ***addr);
|
|||
int sd_network_get_ntp(char ***addr);
|
||||
|
||||
/* Get state from ifindex.
|
||||
* Possible states: failed, configuring, configured, unmanaged
|
||||
* Possible states:
|
||||
* pending: udev is still processing the link, we don't yet know if we will manage it
|
||||
* failed: networkd failed to manage the link
|
||||
* configuring: in the process of retrieving configuration or configuring the link
|
||||
* configured: link configured successfully
|
||||
* unmanaged: networkd is not handling the link
|
||||
* linger: the link is gone, but has not yet been dropped by networkd
|
||||
* Possible return codes:
|
||||
* -ENODATA: networkd is not aware of the link
|
||||
* -EBUSY: udev is still processing the link, networkd does not yet know if it will manage it
|
||||
*/
|
||||
int sd_network_get_link_state(int ifindex, char **state);
|
||||
|
||||
|
|
Loading…
Reference in a new issue