fix up hostapd for mac80211
[openwrt/openwrt.git] / package / hostapd / patches / 005-pass-full-flags-to-sta-function.patch
diff --git a/package/hostapd/patches/005-pass-full-flags-to-sta-function.patch b/package/hostapd/patches/005-pass-full-flags-to-sta-function.patch
new file mode 100644 (file)
index 0000000..11c8c5f
--- /dev/null
@@ -0,0 +1,173 @@
+---
+ hostapd/driver.h             |    8 ++++----
+ hostapd/driver_bsd.c         |    3 ++-
+ hostapd/driver_devicescape.c |    6 +++---
+ hostapd/driver_hostap.c      |    4 ++--
+ hostapd/driver_madwifi.c     |    3 ++-
+ hostapd/driver_prism54.c     |    3 ++-
+ hostapd/ieee802_11.c         |    4 ++--
+ hostapd/ieee802_1x.c         |    4 ++--
+ hostapd/wme.c                |    6 ++++--
+ 9 files changed, 23 insertions(+), 18 deletions(-)
+
+--- hostap.orig/hostapd/driver.h       2007-11-09 13:41:07.000000000 +0100
++++ hostap/hostapd/driver.h    2007-11-09 13:41:15.000000000 +0100
+@@ -92,7 +92,7 @@ struct wpa_driver_ops {
+       int (*get_retry)(void *priv, int *short_retry, int *long_retry);
+       int (*sta_set_flags)(void *priv, const u8 *addr,
+-                           int flags_or, int flags_and);
++                           int total_flags, int flags_or, int flags_and);
+       int (*set_rate_sets)(void *priv, int *supp_rates, int *basic_rates,
+                            int mode);
+       int (*set_channel_flag)(void *priv, int mode, int chan, int flag,
+@@ -427,12 +427,12 @@ hostapd_get_retry(struct hostapd_data *h
+ static inline int
+ hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
+-                    int flags_or, int flags_and)
++                    int total_flags, int flags_or, int flags_and)
+ {
+       if (hapd->driver == NULL || hapd->driver->sta_set_flags == NULL)
+               return 0;
+-      return hapd->driver->sta_set_flags(hapd->drv_priv, addr, flags_or,
+-                                         flags_and);
++      return hapd->driver->sta_set_flags(hapd->drv_priv, addr, total_flags,
++                                         flags_or, flags_and);
+ }
+ static inline int
+--- hostap.orig/hostapd/driver_bsd.c   2007-11-09 13:41:07.000000000 +0100
++++ hostap/hostapd/driver_bsd.c        2007-11-09 13:41:15.000000000 +0100
+@@ -322,7 +322,8 @@ bsd_set_sta_authorized(void *priv, const
+ }
+ static int
+-bsd_sta_set_flags(void *priv, const u8 *addr, int flags_or, int flags_and)
++bsd_sta_set_flags(void *priv, const u8 *addr, int total_flags, int flags_or,
++                int flags_and)
+ {
+       /* For now, only support setting Authorized flag */
+       if (flags_or & WLAN_STA_AUTHORIZED)
+--- hostap.orig/hostapd/driver_devicescape.c   2007-11-09 13:41:14.000000000 +0100
++++ hostap/hostapd/driver_devicescape.c        2007-11-09 13:41:15.000000000 +0100
+@@ -76,7 +76,7 @@ struct i802_driver_data {
+ #define HAPD_DECL     struct hostapd_data *hapd = iface->bss[0]
+ static int i802_sta_set_flags(void *priv, const u8 *addr,
+-                            int flags_or, int flags_and);
++                            int total_flags, int flags_or, int flags_and);
+ static int hostapd_set_iface_flags(struct i802_driver_data *drv, int dev_up)
+@@ -765,7 +765,7 @@ static int i802_sta_remove(void *priv, c
+       struct i802_driver_data *drv = priv;
+       struct prism2_hostapd_param param;
+-      i802_sta_set_flags(drv, addr, 0, ~WLAN_STA_AUTHORIZED);
++      i802_sta_set_flags(drv, addr, 0, 0, ~WLAN_STA_AUTHORIZED);
+       memset(&param, 0, sizeof(param));
+       param.cmd = PRISM2_HOSTAPD_REMOVE_STA;
+@@ -777,7 +777,7 @@ static int i802_sta_remove(void *priv, c
+ static int i802_sta_set_flags(void *priv, const u8 *addr,
+-                            int flags_or, int flags_and)
++                            int total_flags, int flags_or, int flags_and)
+ {
+       struct i802_driver_data *drv = priv;
+       struct prism2_hostapd_param param;
+--- hostap.orig/hostapd/driver_hostap.c        2007-11-09 13:41:07.000000000 +0100
++++ hostap/hostapd/driver_hostap.c     2007-11-09 13:41:15.000000000 +0100
+@@ -374,7 +374,7 @@ static int hostap_send_eapol(void *priv,
+ static int hostap_sta_set_flags(void *priv, const u8 *addr,
+-                              int flags_or, int flags_and)
++                              int total_flags, int flags_or, int flags_and)
+ {
+       struct hostap_driver_data *drv = priv;
+       struct prism2_hostapd_param param;
+@@ -694,7 +694,7 @@ static int hostap_sta_remove(void *priv,
+       struct hostap_driver_data *drv = priv;
+       struct prism2_hostapd_param param;
+-      hostap_sta_set_flags(drv, addr, 0, ~WLAN_STA_AUTHORIZED);
++      hostap_sta_set_flags(drv, addr, 0, 0, ~WLAN_STA_AUTHORIZED);
+       memset(&param, 0, sizeof(param));
+       param.cmd = PRISM2_HOSTAPD_REMOVE_STA;
+--- hostap.orig/hostapd/driver_madwifi.c       2007-11-09 13:41:07.000000000 +0100
++++ hostap/hostapd/driver_madwifi.c    2007-11-09 13:41:15.000000000 +0100
+@@ -410,7 +410,8 @@ madwifi_set_sta_authorized(void *priv, c
+ }
+ static int
+-madwifi_sta_set_flags(void *priv, const u8 *addr, int flags_or, int flags_and)
++madwifi_sta_set_flags(void *priv, const u8 *addr, int total_flags,
++                    int flags_or, int flags_and)
+ {
+       /* For now, only support setting Authorized flag */
+       if (flags_or & WLAN_STA_AUTHORIZED)
+--- hostap.orig/hostapd/driver_prism54.c       2007-11-09 13:41:07.000000000 +0100
++++ hostap/hostapd/driver_prism54.c    2007-11-09 13:41:15.000000000 +0100
+@@ -187,7 +187,8 @@ static int prism54_set_sta_authorized(vo
+ static int
+-prism54_sta_set_flags(void *priv, const u8 *addr, int flags_or, int flags_and)
++prism54_sta_set_flags(void *priv, const u8 *addr, int total_flags,
++                    int flags_or, int flags_and)
+ {
+       /* For now, only support setting Authorized flag */
+       if (flags_or & WLAN_STA_AUTHORIZED)
+--- hostap.orig/hostapd/ieee802_11.c   2007-11-09 13:41:07.000000000 +0100
++++ hostap/hostapd/ieee802_11.c        2007-11-09 13:41:15.000000000 +0100
+@@ -1625,10 +1625,10 @@ static void handle_assoc_cb(struct hosta
+               ap_sta_bind_vlan(hapd, sta, 0);
+       }
+       if (sta->flags & WLAN_STA_SHORT_PREAMBLE) {
+-              hostapd_sta_set_flags(hapd, sta->addr,
++              hostapd_sta_set_flags(hapd, sta->addr, sta->flags,
+                                     WLAN_STA_SHORT_PREAMBLE, ~0);
+       } else {
+-              hostapd_sta_set_flags(hapd, sta->addr,
++              hostapd_sta_set_flags(hapd, sta->addr, sta->flags,
+                                     0, ~WLAN_STA_SHORT_PREAMBLE);
+       }
+--- hostap.orig/hostapd/ieee802_1x.c   2007-11-09 13:41:07.000000000 +0100
++++ hostap/hostapd/ieee802_1x.c        2007-11-09 13:41:15.000000000 +0100
+@@ -94,13 +94,13 @@ void ieee802_1x_set_sta_authorized(struc
+       if (authorized) {
+               sta->flags |= WLAN_STA_AUTHORIZED;
+-              res = hostapd_sta_set_flags(hapd, sta->addr,
++              res = hostapd_sta_set_flags(hapd, sta->addr, sta->flags,
+                                           WLAN_STA_AUTHORIZED, ~0);
+               hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
+                              HOSTAPD_LEVEL_DEBUG, "authorizing port");
+       } else {
+               sta->flags &= ~WLAN_STA_AUTHORIZED;
+-              res = hostapd_sta_set_flags(hapd, sta->addr,
++              res = hostapd_sta_set_flags(hapd, sta->addr, sta->flags,
+                                           0, ~WLAN_STA_AUTHORIZED);
+               hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
+                              HOSTAPD_LEVEL_DEBUG, "unauthorizing port");
+--- hostap.orig/hostapd/wme.c  2007-11-09 13:41:07.000000000 +0100
++++ hostap/hostapd/wme.c       2007-11-09 13:41:15.000000000 +0100
+@@ -110,9 +110,11 @@ int hostapd_wme_sta_config(struct hostap
+ {
+       /* update kernel STA data for WME related items (WLAN_STA_WPA flag) */
+       if (sta->flags & WLAN_STA_WME)
+-              hostapd_sta_set_flags(hapd, sta->addr, WLAN_STA_WME, ~0);
++              hostapd_sta_set_flags(hapd, sta->addr, sta->flags,
++                                    WLAN_STA_WME, ~0);
+       else
+-              hostapd_sta_set_flags(hapd, sta->addr, 0, ~WLAN_STA_WME);
++              hostapd_sta_set_flags(hapd, sta->addr, sta->flags,
++                                    0, ~WLAN_STA_WME);
+       return 0;
+ }