Revert "Revert "[wpa_supplicant] cumilative patch from commit 3a..."
Revert submission 28102966-revert-26533062-Supplicant_merge_June24-CUATTSRBBR
Reason for revert: Fixed the regression issue (ag/28389573)
Reverted changes: /q/submissionid:28102966-revert-26533062-Supplicant_merge_June24-CUATTSRBBR
Bug: 329004037
Test: Turn ON/OFF SoftAp multiple times
Change-Id: Ibfff2a847be5678f1a6d77e28506a05936812a91
diff --git a/src/drivers/linux_ioctl.c b/src/drivers/linux_ioctl.c
index 7edb9df..29abc0c 100644
--- a/src/drivers/linux_ioctl.c
+++ b/src/drivers/linux_ioctl.c
@@ -161,11 +161,20 @@
ifr.ifr_ifindex = ifindex;
if (ioctl(sock, SIOCBRADDIF, &ifr) < 0) {
int saved_errno = errno;
+ char in_br[IFNAMSIZ];
wpa_printf(MSG_DEBUG, "Could not add interface %s into bridge "
"%s: %s", ifname, brname, strerror(errno));
errno = saved_errno;
- return -1;
+
+ /* If ioctl() returns EBUSY when adding an interface into the
+ * bridge, the interface might have already been added by an
+ * external operation, so check whether the interface is
+ * currently on the right bridge and ignore the error if it is.
+ */
+ if (errno != EBUSY || linux_br_get(in_br, ifname) != 0 ||
+ os_strcmp(in_br, brname) != 0)
+ return -1;
}
return 0;