diff options
author | Tom Gundersen <teg@jklm.no> | 2014-08-12 20:00:34 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-08-12 20:42:59 +0200 |
commit | 54cba0b16cdc94d5c21e8d805a4ade1255d43bc9 (patch) | |
tree | 3fc9ab6e6d10b25f5aca724f0e836c31eb0507f3 /src/network | |
parent | 3c9b886068d99e5d3cbabcac32a4decf37244c54 (diff) |
sd-network: split the operstate 'unknown' into 'down' and 'up'
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkd-link.c | 9 | ||||
-rw-r--r-- | src/network/networkd-link.h | 3 | ||||
-rw-r--r-- | src/network/networkd-manager.c | 2 |
3 files changed, 9 insertions, 5 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; |