Remove need for direct driver calls from ieee802_11_auth.c
authorJouni Malinen <j@w1.fi>
Thu, 24 Dec 2009 21:49:19 +0000 (23:49 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 24 Dec 2009 21:49:19 +0000 (23:49 +0200)
hostapd/ap_drv_ops.c
hostapd/driver_i.h
hostapd/hostapd.h
hostapd/ieee802_11_auth.c

index d6401e2..3b5cc2a 100644 (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;
 }
index 7de6c04..24850dc 100644 (file)
@@ -368,25 +368,6 @@ hostapd_driver_commit(struct hostapd_data *hapd)
 }
 
 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,
                      const u8 *ht_oper, size_t ht_oper_len)
index 3937fbf..e438e90 100644 (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);
 };
 
 /**
index cd26c80..5155100 100644 (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 */