Remove need for direct driver calls from ieee802_11_auth.c

This commit is contained in:
Jouni Malinen 2009-12-24 23:49:19 +02:00
parent d24df7c33d
commit 2f3e0bd4d4
4 changed files with 31 additions and 25 deletions

View file

@ -148,6 +148,27 @@ static int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd,
}
static int hostapd_set_radius_acl_auth(struct hostapd_data *hapd,
const u8 *mac, int accepted,
u32 session_timeout)
{
if (hapd->driver == NULL || hapd->driver->set_radius_acl_auth == NULL)
return 0;
return hapd->driver->set_radius_acl_auth(hapd->drv_priv, mac, accepted,
session_timeout);
}
static int hostapd_set_radius_acl_expire(struct hostapd_data *hapd,
const u8 *mac)
{
if (hapd->driver == NULL ||
hapd->driver->set_radius_acl_expire == NULL)
return 0;
return hapd->driver->set_radius_acl_expire(hapd->drv_priv, mac);
}
void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
{
ops->set_ap_wps_ie = hostapd_set_ap_wps_ie;
@ -159,4 +180,6 @@ void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
ops->sta_clear_stats = hostapd_sta_clear_stats;
ops->set_sta_flags = hostapd_set_sta_flags;
ops->set_drv_ieee8021x = hostapd_set_drv_ieee8021x;
ops->set_radius_acl_auth = hostapd_set_radius_acl_auth;
ops->set_radius_acl_expire = hostapd_set_radius_acl_expire;
}

View file

@ -367,25 +367,6 @@ hostapd_driver_commit(struct hostapd_data *hapd)
return hapd->driver->commit(hapd->drv_priv);
}
static inline int
hostapd_set_radius_acl_auth(struct hostapd_data *hapd, const u8 *mac,
int accepted, u32 session_timeout)
{
if (hapd->driver == NULL || hapd->driver->set_radius_acl_auth == NULL)
return 0;
return hapd->driver->set_radius_acl_auth(hapd->drv_priv, mac, accepted,
session_timeout);
}
static inline int
hostapd_set_radius_acl_expire(struct hostapd_data *hapd, const u8 *mac)
{
if (hapd->driver == NULL ||
hapd->driver->set_radius_acl_expire == NULL)
return 0;
return hapd->driver->set_radius_acl_expire(hapd->drv_priv, mac);
}
static inline int
hostapd_set_ht_params(const char *ifname, struct hostapd_data *hapd,
const u8 *ht_capab, size_t ht_capab_len,

View file

@ -64,6 +64,11 @@ struct hostapd_driver_ops {
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);
int (*set_radius_acl_auth)(struct hostapd_data *hapd,
const u8 *mac, int accepted,
u32 session_timeout);
int (*set_radius_acl_expire)(struct hostapd_data *hapd,
const u8 *mac);
};
/**

View file

@ -29,9 +29,6 @@
#include "radius/radius.h"
#include "radius/radius_client.h"
#include "eloop.h"
#ifdef CONFIG_DRIVER_RADIUS_ACL
#include "driver_i.h"
#endif /* CONFIG_DRIVER_RADIUS_ACL */
#define RADIUS_ACL_TIMEOUT 30
@ -323,7 +320,7 @@ static void hostapd_acl_expire_cache(struct hostapd_data *hapd, time_t now)
else
hapd->acl_cache = entry->next;
#ifdef CONFIG_DRIVER_RADIUS_ACL
hostapd_set_radius_acl_expire(hapd, entry->addr);
hapd->drv.set_radius_acl_expire(hapd, entry->addr);
#endif /* CONFIG_DRIVER_RADIUS_ACL */
tmp = entry;
entry = entry->next;
@ -463,8 +460,8 @@ hostapd_acl_recv_radius(struct radius_msg *msg, struct radius_msg *req,
hapd->acl_cache = cache;
#ifdef CONFIG_DRIVER_RADIUS_ACL
hostapd_set_radius_acl_auth(hapd, query->addr, cache->accepted,
cache->session_timeout);
hapd->drv.set_radius_acl_auth(hapd, query->addr, cache->accepted,
cache->session_timeout);
#else /* CONFIG_DRIVER_RADIUS_ACL */
#ifdef NEED_AP_MLME
/* Re-send original authentication frame for 802.11 processing */