Move hostapd_set_drv_ieee8021x() into ap_drv_ops

This commit is contained in:
Jouni Malinen 2009-12-24 23:17:11 +02:00
parent 4c2ddda495
commit 010401fe65
4 changed files with 27 additions and 26 deletions

View file

@ -129,6 +129,25 @@ static int hostapd_set_sta_flags(struct hostapd_data *hapd,
} }
static 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;
if (enabled) {
params.wpa = hapd->conf->wpa;
params.ieee802_1x = hapd->conf->ieee802_1x;
params.wpa_group = hapd->conf->wpa_group;
params.wpa_pairwise = hapd->conf->wpa_pairwise;
params.wpa_key_mgmt = hapd->conf->wpa_key_mgmt;
params.rsn_preauth = hapd->conf->rsn_preauth;
}
return hostapd_set_ieee8021x(hapd, &params);
}
void hostapd_set_driver_ops(struct hostapd_driver_ops *ops) void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
{ {
ops->set_ap_wps_ie = hostapd_set_ap_wps_ie; ops->set_ap_wps_ie = hostapd_set_ap_wps_ie;
@ -139,4 +158,5 @@ void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
ops->read_sta_data = hostapd_read_sta_data; ops->read_sta_data = hostapd_read_sta_data;
ops->sta_clear_stats = hostapd_sta_clear_stats; ops->sta_clear_stats = hostapd_sta_clear_stats;
ops->set_sta_flags = hostapd_set_sta_flags; ops->set_sta_flags = hostapd_set_sta_flags;
ops->set_drv_ieee8021x = hostapd_set_drv_ieee8021x;
} }

View file

@ -178,9 +178,9 @@ int hostapd_reload_config(struct hostapd_iface *iface)
} }
if (hapd->conf->ieee802_1x || hapd->conf->wpa) if (hapd->conf->ieee802_1x || hapd->conf->wpa)
hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 1); hapd->drv.set_drv_ieee8021x(hapd, hapd->conf->iface, 1);
else else
hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0); hapd->drv.set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
hostapd_config_free(oldconf); hostapd_config_free(oldconf);
@ -1486,22 +1486,3 @@ int hostapd_register_probereq_cb(struct hostapd_data *hapd,
return 0; 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;
if (enabled) {
params.wpa = hapd->conf->wpa;
params.ieee802_1x = hapd->conf->ieee802_1x;
params.wpa_group = hapd->conf->wpa_group;
params.wpa_pairwise = hapd->conf->wpa_pairwise;
params.wpa_key_mgmt = hapd->conf->wpa_key_mgmt;
params.rsn_preauth = hapd->conf->rsn_preauth;
}
return hostapd_set_ieee8021x(hapd, &params);
}

View file

@ -62,6 +62,8 @@ struct hostapd_driver_ops {
const u8 *addr); const u8 *addr);
int (*sta_clear_stats)(struct hostapd_data *hapd, const u8 *addr); int (*sta_clear_stats)(struct hostapd_data *hapd, const u8 *addr);
int (*set_sta_flags)(struct hostapd_data *hapd, struct sta_info *sta); int (*set_sta_flags)(struct hostapd_data *hapd, struct sta_info *sta);
int (*set_drv_ieee8021x)(struct hostapd_data *hapd, const char *ifname,
int enabled);
}; };
/** /**
@ -214,8 +216,6 @@ int hostapd_register_probereq_cb(struct hostapd_data *hapd,
void (*cb)(void *ctx, const u8 *sa, void (*cb)(void *ctx, const u8 *sa,
const u8 *ie, size_t ie_len), const u8 *ie, size_t ie_len),
void *ctx); void *ctx);
int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
int enabled);
int eap_server_register_methods(void); int eap_server_register_methods(void);
void hostapd_set_driver_ops(struct hostapd_driver_ops *ops); void hostapd_set_driver_ops(struct hostapd_driver_ops *ops);

View file

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