Move wpa_supplicant_create_ap() into ap.c
This commit is contained in:
parent
c746331b52
commit
1f1b62a0f0
3 changed files with 48 additions and 25 deletions
|
@ -21,6 +21,8 @@
|
|||
#include "eap_common/eap_defs.h"
|
||||
#include "eap_server/eap_methods.h"
|
||||
#include "eap_common/eap_wsc_common.h"
|
||||
#include "config_ssid.h"
|
||||
#include "wpa_supplicant_i.h"
|
||||
|
||||
|
||||
int hostapd_reload_config(struct hostapd_iface *iface)
|
||||
|
@ -137,3 +139,26 @@ hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity,
|
|||
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
void wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid)
|
||||
{
|
||||
struct wpa_driver_associate_params params;
|
||||
|
||||
if (ssid->ssid == NULL || ssid->ssid_len == 0) {
|
||||
wpa_printf(MSG_ERROR, "No SSID configured for AP mode");
|
||||
return;
|
||||
}
|
||||
|
||||
wpa_printf(MSG_DEBUG, "Setting up AP (SSID='%s')",
|
||||
wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
|
||||
|
||||
os_memset(¶ms, 0, sizeof(params));
|
||||
params.ssid = ssid->ssid;
|
||||
params.ssid_len = ssid->ssid_len;
|
||||
params.mode = ssid->mode;
|
||||
|
||||
if (wpa_drv_associate(wpa_s, ¶ms) < 0)
|
||||
wpa_msg(wpa_s, MSG_INFO, "Failed to start AP functionality");
|
||||
}
|
||||
|
|
22
wpa_supplicant/ap.h
Normal file
22
wpa_supplicant/ap.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* WPA Supplicant - Basic AP mode support routines
|
||||
* Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi>
|
||||
* Copyright (c) 2009, Atheros Communications
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef AP_H
|
||||
#define AP_H
|
||||
|
||||
void wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid);
|
||||
|
||||
#endif /* AP_H */
|
|
@ -41,6 +41,7 @@
|
|||
#include "wps_supplicant.h"
|
||||
#include "ibss_rsn.h"
|
||||
#include "sme.h"
|
||||
#include "ap.h"
|
||||
|
||||
const char *wpa_supplicant_version =
|
||||
"wpa_supplicant v" VERSION_STR "\n"
|
||||
|
@ -919,31 +920,6 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
|
|||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_AP
|
||||
static void wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid)
|
||||
{
|
||||
struct wpa_driver_associate_params params;
|
||||
|
||||
if (ssid->ssid == NULL || ssid->ssid_len == 0) {
|
||||
wpa_printf(MSG_ERROR, "No SSID configured for AP mode");
|
||||
return;
|
||||
}
|
||||
|
||||
wpa_printf(MSG_DEBUG, "Setting up AP (SSID='%s')",
|
||||
wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
|
||||
|
||||
os_memset(¶ms, 0, sizeof(params));
|
||||
params.ssid = ssid->ssid;
|
||||
params.ssid_len = ssid->ssid_len;
|
||||
params.mode = ssid->mode;
|
||||
|
||||
if (wpa_drv_associate(wpa_s, ¶ms) < 0)
|
||||
wpa_msg(wpa_s, MSG_INFO, "Failed to start AP functionality");
|
||||
}
|
||||
#endif /* CONFIG_AP */
|
||||
|
||||
|
||||
/**
|
||||
* wpa_supplicant_associate - Request association
|
||||
* @wpa_s: Pointer to wpa_supplicant data
|
||||
|
|
Loading…
Reference in a new issue