[pkg-wpa-devel] r1344 - in /hostapd/trunk: debian/ hostapd/ src/common/ src/crypto/ src/drivers/ src/eap_common/ src/eap_peer/ src/eap_server/ src/eapol_supp/ src/l2_packet/ src/rsn_supp/ src/tls/ src/wps/

kelmo-guest at users.alioth.debian.org kelmo-guest at users.alioth.debian.org
Mon Mar 23 15:48:40 UTC 2009


Author: kelmo-guest
Date: Mon Mar 23 15:48:40 2009
New Revision: 1344

URL: http://svn.debian.org/wsvn/pkg-wpa/?sc=1&rev=1344
Log:
* Document copyright errata of hostapd/driver_atheros.c in
  debian/copyright.
* Bump Standards-Version to 3.8.1, no other changes required.
* Remove var/run/hostapd and usr/share/lintian/overrides from
  debian/dirs. hostapd is able to create its own directory for unix
  sockets (and that may be anywhere admin decides) and lintian stuff
  is taken care of by debhelper now.

Added:
    hostapd/trunk/hostapd/driver_atheros.c
      - copied unchanged from r1341, hostapd/branches/upstream/current/hostapd/driver_atheros.c
Modified:
    hostapd/trunk/debian/changelog
    hostapd/trunk/debian/control
    hostapd/trunk/debian/copyright
    hostapd/trunk/debian/dirs
    hostapd/trunk/hostapd/ChangeLog
    hostapd/trunk/hostapd/Makefile
    hostapd/trunk/hostapd/ctrl_iface.c
    hostapd/trunk/hostapd/driver_bsd.c
    hostapd/trunk/hostapd/driver_madwifi.c
    hostapd/trunk/hostapd/driver_nl80211.c
    hostapd/trunk/hostapd/driver_prism54.c
    hostapd/trunk/hostapd/drivers.c
    hostapd/trunk/hostapd/hostapd.8
    hostapd/trunk/hostapd/hostapd.conf
    hostapd/trunk/hostapd/hostapd_cli.1
    hostapd/trunk/hostapd/ieee802_11.c
    hostapd/trunk/hostapd/wme.c
    hostapd/trunk/hostapd/wme.h
    hostapd/trunk/hostapd/wps_hostapd.c
    hostapd/trunk/src/common/ieee802_11_defs.h
    hostapd/trunk/src/common/nl80211_copy.h
    hostapd/trunk/src/common/version.h
    hostapd/trunk/src/common/wpa_common.c
    hostapd/trunk/src/crypto/crypto_gnutls.c
    hostapd/trunk/src/crypto/crypto_internal.c
    hostapd/trunk/src/crypto/sha256.c
    hostapd/trunk/src/crypto/tls_gnutls.c
    hostapd/trunk/src/drivers/driver_bsd.c
    hostapd/trunk/src/drivers/driver_ndis.c
    hostapd/trunk/src/eap_common/eap_defs.h
    hostapd/trunk/src/eap_common/eap_fast_common.h
    hostapd/trunk/src/eap_common/eap_tlv_common.h
    hostapd/trunk/src/eap_peer/eap_fast.c
    hostapd/trunk/src/eap_peer/eap_gpsk.c
    hostapd/trunk/src/eap_peer/eap_tnc.c
    hostapd/trunk/src/eap_server/eap.c
    hostapd/trunk/src/eap_server/eap_gpsk.c
    hostapd/trunk/src/eap_server/eap_i.h
    hostapd/trunk/src/eap_server/eap_tnc.c
    hostapd/trunk/src/eap_server/eap_ttls.c
    hostapd/trunk/src/eapol_supp/eapol_supp_sm.c
    hostapd/trunk/src/l2_packet/l2_packet_linux.c
    hostapd/trunk/src/rsn_supp/wpa.c
    hostapd/trunk/src/tls/tlsv1_client.c
    hostapd/trunk/src/wps/wps.h
    hostapd/trunk/src/wps/wps_enrollee.c
    hostapd/trunk/src/wps/wps_registrar.c
    hostapd/trunk/src/wps/wps_upnp.c
    hostapd/trunk/src/wps/wps_upnp_ssdp.c

Modified: hostapd/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/debian/changelog?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/debian/changelog (original)
+++ hostapd/trunk/debian/changelog Mon Mar 23 15:48:40 2009
@@ -1,6 +1,8 @@
-hostapd (1:0.6.8-1) unstable; urgency=low
-
-  * New upstream release.
+hostapd (1:0.6.9-1) unstable; urgency=low
+
+  * New upstream release.
+  * Document copyright errata of hostapd/driver_atheros.c in
+    debian/copyright.
     - activate nl80211 driver backend (Closes: #429734)
     - deactivate prism54 driver, it is now working. Do not mention it
       in README.Debian (Closes: #475451)
@@ -23,8 +25,13 @@
     command in debian/rules.
   * Rename debian/lintian-overrides to debian/hostapd.lintian-overrides
     so that dh_lintian automatically picks it up.
-
- -- Kel Modderman <kel at otaku42.de>  Wed, 11 Mar 2009 05:38:27 +1000
+  * Bump Standards-Version to 3.8.1, no other changes required.
+  * Remove var/run/hostapd and usr/share/lintian/overrides from
+    debian/dirs. hostapd is able to create its own directory for unix
+    sockets (and that may be anywhere admin decides) and lintian stuff
+    is taken care of by debhelper now.
+
+ -- Kel Modderman <kel at otaku42.de>  Tue, 24 Mar 2009 01:48:35 +1000
 
 hostapd (1:0.5.10-1) unstable; urgency=low
 

Modified: hostapd/trunk/debian/control
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/debian/control?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/debian/control (original)
+++ hostapd/trunk/debian/control Mon Mar 23 15:48:40 2009
@@ -4,7 +4,7 @@
 Maintainer: Faidon Liambotis <paravoid at debian.org>
 Uploaders: Kel Modderman <kel at otaku42.de>
 Build-Depends: debhelper (>= 7.0.50), libssl-dev, libnl-dev (>= 1.1)
-Standards-Version: 3.8.0
+Standards-Version: 3.8.1
 Homepage: http://w1.fi/
 Vcs-Svn: svn://svn.debian.org/pkg-wpa/hostapd/trunk
 Vcs-Browser: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/

Modified: hostapd/trunk/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/debian/copyright?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/debian/copyright (original)
+++ hostapd/trunk/debian/copyright Mon Mar 23 15:48:40 2009
@@ -18,6 +18,13 @@
 
 Files: src/common/wireless_copy.h
 Copyright: Copyright (c) 1997-2005, Jean Tourrilhes <jt at hpl.hp.com>
+License: BSD | GPL-2
+
+Files: hostapd/driver_atheros.c
+Copyright: Copyright (c) 2004, Sam Leffler <sam at errno.com>
+Copyright: Copyright (c) 2004, Video54 Technologies
+Copyright: Copyright (c) 2005-2007, Jouni Malinen <j at w1.fi>
+Copyright: Copyright (c) 2009, Atheros Communications
 License: BSD | GPL-2
 
 Files: src/drivers/driver_atmel.c

Modified: hostapd/trunk/debian/dirs
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/debian/dirs?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/debian/dirs (original)
+++ hostapd/trunk/debian/dirs Mon Mar 23 15:48:40 2009
@@ -1,4 +1,2 @@
 usr/sbin
 etc/hostapd
-var/run/hostapd
-usr/share/lintian/overrides

Modified: hostapd/trunk/hostapd/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/hostapd/ChangeLog?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/hostapd/ChangeLog (original)
+++ hostapd/trunk/hostapd/ChangeLog Mon Mar 23 15:48:40 2009
@@ -1,4 +1,14 @@
 ChangeLog for hostapd
+
+2009-03-23 - v0.6.9
+	* driver_nl80211: fixed STA accounting data collection (TX/RX bytes
+	  reported correctly; TX/RX packets not yet available from kernel)
+	* fixed EAPOL/EAP reauthentication when using an external RADIUS
+	  authentication server
+	* driver_prism54: fixed segmentation fault on initialization
+	* fixed TNC with EAP-TTLS
+	* fixed IEEE 802.11r key derivation function to match with the standard
+	  (note: this breaks interoperability with previous version) [Bug 303]
 
 2009-02-15 - v0.6.8
 	* increased hostapd_cli ping interval to 5 seconds and made this

Modified: hostapd/trunk/hostapd/Makefile
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/hostapd/Makefile?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/hostapd/Makefile (original)
+++ hostapd/trunk/hostapd/Makefile Mon Mar 23 15:48:40 2009
@@ -113,6 +113,12 @@
 ifdef CONFIG_DRIVER_MADWIFI
 CFLAGS += -DCONFIG_DRIVER_MADWIFI
 OBJS += driver_madwifi.o
+CONFIG_L2_PACKET=y
+endif
+
+ifdef CONFIG_DRIVER_ATHEROS
+CFLAGS += -DCONFIG_DRIVER_ATHEROS
+OBJS += driver_atheros.o
 CONFIG_L2_PACKET=y
 endif
 
@@ -307,7 +313,9 @@
 OBJS += ../src/eap_server/eap_tnc.o
 OBJS += ../src/eap_server/tncs.o
 NEED_BASE64=y
+ifndef CONFIG_DRIVER_BSD
 LIBS += -ldl
+endif
 endif
 
 # Basic EAP functionality is needed for EAPOL

Modified: hostapd/trunk/hostapd/ctrl_iface.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/hostapd/ctrl_iface.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/hostapd/ctrl_iface.c (original)
+++ hostapd/trunk/hostapd/ctrl_iface.c Mon Mar 23 15:48:40 2009
@@ -18,6 +18,7 @@
 
 #include <sys/un.h>
 #include <sys/stat.h>
+#include <stddef.h>
 
 #include "hostapd.h"
 #include "eloop.h"
@@ -60,7 +61,8 @@
 	dst->next = hapd->ctrl_dst;
 	hapd->ctrl_dst = dst;
 	wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor attached",
-		    (u8 *) from->sun_path, fromlen);
+		    (u8 *) from->sun_path,
+		    fromlen - offsetof(struct sockaddr_un, sun_path));
 	return 0;
 }
 
