diff --git a/hostapd/Makefile b/hostapd/Makefile index ad4ad0578..9d9acec17 100644 --- a/hostapd/Makefile +++ b/hostapd/Makefile @@ -39,6 +39,7 @@ OBJS = hostapd.o main.o ieee802_1x.o \ drv_callbacks.o \ tkip_countermeasures.o \ mlme.o wpa_auth_ie.o +OBJS += ap_drv_ops.o NEED_RC4=y NEED_AES=y NEED_MD5=y diff --git a/hostapd/ap_drv_ops.c b/hostapd/ap_drv_ops.c new file mode 100644 index 000000000..6fba78bee --- /dev/null +++ b/hostapd/ap_drv_ops.c @@ -0,0 +1,39 @@ +/* + * hostapd - Driver operations + * Copyright (c) 2009, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#include "includes.h" + +#include "common.h" +#include "hostapd.h" +#include "driver_i.h" + + +static int hostapd_set_ap_wps_ie(struct hostapd_data *hapd, + const u8 *beacon_ie, size_t beacon_ie_len, + const u8 *probe_resp_ie, + size_t probe_resp_ie_len) +{ + if (hostapd_set_wps_beacon_ie(hapd, hapd->wps_beacon_ie, + hapd->wps_beacon_ie_len) < 0 || + hostapd_set_wps_probe_resp_ie(hapd, hapd->wps_probe_resp_ie, + hapd->wps_probe_resp_ie_len) < 0) + return -1; + return 0; +} + + +void hostapd_set_driver_ops(struct hostapd_driver_ops *ops) +{ + ops->set_ap_wps_ie = hostapd_set_ap_wps_ie; +} diff --git a/hostapd/hostapd.c b/hostapd/hostapd.c index f3d1e4cb6..57154e07b 100644 --- a/hostapd/hostapd.c +++ b/hostapd/hostapd.c @@ -1384,6 +1384,7 @@ hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, if (hapd == NULL) return NULL; + hostapd_set_driver_ops(&hapd->drv); hapd->iconf = conf; hapd->conf = bss; hapd->iface = hapd_iface; diff --git a/hostapd/hostapd.h b/hostapd/hostapd.h index c9ee3ddc5..63f45c15c 100644 --- a/hostapd/hostapd.h +++ b/hostapd/hostapd.h @@ -22,6 +22,7 @@ struct wpa_ctrl_dst; struct radius_server_data; struct upnp_wps_device_sm; struct hapd_interfaces; +struct hostapd_data; #ifdef CONFIG_FULL_DYNAMIC_VLAN struct full_dynamic_vlan; @@ -40,6 +41,13 @@ struct hostapd_rate_data { }; +struct hostapd_driver_ops { + int (*set_ap_wps_ie)(struct hostapd_data *hapd, + const u8 *beacon_ie, size_t beacon_ie_len, + const u8 *probe_resp_ie, + size_t probe_resp_ie_len); +}; + /** * struct hostapd_data - hostapd per-BSS data structure */ @@ -67,6 +75,7 @@ struct hostapd_data { const struct wpa_driver_ops *driver; void *drv_priv; + struct hostapd_driver_ops drv; void *msg_ctx; /* ctx for wpa_msg() calls */ @@ -195,5 +204,6 @@ int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname, int hostapd_sta_flags_to_drv(int flags); int eap_server_register_methods(void); +void hostapd_set_driver_ops(struct hostapd_driver_ops *ops); #endif /* HOSTAPD_H */ diff --git a/hostapd/wps_hostapd.c b/hostapd/wps_hostapd.c index 4cb980d66..a00b8ef28 100644 --- a/hostapd/wps_hostapd.c +++ b/hostapd/wps_hostapd.c @@ -27,7 +27,7 @@ #include "wps/wps_defs.h" #include "wps/wps_dev_attr.h" #include "hostapd.h" -#include "driver_i.h" +#include "config.h" #include "sta_info.h" #include "wps_hostapd.h" @@ -109,8 +109,6 @@ static int hostapd_wps_set_ie_cb(void *ctx, const u8 *beacon_ie, os_memcpy(hapd->wps_beacon_ie, beacon_ie, beacon_ie_len); hapd->wps_beacon_ie_len = beacon_ie_len; } - hostapd_set_wps_beacon_ie(hapd, hapd->wps_beacon_ie, - hapd->wps_beacon_ie_len); os_free(hapd->wps_probe_resp_ie); if (probe_resp_ie_len == 0) { @@ -126,8 +124,10 @@ static int hostapd_wps_set_ie_cb(void *ctx, const u8 *beacon_ie, probe_resp_ie_len); hapd->wps_probe_resp_ie_len = probe_resp_ie_len; } - hostapd_set_wps_probe_resp_ie(hapd, hapd->wps_probe_resp_ie, - hapd->wps_probe_resp_ie_len); + hapd->drv.set_ap_wps_ie(hapd, hapd->wps_beacon_ie, + hapd->wps_beacon_ie_len, + hapd->wps_probe_resp_ie, + hapd->wps_probe_resp_ie_len); return 0; } @@ -480,12 +480,12 @@ static void hostapd_wps_clear_ies(struct hostapd_data *hapd) os_free(hapd->wps_beacon_ie); hapd->wps_beacon_ie = NULL; hapd->wps_beacon_ie_len = 0; - hostapd_set_wps_beacon_ie(hapd, NULL, 0); os_free(hapd->wps_probe_resp_ie); hapd->wps_probe_resp_ie = NULL; hapd->wps_probe_resp_ie_len = 0; - hostapd_set_wps_probe_resp_ie(hapd, NULL, 0); + + hapd->drv.set_ap_wps_ie(hapd, NULL, 0, NULL, 0); } diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile index f2c314803..725d51f3c 100644 --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -597,6 +597,7 @@ OBJS += ../hostapd/ieee802_1x.o OBJS += ../src/eapol_auth/eapol_auth_sm.o OBJS += ../hostapd/ieee802_11_auth.o OBJS += ../hostapd/drv_callbacks.o +OBJS += ../hostapd/ap_drv_ops.o ifdef CONFIG_CTRL_IFACE OBJS += ../hostapd/ctrl_iface_ap.o endif