update to 0.6.8

Reviewed by:	thompsa
This commit is contained in:
Sam Leffler 2009-03-02 02:28:22 +00:00
parent 2aef0ff7d9
commit 7a77de1cac
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=189263
8 changed files with 107 additions and 96 deletions

View File

@ -1,3 +1,27 @@
# $FreeBSD$
BINDIR?= /usr/sbin
WPA_DISTDIR?= ${.CURDIR}/../../../contrib/wpa/
WPA_SUPPLICANT_DISTDIR?=${WPA_DISTDIR}/wpa_supplicant
HOSTAPD_DISTDIR?= ${WPA_DISTDIR}/hostapd
.PATH.c:${.CURDIR}/.. \
${WPA_DISTDIR}/src/common \
${WPA_DISTDIR}/src/crypto \
${WPA_DISTDIR}/src/eap_common \
${WPA_DISTDIR}/src/eapol_supp \
${WPA_DISTDIR}/src/l2_packet \
${WPA_DISTDIR}/src/utils
CFLAGS+=-I${.CURDIR}
CFLAGS+=-I${WPA_DISTDIR}/src
CFLAGS+=-I${WPA_DISTDIR}/src/common
CFLAGS+=-I${WPA_DISTDIR}/src/crypto
CFLAGS+=-I${WPA_DISTDIR}/src/l2_packet
CFLAGS+=-I${WPA_DISTDIR}/src/utils
CFLAGS+= -DCONFIG_CTRL_IFACE
CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX
.include <bsd.own.mk>

View File

@ -1,30 +1,32 @@
# $FreeBSD$
.include <bsd.own.mk>
.include "${.CURDIR}/../Makefile.inc"
HOSTAPD_DISTDIR?= ${.CURDIR}/../../../contrib/hostapd
.PATH: ${.CURDIR}/.. ${HOSTAPD_DISTDIR}
.PATH.c:${HOSTAPD_DISTDIR} \
${WPA_DISTDIR}/src/eap_server \
${WPA_DISTDIR}/src/radius \
PROG= hostapd
SRCS= hostapd.c eloop.c ieee802_1x.c eapol_sm.c radius.c md5.c rc4.c \
common.c ieee802_11.c config.c ieee802_11_auth.c accounting.c \
sta_info.c radius_client.c sha1.c wpa.c aes_wrap.c ctrl_iface.c \
driver_conf.c os_unix.c preauth.c pmksa_cache.c beacon.c \
hw_features.c wme.c ap_list.c reconfig.c mlme.c \
vlan_init.c ieee802_11h.c l2_packet.c driver_freebsd.c
CLEANFILES=driver_conf.c
SRCS= accounting.c aes.c aes_wrap.c ap_list.c beacon.c common.c \
config.c ctrl_iface.c drivers.c eapol_sm.c eap.c eap_common.c \
eap_identity.c eap_methods.c eloop.c hostapd.c \
hw_features.c ieee802_11.c ieee802_11_common.c ieee802_11_auth.c \
ieee802_1x.c ip_addr.c md5.c mlme.c pmksa_cache.c radius.c \
radius_client.c rc4.c sha1.c sta_info.c vlan_init.c wme.c \
wpa.c wpa_auth_ie.c wpa_common.c wpa_debug.c wpabuf.c
SRCS+= l2_packet.c driver_freebsd.c os_unix.c
MAN= hostapd.8 hostapd.conf.5
.if ${MK_EXAMPLES} != "no"
FILESDIR= ${SHAREDIR}/examples/hostapd
.PATH: ${HOSTAPD_DISTDIR}
FILES= hostapd.conf hostapd.eap_user hostapd.wpa_psk
.endif
CFLAGS+= -I${.CURDIR} -I${HOSTAPD_DISTDIR}
CFLAGS+= -I${HOSTAPD_DISTDIR}
CFLAGS+= -DCONFIG_DRIVER_BSD
CFLAGS+= -DCONFIG_CTRL_IFACE
CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX
CFLAGS+= -DCONFIG_DRIVER_RADIUS_ACL
.if ${MK_INET6} != "no"
CFLAGS+= -DCONFIG_IPV6
@ -34,21 +36,22 @@ DPADD+= ${LIBPCAP}
LDADD+= -lpcap
# User customizations for wpa_supplicant/hostapd build environment
CFLAGS+=${WPA_SUPPLICANT_CFLAGS}
#DPADD+=${WPA_SUPPLICANT_DPADD}
LDADD+=${WPA_SUPPLICANT_LDADD}
#LDFLAGS+=${WPA_SUPPLICANT_LDFLAGS}
CFLAGS+=${HOSTAPD_CFLAGS}
#DPADD+=${HOSTAPD_DPADD}
LDADD+=${HOSTAPD_LDADD}
#LDFLAGS+=${HOSTAPD_LDFLAGS}
.if !empty(CFLAGS:M*-DEAP_SERVER)
SRCS+= eap.c eap_methods.c eap_identity.c
#SRCS+= eap.c eap_methods.c eap_identity.c
.if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH)
CFLAGS+=-DEAP_TLS -DEAP_PEAP -DEAP_MSCHAPv2 -DEAP_PSK \
-DEAP_TLV -DEAP_TLS_FUNCS -DEAP_TLS_OPENSSL
SRCS+= eap_tls.c eap_peap.c eap_mschapv2.c \
-DEAP_TLS_FUNCS -DEAP_TLS_OPENSSL
SRCS+= crypto_openssl.c
SRCS+= eap_tls.c eap_peap.c eap_peap_common.c eap_mschapv2.c \
eap_psk.c eap_psk_common.c \
eap_tlv.c eap_tls_common.c tls_openssl.c ms_funcs.c crypto.c
eap_tls_common.c tls_openssl.c ms_funcs.c chap.c
CFLAGS+=-DEAP_TTLS -DEAP_MD5
SRCS+= eap_ttls.c eap_md5.c
@ -108,19 +111,4 @@ CFLAGS+= -DINTERNAL_MD5
SRCS+= tls_none.c
.endif
driver_conf.c: Makefile
rm -f driver_conf.c
echo '/* THIS FILE AUTOMATICALLY GENERATED, DO NOT EDIT! */' \
> driver_conf.c
echo '#include <stdlib.h>' >> driver_conf.c
echo '#include <stdio.h>' >> driver_conf.c
echo '#include <sys/types.h>' >> driver_conf.c
echo '#include <netinet/in.h>' >> driver_conf.c
echo '#include "hostapd.h"' >> driver_conf.c
echo '#include "driver.h"' >> driver_conf.c
echo "void bsd_driver_register(void);" >> driver_conf.c
echo 'void register_drivers(void) {' >> driver_conf.c
echo "bsd_driver_register();" >> driver_conf.c
echo '}' >> driver_conf.c
.include <bsd.prog.mk>