@@ -74,15 +76,18 @@
 	dst = hapd->ctrl_dst;
 	while (dst) {
 		if (fromlen == dst->addrlen &&
-		    os_memcmp(from->sun_path, dst->addr.sun_path, fromlen) ==
-		    0) {
+		    os_memcmp(from->sun_path, dst->addr.sun_path,
+			      fromlen - offsetof(struct sockaddr_un, sun_path))
+		    == 0) {
 			if (prev == NULL)
 				hapd->ctrl_dst = dst->next;
 			else
 				prev->next = dst->next;
 			os_free(dst);
 			wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor detached",
-				    (u8 *) from->sun_path, fromlen);
+				    (u8 *) from->sun_path,
+				    fromlen -
+				    offsetof(struct sockaddr_un, sun_path));
 			return 0;
 		}
 		prev = dst;
@@ -104,10 +109,12 @@
 	dst = hapd->ctrl_dst;
 	while (dst) {
 		if (fromlen == dst->addrlen &&
-		    os_memcmp(from->sun_path, dst->addr.sun_path, fromlen) ==
-		    0) {
+		    os_memcmp(from->sun_path, dst->addr.sun_path,
+			      fromlen - offsetof(struct sockaddr_un, sun_path))
+		    == 0) {
 			wpa_hexdump(MSG_DEBUG, "CTRL_IFACE changed monitor "
-				    "level", (u8 *) from->sun_path, fromlen);
+				    "level", (u8 *) from->sun_path, fromlen -
+				    offsetof(struct sockaddr_un, sun_path));
 			dst->debug_level = atoi(level);
 			return 0;
 		}
@@ -434,6 +441,9 @@
 	}
 
 	os_memset(&addr, 0, sizeof(addr));
+#ifdef __FreeBSD__
+	addr.sun_len = sizeof(addr);
+#endif /* __FreeBSD__ */
 	addr.sun_family = AF_UNIX;
 	fname = hostapd_ctrl_iface_path(hapd);
 	if (fname == NULL)
@@ -536,15 +546,17 @@
 		next = dst->next;
 		if (level >= dst->debug_level) {
 			wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor send",
-				    (u8 *) dst->addr.sun_path, dst->addrlen);
+				    (u8 *) dst->addr.sun_path, dst->addrlen -
+				    offsetof(struct sockaddr_un, sun_path));
 			msg.msg_name = &dst->addr;
 			msg.msg_namelen = dst->addrlen;
 			if (sendmsg(hapd->ctrl_sock, &msg, 0) < 0) {
-				fprintf(stderr, "CTRL_IFACE monitor[%d]: ",
-					idx);
-				perror("sendmsg");
+				int _errno = errno;
+				wpa_printf(MSG_INFO, "CTRL_IFACE monitor[%d]: "
+					   "%d - %s",
+					   idx, errno, strerror(errno));
 				dst->errors++;
-				if (dst->errors > 10) {
+				if (dst->errors > 10 || _errno == ENOENT) {
 					hostapd_ctrl_iface_detach(
 						hapd, &dst->addr,
 						dst->addrlen);

Modified: hostapd/trunk/hostapd/driver_bsd.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/hostapd/driver_bsd.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/hostapd/driver_bsd.c (original)
+++ hostapd/trunk/hostapd/driver_bsd.c Mon Mar 23 15:48:40 2009
@@ -29,6 +29,7 @@
 #undef RSN_VERSION
 #undef WPA_VERSION
 #undef WPA_OUI_TYPE
+#undef WME_OUI_TYPE
 
 #include "hostapd.h"
 #include "driver.h"

Modified: hostapd/trunk/hostapd/driver_madwifi.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/hostapd/driver_madwifi.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/hostapd/driver_madwifi.c (original)
+++ hostapd/trunk/hostapd/driver_madwifi.c Mon Mar 23 15:48:40 2009
@@ -877,14 +877,14 @@
 	}
 	wpa_hexdump(MSG_MSGDUMP, "madwifi req WPA IE",
 		    ie.wpa_ie, IEEE80211_MAX_OPT_IE);
-	wpa_hexdump(MSG_MSGDUMP, "madwifi req RSN IE",
-		    ie.rsn_ie, IEEE80211_MAX_OPT_IE);
 	iebuf = ie.wpa_ie;
 	/* madwifi seems to return some random data if WPA/RSN IE is not set.
 	 * Assume the IE was not included if the IE type is unknown. */
 	if (iebuf[0] != WLAN_EID_VENDOR_SPECIFIC)
 		iebuf[1] = 0;
 #ifdef MADWIFI_NG
+	wpa_hexdump(MSG_MSGDUMP, "madwifi req RSN IE",
+		    ie.rsn_ie, IEEE80211_MAX_OPT_IE);
 	if (iebuf[1] == 0 && ie.rsn_ie[1] > 0) {
 		/* madwifi-ng svn #1453 added rsn_ie. Use it, if wpa_ie was not
 		 * set. This is needed for WPA2. */

Modified: hostapd/trunk/hostapd/driver_nl80211.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/hostapd/driver_nl80211.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/hostapd/driver_nl80211.c (original)
+++ hostapd/trunk/hostapd/driver_nl80211.c Mon Mar 23 15:48:40 2009
@@ -682,6 +682,8 @@
 		[NL80211_STA_INFO_INACTIVE_TIME] = { .type = NLA_U32 },
 		[NL80211_STA_INFO_RX_BYTES] = { .type = NLA_U32 },
 		[NL80211_STA_INFO_TX_BYTES] = { .type = NLA_U32 },
+		[NL80211_STA_INFO_RX_PACKETS] = { .type = NLA_U32 },
+		[NL80211_STA_INFO_TX_PACKETS] = { .type = NLA_U32 },
 	};
 
 	nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
@@ -710,7 +712,13 @@
 	if (stats[NL80211_STA_INFO_RX_BYTES])
 		data->rx_bytes = nla_get_u32(stats[NL80211_STA_INFO_RX_BYTES]);
 	if (stats[NL80211_STA_INFO_TX_BYTES])
-		data->rx_bytes = nla_get_u32(stats[NL80211_STA_INFO_TX_BYTES]);
+		data->tx_bytes = nla_get_u32(stats[NL80211_STA_INFO_TX_BYTES]);
+	if (stats[NL80211_STA_INFO_RX_PACKETS])
+		data->rx_packets =
+			nla_get_u32(stats[NL80211_STA_INFO_RX_PACKETS]);
+	if (stats[NL80211_STA_INFO_TX_PACKETS])
+		data->tx_packets =
+			nla_get_u32(stats[NL80211_STA_INFO_TX_PACKETS]);
 
 	return NL_SKIP;
 }
@@ -721,6 +729,7 @@
 	struct i802_driver_data *drv = priv;
 	struct nl_msg *msg;
 
+	os_memset(data, 0, sizeof(*data));
 	msg = nlmsg_alloc();
 	if (!msg)
 		return -ENOMEM;
@@ -837,6 +846,9 @@
 #endif /* CONFIG_IEEE80211N */
 
 	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
+	if (ret)
+		wpa_printf(MSG_DEBUG, "nl80211: NL80211_CMD_NEW_STATION "
+			   "result: %d (%s)", ret, strerror(-ret));
 	if (ret == -EEXIST)
 		ret = 0;
  nla_put_failure:

Modified: hostapd/trunk/hostapd/driver_prism54.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/hostapd/driver_prism54.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/hostapd/driver_prism54.c (original)
+++ hostapd/trunk/hostapd/driver_prism54.c Mon Mar 23 15:48:40 2009
@@ -1052,7 +1052,7 @@
 	}
 	prism54_init_1x(drv);
 	/* must clean previous elems */
