summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/network/networkd-link.c9
-rw-r--r--src/network/networkd-link.h3
-rw-r--r--src/network/networkd-manager.c2
-rw-r--r--src/systemd/sd-network.h2
4 files changed, 10 insertions, 6 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index a62bdf9fa0..6a5fe59d49 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1656,8 +1656,10 @@ static void link_update_operstate(Link *link) {
else
/* no useful addresses found */
link->operstate = LINK_OPERSTATE_CARRIER;
- } else
- link->operstate = LINK_OPERSTATE_UNKNOWN;
+ } else if (link->flags & IFF_UP)
+ link->operstate = LINK_OPERSTATE_UP;
+ else
+ link->operstate = LINK_OPERSTATE_DOWN;
}
int link_save(Link *link) {
@@ -1791,7 +1793,8 @@ static const char* const link_state_table[_LINK_STATE_MAX] = {
DEFINE_STRING_TABLE_LOOKUP(link_state, LinkState);
static const char* const link_operstate_table[_LINK_OPERSTATE_MAX] = {
- [LINK_OPERSTATE_UNKNOWN] = "unknown",
+ [LINK_OPERSTATE_DOWN] = "down",
+ [LINK_OPERSTATE_UP] = "up",
[LINK_OPERSTATE_DORMANT] = "dormant",
[LINK_OPERSTATE_CARRIER] = "carrier",
[LINK_OPERSTATE_DEGRADED] = "degraded",
diff --git a/src/network/networkd-link.h b/src/network/networkd-link.h
index 1e64e12e8c..144c7c403f 100644
--- a/src/network/networkd-link.h
+++ b/src/network/networkd-link.h
@@ -37,7 +37,8 @@ typedef enum LinkState {
} LinkState;
typedef enum LinkOperationalState {
- LINK_OPERSTATE_UNKNOWN,
+ LINK_OPERSTATE_DOWN,
+ LINK_OPERSTATE_UP,
LINK_OPERSTATE_DORMANT,
LINK_OPERSTATE_CARRIER,
LINK_OPERSTATE_DEGRADED,
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index 586842eefc..ff6c71db35 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -456,7 +456,7 @@ int manager_save(Manager *m) {
Iterator i;
_cleanup_free_ char *temp_path = NULL;
_cleanup_fclose_ FILE *f = NULL;
- LinkOperationalState operstate = LINK_OPERSTATE_UNKNOWN;
+ LinkOperationalState operstate = LINK_OPERSTATE_DOWN;
const char *operstate_str;
int r;
diff --git a/src/systemd/sd-network.h b/src/systemd/sd-network.h
index 44c4e97447..14373c7c96 100644
--- a/src/systemd/sd-network.h
+++ b/src/systemd/sd-network.h
@@ -50,7 +50,7 @@
_SD_BEGIN_DECLARATIONS;
/* Get overall operational state
- * Possible states: unknown, dormant, carrier, degraded, routable
+ * Possible states: down, up, dormant, carrier, degraded, routable
* Possible return codes:
* -ENODATA: networkd is not aware of any links
*/