Browse Source

Remove direct driver calls from ieee802_11.c

Jouni Malinen 15 years ago
parent
commit
2ce86d9d72
4 changed files with 38 additions and 35 deletions
  1. 26 0
      hostapd/ap_drv_ops.c
  2. 0 24
      hostapd/driver_i.h
  3. 6 3
      hostapd/hostapd.h
  4. 6 8
      hostapd/ieee802_11.c

+ 26 - 0
hostapd/ap_drv_ops.c

@@ -297,6 +297,31 @@ static int hostapd_sta_disassoc(struct hostapd_data *hapd, const u8 *addr,
 }
 
 
+static int hostapd_sta_add(const char *ifname, struct hostapd_data *hapd,
+			   const u8 *addr, u16 aid, u16 capability,
+			   const u8 *supp_rates, size_t supp_rates_len,
+			   u16 listen_interval,
+			   const struct ieee80211_ht_capabilities *ht_capab)
+{
+	struct hostapd_sta_add_params params;
+
+	if (hapd->driver == NULL)
+		return 0;
+	if (hapd->driver->sta_add == NULL)
+		return 0;
+
+	os_memset(&params, 0, sizeof(params));
+	params.addr = addr;
+	params.aid = aid;
+	params.capability = capability;
+	params.supp_rates = supp_rates;
+	params.supp_rates_len = supp_rates_len;
+	params.listen_interval = listen_interval;
+	params.ht_capabilities = ht_capab;
+	return hapd->driver->sta_add(ifname, hapd->drv_priv, &params);
+}
+
+
 static int hostapd_sta_remove(struct hostapd_data *hapd, const u8 *addr)
 {
 	if (hapd->driver == NULL || hapd->driver->sta_remove == NULL)
@@ -327,5 +352,6 @@ void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
 	ops->get_inact_sec = hostapd_get_inact_sec;
 	ops->sta_deauth = hostapd_sta_deauth;
 	ops->sta_disassoc = hostapd_sta_disassoc;
+	ops->sta_add = hostapd_sta_add;
 	ops->sta_remove = hostapd_sta_remove;
 }

+ 0 - 24
hostapd/driver_i.h

@@ -134,30 +134,6 @@ hostapd_set_countermeasures(struct hostapd_data *hapd, int enabled)
 	return hapd->driver->hapd_set_countermeasures(hapd->drv_priv, enabled);
 }
 
-static inline int
-hostapd_sta_add(const char *ifname, struct hostapd_data *hapd, const u8 *addr,
-		u16 aid, u16 capability, const u8 *supp_rates,
-		size_t supp_rates_len, u16 listen_interval,
-		const struct ieee80211_ht_capabilities *ht_capabilities)
-{
-	struct hostapd_sta_add_params params;
-
-	if (hapd->driver == NULL)
-		return 0;
-	if (hapd->driver->sta_add == NULL)
-		return 0;
-
-	os_memset(&params, 0, sizeof(params));
-	params.addr = addr;
-	params.aid = aid;
-	params.capability = capability;
-	params.supp_rates = supp_rates;
-	params.supp_rates_len = supp_rates_len;
-	params.listen_interval = listen_interval;
-	params.ht_capabilities = ht_capabilities;
-	return hapd->driver->sta_add(ifname, hapd->drv_priv, &params);
-}
-
 static inline int
 hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq, int channel,
 		 int ht_enabled, int sec_channel_offset)

+ 6 - 3
hostapd/hostapd.h

@@ -25,10 +25,8 @@ struct hapd_interfaces;
 struct hostapd_data;
 struct sta_info;
 struct hostap_sta_driver_data;
-
-#ifdef CONFIG_FULL_DYNAMIC_VLAN
+struct ieee80211_ht_capabilities;
 struct full_dynamic_vlan;
-#endif /* CONFIG_FULL_DYNAMIC_VLAN */
 
 struct hostapd_probereq_cb {
 	void (*cb)(void *ctx, const u8 *sa, const u8 *ie, size_t ie_len);
@@ -85,6 +83,11 @@ struct hostapd_driver_ops {
 			  int reason);
 	int (*sta_disassoc)(struct hostapd_data *hapd, const u8 *addr,
 			    int reason);
+	int (*sta_add)(const char *ifname, struct hostapd_data *hapd,
+		       const u8 *addr, u16 aid, u16 capability,
+		       const u8 *supp_rates, size_t supp_rates_len,
+		       u16 listen_interval,
+		       const struct ieee80211_ht_capabilities *ht_capab);
 	int (*sta_remove)(struct hostapd_data *hapd, const u8 *addr);
 };
 

+ 6 - 8
hostapd/ieee802_11.c

@@ -16,11 +16,10 @@
 
 #ifndef CONFIG_NATIVE_WINDOWS
 
-#include <net/if.h>
-
 #include "common.h"
 #include "eloop.h"
 #include "crypto/crypto.h"
+#include "drivers/driver.h"
 #include "common/wpa_ctrl.h"
 #include "radius/radius.h"
 #include "radius/radius_client.h"
@@ -35,7 +34,7 @@
 #include "wme.h"
 #include "ap_list.h"
 #include "accounting.h"
-#include "driver_i.h"
+#include "config.h"
 #include "mlme.h"
 
 
@@ -1550,11 +1549,10 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
 		hostapd_get_ht_capab(hapd, sta->ht_capabilities, &ht_cap);
 #endif /* CONFIG_IEEE80211N */
 
-	if (hostapd_sta_add(hapd->conf->iface, hapd, sta->addr, sta->aid,
-			    sta->capability, sta->supported_rates,
-			    sta->supported_rates_len, sta->listen_interval,
-			    sta->flags & WLAN_STA_HT ? &ht_cap : NULL))
-	{
+	if (hapd->drv.sta_add(hapd->conf->iface, hapd, sta->addr, sta->aid,
+			      sta->capability, sta->supported_rates,
+			      sta->supported_rates_len, sta->listen_interval,
+			      sta->flags & WLAN_STA_HT ? &ht_cap : NULL)) {
 		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
 			       HOSTAPD_LEVEL_NOTICE,
 			       "Could not add STA to kernel driver");