fix hostapd race condition which breaks wpa with madwifi
authorFelix Fietkau <nbd@openwrt.org>
Wed, 29 Oct 2008 15:52:44 +0000 (15:52 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 29 Oct 2008 15:52:44 +0000 (15:52 +0000)
SVN-Revision: 13075

package/hostapd/patches/100-madwifi_fix.patch [new file with mode: 0644]

diff --git a/package/hostapd/patches/100-madwifi_fix.patch b/package/hostapd/patches/100-madwifi_fix.patch
new file mode 100644 (file)
index 0000000..45e9023
--- /dev/null
@@ -0,0 +1,27 @@
+--- a/hostapd/driver_madwifi.c
++++ b/hostapd/driver_madwifi.c
+@@ -298,6 +298,7 @@ madwifi_set_iface_flags(void *priv, int 
+ {
+       struct madwifi_driver_data *drv = priv;
+       struct ifreq ifr;
++      short flags;
+       wpa_printf(MSG_DEBUG, "%s: dev_up=%d", __func__, dev_up);
+@@ -312,10 +313,14 @@ madwifi_set_iface_flags(void *priv, int 
+               return -1;
+       }
++      flags = ifr.ifr_flags;
+       if (dev_up)
+-              ifr.ifr_flags |= IFF_UP;
++              flags |= IFF_UP;
+       else
+-              ifr.ifr_flags &= ~IFF_UP;
++              flags &= ~IFF_UP;
++
++      if (flags == ifr.ifr_flags)
++              return 0;
+       if (ioctl(drv->ioctl_sock, SIOCSIFFLAGS, &ifr) != 0) {
+               perror("ioctl[SIOCSIFFLAGS]");