2 * WPA Supplicant - Basic AP mode support routines
3 * Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi>
4 * Copyright (c) 2009, Atheros Communications
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * Alternatively, this software may be distributed under the terms of BSD
13 * See README and COPYING for more details.
16 #include "utils/includes.h"
18 #include "utils/common.h"
19 #include "common/ieee802_11_defs.h"
20 #include "common/wpa_ctrl.h"
21 #include "ap/hostapd.h"
22 #include "ap/ap_config.h"
24 #include "ap/ieee802_11.h"
25 #endif /* NEED_AP_MLME */
26 #include "ap/beacon.h"
27 #include "ap/ieee802_1x.h"
28 #include "ap/wps_hostapd.h"
29 #include "ap/ctrl_iface_ap.h"
30 #include "eap_common/eap_defs.h"
31 #include "eap_server/eap_methods.h"
32 #include "eap_common/eap_wsc_common.h"
34 #include "common/ieee802_11_defs.h"
35 #include "config_ssid.h"
37 #include "wpa_supplicant_i.h"
39 #include "p2p_supplicant.h"
41 #include "ap/sta_info.h"
44 static int wpa_supplicant_conf_ap(struct wpa_supplicant
*wpa_s
,
45 struct wpa_ssid
*ssid
,
46 struct hostapd_config
*conf
)
48 struct hostapd_bss_config
*bss
= &conf
->bss
[0];
51 conf
->driver
= wpa_s
->driver
;
53 os_strlcpy(bss
->iface
, wpa_s
->ifname
, sizeof(bss
->iface
));
55 if (ssid
->frequency
== 0) {
56 /* default channel 11 */
57 conf
->hw_mode
= HOSTAPD_MODE_IEEE80211G
;
59 } else if (ssid
->frequency
>= 2412 && ssid
->frequency
<= 2472) {
60 conf
->hw_mode
= HOSTAPD_MODE_IEEE80211G
;
61 conf
->channel
= (ssid
->frequency
- 2407) / 5;
62 } else if ((ssid
->frequency
>= 5180 && ssid
->frequency
<= 5240) ||
63 (ssid
->frequency
>= 5745 && ssid
->frequency
<= 5825)) {
64 conf
->hw_mode
= HOSTAPD_MODE_IEEE80211A
;
65 conf
->channel
= (ssid
->frequency
- 5000) / 5;
67 wpa_printf(MSG_ERROR
, "Unsupported AP mode frequency: %d MHz",
72 /* TODO: enable HT if driver supports it;
73 * drop to 11b if driver does not support 11g */
76 if (conf
->hw_mode
== HOSTAPD_MODE_IEEE80211G
) {
77 /* Remove 802.11b rates from supported and basic rate sets */
78 int *list
= os_malloc(4 * sizeof(int));
85 conf
->basic_rates
= list
;
87 list
= os_malloc(9 * sizeof(int));
99 conf
->supported_rates
= list
;
101 #endif /* CONFIG_P2P */
103 if (ssid
->ssid_len
== 0) {
104 wpa_printf(MSG_ERROR
, "No SSID configured for AP mode");
107 os_memcpy(bss
->ssid
.ssid
, ssid
->ssid
, ssid
->ssid_len
);
108 bss
->ssid
.ssid
[ssid
->ssid_len
] = '\0';
109 bss
->ssid
.ssid_len
= ssid
->ssid_len
;
110 bss
->ssid
.ssid_set
= 1;
112 if (wpa_key_mgmt_wpa_psk(ssid
->key_mgmt
))
113 bss
->wpa
= ssid
->proto
;
114 bss
->wpa_key_mgmt
= ssid
->key_mgmt
;
115 bss
->wpa_pairwise
= ssid
->pairwise_cipher
;
116 if (ssid
->passphrase
) {
117 bss
->ssid
.wpa_passphrase
= os_strdup(ssid
->passphrase
);
118 } else if (ssid
->psk_set
) {
119 os_free(bss
->ssid
.wpa_psk
);
120 bss
->ssid
.wpa_psk
= os_zalloc(sizeof(struct hostapd_wpa_psk
));
121 if (bss
->ssid
.wpa_psk
== NULL
)
123 os_memcpy(bss
->ssid
.wpa_psk
->psk
, ssid
->psk
, PMK_LEN
);
124 bss
->ssid
.wpa_psk
->group
= 1;
127 /* Select group cipher based on the enabled pairwise cipher suites */
130 pairwise
|= bss
->wpa_pairwise
;
132 if (bss
->rsn_pairwise
== 0)
133 bss
->rsn_pairwise
= bss
->wpa_pairwise
;
134 pairwise
|= bss
->rsn_pairwise
;
136 if (pairwise
& WPA_CIPHER_TKIP
)
137 bss
->wpa_group
= WPA_CIPHER_TKIP
;
139 bss
->wpa_group
= WPA_CIPHER_CCMP
;
141 if (bss
->wpa
&& bss
->ieee802_1x
)
142 bss
->ssid
.security_policy
= SECURITY_WPA
;
144 bss
->ssid
.security_policy
= SECURITY_WPA_PSK
;
145 else if (bss
->ieee802_1x
) {
146 bss
->ssid
.security_policy
= SECURITY_IEEE_802_1X
;
147 bss
->ssid
.wep
.default_len
= bss
->default_wep_key_len
;
148 } else if (bss
->ssid
.wep
.keys_set
)
149 bss
->ssid
.security_policy
= SECURITY_STATIC_WEP
;
151 bss
->ssid
.security_policy
= SECURITY_PLAINTEXT
;
155 * Enable WPS by default, but require user interaction to actually use
156 * it. Only the internal Registrar is supported.
160 bss
->ap_setup_locked
= 1;
161 if (wpa_s
->conf
->config_methods
)
162 bss
->config_methods
= os_strdup(wpa_s
->conf
->config_methods
);
163 if (wpa_s
->conf
->device_type
)
164 bss
->device_type
= os_strdup(wpa_s
->conf
->device_type
);
165 if (wpa_s
->conf
->device_name
) {
166 bss
->device_name
= os_strdup(wpa_s
->conf
->device_name
);
167 bss
->friendly_name
= os_strdup(wpa_s
->conf
->device_name
);
169 if (wpa_s
->conf
->manufacturer
)
170 bss
->manufacturer
= os_strdup(wpa_s
->conf
->manufacturer
);
171 if (wpa_s
->conf
->model_name
)
172 bss
->model_name
= os_strdup(wpa_s
->conf
->model_name
);
173 if (wpa_s
->conf
->model_number
)
174 bss
->model_number
= os_strdup(wpa_s
->conf
->model_number
);
175 if (wpa_s
->conf
->serial_number
)
176 bss
->serial_number
= os_strdup(wpa_s
->conf
->serial_number
);
177 os_memcpy(bss
->uuid
, wpa_s
->conf
->uuid
, WPS_UUID_LEN
);
178 os_memcpy(bss
->os_version
, wpa_s
->conf
->os_version
, 4);
179 #endif /* CONFIG_WPS */
181 bss
->max_num_sta
= wpa_s
->conf
->max_num_sta
;
187 static void ap_public_action_rx(void *ctx
, const u8
*buf
, size_t len
, int freq
)
190 struct wpa_supplicant
*wpa_s
= ctx
;
191 const struct ieee80211_mgmt
*mgmt
;
194 mgmt
= (const struct ieee80211_mgmt
*) buf
;
195 hdr_len
= (const u8
*) &mgmt
->u
.action
.u
.vs_public_action
.action
- buf
;
198 wpas_p2p_rx_action(wpa_s
, mgmt
->da
, mgmt
->sa
, mgmt
->bssid
,
199 mgmt
->u
.action
.category
,
200 &mgmt
->u
.action
.u
.vs_public_action
.action
,
201 len
- hdr_len
, freq
);
202 #endif /* CONFIG_P2P */
206 static void ap_wps_event_cb(void *ctx
, enum wps_event event
,
207 union wps_event_data
*data
)
209 struct wpa_supplicant
*wpa_s
= ctx
;
211 if (event
== WPS_EV_FAIL
&& wpa_s
->parent
&& wpa_s
->parent
!= wpa_s
) {
212 struct wps_event_fail
*fail
= &data
->fail
;
215 * src/ap/wps_hostapd.c has already sent this on the main
216 * interface, so only send on the parent interface here if
219 wpa_msg(wpa_s
->parent
, MSG_INFO
, WPS_EVENT_FAIL
220 "msg=%d config_error=%d",
221 fail
->msg
, fail
->config_error
);
226 static int ap_vendor_action_rx(void *ctx
, const u8
*buf
, size_t len
, int freq
)
229 struct wpa_supplicant
*wpa_s
= ctx
;
230 const struct ieee80211_mgmt
*mgmt
;
233 mgmt
= (const struct ieee80211_mgmt
*) buf
;
234 hdr_len
= (const u8
*) &mgmt
->u
.action
.u
.vs_public_action
.action
- buf
;
237 wpas_p2p_rx_action(wpa_s
, mgmt
->da
, mgmt
->sa
, mgmt
->bssid
,
238 mgmt
->u
.action
.category
,
239 &mgmt
->u
.action
.u
.vs_public_action
.action
,
240 len
- hdr_len
, freq
);
241 #endif /* CONFIG_P2P */
246 static int ap_probe_req_rx(void *ctx
, const u8
*addr
, const u8
*ie
,
250 struct wpa_supplicant
*wpa_s
= ctx
;
251 return wpas_p2p_probe_req_rx(wpa_s
, addr
, ie
, ie_len
);
252 #else /* CONFIG_P2P */
254 #endif /* CONFIG_P2P */
258 static void ap_wps_reg_success_cb(void *ctx
, const u8
*mac_addr
,
262 struct wpa_supplicant
*wpa_s
= ctx
;
263 wpas_p2p_wps_success(wpa_s
, mac_addr
, 1);
264 #endif /* CONFIG_P2P */
268 int wpa_supplicant_create_ap(struct wpa_supplicant
*wpa_s
,
269 struct wpa_ssid
*ssid
)
271 struct wpa_driver_associate_params params
;
272 struct hostapd_iface
*hapd_iface
;
273 struct hostapd_config
*conf
;
276 if (ssid
->ssid
== NULL
|| ssid
->ssid_len
== 0) {
277 wpa_printf(MSG_ERROR
, "No SSID configured for AP mode");
281 wpa_supplicant_ap_deinit(wpa_s
);
283 wpa_printf(MSG_DEBUG
, "Setting up AP (SSID='%s')",
284 wpa_ssid_txt(ssid
->ssid
, ssid
->ssid_len
));
286 os_memset(¶ms
, 0, sizeof(params
));
287 params
.ssid
= ssid
->ssid
;
288 params
.ssid_len
= ssid
->ssid_len
;
289 switch (ssid
->mode
) {
290 case WPAS_MODE_INFRA
:
291 params
.mode
= IEEE80211_MODE_INFRA
;
294 params
.mode
= IEEE80211_MODE_IBSS
;
297 case WPAS_MODE_P2P_GO
:
298 case WPAS_MODE_P2P_GROUP_FORMATION
:
299 params
.mode
= IEEE80211_MODE_AP
;
302 params
.freq
= ssid
->frequency
;
304 if (ssid
->key_mgmt
& WPA_KEY_MGMT_PSK
)
305 wpa_s
->key_mgmt
= WPA_KEY_MGMT_PSK
;
307 wpa_s
->key_mgmt
= WPA_KEY_MGMT_NONE
;
308 params
.key_mgmt_suite
= key_mgmt2driver(wpa_s
->key_mgmt
);
310 if (ssid
->pairwise_cipher
& WPA_CIPHER_CCMP
)
311 wpa_s
->pairwise_cipher
= WPA_CIPHER_CCMP
;
312 else if (ssid
->pairwise_cipher
& WPA_CIPHER_TKIP
)
313 wpa_s
->pairwise_cipher
= WPA_CIPHER_TKIP
;
314 else if (ssid
->pairwise_cipher
& WPA_CIPHER_NONE
)
315 wpa_s
->pairwise_cipher
= WPA_CIPHER_NONE
;
317 wpa_printf(MSG_WARNING
, "WPA: Failed to select pairwise "
321 params
.pairwise_suite
= cipher_suite2driver(wpa_s
->pairwise_cipher
);
322 params
.group_suite
= params
.pairwise_suite
;
325 if (ssid
->mode
== WPAS_MODE_P2P_GO
||
326 ssid
->mode
== WPAS_MODE_P2P_GROUP_FORMATION
)
328 wpa_drv_set_intra_bss(wpa_s
, wpa_s
->conf
->p2p_intra_bss
);
329 #endif /* CONFIG_P2P */
331 if (wpa_s
->parent
->set_ap_uapsd
)
332 params
.uapsd
= wpa_s
->parent
->ap_uapsd
;
336 if (wpa_drv_associate(wpa_s
, ¶ms
) < 0) {
337 wpa_msg(wpa_s
, MSG_INFO
, "Failed to start AP functionality");
341 wpa_s
->ap_iface
= hapd_iface
= os_zalloc(sizeof(*wpa_s
->ap_iface
));
342 if (hapd_iface
== NULL
)
344 hapd_iface
->owner
= wpa_s
;
346 wpa_s
->ap_iface
->conf
= conf
= hostapd_config_defaults();
348 wpa_supplicant_ap_deinit(wpa_s
);
352 if (wpa_supplicant_conf_ap(wpa_s
, ssid
, conf
)) {
353 wpa_printf(MSG_ERROR
, "Failed to create AP configuration");
354 wpa_supplicant_ap_deinit(wpa_s
);
359 if (ssid
->mode
== WPAS_MODE_P2P_GO
)
360 conf
->bss
[0].p2p
= P2P_ENABLED
| P2P_GROUP_OWNER
;
361 else if (ssid
->mode
== WPAS_MODE_P2P_GROUP_FORMATION
)
362 conf
->bss
[0].p2p
= P2P_ENABLED
| P2P_GROUP_OWNER
|
364 #endif /* CONFIG_P2P */
366 hapd_iface
->num_bss
= conf
->num_bss
;
367 hapd_iface
->bss
= os_zalloc(conf
->num_bss
*
368 sizeof(struct hostapd_data
*));
369 if (hapd_iface
->bss
== NULL
) {
370 wpa_supplicant_ap_deinit(wpa_s
);
374 for (i
= 0; i
< conf
->num_bss
; i
++) {
376 hostapd_alloc_bss_data(hapd_iface
, conf
,
378 if (hapd_iface
->bss
[i
] == NULL
) {
379 wpa_supplicant_ap_deinit(wpa_s
);
383 hapd_iface
->bss
[i
]->msg_ctx
= wpa_s
;
384 hapd_iface
->bss
[i
]->public_action_cb
= ap_public_action_rx
;
385 hapd_iface
->bss
[i
]->public_action_cb_ctx
= wpa_s
;
386 hapd_iface
->bss
[i
]->vendor_action_cb
= ap_vendor_action_rx
;
387 hapd_iface
->bss
[i
]->vendor_action_cb_ctx
= wpa_s
;
388 hostapd_register_probereq_cb(hapd_iface
->bss
[i
],
389 ap_probe_req_rx
, wpa_s
);
390 hapd_iface
->bss
[i
]->wps_reg_success_cb
= ap_wps_reg_success_cb
;
391 hapd_iface
->bss
[i
]->wps_reg_success_cb_ctx
= wpa_s
;
392 hapd_iface
->bss
[i
]->wps_event_cb
= ap_wps_event_cb
;
393 hapd_iface
->bss
[i
]->wps_event_cb_ctx
= wpa_s
;
395 hapd_iface
->bss
[i
]->p2p
= wpa_s
->global
->p2p
;
396 hapd_iface
->bss
[i
]->p2p_group
= wpas_p2p_group_init(
397 wpa_s
, ssid
->p2p_persistent_group
,
398 ssid
->mode
== WPAS_MODE_P2P_GROUP_FORMATION
);
399 #endif /* CONFIG_P2P */
402 os_memcpy(hapd_iface
->bss
[0]->own_addr
, wpa_s
->own_addr
, ETH_ALEN
);
403 hapd_iface
->bss
[0]->driver
= wpa_s
->driver
;
404 hapd_iface
->bss
[0]->drv_priv
= wpa_s
->drv_priv
;
406 if (hostapd_setup_interface(wpa_s
->ap_iface
)) {
407 wpa_printf(MSG_ERROR
, "Failed to initialize AP interface");
408 wpa_supplicant_ap_deinit(wpa_s
);
412 wpa_s
->current_ssid
= ssid
;
413 os_memcpy(wpa_s
->bssid
, wpa_s
->own_addr
, ETH_ALEN
);
414 wpa_s
->assoc_freq
= ssid
->frequency
;
415 wpa_supplicant_set_state(wpa_s
, WPA_COMPLETED
);
417 if (wpa_s
->ap_configured_cb
)
418 wpa_s
->ap_configured_cb(wpa_s
->ap_configured_cb_ctx
,
419 wpa_s
->ap_configured_cb_data
);
425 void wpa_supplicant_ap_deinit(struct wpa_supplicant
*wpa_s
)
427 if (wpa_s
->ap_iface
== NULL
)
430 wpa_s
->current_ssid
= NULL
;
432 if (wpa_s
->ap_iface
->bss
)
433 wpa_s
->ap_iface
->bss
[0]->p2p_group
= NULL
;
434 wpas_p2p_group_deinit(wpa_s
);
435 #endif /* CONFIG_P2P */
436 hostapd_interface_deinit(wpa_s
->ap_iface
);
437 hostapd_interface_free(wpa_s
->ap_iface
);
438 wpa_s
->ap_iface
= NULL
;
439 wpa_drv_deinit_ap(wpa_s
);
443 void ap_tx_status(void *ctx
, const u8
*addr
,
444 const u8
*buf
, size_t len
, int ack
)
447 struct wpa_supplicant
*wpa_s
= ctx
;
448 hostapd_tx_status(wpa_s
->ap_iface
->bss
[0], addr
, buf
, len
, ack
);
449 #endif /* NEED_AP_MLME */
453 void ap_rx_from_unknown_sta(void *ctx
, const u8
*frame
, size_t len
)
456 struct wpa_supplicant
*wpa_s
= ctx
;
457 const struct ieee80211_hdr
*hdr
=
458 (const struct ieee80211_hdr
*) frame
;
459 u16 fc
= le_to_host16(hdr
->frame_control
);
460 ieee802_11_rx_from_unknown(wpa_s
->ap_iface
->bss
[0], hdr
->addr2
,
461 (fc
& (WLAN_FC_TODS
| WLAN_FC_FROMDS
)) ==
462 (WLAN_FC_TODS
| WLAN_FC_FROMDS
));
463 #endif /* NEED_AP_MLME */
467 void ap_mgmt_rx(void *ctx
, struct rx_mgmt
*rx_mgmt
)
470 struct wpa_supplicant
*wpa_s
= ctx
;
471 struct hostapd_frame_info fi
;
472 os_memset(&fi
, 0, sizeof(fi
));
473 fi
.datarate
= rx_mgmt
->datarate
;
474 fi
.ssi_signal
= rx_mgmt
->ssi_signal
;
475 ieee802_11_mgmt(wpa_s
->ap_iface
->bss
[0], rx_mgmt
->frame
,
476 rx_mgmt
->frame_len
, &fi
);
477 #endif /* NEED_AP_MLME */
481 void ap_mgmt_tx_cb(void *ctx
, const u8
*buf
, size_t len
, u16 stype
, int ok
)
484 struct wpa_supplicant
*wpa_s
= ctx
;
485 ieee802_11_mgmt_cb(wpa_s
->ap_iface
->bss
[0], buf
, len
, stype
, ok
);
486 #endif /* NEED_AP_MLME */
490 void wpa_supplicant_ap_rx_eapol(struct wpa_supplicant
*wpa_s
,
491 const u8
*src_addr
, const u8
*buf
, size_t len
)
493 ieee802_1x_receive(wpa_s
->ap_iface
->bss
[0], src_addr
, buf
, len
);
499 int wpa_supplicant_ap_wps_pbc(struct wpa_supplicant
*wpa_s
, const u8
*bssid
)
501 if (!wpa_s
->ap_iface
)
503 return hostapd_wps_button_pushed(wpa_s
->ap_iface
->bss
[0]);
507 static int wpa_supplicant_ap_wps_sta_cancel(struct hostapd_data
*hapd
,
508 struct sta_info
*sta
, void *ctx
)
510 if (sta
&& (sta
->flags
& WLAN_STA_WPS
)) {
511 ap_sta_deauthenticate(hapd
, sta
,
512 WLAN_REASON_PREV_AUTH_NOT_VALID
);
513 wpa_printf(MSG_DEBUG
, "WPS: %s: Deauth sta=" MACSTR
,
514 __func__
, MAC2STR(sta
->addr
));
522 int wpa_supplicant_ap_wps_cancel(struct wpa_supplicant
*wpa_s
)
524 struct wps_registrar
*reg
;
525 int reg_sel
= 0, wps_sta
= 0;
527 if (!wpa_s
->ap_iface
|| !wpa_s
->ap_iface
->bss
[0]->wps
)
530 reg
= wpa_s
->ap_iface
->bss
[0]->wps
->registrar
;
531 reg_sel
= wps_registrar_wps_cancel(reg
);
532 wps_sta
= ap_for_each_sta(wpa_s
->ap_iface
->bss
[0],
533 wpa_supplicant_ap_wps_sta_cancel
, NULL
);
535 if (!reg_sel
&& !wps_sta
) {
536 wpa_printf(MSG_DEBUG
, "No WPS operation in progress at this "
542 * There are 2 cases to return wps cancel as success:
543 * 1. When wps cancel was initiated but no connection has been
544 * established with client yet.
545 * 2. Client is in the middle of exchanging WPS messages.
552 int wpa_supplicant_ap_wps_pin(struct wpa_supplicant
*wpa_s
, const u8
*bssid
,
553 const char *pin
, char *buf
, size_t buflen
)
555 int ret
, ret_len
= 0;
557 if (!wpa_s
->ap_iface
)
561 unsigned int rpin
= wps_generate_pin();
562 ret_len
= os_snprintf(buf
, buflen
, "%d", rpin
);
565 ret_len
= os_snprintf(buf
, buflen
, "%s", pin
);
567 ret
= hostapd_wps_add_pin(wpa_s
->ap_iface
->bss
[0], bssid
, "any", pin
,
574 #endif /* CONFIG_WPS */
577 #ifdef CONFIG_CTRL_IFACE
579 int ap_ctrl_iface_sta_first(struct wpa_supplicant
*wpa_s
,
580 char *buf
, size_t buflen
)
582 if (wpa_s
->ap_iface
== NULL
)
584 return hostapd_ctrl_iface_sta_first(wpa_s
->ap_iface
->bss
[0],
589 int ap_ctrl_iface_sta(struct wpa_supplicant
*wpa_s
, const char *txtaddr
,
590 char *buf
, size_t buflen
)
592 if (wpa_s
->ap_iface
== NULL
)
594 return hostapd_ctrl_iface_sta(wpa_s
->ap_iface
->bss
[0], txtaddr
,
599 int ap_ctrl_iface_sta_next(struct wpa_supplicant
*wpa_s
, const char *txtaddr
,
600 char *buf
, size_t buflen
)
602 if (wpa_s
->ap_iface
== NULL
)
604 return hostapd_ctrl_iface_sta_next(wpa_s
->ap_iface
->bss
[0], txtaddr
,
609 int ap_ctrl_iface_wpa_get_status(struct wpa_supplicant
*wpa_s
, char *buf
,
610 size_t buflen
, int verbose
)
612 char *pos
= buf
, *end
= buf
+ buflen
;
614 struct hostapd_bss_config
*conf
;
616 if (wpa_s
->ap_iface
== NULL
)
619 conf
= wpa_s
->ap_iface
->bss
[0]->conf
;
623 ret
= os_snprintf(pos
, end
- pos
,
624 "pairwise_cipher=%s\n"
627 wpa_cipher_txt(conf
->rsn_pairwise
),
628 wpa_cipher_txt(conf
->wpa_group
),
629 wpa_key_mgmt_txt(conf
->wpa_key_mgmt
,
631 if (ret
< 0 || ret
>= end
- pos
)
637 #endif /* CONFIG_CTRL_IFACE */
640 int wpa_supplicant_ap_update_beacon(struct wpa_supplicant
*wpa_s
)
642 struct hostapd_iface
*iface
= wpa_s
->ap_iface
;
643 struct wpa_ssid
*ssid
= wpa_s
->current_ssid
;
644 struct hostapd_data
*hapd
;
646 if (ssid
== NULL
|| wpa_s
->ap_iface
== NULL
)
650 if (ssid
->mode
== WPAS_MODE_P2P_GO
)
651 iface
->conf
->bss
[0].p2p
= P2P_ENABLED
| P2P_GROUP_OWNER
;
652 else if (ssid
->mode
== WPAS_MODE_P2P_GROUP_FORMATION
)
653 iface
->conf
->bss
[0].p2p
= P2P_ENABLED
| P2P_GROUP_OWNER
|
655 #endif /* CONFIG_P2P */
657 ieee802_11_set_beacons(iface
);
658 hapd
= iface
->bss
[0];
659 hapd
->drv
.set_ap_wps_ie(hapd
);
665 int wpa_supplicant_ap_mac_addr_filter(struct wpa_supplicant
*wpa_s
,
668 struct hostapd_data
*hapd
;
669 struct hostapd_bss_config
*conf
;
671 if (!wpa_s
->ap_iface
)
675 wpa_printf(MSG_DEBUG
, "AP: Set MAC address filter: " MACSTR
,
678 wpa_printf(MSG_DEBUG
, "AP: Clear MAC address filter");
680 hapd
= wpa_s
->ap_iface
->bss
[0];
683 os_free(conf
->accept_mac
);
684 conf
->accept_mac
= NULL
;
685 conf
->num_accept_mac
= 0;
686 os_free(conf
->deny_mac
);
687 conf
->deny_mac
= NULL
;
688 conf
->num_deny_mac
= 0;
691 conf
->macaddr_acl
= ACCEPT_UNLESS_DENIED
;
695 conf
->macaddr_acl
= DENY_UNLESS_ACCEPTED
;
696 conf
->accept_mac
= os_zalloc(sizeof(struct mac_acl_entry
));
697 if (conf
->accept_mac
== NULL
)
699 os_memcpy(conf
->accept_mac
[0].addr
, addr
, ETH_ALEN
);
700 conf
->num_accept_mac
= 1;