Change set_ieee8021x driver op to use parameters structure

This makes it easier to extent the set of parameters passed to
this driver wrapper function.
This commit is contained in:
Jouni Malinen 2009-12-12 23:32:44 +02:00
parent 08fd8c15a0
commit e3bd3912ca
9 changed files with 43 additions and 16 deletions

View file

@ -63,12 +63,11 @@ hostapd_driver_deinit(struct hostapd_data *hapd)
}
static inline int
hostapd_set_ieee8021x(const char *ifname, struct hostapd_data *hapd,
int enabled)
hostapd_set_ieee8021x(struct hostapd_data *hapd, struct wpa_bss_params *params)
{
if (hapd->driver == NULL || hapd->driver->set_ieee8021x == NULL)
return 0;
return hapd->driver->set_ieee8021x(ifname, hapd->drv_priv, enabled);
return hapd->driver->set_ieee8021x(hapd->drv_priv, params);
}
static inline int

View file

@ -177,7 +177,9 @@ int hostapd_reload_config(struct hostapd_iface *iface)
}
if (hapd->conf->ieee802_1x || hapd->conf->wpa)
hostapd_set_ieee8021x(hapd->conf->iface, hapd, 1);
hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 1);
else
hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
hostapd_config_free(oldconf);
@ -1486,3 +1488,14 @@ int hostapd_register_probereq_cb(struct hostapd_data *hapd,
return 0;
}
int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
int enabled)
{
struct wpa_bss_params params;
os_memset(&params, 0, sizeof(params));
params.ifname = ifname;
params.enabled = enabled;
return hostapd_set_ieee8021x(hapd, &params);
}

View file

@ -187,6 +187,8 @@ int hostapd_register_probereq_cb(struct hostapd_data *hapd,
void (*cb)(void *ctx, const u8 *sa,
const u8 *ie, size_t ie_len),
void *ctx);
int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
int enabled);
int eap_server_register_methods(void);

View file

@ -236,7 +236,7 @@ ieee802_1x_group_alloc(struct hostapd_data *hapd, const char *ifname)
NULL, 0, key->key[key->idx], key->len[key->idx]))
printf("Could not set dynamic VLAN WEP encryption key.\n");
hostapd_set_ieee8021x(ifname, hapd, 1);
hostapd_set_drv_ieee8021x(hapd, ifname, 1);
return key;
}
@ -1664,7 +1664,7 @@ int ieee802_1x_init(struct hostapd_data *hapd)
return -1;
if ((hapd->conf->ieee802_1x || hapd->conf->wpa) &&
hostapd_set_ieee8021x(hapd->conf->iface, hapd, 1))
hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 1))
return -1;
#ifndef CONFIG_NO_RADIUS
@ -1696,7 +1696,7 @@ void ieee802_1x_deinit(struct hostapd_data *hapd)
if (hapd->driver != NULL &&
(hapd->conf->ieee802_1x || hapd->conf->wpa))
hostapd_set_ieee8021x(hapd->conf->iface, hapd, 0);
hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
eapol_auth_deinit(hapd->eapol_auth);
hapd->eapol_auth = NULL;

View file

@ -481,6 +481,14 @@ struct wpa_init_params {
};
struct wpa_bss_params {
/** Interface name (for multi-SSID/VLAN support) */
const char *ifname;
/** Whether IEEE 802.1X or WPA/WPA2 is enabled */
int enabled;
};
/**
* struct wpa_driver_ops - Driver interface API definition
*
@ -1084,16 +1092,17 @@ struct wpa_driver_ops {
/**
* set_ieee8021x - Enable/disable IEEE 802.1X support (AP only)
* @ifname: Interface name (for multi-SSID/VLAN support)
* @priv: Private driver interface data
* @enabled: 1 = enable, 0 = disable
* @params: BSS parameters
* Returns: 0 on success, -1 on failure
*
* This is an optional function to configure the kernel driver to
* enable/disable 802.1X support. This can be left undefined (set to
* %NULL) if IEEE 802.1X support is always enabled.
* enable/disable IEEE 802.1X support and set WPA/WPA2 parameters. This
* can be left undefined (set to %NULL) if IEEE 802.1X support is
* always enabled and the driver uses set_beacon() to set WPA/RSN IE
* for Beacon frames.
*/
int (*set_ieee8021x)(const char *ifname, void *priv, int enabled);
int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params);
/**
* set_privacy - Enable/disable privacy (AP only)

View file

@ -306,11 +306,12 @@ madwifi_set_iface_flags(void *priv, int dev_up)
}
static int
madwifi_set_ieee8021x(const char *ifname, void *priv, int enabled)
madwifi_set_ieee8021x(void *priv, struct wpa_bss_params *params)
{
struct madwifi_driver_data *drv = priv;
struct hostapd_data *hapd = drv->hapd;
struct hostapd_bss_config *conf = hapd->conf;
int enabled = params->enabled;
wpa_printf(MSG_DEBUG, "%s: enabled=%d", __func__, enabled);

View file

@ -323,11 +323,12 @@ bsd_set_iface_flags(void *priv, int dev_up)
}
static int
bsd_set_ieee8021x(const char *ifname, void *priv, int enabled)
bsd_set_ieee8021x(void *priv, struct wpa_bss_params *params)
{
struct bsd_driver_data *drv = priv;
struct hostapd_data *hapd = drv->hapd;
struct hostapd_bss_config *conf = hapd->conf;
int enabled = params->enabled;
wpa_printf(MSG_DEBUG, "%s: enabled=%d", __func__, enabled);

View file

@ -542,9 +542,10 @@ static int hostap_ioctl_prism2param(void *priv, int param, int value)
}
static int hostap_set_ieee8021x(const char *ifname, void *priv, int enabled)
static int hostap_set_ieee8021x(void *priv, struct wpa_bss_params *params)
{
struct hostap_driver_data *drv = priv;
int enabled = params->enabled;
/* enable kernel driver support for IEEE 802.1X */
if (hostap_ioctl_prism2param(drv, PRISM2_PARAM_IEEE_802_1X, enabled)) {

View file

@ -351,11 +351,12 @@ madwifi_set_iface_flags(void *priv, int dev_up)
}
static int
madwifi_set_ieee8021x(const char *ifname, void *priv, int enabled)
madwifi_set_ieee8021x(void *priv, struct wpa_bss_params *params)
{
struct madwifi_driver_data *drv = priv;
struct hostapd_data *hapd = drv->hapd;
struct hostapd_bss_config *conf = hapd->conf;
int enabled = params->enabled;
wpa_printf(MSG_DEBUG, "%s: enabled=%d", __func__, enabled);