]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: unset master if not enslaved with networkd
authorTom Yan <tom.ty89@gmail.com>
Sat, 28 May 2016 05:31:41 +0000 (13:31 +0800)
committerTom Yan <tom.ty89@gmail.com>
Sat, 28 May 2016 05:31:41 +0000 (13:31 +0800)
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.

src/network/networkd-link.c

index 6e6f9618b0d9d72335e8b34652b9ea937b4eb0c2..377e6f52f45045045cc9e641d487e7d30cbf8c8c 100644 (file)
@@ -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");