-	hostapd_set_generic_elem(hapd, NULL, 0);
+	prism54_set_generic_elem(drv->iface, drv, NULL, 0);
 
 	return drv;
 }

Modified: hostapd/trunk/hostapd/drivers.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/hostapd/drivers.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/hostapd/drivers.c (original)
+++ hostapd/trunk/hostapd/drivers.c Mon Mar 23 15:48:40 2009
@@ -27,6 +27,9 @@
 #ifdef CONFIG_DRIVER_MADWIFI
 extern struct wpa_driver_ops wpa_driver_madwifi_ops; /* driver_madwifi.c */
 #endif /* CONFIG_DRIVER_MADWIFI */
+#ifdef CONFIG_DRIVER_ATHEROS
+extern struct wpa_driver_ops wpa_driver_atheros_ops; /* driver_atheros.c */
+#endif /* CONFIG_DRIVER_ATHEROS */
 #ifdef CONFIG_DRIVER_BSD
 extern struct wpa_driver_ops wpa_driver_bsd_ops; /* driver_bsd.c */
 #endif /* CONFIG_DRIVER_BSD */
@@ -55,6 +58,9 @@
 #ifdef CONFIG_DRIVER_MADWIFI
 	&wpa_driver_madwifi_ops,
 #endif /* CONFIG_DRIVER_MADWIFI */
+#ifdef CONFIG_DRIVER_ATHEROS
+	&wpa_driver_atheros_ops,
+#endif /* CONFIG_DRIVER_ATHEROS */
 #ifdef CONFIG_DRIVER_BSD
 	&wpa_driver_bsd_ops,
 #endif /* CONFIG_DRIVER_BSD */

Modified: hostapd/trunk/hostapd/hostapd.8
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/hostapd/hostapd.8?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/hostapd/hostapd.8 (original)
+++ hostapd/trunk/hostapd/hostapd.8 Mon Mar 23 15:48:40 2009
@@ -3,7 +3,7 @@
 hostapd \- IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
 .SH SYNOPSIS
 .B hostapd
-[-hdBKtv] [-P <PID file>] <configuration file(s)>
+[\-hdBKtv] [\-P <PID file>] <configuration file(s)>
 .SH DESCRIPTION
 This manual page documents briefly the
 .B hostapd

Modified: hostapd/trunk/hostapd/hostapd.conf
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/hostapd/hostapd.conf?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/hostapd/hostapd.conf (original)
+++ hostapd/trunk/hostapd/hostapd.conf Mon Mar 23 15:48:40 2009
@@ -245,14 +245,14 @@
 #tx_queue_beacon_cwmax=7
 #tx_queue_beacon_burst=1.5
 
-# 802.1D Tag to AC mappings
+# 802.1D Tag (= UP) to AC mappings
 # WMM specifies following mapping of data frames to different ACs. This mapping
 # can be configured using Linux QoS/tc and sch_pktpri.o module.
 # 802.1D Tag	802.1D Designation	Access Category	WMM Designation
 # 1		BK			AC_BK		Background
 # 2		-			AC_BK		Background
 # 0		BE			AC_BE		Best Effort
-# 3		EE			AC_VI		Video
+# 3		EE			AC_BE		Best Effort
 # 4		CL			AC_VI		Video
 # 5		VI			AC_VI		Video
 # 6		VO			AC_VO		Voice

Modified: hostapd/trunk/hostapd/hostapd_cli.1
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/hostapd/hostapd_cli.1?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/hostapd/hostapd_cli.1 (original)
+++ hostapd/trunk/hostapd/hostapd_cli.1 Mon Mar 23 15:48:40 2009
@@ -3,7 +3,7 @@
 hostapd_cli \- hostapd command-line interface
 .SH SYNOPSIS
 .B hostapd_cli
-[-p<path>] [-i<ifname>] [-hv] [command..]
+[\-p<path>] [\-i<ifname>] [\-hv] [command..]
 .SH DESCRIPTION
 This manual page documents briefly the
 .B hostapd_cli

Modified: hostapd/trunk/hostapd/ieee802_11.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/hostapd/ieee802_11.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/hostapd/ieee802_11.c (original)
+++ hostapd/trunk/hostapd/ieee802_11.c Mon Mar 23 15:48:40 2009
@@ -1527,6 +1527,34 @@
 }
 
 
+#ifdef CONFIG_IEEE80211N
+static void
+hostapd_get_ht_capab(struct hostapd_data *hapd,
+		     struct ht_cap_ie *ht_cap_ie,
+		     struct ht_cap_ie *neg_ht_cap_ie)
+{
+
+	os_memcpy(neg_ht_cap_ie, ht_cap_ie, sizeof(struct ht_cap_ie));
+	neg_ht_cap_ie->data.capabilities_info =
+		ht_cap_ie->data.capabilities_info & hapd->iconf->ht_capab;
+
+	neg_ht_cap_ie->data.capabilities_info &= ~HT_CAP_INFO_SMPS_DISABLED;
+	if ((ht_cap_ie->data.capabilities_info & HT_CAP_INFO_SMPS_DISABLED) ==
+	    (hapd->iconf->ht_capab & HT_CAP_INFO_SMPS_DISABLED))
+		neg_ht_cap_ie->data.capabilities_info |=
+			hapd->iconf->ht_capab & HT_CAP_INFO_SMPS_DISABLED;
+	else
+		neg_ht_cap_ie->data.capabilities_info |=
+			HT_CAP_INFO_SMPS_DISABLED;
+
+	/* FIXME: Rx STBC needs to be handled specially */
+	neg_ht_cap_ie->data.capabilities_info &= ~HT_CAP_INFO_RX_STBC_MASK;
+	neg_ht_cap_ie->data.capabilities_info |=
+		hapd->iconf->ht_capab & HT_CAP_INFO_RX_STBC_MASK;
+}
+#endif /* CONFIG_IEEE80211N */
+
+
 static void handle_assoc_cb(struct hostapd_data *hapd,
 			    struct ieee80211_mgmt *mgmt,
 			    size_t len, int reassoc, int ok)
@@ -1534,7 +1562,10 @@
 	u16 status;
 	struct sta_info *sta;
 	int new_assoc = 1;
-	struct ht_cap_ie *ht_cap = NULL;
+#ifdef CONFIG_IEEE80211N
+	struct ht_cap_ie ht_cap;
+#endif /* CONFIG_IEEE80211N */
+	struct ht_cap_ie *ht_cap_ptr = NULL;
 
 	if (!ok) {
 		hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211,
@@ -1584,8 +1615,10 @@
 		mlme_associate_indication(hapd, sta);
 
 #ifdef CONFIG_IEEE80211N
-	if (sta->flags & WLAN_STA_HT)
-		ht_cap = &sta->ht_capabilities;
+	if (sta->flags & WLAN_STA_HT) {
+		ht_cap_ptr = &ht_cap;
+		hostapd_get_ht_capab(hapd, &sta->ht_capabilities, ht_cap_ptr);
+	}
 #endif /* CONFIG_IEEE80211N */
 
 #ifdef CONFIG_IEEE80211W
@@ -1595,7 +1628,7 @@
 	if (hostapd_sta_add(hapd->conf->iface, hapd, sta->addr, sta->aid,
 			    sta->capability, sta->supported_rates,
 			    sta->supported_rates_len, 0, sta->listen_interval,
-			    ht_cap))
+			    ht_cap_ptr))
 	{
 		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
 			       HOSTAPD_LEVEL_NOTICE,

Modified: hostapd/trunk/hostapd/wme.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/hostapd/wme.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/hostapd/wme.c (original)
+++ hostapd/trunk/hostapd/wme.c Mon Mar 23 15:48:40 2009
@@ -153,40 +153,102 @@
 }
 
 
