From 77a96c54371bb0f47d2e0d187b53b1b7dc63e885 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 16 Nov 2007 03:10:56 +0000 Subject: fix up hostapd for mac80211 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@9554 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches/004-use-nl80211-for-get-key.patch | 116 +++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 package/hostapd/patches/004-use-nl80211-for-get-key.patch (limited to 'package/hostapd/patches/004-use-nl80211-for-get-key.patch') diff --git a/package/hostapd/patches/004-use-nl80211-for-get-key.patch b/package/hostapd/patches/004-use-nl80211-for-get-key.patch new file mode 100644 index 0000000000..142c1939d2 --- /dev/null +++ b/package/hostapd/patches/004-use-nl80211-for-get-key.patch @@ -0,0 +1,116 @@ +--- + hostapd/driver_devicescape.c | 96 ++++++++++++++++++++++++++++++++++--------- + 1 file changed, 76 insertions(+), 20 deletions(-) + +--- hostap.orig/hostapd/driver_devicescape.c 2007-11-09 13:41:13.000000000 +0100 ++++ hostap/hostapd/driver_devicescape.c 2007-11-09 13:41:14.000000000 +0100 +@@ -228,33 +228,89 @@ static int i802_set_encryption(const cha + return ret; + } + ++static inline int min_int(int a, int b) ++{ ++ if (acmd = PRISM2_GET_ENCRYPTION; +- if (addr == NULL) +- memset(param->sta_addr, 0xff, ETH_ALEN); +- else +- memcpy(param->sta_addr, addr, ETH_ALEN); +- param->u.crypt.idx = idx; +- +- ret = hostapd_ioctl_iface(iface, drv, param, param_len); +- if (ret == 0) { +- memcpy(seq, param->u.crypt.seq_counter, +- HOSTAP_SEQ_COUNTER_SIZE); +- } +- free(param); ++ genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, ++ 0, NL80211_CMD_GET_KEY, 0); ++ ++ if (addr) ++ NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); ++ NLA_PUT_U8(msg, NL80211_ATTR_KEY_IDX, idx); ++ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(iface)); ++ ++ cb = nl_cb_alloc(NL_CB_CUSTOM); ++ if (!cb) ++ goto out; ++ ++ memset(seq, 0, 6); ++ ++ if (nl_send_auto_complete(drv->nl_handle, msg) < 0) ++ goto out; ++ ++ nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, get_key_handler, seq); ++ nl_cb_set(cb, NL_CB_ACK, NL_CB_CUSTOM, ack_wait_handler, &finished); ++ ++ err = nl_recvmsgs(drv->nl_handle, cb); ++ ++ if (!finished) ++ err = nl_wait_for_ack(drv->nl_handle); ++ ++ if (err < 0) ++ goto out; ++ ++ ret = 0; ++ ++ out: ++ nl_cb_put(cb); ++ nla_put_failure: ++ nlmsg_free(msg); + return ret; + } + -- cgit v1.2.3