summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorTom Yan <tom.ty89@gmail.com>2016-05-28 13:31:41 +0800
committerTom Yan <tom.ty89@gmail.com>2016-05-28 13:31:41 +0800
commit2b2d8603ce5b9cbe797745ab6339f6f5e0dfb4ad (patch)
tree0a696d9de0e0bf6e22b63924a61a3e2f0fe668aa /src/network/networkd-link.c
parent4cef7fe3d1e8db7b1c20fb920c6e0ba05b0d2fc0 (diff)
networkd: unset master if not enslaved with networkd
When we manage an interface with networkd but not as a slave (i.e. no `Bridge=` or `Bond=` set in its .network), we do not want it to remain slaved.
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 6e6f9618b0..377e6f52f4 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1568,6 +1568,13 @@ static int link_up(Link *link) {
if (r < 0)
return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m");
+ /* set it free if not enslaved with networkd */
+ if (!link->network->bridge && !link->network->bond) {
+ r = sd_netlink_message_append_u32(req, IFLA_MASTER, 0);
+ if (r < 0)
+ return log_link_error_errno(link, r, "Could not append IFLA_MASTER attribute: %m");
+ }
+
r = sd_rtnl_message_link_set_flags(req, IFF_UP, IFF_UP);
if (r < 0)
return log_link_error_errno(link, r, "Could not set link flags: %m");