-/* given frame data payload size in bytes, and data_rate in bits per second
- * returns time to complete frame exchange */
-/* FIX: should not use floating point types */
-static double wme_frame_exchange_time(int bytes, int data_rate, int encryption,
-				      int cts_protection)
-{
-	/* TODO: account for MAC/PHY headers correctly */
-	/* TODO: account for encryption headers */
-	/* TODO: account for WDS headers */
-	/* TODO: account for CTS protection */
-	/* TODO: account for SIFS + ACK at minimum PHY rate */
-	return (bytes + 400) * 8.0 / data_rate;
-}
-
-
 static void wme_setup_request(struct hostapd_data *hapd,
 			      struct ieee80211_mgmt *mgmt,
 			      struct wme_tspec_info_element *tspec, size_t len)
 {
-	/* FIX: should not use floating point types */
-	double medium_time, pps;
-
-	/* TODO: account for airtime and answer no to tspec setup requests
-	 * when none left!! */
-
-	pps = (tspec->mean_data_rate / 8.0) / tspec->nominal_msdu_size;
-	medium_time = (tspec->surplus_bandwidth_allowance / 8) * pps *
-		wme_frame_exchange_time(tspec->nominal_msdu_size,
-					tspec->minimum_phy_rate, 0, 0);
-	tspec->medium_time = medium_time * 1000000.0 / 32.0;
+	u8 *end = ((u8 *) mgmt) + len;
+	int medium_time, pps, duration;
+	int up, psb, dir, tid;
+	u16 val, surplus;
+
+	if ((u8 *) (tspec + 1) > end) {
+		wpa_printf(MSG_DEBUG, "WMM: TSPEC overflow in ADDTS Request");
+		return;
+	}
+
+	wpa_printf(MSG_DEBUG, "WMM: ADDTS Request (Dialog Token %d) for TSPEC "
+		   "from " MACSTR,
+		   mgmt->u.action.u.wme_action.dialog_token,
+		   MAC2STR(mgmt->sa));
+
+	up = (tspec->ts_info[1] >> 3) & 0x07;
+	psb = (tspec->ts_info[1] >> 2) & 0x01;
+	dir = (tspec->ts_info[0] >> 5) & 0x03;
+	tid = (tspec->ts_info[0] >> 1) & 0x0f;
+	wpa_printf(MSG_DEBUG, "WMM: TS Info: UP=%d PSB=%d Direction=%d TID=%d",
+		   up, psb, dir, tid);
+	val = le_to_host16(tspec->nominal_msdu_size);
+	wpa_printf(MSG_DEBUG, "WMM: Nominal MSDU Size: %d%s",
+		   val & 0x7fff, val & 0x8000 ? " (fixed)" : "");
+	wpa_printf(MSG_DEBUG, "WMM: Mean Data Rate: %u bps",
+		   le_to_host32(tspec->mean_data_rate));
+	wpa_printf(MSG_DEBUG, "WMM: Minimum PHY Rate: %u bps",
+		   le_to_host32(tspec->minimum_phy_rate));
+	val = le_to_host16(tspec->surplus_bandwidth_allowance);
+	wpa_printf(MSG_DEBUG, "WMM: Surplus Bandwidth Allowance: %u.%04u",
+		   val >> 13, 10000 * (val & 0x1fff) / 0x2000);
+
+	val = le_to_host16(tspec->nominal_msdu_size);
+	if (val == 0) {
+		wpa_printf(MSG_DEBUG, "WMM: Invalid Nominal MSDU Size (0)");
+		goto invalid;
+	}
+	/* pps = Ceiling((Mean Data Rate / 8) / Nominal MSDU Size) */
+	pps = ((le_to_host32(tspec->mean_data_rate) / 8) + val - 1) / val;
+	wpa_printf(MSG_DEBUG, "WMM: Packets-per-second estimate for TSPEC: %d",
+		   pps);
+
+	if (le_to_host32(tspec->minimum_phy_rate) < 1000000) {
+		wpa_printf(MSG_DEBUG, "WMM: Too small Minimum PHY Rate");
+		goto invalid;
+	}
+
+	duration = (le_to_host16(tspec->nominal_msdu_size) & 0x7fff) * 8 /
+		(le_to_host32(tspec->minimum_phy_rate) / 1000000) +
+		50 /* FIX: proper SIFS + ACK duration */;
+
+	/* unsigned binary number with an implicit binary point after the
+	 * leftmost 3 bits, i.e., 0x2000 = 1.0 */
+	surplus = le_to_host16(tspec->surplus_bandwidth_allowance);
+	if (surplus <= 0x2000) {
+		wpa_printf(MSG_DEBUG, "WMM: Surplus Bandwidth Allowance not "
+			   "greater than unity");
+		goto invalid;
+	}
+
+	medium_time = surplus * pps * duration / 0x2000;
+	wpa_printf(MSG_DEBUG, "WMM: Estimated medium time: %u", medium_time);
+
+	/*
+	 * TODO: store list of granted (and still active) TSPECs and check
+	 * whether there is available medium time for this request. For now,
+	 * just refuse requests that would by themselves take very large
+	 * portion of the available bandwidth.
+	 */
+	if (medium_time > 750000) {
+		wpa_printf(MSG_DEBUG, "WMM: Refuse TSPEC request for over "
+			   "75%% of available bandwidth");
+		wme_send_action(hapd, mgmt->sa, tspec,
+				WME_ACTION_CODE_SETUP_RESPONSE,
+				mgmt->u.action.u.wme_action.dialog_token,
+				WME_SETUP_RESPONSE_STATUS_REFUSED);
+		return;
+	}
+
+	/* Convert to 32 microseconds per second unit */
+	tspec->medium_time = host_to_le16(medium_time / 32);
 
 	wme_send_action(hapd, mgmt->sa, tspec, WME_ACTION_CODE_SETUP_RESPONSE,
 			mgmt->u.action.u.wme_action.dialog_token,
 			WME_SETUP_RESPONSE_STATUS_ADMISSION_ACCEPTED);
+	return;
+
+invalid:
+	wme_send_action(hapd, mgmt->sa, tspec,
+			WME_ACTION_CODE_SETUP_RESPONSE,
+			mgmt->u.action.u.wme_action.dialog_token,
+			WME_SETUP_RESPONSE_STATUS_INVALID_PARAMETERS);
 }
 
 

Modified: hostapd/trunk/hostapd/wme.h
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/hostapd/wme.h?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/hostapd/wme.h (original)
+++ hostapd/trunk/hostapd/wme.h Mon Mar 23 15:48:40 2009
@@ -86,27 +86,29 @@
 } __attribute__ ((packed));
 
 struct wme_tspec_info_element {
-	u8 eid;
-	u8 length;
-	u8 oui[3];
-	u8 oui_type;
-	u8 oui_subtype;
-	u8 version;
-	u16 ts_info;
-	u16 nominal_msdu_size;
-	u16 maximum_msdu_size;
-	u32 minimum_service_interval;
-	u32 maximum_service_interval;
-	u32 inactivity_interval;
-	u32 start_time;
-	u32 minimum_data_rate;
-	u32 mean_data_rate;
-	u32 maximum_burst_size;
-	u32 minimum_phy_rate;
-	u32 peak_data_rate;
-	u32 delay_bound;
-	u16 surplus_bandwidth_allowance;
-	u16 medium_time;
+	u8 eid; /* 221 = 0xdd */
+	u8 length; /* 6 + 55 = 61 */
+	u8 oui[3]; /* 00:50:f2 */
+	u8 oui_type; /* 2 */
+	u8 oui_subtype; /* 2 */
+	u8 version; /* 1 */
+	/* WMM TSPEC body (55 octets): */
+	u8 ts_info[3];
+	le16 nominal_msdu_size;
+	le16 maximum_msdu_size;
+	le32 minimum_service_interval;
+	le32 maximum_service_interval;
+	le32 inactivity_interval;
+	le32 suspension_interval;
+	le32 service_start_time;
+	le32 minimum_data_rate;
+	le32 mean_data_rate;
+	le32 peak_data_rate;
+	le32 maximum_burst_size;
+	le32 delay_bound;
+	le32 minimum_phy_rate;
+	le16 surplus_bandwidth_allowance;
+	le16 medium_time;
 } __attribute__ ((packed));
 
 

Modified: hostapd/trunk/hostapd/wps_hostapd.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/hostapd/wps_hostapd.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/hostapd/wps_hostapd.c (original)
+++ hostapd/trunk/hostapd/wps_hostapd.c Mon Mar 23 15:48:40 2009
@@ -326,15 +326,21 @@
 		else
 			fprintf(nconf, "auth_algs=1\n");
 
