From 42d7efd08301a649ced2059c048d7381a27892b4 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 16 Nov 2007 03:24:01 +0000 Subject: [PATCH] update hostapd patches to the latest from http://johannes.sipsolutions.net/patches/hostap/all/2007-11-14-16:31/ SVN-Revision: 9564 --- ...001-pass-full-flags-to-sta-function.patch} | 42 +++++++++---------- .../patches/001-remove-michael-mic.patch | 18 -------- .../patches/002-remove-michael-mic.patch | 34 +++++++++++++++ ...s.patch => 003-use-nl80211-for-keys.patch} | 0 ...atch => 004-use-nl80211-for-beacons.patch} | 0 ...atch => 005-use-nl80211-for-get-key.patch} | 0 .../patches/006-use-nl80211-for-sta.patch | 38 +++++++++-------- 7 files changed, 75 insertions(+), 57 deletions(-) rename package/hostapd/patches/{005-pass-full-flags-to-sta-function.patch => 001-pass-full-flags-to-sta-function.patch} (81%) delete mode 100644 package/hostapd/patches/001-remove-michael-mic.patch create mode 100644 package/hostapd/patches/002-remove-michael-mic.patch rename package/hostapd/patches/{002-use-nl80211-for-keys.patch => 003-use-nl80211-for-keys.patch} (100%) rename package/hostapd/patches/{003-use-nl80211-for-beacons.patch => 004-use-nl80211-for-beacons.patch} (100%) rename package/hostapd/patches/{004-use-nl80211-for-get-key.patch => 005-use-nl80211-for-get-key.patch} (100%) diff --git a/package/hostapd/patches/005-pass-full-flags-to-sta-function.patch b/package/hostapd/patches/001-pass-full-flags-to-sta-function.patch similarity index 81% rename from package/hostapd/patches/005-pass-full-flags-to-sta-function.patch rename to package/hostapd/patches/001-pass-full-flags-to-sta-function.patch index 11c8c5fd46..3364cf8fc9 100644 --- a/package/hostapd/patches/005-pass-full-flags-to-sta-function.patch +++ b/package/hostapd/patches/001-pass-full-flags-to-sta-function.patch @@ -10,8 +10,8 @@ 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 +--- hostap.orig/hostapd/driver.h 2007-11-14 17:30:38.000000000 +0100 ++++ hostap/hostapd/driver.h 2007-11-14 17:30:47.000000000 +0100 @@ -92,7 +92,7 @@ struct wpa_driver_ops { int (*get_retry)(void *priv, int *short_retry, int *long_retry); @@ -37,8 +37,8 @@ } 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 +--- hostap.orig/hostapd/driver_bsd.c 2007-11-14 17:30:38.000000000 +0100 ++++ hostap/hostapd/driver_bsd.c 2007-11-14 17:30:47.000000000 +0100 @@ -322,7 +322,8 @@ bsd_set_sta_authorized(void *priv, const } @@ -49,9 +49,9 @@ { /* 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 { +--- hostap.orig/hostapd/driver_devicescape.c 2007-11-14 17:30:39.000000000 +0100 ++++ hostap/hostapd/driver_devicescape.c 2007-11-14 17:30:47.000000000 +0100 +@@ -74,7 +74,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, @@ -60,7 +60,7 @@ 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 +@@ -666,7 +666,7 @@ static int i802_sta_remove(void *priv, c struct i802_driver_data *drv = priv; struct prism2_hostapd_param param; @@ -69,7 +69,7 @@ memset(¶m, 0, sizeof(param)); param.cmd = PRISM2_HOSTAPD_REMOVE_STA; -@@ -777,7 +777,7 @@ static int i802_sta_remove(void *priv, c +@@ -678,7 +678,7 @@ static int i802_sta_remove(void *priv, c static int i802_sta_set_flags(void *priv, const u8 *addr, @@ -78,8 +78,8 @@ { 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 +--- hostap.orig/hostapd/driver_hostap.c 2007-11-14 17:30:38.000000000 +0100 ++++ hostap/hostapd/driver_hostap.c 2007-11-14 17:30:47.000000000 +0100 @@ -374,7 +374,7 @@ static int hostap_send_eapol(void *priv, @@ -98,8 +98,8 @@ memset(¶m, 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 +--- hostap.orig/hostapd/driver_madwifi.c 2007-11-14 17:30:38.000000000 +0100 ++++ hostap/hostapd/driver_madwifi.c 2007-11-14 17:30:47.000000000 +0100 @@ -410,7 +410,8 @@ madwifi_set_sta_authorized(void *priv, c } @@ -110,8 +110,8 @@ { /* 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 +--- hostap.orig/hostapd/driver_prism54.c 2007-11-14 17:30:38.000000000 +0100 ++++ hostap/hostapd/driver_prism54.c 2007-11-14 17:30:47.000000000 +0100 @@ -187,7 +187,8 @@ static int prism54_set_sta_authorized(vo @@ -122,8 +122,8 @@ { /* 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 +--- hostap.orig/hostapd/ieee802_11.c 2007-11-14 17:30:37.000000000 +0100 ++++ hostap/hostapd/ieee802_11.c 2007-11-14 17:30:47.000000000 +0100 @@ -1625,10 +1625,10 @@ static void handle_assoc_cb(struct hosta ap_sta_bind_vlan(hapd, sta, 0); } @@ -137,8 +137,8 @@ 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 +--- hostap.orig/hostapd/ieee802_1x.c 2007-11-14 17:30:37.000000000 +0100 ++++ hostap/hostapd/ieee802_1x.c 2007-11-14 17:30:47.000000000 +0100 @@ -94,13 +94,13 @@ void ieee802_1x_set_sta_authorized(struc if (authorized) { @@ -155,8 +155,8 @@ 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 +--- hostap.orig/hostapd/wme.c 2007-11-14 17:30:38.000000000 +0100 ++++ hostap/hostapd/wme.c 2007-11-14 17:30:47.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) */ diff --git a/package/hostapd/patches/001-remove-michael-mic.patch b/package/hostapd/patches/001-remove-michael-mic.patch deleted file mode 100644 index de76c06930..0000000000 --- a/package/hostapd/patches/001-remove-michael-mic.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- - hostapd/driver_devicescape.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- hostap.orig/hostapd/driver_devicescape.c 2007-11-09 13:41:08.000000000 +0100 -+++ hostap/hostapd/driver_devicescape.c 2007-11-09 13:41:12.000000000 +0100 -@@ -1386,10 +1386,10 @@ static void handle_frame(struct hostapd_ - case ieee80211_msg_wep_frame_unknown_key: - ieee802_11_rx_unknown_key(hapd, buf, data_len); - return; -- */ - case ieee80211_msg_michael_mic_failure: - hostapd_michael_mic_failure(hapd, buf, data_len); - return; -+ */ - /* - * TODO - * We should be telling them to go away. But we don't support that now. diff --git a/package/hostapd/patches/002-remove-michael-mic.patch b/package/hostapd/patches/002-remove-michael-mic.patch new file mode 100644 index 0000000000..a90b40f36a --- /dev/null +++ b/package/hostapd/patches/002-remove-michael-mic.patch @@ -0,0 +1,34 @@ +--- + hostapd/driver_devicescape.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- hostap.orig/hostapd/driver_devicescape.c 2007-11-14 17:30:47.000000000 +0100 ++++ hostap/hostapd/driver_devicescape.c 2007-11-14 17:31:07.000000000 +0100 +@@ -1264,6 +1264,7 @@ static void dump_frame_info(struct ieee8 + } + + ++/* + static void hostapd_michael_mic_failure(struct hostapd_data *hapd, u8 *buf, + size_t len) + { +@@ -1278,6 +1279,7 @@ static void hostapd_michael_mic_failure( + + mlme_michaelmicfailure_indication(hapd, hdr->addr2); + } ++*/ + + + static void handle_frame(struct hostapd_iface *iface, u8 *buf, size_t len, +@@ -1386,10 +1388,10 @@ static void handle_frame(struct hostapd_ + case ieee80211_msg_wep_frame_unknown_key: + ieee802_11_rx_unknown_key(hapd, buf, data_len); + return; +- */ + case ieee80211_msg_michael_mic_failure: + hostapd_michael_mic_failure(hapd, buf, data_len); + return; ++ */ + /* + * TODO + * We should be telling them to go away. But we don't support that now. diff --git a/package/hostapd/patches/002-use-nl80211-for-keys.patch b/package/hostapd/patches/003-use-nl80211-for-keys.patch similarity index 100% rename from package/hostapd/patches/002-use-nl80211-for-keys.patch rename to package/hostapd/patches/003-use-nl80211-for-keys.patch diff --git a/package/hostapd/patches/003-use-nl80211-for-beacons.patch b/package/hostapd/patches/004-use-nl80211-for-beacons.patch similarity index 100% rename from package/hostapd/patches/003-use-nl80211-for-beacons.patch rename to package/hostapd/patches/004-use-nl80211-for-beacons.patch diff --git a/package/hostapd/patches/004-use-nl80211-for-get-key.patch b/package/hostapd/patches/005-use-nl80211-for-get-key.patch similarity index 100% rename from package/hostapd/patches/004-use-nl80211-for-get-key.patch rename to package/hostapd/patches/005-use-nl80211-for-get-key.patch diff --git a/package/hostapd/patches/006-use-nl80211-for-sta.patch b/package/hostapd/patches/006-use-nl80211-for-sta.patch index f94ba42886..133a750194 100644 --- a/package/hostapd/patches/006-use-nl80211-for-sta.patch +++ b/package/hostapd/patches/006-use-nl80211-for-sta.patch @@ -1,9 +1,9 @@ --- - hostapd/driver_devicescape.c | 330 ++++++++++++++++++++++++++++++++----------- - 1 file changed, 249 insertions(+), 81 deletions(-) + hostapd/driver_devicescape.c | 332 ++++++++++++++++++++++++++++++++----------- + 1 file changed, 251 insertions(+), 81 deletions(-) ---- hostap.orig/hostapd/driver_devicescape.c 2007-11-09 13:41:15.000000000 +0100 -+++ hostap/hostapd/driver_devicescape.c 2007-11-09 13:41:16.000000000 +0100 +--- hostap.orig/hostapd/driver_devicescape.c 2007-11-14 17:31:15.000000000 +0100 ++++ hostap/hostapd/driver_devicescape.c 2007-11-14 17:31:16.000000000 +0100 @@ -75,8 +75,14 @@ struct i802_driver_data { #define HAPD_DECL struct hostapd_data *hapd = iface->bss[0] @@ -128,12 +128,15 @@ + int ret = -1; + int err = 0; + int finished = 0; - -- memset(data, 0, sizeof(*data)); ++ + msg = nlmsg_alloc(); + if (!msg) + goto out; +- memset(data, 0, sizeof(*data)); ++ genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, ++ 0, NL80211_CMD_GET_STATION, 0); + - memset(¶m, 0, sizeof(param)); - param.cmd = PRISM2_HOSTAPD_GET_INFO_STA; - memcpy(param.sta_addr, addr, ETH_ALEN); @@ -141,9 +144,6 @@ - printf(" Could not get station info from kernel driver.\n"); - return -1; - } -+ genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, -+ 0, NL80211_CMD_GET_STATION, 0); -+ + NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); + NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(drv->iface)); + @@ -189,7 +189,7 @@ } -@@ -744,35 +825,68 @@ static int i802_sta_add(const char *ifna +@@ -744,35 +825,70 @@ static int i802_sta_add(const char *ifna size_t supp_rates_len, int flags) { struct i802_driver_data *drv = priv; @@ -223,12 +223,14 @@ + supp_rates); + NLA_PUT_U16(msg, NL80211_ATTR_STA_LISTEN_INTERVAL, 0); + -+ ret = 0; ++ ret = nl_send_auto_complete(drv->nl_handle, msg); ++ if (ret < 0) ++ goto nla_put_failure; + -+ if (nl_send_auto_complete(drv->nl_handle, msg) < 0 || -+ nl_wait_for_ack(drv->nl_handle) < 0) { -+ ret = -1; -+ } ++ ret = nl_wait_for_ack(drv->nl_handle); ++ /* ignore EEXIST, this happens if a STA associates while associated */ ++ if (ret == -EEXIST || ret >= 0) ++ ret = 0; + + nla_put_failure: + nlmsg_free(msg); @@ -278,7 +280,7 @@ } -@@ -780,14 +894,51 @@ static int i802_sta_set_flags(void *priv +@@ -780,14 +896,51 @@ static int i802_sta_set_flags(void *priv int total_flags, int flags_or, int flags_and) { struct i802_driver_data *drv = priv; @@ -337,7 +339,7 @@ } -@@ -1257,18 +1408,38 @@ static struct hostapd_hw_modes * i802_ge +@@ -1257,18 +1410,38 @@ static struct hostapd_hw_modes * i802_ge } @@ -385,7 +387,7 @@ } -@@ -1750,17 +1921,14 @@ static int i802_init_sockets(struct i802 +@@ -1752,17 +1925,14 @@ static int i802_init_sockets(struct i802 static int i802_get_inact_sec(void *priv, const u8 *addr) {