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)