View File

@ -27,23 +27,27 @@
#include <net80211/ieee80211_ioctl.h>
#undef RSN_VERSION
#undef WPA_VERSION
#undef WPA_OUI_TYPE
#undef WME_OUI_TYPE
#include "hostapd.h"
#include "driver.h"
#include "ieee802_1x.h"
#include "ieee802_11_auth.h"
#include "eloop.h"
#include "sta_info.h"
#include "l2_packet.h"
#include "l2_packet/l2_packet.h"
#include "eapol_sm.h"
#include "wpa.h"
#include "radius.h"
#include "radius/radius.h"
#include "ieee802_11.h"
#include "common.h"
#include "hostap_common.h"
struct bsd_driver_data {
struct driver_ops ops; /* base class */
struct hostapd_data *hapd; /* back pointer */
char iface[IFNAMSIZ + 1];
@ -53,7 +57,7 @@ struct bsd_driver_data {
int wext_sock; /* socket for wireless events */
};
static const struct driver_ops bsd_driver_ops;
static const struct wpa_driver_ops bsd_driver_ops;
static int bsd_sta_deauth(void *priv, const u8 *addr, int reason_code);
@ -129,7 +133,7 @@ bsd_set_iface_flags(void *priv, int flags)
struct hostapd_data *hapd = drv->hapd;
struct ifreq ifr;
HOSTAPD_DEBUG(HOSTAPD_DEBUG_VERBOSE, "%s: flags=0x%x\n", __func__, flags);
wpa_printf(MSG_DEBUG, "%s: flags=0x%x\n", __func__, flags);
if (drv->ioctl_sock < 0)
return -1;
@ -185,8 +189,7 @@ bsd_set_ieee8021x(const char *ifname, void *priv, int enabled)
struct hostapd_data *hapd = drv->hapd;
struct hostapd_bss_config *conf = hapd->conf;
HOSTAPD_DEBUG(HOSTAPD_DEBUG_VERBOSE,
"%s: enabled=%d\n", __func__, enabled);
wpa_printf(MSG_DEBUG, "%s: enabled=%d\n", __func__, enabled);
if (!enabled) {
/* XXX restore state */
@ -218,8 +221,7 @@ bsd_set_privacy(const char *ifname, void *priv, int enabled)
struct bsd_driver_data *drv = priv;
struct hostapd_data *hapd = drv->hapd;
HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL,
"%s: enabled=%d\n", __func__, enabled);
wpa_printf(MSG_DEBUG, "%s: enabled=%d\n", __func__, enabled);
return set80211param(priv, IEEE80211_IOC_PRIVACY, enabled);
}
@ -231,8 +233,7 @@ bsd_set_sta_authorized(void *priv, const u8 *addr, int authorized)
struct hostapd_data *hapd = drv->hapd;
struct ieee80211req_mlme mlme;
HOSTAPD_DEBUG(HOSTAPD_DEBUG_VERBOSE,
"%s: addr=%s authorized=%d\n",
wpa_printf(MSG_DEBUG, "%s: addr=%s authorized=%d\n",
__func__, ether_sprintf(addr), authorized);
if (authorized)
@ -245,7 +246,8 @@ bsd_set_sta_authorized(void *priv, const u8 *addr, int authorized)
}
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)
@ -262,8 +264,7 @@ bsd_del_key(void *priv, const unsigned char *addr, int key_idx)
struct hostapd_data *hapd = drv->hapd;
struct ieee80211req_del_key wk;
HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL,
"%s: addr=%s key_idx=%d\n",
wpa_printf(MSG_DEBUG, "%s: addr=%s key_idx=%d\n",
__func__, ether_sprintf(addr), key_idx);
memset(&wk, 0, sizeof(wk));
@ -290,8 +291,7 @@ bsd_set_key(const char *ifname, void *priv, const char *alg,
if (strcmp(alg, "none") == 0)
return bsd_del_key(priv, addr, key_idx);
HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL,
"%s: alg=%s addr=%s key_idx=%d\n",
wpa_printf(MSG_DEBUG, "%s: alg=%s addr=%s key_idx=%d\n",
__func__, alg, ether_sprintf(addr), key_idx);
if (strcmp(alg, "WEP") == 0)
@ -339,8 +339,8 @@ bsd_get_seqnum(const char *ifname, void *priv, const u8 *addr, int idx,
struct hostapd_data *hapd = drv->hapd;
struct ieee80211req_key wk;
HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL,
"%s: addr=%s idx=%d\n", __func__, ether_sprintf(addr), idx);
wpa_printf(MSG_DEBUG, "%s: addr=%s idx=%d\n",
__func__, ether_sprintf(addr), idx);
memset(&wk, 0, sizeof(wk));
if (addr == NULL)
@ -396,8 +396,7 @@ bsd_sta_clear_stats(void *priv, const u8 *addr)
struct hostapd_data *hapd = drv->hapd;
struct ieee80211req_sta_stats stats;
HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, "%s: addr=%s\n",
__func__, ether_sprintf(addr));
wpa_printf(MSG_DEBUG, "%s: addr=%s\n", __func__, ether_sprintf(addr));
/* zero station statistics */
memset(&stats, 0, sizeof(stats));
@ -419,7 +418,7 @@ bsd_set_opt_ie(const char *ifname, void *priv, const u8 *ie, size_t ie_len)
ireq.i_data = (void *) ie;
ireq.i_len = ie_len;
HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, "%s: set WPA+RSN ie (len %d)\n",
wpa_printf(MSG_DEBUG, "%s: set WPA+RSN ie (len %d)\n",
__func__, ie_len);
if (ioctl(drv->ioctl_sock, SIOCS80211, &ireq) < 0) {
printf("Unable to set WPA+RSN ie\n");
@ -435,8 +434,7 @@ bsd_sta_deauth(void *priv, const u8 *addr, int reason_code)
struct hostapd_data *hapd = drv->hapd;
struct ieee80211req_mlme mlme;
HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL,
"%s: addr=%s reason_code=%d\n",
wpa_printf(MSG_DEBUG, "%s: addr=%s reason_code=%d\n",
__func__, ether_sprintf(addr), reason_code);
mlme.im_op = IEEE80211_MLME_DEAUTH;
@ -452,8 +450,7 @@ bsd_sta_disassoc(void *priv, const u8 *addr, int reason_code)
struct hostapd_data *hapd = drv->hapd;
struct ieee80211req_mlme mlme;
HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL,
"%s: addr=%s reason_code=%d\n",
wpa_printf(MSG_DEBUG, "%s: addr=%s reason_code=%d\n",
__func__, ether_sprintf(addr), reason_code);
mlme.im_reason = reason_code;
@ -521,7 +518,7 @@ bsd_new_sta(struct bsd_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
}
ielen = 2 + ie.wpa_ie[1];
res = wpa_validate_wpa_ie(hapd->wpa_auth, sta->wpa_sm,
ie.wpa_ie, ielen);
ie.wpa_ie, ielen, NULL, 0);
if (res != WPA_IE_OK) {
printf("WPA/RSN information element rejected? "
"(res %u)\n", res);
@ -742,8 +739,7 @@ bsd_get_ssid(const char *ifname, void *priv, u8 *buf, int len)
struct hostapd_data *hapd = drv->hapd;
int ssid_len = get80211var(priv, IEEE80211_IOC_SSID, buf, len);
HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, "%s: ssid=\"%.*s\"\n",
__func__, ssid_len, buf);
wpa_printf(MSG_DEBUG, "%s: ssid=\"%.*s\"\n", __func__, ssid_len, buf);
return ssid_len;
}
@ -754,8 +750,7 @@ bsd_set_ssid(const char *ifname, void *priv, const u8 *buf, int len)
struct bsd_driver_data *drv = priv;
struct hostapd_data *hapd = drv->hapd;
HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, "%s: ssid=\"%.*s\"\n",
__func__, len, buf);
wpa_printf(MSG_DEBUG, "%s: ssid=\"%.*s\"\n", __func__, len, buf);
return set80211var(priv, IEEE80211_IOC_SSID, buf, len);
}
@ -830,7 +825,7 @@ bsd_set_radius_acl_expire(void *priv, const u8 *mac)
}
#endif /* CONFIG_DRIVER_RADIUS_ACL */
static int
static void *
bsd_init(struct hostapd_data *hapd)
{
struct bsd_driver_data *drv;
@ -842,7 +837,6 @@ bsd_init(struct hostapd_data *hapd)
}
memset(drv, 0, sizeof(*drv));
drv->ops = bsd_driver_ops;
drv->hapd = hapd;
drv->ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0);
if (drv->ioctl_sock < 0) {
@ -872,8 +866,7 @@ bsd_init(struct hostapd_data *hapd)
bsd_set_iface_flags(drv, -IFF_UP); /* mark down during setup */
hapd->driver = &drv->ops;
return 0;
return drv;
bad:
if (drv != NULL) {
if (drv->sock_xmit != NULL)
@ -882,7 +875,7 @@ bsd_init(struct hostapd_data *hapd)
close(drv->ioctl_sock);
free(drv);
}
return -1;
return NULL;
}
@ -891,8 +884,6 @@ bsd_deinit(void *priv)
{
struct bsd_driver_data *drv = priv;
drv->hapd->driver = NULL;
(void) bsd_set_iface_flags(drv, -IFF_UP);
if (drv->ioctl_sock >= 0)
close(drv->ioctl_sock);
@ -901,7 +892,7 @@ bsd_deinit(void *priv)
free(drv);
}
static const struct driver_ops bsd_driver_ops = {
const struct wpa_driver_ops wpa_driver_bsd_ops = {
.name = "bsd",
.init = bsd_init,
.deinit = bsd_deinit,
@ -928,8 +919,3 @@ static const struct driver_ops bsd_driver_ops = {
.set_radius_acl_expire = bsd_set_radius_acl_expire,
#endif
};
void bsd_driver_register(void)
{
driver_register(bsd_driver_ops.name, &bsd_driver_ops);
}

View File

@ -7,7 +7,7 @@ WPA_SUPPLICANT_DISTDIR?= ${CONTRIB}/wpa_supplicant
.PATH: ${HOSTAPD_DISTDIR} ${WPA_SUPPLICANT_DISTDIR}
PROG= hostapd_cli
SRCS= hostapd_cli.c wpa_ctrl.c
SRCS= hostapd_cli.c wpa_ctrl.c os_unix.c
CFLAGS+= -DCONFIG_CTRL_IFACE
CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX

View File

@ -11,4 +11,8 @@ MAN= wpa_cli.8
CFLAGS+= -DCONFIG_CTRL_IFACE
CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX
#CFLAGS+= -DCONFIG_READLINE
#LDADD+= -ledit -ltermcap
#DPADD+= ${LIBEDIT} ${LIBTERMCAP}
.include <bsd.prog.mk>

View File

@ -1,14 +1,18 @@
# $FreeBSD$
.include <bsd.own.mk>
.include "${.CURDIR}/../Makefile.inc"
WPA_SUPPLICANT_DISTDIR?= ${.CURDIR}/../../../contrib/wpa_supplicant
.PATH: ${.CURDIR}/.. ${WPA_SUPPLICANT_DISTDIR}
.PATH.c:${WPA_SUPPLICANT_DISTDIR} \
${WPA_DISTDIR}/src/drivers \
${WPA_DISTDIR}/src/eap_peer \
${WPA_DISTDIR}/src/rsn_supp
PROG= wpa_supplicant
SRCS= config.c eloop.c common.c md5.c rc4.c sha1.c aes_wrap.c \
wpa_supplicant.c events.c wpa.c preauth.c pmksa_cache.c \
ctrl_iface.c ctrl_iface_unix.c l2_packet.c main.c drivers.c \
SRCS= aes.c aes_wrap.c blacklist.c common.c config.c ctrl_iface.c \
ctrl_iface_unix.c drivers.c eloop.c events.c l2_packet.c main.c \
md5.c preauth.c pmksa_cache.c rc4.c scan.c scan_helpers.c sha1.c \
wpa.c wpa_common.c wpa_debug.c wpa_ie.c wpa_supplicant.c \
wpabuf.c wpas_glue.c \
driver_ndis.c Packet32.c \
driver_wired.c \
driver_freebsd.c os_unix.c
@ -17,15 +21,17 @@ MAN= wpa_supplicant.8 wpa_supplicant.conf.5
.if ${MK_EXAMPLES} != "no"
FILESDIR= ${SHAREDIR}/examples/etc
.PATH: ${WPA_SUPPLICANT_DISTDIR}
FILES= wpa_supplicant.conf
.endif
CFLAGS+= -I${.CURDIR} -I${WPA_SUPPLICANT_DISTDIR}
CFLAGS+=-I${WPA_SUPPLICANT_DISTDIR}
CFLAGS+=-I${WPA_DISTDIR}/src/drivers
CFLAGS+=-I${WPA_DISTDIR}/src/rsn_supp
CFLAGS+= -DCONFIG_DRIVER_BSD
CFLAGS+= -DCONFIG_DRIVER_NDIS
CFLAGS+= -DCONFIG_DRIVER_WIRED
CFLAGS+= -DCONFIG_CTRL_IFACE
CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX
CFLAGS+= -DCONFIG_TERMINATE_ONLASTIF
CFLAGS+= -DCONFIG_DEBUG_SYSLOG
CFLAGS+= -g
@ -43,15 +49,19 @@ LDADD+=${WPA_SUPPLICANT_LDADD}
#LDFLAGS+=${WPA_SUPPLICANT_LDFLAGS}
.if ${MK_WPA_SUPPLICANT_EAPOL} != "no"
SRCS+= eapol_sm.c eap.c eap_methods.c
SRCS+= eapol_supp_sm.c eap.c eap_common.c eap_methods.c
CFLAGS+= -DIEEE8021X_EAPOL
.if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH)
CFLAGS+=-DEAP_TLS -DEAP_PEAP -DEAP_MSCHAPv2 -DEAP_LEAP -DEAP_PSK \
-DEAP_TLV -DEAP_TLS_FUNCS -DEAP_TLS_OPENSSL
SRCS+= eap_tls.c eap_peap.c eap_mschapv2.c eap_leap.c \
SRCS+= chap.c crypto_openssl.c \
eap_leap.c \
eap_mschapv2.c \
eap_peap.c eap_peap_common.c \
eap_psk.c eap_psk_common.c \
eap_tlv.c eap_tls_common.c tls_openssl.c ms_funcs.c crypto.c
eap_tls.c eap_tls_common.c \
mschapv2.c ms_funcs.c tls_openssl.c
CFLAGS+=-DEAP_TTLS -DEAP_MD5
SRCS+= eap_ttls.c eap_md5.c

View File

@ -24,9 +24,8 @@
#include "common.h"
#include "driver.h"
#include "eloop.h"
#include "wpa_supplicant.h"
#include "l2_packet.h"
#include "wpa.h" /* XXX for RSN_INFO_ELEM */
#include "ieee802_11_defs.h"
#include <sys/socket.h>
#include <net/if.h>
@ -424,7 +423,7 @@ wpa_driver_bsd_associate(void *priv, struct wpa_driver_associate_params *params)
if (params->wpa_ie_len &&
set80211param(drv, IEEE80211_IOC_WPA,
params->wpa_ie[0] == RSN_INFO_ELEM ? 2 : 1) < 0)
params->wpa_ie[0] == WLAN_EID_RSN ? 2 : 1) < 0)
return -1;
memset(&mlme, 0, sizeof(mlme));

View File

@ -21,7 +21,7 @@
#include "common.h"
#include "driver.h"
#include "wpa_supplicant.h"
#include "wpa.h"
static const u8 pae_group_addr[ETH_ALEN] =
{ 0x01, 0x80, 0xc2, 0x00, 0x00, 0x03 };