-		if (cred->encr_type & WPS_ENCR_WEP && cred->key_idx < 4) {
-			fprintf(nconf, "wep_default_key=%d\n", cred->key_idx);
-			fprintf(nconf, "wep_key%d=", cred->key_idx);
-			if (cred->key_len != 10 && cred->key_len != 26)
-				fputc('"', nconf);
-			for (i = 0; i < cred->key_len; i++)
-				fputc(cred->key[i], nconf);
-			if (cred->key_len != 10 && cred->key_len != 26)
-				fputc('"', nconf);
+		if (cred->encr_type & WPS_ENCR_WEP && cred->key_idx <= 4) {
+			int key_idx = cred->key_idx;
+			if (key_idx)
+				key_idx--;
+			fprintf(nconf, "wep_default_key=%d\n", key_idx);
+			fprintf(nconf, "wep_key%d=", key_idx);
+			if (cred->key_len == 10 || cred->key_len == 26) {
+				/* WEP key as a hex string */
+				for (i = 0; i < cred->key_len; i++)
+					fputc(cred->key[i], nconf);
+			} else {
+				/* Raw WEP key; convert to hex */
+				for (i = 0; i < cred->key_len; i++)
+					fprintf(nconf, "%02x", cred->key[i]);
+			}
 			fprintf(nconf, "\n");
 		}
 	}
@@ -620,6 +626,8 @@
 	cfg.extra_cred_len = conf->extra_cred_len;
 	cfg.disable_auto_conf = (hapd->conf->wps_cred_processing == 1) &&
 		conf->skip_cred_build;
+	if (conf->ssid.security_policy == SECURITY_STATIC_WEP)
+		cfg.static_wep_only = 1;
 
 	wps->registrar = wps_registrar_init(wps, &cfg);
 	if (wps->registrar == NULL) {

Modified: hostapd/trunk/src/common/ieee802_11_defs.h
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/common/ieee802_11_defs.h?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/common/ieee802_11_defs.h (original)
+++ hostapd/trunk/src/common/ieee802_11_defs.h Mon Mar 23 15:48:40 2009
@@ -134,10 +134,9 @@
 #define WLAN_STATUS_ASSOC_DENIED_LISTEN_INT_TOO_LARGE 51
 /* IEEE 802.11r */
 #define WLAN_STATUS_INVALID_FT_ACTION_FRAME_COUNT 52
-#define WLAN_STATUS_EXPECTED_RESOURCE_REQ_FT 53
-#define WLAN_STATUS_INVALID_PMKID 54
-#define WLAN_STATUS_INVALID_MDIE 55
-#define WLAN_STATUS_INVALID_FTIE 56
+#define WLAN_STATUS_INVALID_PMKID 53
+#define WLAN_STATUS_INVALID_MDIE 54
+#define WLAN_STATUS_INVALID_FTIE 55
 
 /* Reason codes (IEEE 802.11-2007, 7.3.1.7, Table 7-22) */
 #define WLAN_REASON_UNSPECIFIED 1

Modified: hostapd/trunk/src/common/nl80211_copy.h
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/common/nl80211_copy.h?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/common/nl80211_copy.h (original)
+++ hostapd/trunk/src/common/nl80211_copy.h Mon Mar 23 15:48:40 2009
@@ -526,6 +526,9 @@
  * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm)
  * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute
  * 	containing info as possible, see &enum nl80211_sta_info_txrate.
+ * @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station)
+ * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this
+ *	station)
  */
 enum nl80211_sta_info {
 	__NL80211_STA_INFO_INVALID,
@@ -537,6 +540,8 @@
 	NL80211_STA_INFO_PLINK_STATE,
 	NL80211_STA_INFO_SIGNAL,
 	NL80211_STA_INFO_TX_BITRATE,
+	NL80211_STA_INFO_RX_PACKETS,
+	NL80211_STA_INFO_TX_PACKETS,
 
 	/* keep last */
 	__NL80211_STA_INFO_AFTER_LAST,

Modified: hostapd/trunk/src/common/version.h
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/common/version.h?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/common/version.h (original)
+++ hostapd/trunk/src/common/version.h Mon Mar 23 15:48:40 2009
@@ -1,6 +1,6 @@
 #ifndef VERSION_H
 #define VERSION_H
 
-#define VERSION_STR "0.6.8"
+#define VERSION_STR "0.6.9"
 
 #endif /* VERSION_H */

Modified: hostapd/trunk/src/common/wpa_common.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/common/wpa_common.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/common/wpa_common.c (original)
+++ hostapd/trunk/src/common/wpa_common.c Mon Mar 23 15:48:40 2009
@@ -56,10 +56,10 @@
 		hmac_sha1(key, 16, buf, len, hash);
 		os_memcpy(mic, hash, MD5_MAC_LEN);
 		break;
-#ifdef CONFIG_IEEE80211R
+#if defined(CONFIG_IEEE80211R) || defined(CONFIG_IEEE80211W)
 	case WPA_KEY_INFO_TYPE_AES_128_CMAC:
 		return omac1_aes_128(key, buf, len, mic);
-#endif /* CONFIG_IEEE80211R */
+#endif /* CONFIG_IEEE80211R || CONFIG_IEEE80211W */
 	default:
 		return -1;
 	}

Modified: hostapd/trunk/src/crypto/crypto_gnutls.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/crypto/crypto_gnutls.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/crypto/crypto_gnutls.c (original)
+++ hostapd/trunk/src/crypto/crypto_gnutls.c Mon Mar 23 15:48:40 2009
@@ -57,7 +57,6 @@
 }
 
 
-#ifdef EAP_TLS_FUNCS
 void md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
 {
 	gcry_md_hd_t hd;
@@ -162,7 +161,6 @@
 	gcry_cipher_hd_t hd = ctx;
 	gcry_cipher_close(hd);
 }
-#endif /* EAP_TLS_FUNCS */
 
 
 int crypto_mod_exp(const u8 *base, size_t base_len,

Modified: hostapd/trunk/src/crypto/crypto_internal.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/crypto/crypto_internal.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/crypto/crypto_internal.c (original)
+++ hostapd/trunk/src/crypto/crypto_internal.c Mon Mar 23 15:48:40 2009
@@ -25,7 +25,7 @@
 #include "tls/asn1.h"
 
 
-#ifdef EAP_TLS_FUNCS
+#ifdef CONFIG_CRYPTO_INTERNAL
 
 #ifdef CONFIG_TLS_INTERNAL
 
@@ -788,6 +788,7 @@
 void crypto_global_deinit(void)
 {
 }
+#endif /* CONFIG_TLS_INTERNAL */
 
 
 #if defined(EAP_FAST) || defined(CONFIG_WPS)
@@ -830,6 +831,4 @@
 #endif /* EAP_FAST || CONFIG_WPS */
 
 
-#endif /* CONFIG_TLS_INTERNAL */
-
-#endif /* EAP_TLS_FUNCS */
+#endif /* CONFIG_CRYPTO_INTERNAL */

Modified: hostapd/trunk/src/crypto/sha256.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/crypto/sha256.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/crypto/sha256.c (original)
+++ hostapd/trunk/src/crypto/sha256.c Mon Mar 23 15:48:40 2009
@@ -122,7 +122,7 @@
 void sha256_prf(const u8 *key, size_t key_len, const char *label,
 		const u8 *data, size_t data_len, u8 *buf, size_t buf_len)
 {
-	u16 counter = 0;
+	u16 counter = 1;
 	size_t pos, plen;
 	u8 hash[SHA256_MAC_LEN];
 	const u8 *addr[4];

Modified: hostapd/trunk/src/crypto/tls_gnutls.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/crypto/tls_gnutls.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/crypto/tls_gnutls.c (original)
+++ hostapd/trunk/src/crypto/tls_gnutls.c Mon Mar 23 15:48:40 2009
@@ -989,11 +989,13 @@
 			return NULL;
 		}
 
+#ifdef CONFIG_GNUTLS_EXTRA
 		if (conn->tls_ia && !gnutls_ia_handshake_p(conn->session)) {
 			wpa_printf(MSG_INFO, "TLS: No TLS/IA negotiation");
 			conn->failed++;
 			return NULL;
 		}
+#endif /* CONFIG_GNUTLS_EXTRA */
 
 		if (conn->tls_ia)
 			wpa_printf(MSG_DEBUG, "TLS: Start TLS/IA handshake");

Modified: hostapd/trunk/src/drivers/driver_bsd.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/drivers/driver_bsd.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/drivers/driver_bsd.c (original)
+++ hostapd/trunk/src/drivers/driver_bsd.c Mon Mar 23 15:48:40 2009
@@ -177,7 +177,7 @@
 }
 
 static int
