chiark / gitweb /
networkd: reorder bonding and bridging
authorTom Gundersen <teg@jklm.no>
Fri, 9 May 2014 10:20:21 +0000 (12:20 +0200)
committerTom Gundersen <teg@jklm.no>
Fri, 9 May 2014 12:41:27 +0000 (14:41 +0200)
A link should only ever be part of one, but if we accidentally do both, let's do it
in the right order so the failure is more obvious in the logs.

src/network/networkd-link.c

index 0a228b2..7cb9ee6 100644 (file)
@@ -1490,19 +1490,19 @@ static int link_enter_enslave(Link *link) {
             hashmap_isempty(link->network->macvlans))
                 return link_enslaved(link);
 
-        if (link->network->bridge) {
+        if (link->network->bond) {
                 log_struct_link(LOG_DEBUG, link,
                                 "MESSAGE=%s: enslaving by '%s'",
-                                link->ifname, link->network->bridge->name,
-                                NETDEV(link->network->bridge),
+                                link->ifname, link->network->bond->name,
+                                NETDEV(link->network->bond),
                                 NULL);
 
-                r = netdev_enslave(link->network->bridge, link, &enslave_handler);
+                r = netdev_enslave(link->network->bond, link, &enslave_handler);
                 if (r < 0) {
                         log_struct_link(LOG_WARNING, link,
                                         "MESSAGE=%s: could not enslave by '%s': %s",
-                                        link->ifname, link->network->bridge->name, strerror(-r),
-                                        NETDEV(link->network->bridge),
+                                        link->ifname, link->network->bond->name, strerror(-r),
+                                        NETDEV(link->network->bond),
                                         NULL);
                         link_enter_failed(link);
                         return r;
@@ -1512,19 +1512,19 @@ static int link_enter_enslave(Link *link) {
                 link->enslaving ++;
         }
 
-        if (link->network->bond) {
+        if (link->network->bridge) {
                 log_struct_link(LOG_DEBUG, link,
                                 "MESSAGE=%s: enslaving by '%s'",
-                                link->ifname, link->network->bond->name,
-                                NETDEV(link->network->bond),
+                                link->ifname, link->network->bridge->name,
+                                NETDEV(link->network->bridge),
                                 NULL);
 
-                r = netdev_enslave(link->network->bond, link, &enslave_handler);
+                r = netdev_enslave(link->network->bridge, link, &enslave_handler);
                 if (r < 0) {
                         log_struct_link(LOG_WARNING, link,
                                         "MESSAGE=%s: could not enslave by '%s': %s",
-                                        link->ifname, link->network->bond->name, strerror(-r),
-                                        NETDEV(link->network->bond),
+                                        link->ifname, link->network->bridge->name, strerror(-r),
+                                        NETDEV(link->network->bridge),
                                         NULL);
                         link_enter_failed(link);
                         return r;