Browse Source

Remove need for direct driver calls from ieee802_11_auth.c

Jouni Malinen 15 years ago
parent
commit
2f3e0bd4d4
4 changed files with 31 additions and 25 deletions
  1. 23 0
      hostapd/ap_drv_ops.c
  2. 0 19
      hostapd/driver_i.h
  3. 5 0
      hostapd/hostapd.h
  4. 3 6
      hostapd/ieee802_11_auth.c

+ 23 - 0
hostapd/ap_drv_ops.c

@@ -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;
 }

+ 0 - 19
hostapd/driver_i.h

@@ -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,

+ 5 - 0
hostapd/hostapd.h

@@ -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);
 };
 
 /**

+ 3 - 6
hostapd/ieee802_11_auth.c

@@ -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 */