Move hostapd configuration parser into separate file
config.c includes now only the generic helper functions that are needed both for hostapd and the AP mode operations in wpa_supplicant. hostapd/config_file.c is only needed for hostapd.
This commit is contained in:
parent
45cefa0bf3
commit
41d719d6e0
8 changed files with 2071 additions and 2023 deletions
|
@ -33,7 +33,7 @@ LIBS += -lws2_32
|
|||
endif
|
||||
|
||||
OBJS = hostapd.o main.o ieee802_1x.o \
|
||||
config.o ieee802_11_auth.o \
|
||||
config.o config_file.o ieee802_11_auth.o \
|
||||
sta_info.o wpa.o \
|
||||
preauth.o pmksa_cache.o \
|
||||
drv_callbacks.o \
|
||||
|
|
2020
hostapd/config.c
2020
hostapd/config.c
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* hostapd / Configuration file
|
||||
* hostapd / Configuration definitions and helpers functions
|
||||
* Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -19,6 +19,9 @@
|
|||
#include "ip_addr.h"
|
||||
#include "common/wpa_common.h"
|
||||
|
||||
#define MAX_STA_COUNT 2007
|
||||
#define MAX_VLAN_ID 4094
|
||||
|
||||
typedef u8 macaddr[ETH_ALEN];
|
||||
|
||||
struct mac_acl_entry {
|
||||
|
@ -371,7 +374,7 @@ struct hostapd_config {
|
|||
int hostapd_mac_comp(const void *a, const void *b);
|
||||
int hostapd_mac_comp_empty(const void *a);
|
||||
struct hostapd_config * hostapd_config_defaults(void);
|
||||
struct hostapd_config * hostapd_config_read(const char *fname);
|
||||
void hostapd_config_defaults_bss(struct hostapd_bss_config *bss);
|
||||
void hostapd_config_free(struct hostapd_config *conf);
|
||||
int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries,
|
||||
const u8 *addr, int *vlan_id);
|
||||
|
|
2036
hostapd/config_file.c
Normal file
2036
hostapd/config_file.c
Normal file
File diff suppressed because it is too large
Load diff
20
hostapd/config_file.h
Normal file
20
hostapd/config_file.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* hostapd / Configuration file parser
|
||||
* Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* 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 CONFIG_FILE_H
|
||||
#define CONFIG_FILE_H
|
||||
|
||||
struct hostapd_config * hostapd_config_read(const char *fname);
|
||||
|
||||
#endif /* CONFIG_FILE_H */
|
|
@ -127,7 +127,9 @@ int hostapd_reload_config(struct hostapd_iface *iface)
|
|||
struct wpa_auth_config wpa_auth_conf;
|
||||
size_t j;
|
||||
|
||||
newconf = hostapd_config_read(iface->config_fname);
|
||||
if (iface->config_read_cb == NULL)
|
||||
return -1;
|
||||
newconf = iface->config_read_cb(iface->config_fname);
|
||||
if (newconf == NULL)
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#include "common/defs.h"
|
||||
|
||||
#define MAX_VLAN_ID 4094
|
||||
|
||||
struct wpa_driver_ops;
|
||||
struct wpa_ctrl_dst;
|
||||
struct radius_server_data;
|
||||
|
@ -141,6 +139,7 @@ struct hostapd_data {
|
|||
struct hostapd_iface {
|
||||
struct hapd_interfaces *interfaces;
|
||||
void *owner;
|
||||
struct hostapd_config * (*config_read_cb)(const char *config_fname);
|
||||
char *config_fname;
|
||||
struct hostapd_config *conf;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "eap_server/tncs.h"
|
||||
#include "hostapd.h"
|
||||
#include "config.h"
|
||||
#include "config_file.h"
|
||||
|
||||
|
||||
extern int wpa_debug_level;
|
||||
|
@ -178,6 +179,7 @@ static struct hostapd_iface * hostapd_init(const char *config_file)
|
|||
if (hapd_iface == NULL)
|
||||
goto fail;
|
||||
|
||||
hapd_iface->config_read_cb = hostapd_config_read;
|
||||
hapd_iface->config_fname = os_strdup(config_file);
|
||||
if (hapd_iface->config_fname == NULL)
|
||||
goto fail;
|
||||
|
|
Loading…
Reference in a new issue