-wpa_driver_bsd_set_ssid(void *priv, const char *ssid,
+wpa_driver_bsd_set_ssid(void *priv, const u8 *ssid,
 			     size_t ssid_len)
 {
 	struct wpa_driver_bsd_data *drv = priv;
@@ -187,7 +187,7 @@
 
 static int
 wpa_driver_bsd_set_wpa_ie(struct wpa_driver_bsd_data *drv,
-	const char *wpa_ie, size_t wpa_ie_len)
+	const u8 *wpa_ie, size_t wpa_ie_len)
 {
 	return set80211var(drv, IEEE80211_IOC_OPTIE, wpa_ie, wpa_ie_len);
 }

Modified: hostapd/trunk/src/drivers/driver_ndis.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/drivers/driver_ndis.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/drivers/driver_ndis.c (original)
+++ hostapd/trunk/src/drivers/driver_ndis.c Mon Mar 23 15:48:40 2009
@@ -54,6 +54,10 @@
 static int wpa_driver_ndis_adapter_init(struct wpa_driver_ndis_data *drv);
 static int wpa_driver_ndis_adapter_open(struct wpa_driver_ndis_data *drv);
 static void wpa_driver_ndis_adapter_close(struct wpa_driver_ndis_data *drv);
+
+
+static const u8 pae_group_addr[ETH_ALEN] =
+{ 0x01, 0x80, 0xc2, 0x00, 0x00, 0x03 };
 
 
 /* FIX: to be removed once this can be compiled with the complete NDIS
@@ -610,12 +614,7 @@
 		 * Report PAE group address as the "BSSID" for wired
 		 * connection.
 		 */
-		bssid[0] = 0x01;
-		bssid[1] = 0x80;
-		bssid[2] = 0xc2;
-		bssid[3] = 0x00;
-		bssid[4] = 0x00;
-		bssid[5] = 0x03;
+		os_memcpy(bssid, pae_group_addr, ETH_ALEN);
 		return 0;
 	}
 
@@ -2704,6 +2703,19 @@
 }
 
 
+static int ndis_add_multicast(struct wpa_driver_ndis_data *drv)
+{
+	if (ndis_set_oid(drv, OID_802_3_MULTICAST_LIST,
+			 (const char *) pae_group_addr, ETH_ALEN) < 0) {
+		wpa_printf(MSG_DEBUG, "NDIS: Failed to add PAE group address "
+			   "to the multicast list");
+		return -1;
+	}
+
+	return 0;
+}
+
+
 static void * wpa_driver_ndis_init(void *ctx, const char *ifname)
 {
 	struct wpa_driver_ndis_data *drv;
@@ -2799,6 +2811,7 @@
 				   "any wireless capabilities - assume it is "
 				   "a wired interface");
 			drv->wired = 1;
+			ndis_add_multicast(drv);
 		}
 	}
 

Modified: hostapd/trunk/src/eap_common/eap_defs.h
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/eap_common/eap_defs.h?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/eap_common/eap_defs.h (original)
+++ hostapd/trunk/src/eap_common/eap_defs.h Mon Mar 23 15:48:40 2009
@@ -67,7 +67,7 @@
 	EAP_TYPE_SAKE = 48 /* RFC 4763 */,
 	EAP_TYPE_IKEV2 = 49 /* RFC 5106 */,
 	EAP_TYPE_AKA_PRIME = 50 /* draft-arkko-eap-aka-kdf-10.txt */,
-	EAP_TYPE_GPSK = 51 /* draft-ietf-emu-eap-gpsk-17.txt */,
+	EAP_TYPE_GPSK = 51 /* RFC 5433 */,
 	EAP_TYPE_EXPANDED = 254 /* RFC 3748 */
 } EapType;
 

Modified: hostapd/trunk/src/eap_common/eap_fast_common.h
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/eap_common/eap_fast_common.h?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/eap_common/eap_fast_common.h (original)
+++ hostapd/trunk/src/eap_common/eap_fast_common.h Mon Mar 23 15:48:40 2009
@@ -24,8 +24,7 @@
 #define TLS_EXT_PAC_OPAQUE 35
 
 /*
- * draft-cam-winget-eap-fast-provisioning-04.txt:
- * Section 4.2.1 - Formats for PAC TLV Attributes / Type Field
+ * RFC 5422: Section 4.2.1 - Formats for PAC TLV Attributes / Type Field
  * Note: bit 0x8000 (Mandatory) and bit 0x4000 (Reserved) are also defined
  * in the general PAC TLV format (Section 4.2).
  */
@@ -59,10 +58,7 @@
 
 #define EAP_FAST_PAC_KEY_LEN 32
 
-/* draft-cam-winget-eap-fast-provisioning-04.txt: 4.2.6 PAC-Type TLV
- * Note: Machine Authentication PAC and User Authorization PAC were removed in
- * draft-cam-winget-eap-fast-provisioning-03.txt
- */
+/* RFC 5422: 4.2.6 PAC-Type TLV */
 #define PAC_TYPE_TUNNEL_PAC 1
 /* Application Specific Short Lived PACs (only in volatile storage) */
 /* User Authorization PAC */
@@ -73,8 +69,8 @@
 
 
 /*
- * draft-cam-winget-eap-fast-provisioning-04.txt:
- * Section 3.4 - Key Derivations Used in the EAP-FAST Provisioning Exchange
+ * RFC 5422:
+ * Section 3.3 - Key Derivations Used in the EAP-FAST Provisioning Exchange
  */
 struct eap_fast_key_block_provisioning {
 	/* Extra key material after TLS key_block */

Modified: hostapd/trunk/src/eap_common/eap_tlv_common.h
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/eap_common/eap_tlv_common.h?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/eap_common/eap_tlv_common.h (original)
+++ hostapd/trunk/src/eap_common/eap_tlv_common.h Mon Mar 23 15:48:40 2009
@@ -24,8 +24,7 @@
 #define EAP_TLV_URI_TLV 8
 #define EAP_TLV_EAP_PAYLOAD_TLV 9
 #define EAP_TLV_INTERMEDIATE_RESULT_TLV 10
-#define EAP_TLV_PAC_TLV 11 /* draft-cam-winget-eap-fast-provisioning-04.txt,
-			    * Section 4.2 */
+#define EAP_TLV_PAC_TLV 11 /* RFC 5422, Section 4.2 */
 #define EAP_TLV_CRYPTO_BINDING_TLV 12
 #define EAP_TLV_CALLING_STATION_ID_TLV 13
 #define EAP_TLV_CALLED_STATION_ID_TLV 14
@@ -99,7 +98,7 @@
 	be16 action;
 } STRUCT_PACKED;
 
