system-linux: fix bogus debug error messages on adding bridge members
authorFelix Fietkau <nbd@nbd.name>
Mon, 20 Nov 2023 17:35:49 +0000 (18:35 +0100)
committerFelix Fietkau <nbd@nbd.name>
Mon, 20 Nov 2023 18:13:59 +0000 (19:13 +0100)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
system-linux.c

index cc1b5e969132c41ceaa38744faa07b9d94125436..96cc99397100b2c7a2412f23e112c38203e912c4 100644 (file)
@@ -948,16 +948,19 @@ int system_bridge_addif(struct device *bridge, struct device *dev)
        int tries = 0;
        int ret;
 
-retry:
-       ret = 0;
-       oldbr = system_get_bridge(dev->ifname, dev_buf, sizeof(dev_buf));
-       if (!oldbr || strcmp(oldbr, bridge->ifname) != 0) {
+
+       for (tries = 0; tries < 3; tries++) {
+               ret = 0;
+               oldbr = system_get_bridge(dev->ifname, dev_buf, sizeof(dev_buf));
+               if (oldbr && !strcmp(oldbr, bridge->ifname))
+                       break;
+
                ret = system_bridge_if(bridge->ifname, dev, SIOCBRADDIF, NULL);
-               tries++;
+               if (!ret)
+                       break;
+
                D(SYSTEM, "Failed to add device '%s' to bridge '%s' (tries=%d): %s\n",
                  dev->ifname, bridge->ifname, tries, strerror(errno));
-               if (tries <= 3)
-                       goto retry;
        }
 
        if (dev->wireless)