summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-08-13 15:34:27 +0200
committerTom Gundersen <teg@jklm.no>2014-08-13 15:39:57 +0200
commit8434fd5cf23f998a0f3a0f947a4308a8c18ba7a5 (patch)
treed2efcdb8f500b3358b744e7319880f79fff9e47b
parent90ab504273a7f186ebb76e6acfb778b4e0d7c91b (diff)
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.
-rw-r--r--src/libsystemd/sd-network/sd-network.c2
-rw-r--r--src/network/networkd-link.c14
-rw-r--r--src/network/networkd-link.h2
-rw-r--r--src/systemd/sd-network.h9
4 files changed, 15 insertions, 12 deletions
diff --git a/src/libsystemd/sd-network/sd-network.c b/src/libsystemd/sd-network/sd-network.c
index d2e608c79d..1039a2c48c 100644
--- a/src/libsystemd/sd-network/sd-network.c
+++ b/src/libsystemd/sd-network/sd-network.c
@@ -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;
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 6a5fe59d49..398e8baac9 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -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",
diff --git a/src/network/networkd-link.h b/src/network/networkd-link.h
index 144c7c403f..6d58fa1584 100644
--- a/src/network/networkd-link.h
+++ b/src/network/networkd-link.h
@@ -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,
diff --git a/src/systemd/sd-network.h b/src/systemd/sd-network.h
index 14373c7c96..a72e6c4bf1 100644
--- a/src/systemd/sd-network.h
+++ b/src/systemd/sd-network.h
@@ -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);