-/* draft-cam-winget-eap-fast-provisiong-04.txt, Section 4.2.6 - PAC-Type TLV */
+/* RFC 5422, Section 4.2.6 - PAC-Type TLV */
 struct eap_tlv_pac_type_tlv {
 	be16 tlv_type; /* PAC_TYPE_PAC_TYPE */
 	be16 length;

Modified: hostapd/trunk/src/eap_peer/eap_fast.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/eap_peer/eap_fast.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/eap_peer/eap_fast.c (original)
+++ hostapd/trunk/src/eap_peer/eap_fast.c Mon Mar 23 15:48:40 2009
@@ -918,10 +918,7 @@
 		entry->a_id_info_len = len;
 		break;
 	case PAC_TYPE_PAC_TYPE:
-		/*
-		 * draft-cam-winget-eap-fast-provisioning-04.txt,
-		 * Section 4.2.6 - PAC-Type TLV
-		 */
+		/* RFC 5422, Section 4.2.6 - PAC-Type TLV */
 		if (len != 2) {
 			wpa_printf(MSG_INFO, "EAP-FAST: Invalid PAC-Type "
 				   "length %lu (expected 2)",
@@ -961,7 +958,7 @@
 	size_t left, len;
 	int type;
 
-	/* draft-cam-winget-eap-fast-provisioning-04.txt, Section 4.2.4 */
+	/* RFC 5422, Section 4.2.4 */
 
 	/* PAC-Type defaults to Tunnel PAC (Type 1) */
 	entry->pac_type = PAC_TYPE_TUNNEL_PAC;

Modified: hostapd/trunk/src/eap_peer/eap_gpsk.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/eap_peer/eap_gpsk.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/eap_peer/eap_gpsk.c (original)
+++ hostapd/trunk/src/eap_peer/eap_gpsk.c Mon Mar 23 15:48:40 2009
@@ -1,5 +1,5 @@
 /*
- * EAP peer method: EAP-GPSK (draft-ietf-emu-eap-gpsk-08.txt)
+ * EAP peer method: EAP-GPSK (RFC 5433)
  * Copyright (c) 2006-2008, Jouni Malinen <j at w1.fi>
  *
  * This program is free software; you can redistribute it and/or modify

Modified: hostapd/trunk/src/eap_peer/eap_tnc.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/eap_peer/eap_tnc.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/eap_peer/eap_tnc.c (original)
+++ hostapd/trunk/src/eap_peer/eap_tnc.c Mon Mar 23 15:48:40 2009
@@ -295,7 +295,7 @@
 			wpa_printf(MSG_DEBUG, "EAP-TNC: Server did not use "
 				   "start flag in the first message");
 			ret->ignore = TRUE;
-			return NULL;
+			goto fail;
 		}
 
 		tncc_init_connection(data->tncc);
@@ -308,7 +308,7 @@
 			wpa_printf(MSG_DEBUG, "EAP-TNC: Server used start "
 				   "flag again");
 			ret->ignore = TRUE;
-			return NULL;
+			goto fail;
 		}
 
 		res = tncc_process_if_tnccs(data->tncc,
@@ -317,7 +317,7 @@
 		switch (res) {
 		case TNCCS_PROCESS_ERROR:
 			ret->ignore = TRUE;
-			return NULL;
+			goto fail;
 		case TNCCS_PROCESS_OK_NO_RECOMMENDATION:
 		case TNCCS_RECOMMENDATION_ERROR:
 			wpa_printf(MSG_DEBUG, "EAP-TNC: No "
@@ -404,6 +404,11 @@
 	data->out_buf = resp;
 	data->state = PROC_MSG;
 	return eap_tnc_build_msg(data, ret, id);
+
+fail:
+	if (data->in_buf == &tmpbuf)
+		data->in_buf = NULL;
+	return NULL;
 }
 
 

Modified: hostapd/trunk/src/eap_server/eap.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/eap_server/eap.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/eap_server/eap.c (original)
+++ hostapd/trunk/src/eap_server/eap.c Mon Mar 23 15:48:40 2009
@@ -573,6 +573,13 @@
 	}
 
 	sm->eap_if.eapSuccess = TRUE;
+
+	/*
+	 * Start reauthentication with identity request even though we know the
+	 * previously used identity. This is needed to get reauthentication
+	 * started properly.
+	 */
+	sm->start_reauth = TRUE;
 }
 
 
@@ -1070,7 +1077,7 @@
 
 static int eap_sm_Policy_getDecision(struct eap_sm *sm)
 {
-	if (!sm->eap_server && sm->identity) {
+	if (!sm->eap_server && sm->identity && !sm->start_reauth) {
 		wpa_printf(MSG_DEBUG, "EAP: getDecision: -> PASSTHROUGH");
 		return DECISION_PASSTHROUGH;
 	}
@@ -1091,7 +1098,8 @@
 		return DECISION_FAILURE;
 	}
 
-	if ((sm->user == NULL || sm->update_user) && sm->identity) {
+	if ((sm->user == NULL || sm->update_user) && sm->identity &&
+	    !sm->start_reauth) {
 		/*
 		 * Allow Identity method to be started once to allow identity
 		 * selection hint to be sent from the authentication server,
@@ -1118,6 +1126,7 @@
 		}
 		sm->update_user = FALSE;
 	}
+	sm->start_reauth = FALSE;
 
 	if (sm->user && sm->user_eap_method_index < EAP_MAX_METHODS &&
 	    (sm->user->methods[sm->user_eap_method_index].vendor !=

Modified: hostapd/trunk/src/eap_server/eap_gpsk.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/eap_server/eap_gpsk.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/eap_server/eap_gpsk.c (original)
+++ hostapd/trunk/src/eap_server/eap_gpsk.c Mon Mar 23 15:48:40 2009
@@ -1,5 +1,5 @@
 /*
- * hostapd / EAP-GPSK (draft-ietf-emu-eap-gpsk-08.txt) server
+ * hostapd / EAP-GPSK (RFC 5433) server
  * Copyright (c) 2006-2007, Jouni Malinen <j at w1.fi>
  *
  * This program is free software; you can redistribute it and/or modify

Modified: hostapd/trunk/src/eap_server/eap_i.h
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/eap_server/eap_i.h?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/eap_server/eap_i.h (original)
+++ hostapd/trunk/src/eap_server/eap_i.h Mon Mar 23 15:48:40 2009
@@ -183,6 +183,8 @@
 	int tnc;
 	struct wps_context *wps;
 	struct wpabuf *assoc_wps_ie;
+
+	Boolean start_reauth;
 };
 
 int eap_user_get(struct eap_sm *sm, const u8 *identity, size_t identity_len,

Modified: hostapd/trunk/src/eap_server/eap_tnc.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/eap_server/eap_tnc.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/eap_server/eap_tnc.c (original)
+++ hostapd/trunk/src/eap_server/eap_tnc.c Mon Mar 23 15:48:40 2009
@@ -500,7 +500,7 @@
 static Boolean eap_tnc_isDone(struct eap_sm *sm, void *priv)
 {
 	struct eap_tnc_data *data = priv;
-	return data->state == DONE;
+	return data->state == DONE || data->state == FAIL;
 }
 
 

Modified: hostapd/trunk/src/eap_server/eap_ttls.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/eap_server/eap_ttls.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/eap_server/eap_ttls.c (original)
+++ hostapd/trunk/src/eap_server/eap_ttls.c Mon Mar 23 15:48:40 2009
@@ -954,7 +954,7 @@
 	sm->init_phase2 = 1;
 	data->phase2_priv = data->phase2_method->init(sm);
 	sm->init_phase2 = 0;
-	return 0;
+	return data->phase2_priv == NULL ? -1 : 0;
 }
 
 
@@ -1045,6 +1045,11 @@
 		next_type = sm->user->methods[0].method;
 		sm->user_eap_method_index = 1;
 		wpa_printf(MSG_DEBUG, "EAP-TTLS: try EAP type %d", next_type);
+		if (eap_ttls_phase2_eap_init(sm, data, next_type)) {
+			wpa_printf(MSG_DEBUG, "EAP-TTLS: Failed to initialize "
+				   "EAP type %d", next_type);
+			eap_ttls_state(data, FAILURE);
+		}
 		break;
 	case PHASE2_METHOD:
 		if (data->ttls_version > 0) {
@@ -1065,12 +1070,6 @@
 		wpa_printf(MSG_DEBUG, "EAP-TTLS: %s - unexpected state %d",
 			   __func__, data->state);
 		break;
-	}
-
-	if (eap_ttls_phase2_eap_init(sm, data, next_type)) {
-		wpa_printf(MSG_DEBUG, "EAP-TTLS: Failed to initialize EAP "
-			   "type %d", next_type);
-		eap_ttls_state(data, FAILURE);
 	}
 }
 

Modified: hostapd/trunk/src/eapol_supp/eapol_supp_sm.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/eapol_supp/eapol_supp_sm.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/eapol_supp/eapol_supp_sm.c (original)
+++ hostapd/trunk/src/eapol_supp/eapol_supp_sm.c Mon Mar 23 15:48:40 2009
@@ -282,7 +282,12 @@
 		 * delay authentication. Use a short timeout to send the first
 		 * EAPOL-Start if Authenticator does not start authentication.
 		 */
+#ifdef CONFIG_WPS
+		/* Reduce latency on starting WPS negotiation. */
+		sm->startWhen = 1;
+#else /* CONFIG_WPS */
 		sm->startWhen = 3;
+#endif /* CONFIG_WPS */
 	}
 	eapol_enable_timer_tick(sm);
 	sm->eapolEap = FALSE;

Modified: hostapd/trunk/src/l2_packet/l2_packet_linux.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/l2_packet/l2_packet_linux.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/l2_packet/l2_packet_linux.c (original)
+++ hostapd/trunk/src/l2_packet/l2_packet_linux.c Mon Mar 23 15:48:40 2009
@@ -115,6 +115,7 @@
 		os_free(l2);
 		return NULL;
 	}
+	os_memset(&ifr, 0, sizeof(ifr));
 	os_strlcpy(ifr.ifr_name, l2->ifname, sizeof(ifr.ifr_name));
 	if (ioctl(l2->fd, SIOCGIFINDEX, &ifr) < 0) {
 		perror("ioctl[SIOCGIFINDEX]");

Modified: hostapd/trunk/src/rsn_supp/wpa.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/rsn_supp/wpa.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/rsn_supp/wpa.c (original)
+++ hostapd/trunk/src/rsn_supp/wpa.c Mon Mar 23 15:48:40 2009
@@ -1468,9 +1468,9 @@
 	key_info = WPA_GET_BE16(key->key_info);
 	ver = key_info & WPA_KEY_INFO_TYPE_MASK;
 	if (ver != WPA_KEY_INFO_TYPE_HMAC_MD5_RC4 &&
-#ifdef CONFIG_IEEE80211R
+#if defined(CONFIG_IEEE80211R) || defined(CONFIG_IEEE80211W)
 	    ver != WPA_KEY_INFO_TYPE_AES_128_CMAC &&
-#endif /* CONFIG_IEEE80211R */
+#endif /* CONFIG_IEEE80211R || CONFIG_IEEE80211W */
 	    ver != WPA_KEY_INFO_TYPE_HMAC_SHA1_AES) {
 		wpa_printf(MSG_INFO, "WPA: Unsupported EAPOL-Key descriptor "
 			   "version %d.", ver);

Modified: hostapd/trunk/src/tls/tlsv1_client.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/tls/tlsv1_client.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/tls/tlsv1_client.c (original)
+++ hostapd/trunk/src/tls/tlsv1_client.c Mon Mar 23 15:48:40 2009
@@ -620,6 +620,17 @@
 		suites[count++] = TLS_DH_anon_WITH_3DES_EDE_CBC_SHA;
 		suites[count++] = TLS_DH_anon_WITH_RC4_128_MD5;
 		suites[count++] = TLS_DH_anon_WITH_DES_CBC_SHA;
+
+		/*
+		 * Cisco AP (at least 350 and 1200 series) local authentication
+		 * server does not know how to search cipher suites from the
+		 * list and seem to require that the last entry in the list is
+		 * the one that it wants to use. However, TLS specification
+		 * requires the list to be in the client preference order. As a
+		 * workaround, ass anon-DH AES-128-SHA1 again at the end of the
+		 * list to allow the Cisco code to find it.
+		 */
+		suites[count++] = TLS_DH_anon_WITH_AES_128_CBC_SHA;
 		conn->num_cipher_suites = count;
 	}
 

Modified: hostapd/trunk/src/wps/wps.h
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/wps/wps.h?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/wps/wps.h (original)
+++ hostapd/trunk/src/wps/wps.h Mon Mar 23 15:48:40 2009
@@ -266,6 +266,11 @@
 	 * to be set with a suitable Credential and skip_cred_build being used.
 	 */
 	int disable_auto_conf;
+
+	/**
+	 * static_wep_only - Whether the BSS supports only static WEP
+	 */
+	int static_wep_only;
 };
 
 

Modified: hostapd/trunk/src/wps/wps_enrollee.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/wps/wps_enrollee.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/wps/wps_enrollee.c (original)
+++ hostapd/trunk/src/wps/wps_enrollee.c Mon Mar 23 15:48:40 2009
@@ -41,7 +41,7 @@
 		   state);
 	wpabuf_put_be16(msg, ATTR_WPS_STATE);
 	wpabuf_put_be16(msg, 1);
-	wpabuf_put_u8(msg, WPS_STATE_NOT_CONFIGURED);
+	wpabuf_put_u8(msg, state);
 	return 0;
 }
 

Modified: hostapd/trunk/src/wps/wps_registrar.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/wps/wps_registrar.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/wps/wps_registrar.c (original)
+++ hostapd/trunk/src/wps/wps_registrar.c Mon Mar 23 15:48:40 2009
@@ -98,6 +98,7 @@
 	int disable_auto_conf;
 	int sel_reg_dev_password_id_override;
 	int sel_reg_config_methods_override;
+	int static_wep_only;
 };
 
 
