Parcourir la source

Remove direct driver calls from tkip_countermeasures.c

Jouni Malinen il y a 15 ans
Parent
commit
6d1278e998
4 fichiers modifiés avec 13 ajouts et 12 suppressions
  1. 10 0
      hostapd/ap_drv_ops.c
  2. 0 9
      hostapd/driver_i.h
  3. 1 0
      hostapd/hostapd.h
  4. 2 3
      hostapd/tkip_countermeasures.c

+ 10 - 0
hostapd/ap_drv_ops.c

@@ -330,6 +330,15 @@ static int hostapd_sta_remove(struct hostapd_data *hapd, const u8 *addr)
 }
 
 
+static int hostapd_set_countermeasures(struct hostapd_data *hapd, int enabled)
+{
+	if (hapd->driver == NULL ||
+	    hapd->driver->hapd_set_countermeasures == NULL)
+		return 0;
+	return hapd->driver->hapd_set_countermeasures(hapd->drv_priv, enabled);
+}
+
+
 void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
 {
 	ops->set_ap_wps_ie = hostapd_set_ap_wps_ie;
@@ -354,4 +363,5 @@ void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
 	ops->sta_disassoc = hostapd_sta_disassoc;
 	ops->sta_add = hostapd_sta_add;
 	ops->sta_remove = hostapd_sta_remove;
+	ops->set_countermeasures = hostapd_set_countermeasures;
 }

+ 0 - 9
hostapd/driver_i.h

@@ -125,15 +125,6 @@ hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len)
 					   buf, len);
 }
 
-static inline int
-hostapd_set_countermeasures(struct hostapd_data *hapd, int enabled)
-{
-	if (hapd->driver == NULL ||
-	    hapd->driver->hapd_set_countermeasures == NULL)
-		return 0;
-	return hapd->driver->hapd_set_countermeasures(hapd->drv_priv, enabled);
-}
-
 static inline int
 hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq, int channel,
 		 int ht_enabled, int sec_channel_offset)

+ 1 - 0
hostapd/hostapd.h

@@ -89,6 +89,7 @@ struct hostapd_driver_ops {
 		       u16 listen_interval,
 		       const struct ieee80211_ht_capabilities *ht_capab);
 	int (*sta_remove)(struct hostapd_data *hapd, const u8 *addr);
+	int (*set_countermeasures)(struct hostapd_data *hapd, int enabled);
 };
 
 /**

+ 2 - 3
hostapd/tkip_countermeasures.c

@@ -17,7 +17,6 @@
 #include "common.h"
 #include "hostapd.h"
 #include "eloop.h"
-#include "driver_i.h"
 #include "sta_info.h"
 #include "mlme.h"
 #include "wpa.h"
@@ -30,7 +29,7 @@ static void ieee80211_tkip_countermeasures_stop(void *eloop_ctx,
 {
 	struct hostapd_data *hapd = eloop_ctx;
 	hapd->tkip_countermeasures = 0;
-	hostapd_set_countermeasures(hapd, 0);
+	hapd->drv.set_countermeasures(hapd, 0);
 	hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
 		       HOSTAPD_LEVEL_INFO, "TKIP countermeasures ended");
 }
@@ -45,7 +44,7 @@ static void ieee80211_tkip_countermeasures_start(struct hostapd_data *hapd)
 
 	wpa_auth_countermeasures_start(hapd->wpa_auth);
 	hapd->tkip_countermeasures = 1;
-	hostapd_set_countermeasures(hapd, 1);
+	hapd->drv.set_countermeasures(hapd, 1);
 	wpa_gtk_rekey(hapd->wpa_auth);
 	eloop_cancel_timeout(ieee80211_tkip_countermeasures_stop, hapd, NULL);
 	eloop_register_timeout(60, 0, ieee80211_tkip_countermeasures_stop,