summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-04-20 19:49:00 +0200
committerTom Gundersen <teg@jklm.no>2014-04-20 19:54:35 +0200
commit57bd6899b35b84d1f23809133ae45d29a87b2eaa (patch)
tree461fa2a3ed8d70966ea56c739ecc63838a035c5d /src/network/networkd-link.c
parent4bb40e8125ae0a83a13cb8e020950975eeeb1ad2 (diff)
networkd: link - add explicit unmanaged state
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index cf22778b42..392665a4d1 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -141,6 +141,16 @@ static int link_enter_configured(Link *link) {
return 0;
}
+static void link_enter_unmanaged(Link *link) {
+ assert(link);
+
+ log_info_link(link, "unmanaged");
+
+ link->state = LINK_STATE_UNMANAGED;
+
+ link_save(link);
+}
+
static void link_enter_failed(Link *link) {
assert(link);
@@ -1471,8 +1481,11 @@ int link_initialized(Link *link, struct udev_device *device) {
log_debug_link(link, "link initialized");
r = network_get(link->manager, device, link->ifname, &link->mac, &network);
- if (r < 0)
- return r == -ENOENT ? 0 : r;
+ if (r == -ENOENT) {
+ link_enter_unmanaged(link);
+ return 0;
+ } else if (r < 0)
+ return r;
r = network_apply(link->manager, network, link);
if (r < 0)
@@ -1541,7 +1554,7 @@ int link_update(Link *link, sd_rtnl_message *m) {
assert(link->ifname);
assert(m);
- if (link->state == LINK_STATE_FAILED)
+ if (link->state == LINK_STATE_FAILED || link->state == LINK_STATE_UNMANAGED)
return 0;
r = sd_rtnl_message_read_string(m, IFLA_IFNAME, &ifname);
@@ -1667,6 +1680,7 @@ static const char* const link_state_table[_LINK_STATE_MAX] = {
[LINK_STATE_SETTING_ADDRESSES] = "configuring",
[LINK_STATE_SETTING_ROUTES] = "configuring",
[LINK_STATE_CONFIGURED] = "configured",
+ [LINK_STATE_UNMANAGED] = "unmanaged",
[LINK_STATE_FAILED] = "failed",
};