@@ -376,6 +377,7 @@
 	reg->disable_auto_conf = cfg->disable_auto_conf;
 	reg->sel_reg_dev_password_id_override = -1;
 	reg->sel_reg_config_methods_override = -1;
+	reg->static_wep_only = cfg->static_wep_only;
 
 	if (wps_set_ie(reg)) {
 		wps_registrar_deinit(reg);
@@ -775,6 +777,28 @@
 		wpabuf_free(beacon);
 		wpabuf_free(probe);
 		return -1;
+	}
+
+	if (reg->static_wep_only) {
+		/*
+		 * Windows XP and Vista clients can get confused about
+		 * EAP-Identity/Request when they probe the network with
+		 * EAPOL-Start. In such a case, they may assume the network is
+		 * using IEEE 802.1X and prompt user for a certificate while
+		 * the correct (non-WPS) behavior would be to ask for the
+		 * static WEP key. As a workaround, use Microsoft Provisioning
+		 * IE to advertise that legacy 802.1X is not supported.
+		 */
+		const u8 ms_wps[7] = {
+			WLAN_EID_VENDOR_SPECIFIC, 5,
+			/* Microsoft Provisioning IE (00:50:f2:5) */
+			0x00, 0x50, 0xf2, 5,
+			0x00 /* no legacy 802.1X or MS WPS */
+		};
+		wpa_printf(MSG_DEBUG, "WPS: Add Microsoft Provisioning IE "
+			   "into Beacon/Probe Response frames");
+		wpabuf_put_data(beacon, ms_wps, sizeof(ms_wps));
+		wpabuf_put_data(probe, ms_wps, sizeof(ms_wps));
 	}
 
 	ret = wps_cb_set_ie(reg, beacon, probe);
@@ -2401,7 +2425,6 @@
  * wps_registrar_set_selected_registrar - Notification of SetSelectedRegistrar
  * @reg: Registrar data from wps_registrar_init()
  * @msg: Received message from SetSelectedRegistrar
- * @msg_len: Length of msg in octets
  * Returns: 0 on success, -1 on failure
  *
  * This function is called when an AP receives a SetSelectedRegistrar UPnP

Modified: hostapd/trunk/src/wps/wps_upnp.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/wps/wps_upnp.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/wps/wps_upnp.c (original)
+++ hostapd/trunk/src/wps/wps_upnp.c Mon Mar 23 15:48:40 2009
@@ -832,6 +832,50 @@
 }
 
 
+#ifdef __FreeBSD__
+#include <sys/sysctl.h>
+#include <net/route.h>
+#include <net/if_dl.h>
+
+static int eth_get(const char *device, u8 ea[ETH_ALEN])
+{
+	struct if_msghdr *ifm;
+	struct sockaddr_dl *sdl;
+	u_char *p, *buf;
+	size_t len;
+	int mib[] = { CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0 };
+
+	if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0)
+		return -1;
+	if ((buf = os_malloc(len)) == NULL)
+		return -1;
+	if (sysctl(mib, 6, buf, &len, NULL, 0) < 0) {
+		os_free(buf);
+		return -1;
+	}
+	for (p = buf; p < buf + len; p += ifm->ifm_msglen) {
+		ifm = (struct if_msghdr *)p;
+		sdl = (struct sockaddr_dl *)(ifm + 1);
+		if (ifm->ifm_type != RTM_IFINFO ||
+		    (ifm->ifm_addrs & RTA_IFP) == 0)
+			continue;
+		if (sdl->sdl_family != AF_LINK || sdl->sdl_nlen == 0 ||
+		    os_memcmp(sdl->sdl_data, device, sdl->sdl_nlen) != 0)
+			continue;
+		os_memcpy(ea, LLADDR(sdl), sdl->sdl_alen);
+		break;
+	}
+	os_free(buf);
+
+	if (p >= buf + len) {
+		errno = ESRCH;
+		return -1;
+	}
+	return 0;
+}
+#endif /* __FreeBSD__ */
+
+
 /**
  * get_netif_info - Get hw and IP addresses for network device
  * @net_if: Selected network interface name
@@ -870,6 +914,7 @@
 	in_addr.s_addr = *ip_addr;
 	os_snprintf(*ip_addr_text, 16, "%s", inet_ntoa(in_addr));
 
+#ifdef __linux__
 	os_strlcpy(req.ifr_name, net_if, sizeof(req.ifr_name));
 	if (ioctl(sock, SIOCGIFHWADDR, &req) < 0) {
 		wpa_printf(MSG_ERROR, "WPS UPnP: SIOCGIFHWADDR failed: "
@@ -877,6 +922,14 @@
 		goto fail;
 	}
 	os_memcpy(mac, req.ifr_addr.sa_data, 6);
+#elif defined(__FreeBSD__)
+	if (eth_get(net_if, mac) < 0) {
+		wpa_printf(MSG_ERROR, "WPS UPnP: Failed to get MAC address");
+		goto fail;
+	}
+#else
+#error MAC address fetch not implemented
+#endif
 	os_snprintf(*mac_addr_text, 18, MACSTR, MAC2STR(req.ifr_addr.sa_data));
 
 	close(sock);

Modified: hostapd/trunk/src/wps/wps_upnp_ssdp.c
URL: http://svn.debian.org/wsvn/pkg-wpa/hostapd/trunk/src/wps/wps_upnp_ssdp.c?rev=1344&op=diff
==============================================================================
--- hostapd/trunk/src/wps/wps_upnp_ssdp.c (original)
+++ hostapd/trunk/src/wps/wps_upnp_ssdp.c Mon Mar 23 15:48:40 2009
@@ -784,6 +784,7 @@
  */
 int add_ssdp_network(char *net_if)
 {
+#ifdef __linux__
 	int ret = -1;
 	int sock = -1;
 	struct rtentry rt;
@@ -826,6 +827,9 @@
 		close(sock);
 
 	return ret;
+#else /* __linux__ */
+	return 0;
+#endif /* __linux__ */
 }
 
 




More information about the Pkg-wpa-devel mailing list