Browse Source

Moved TX status processing for STA entries away from driver_*.c

Driver wrappers should not need to know about this level of core hostapd
details.
Jouni Malinen 16 years ago
parent
commit
8607f4c31f
6 changed files with 24 additions and 25 deletions
  1. 2 0
      hostapd/driver.h
  2. 1 12
      hostapd/driver_hostap.c
  3. 1 11
      hostapd/driver_nl80211.c
  4. 18 0
      hostapd/hostapd.c
  5. 1 1
      hostapd/ieee802_1x.c
  6. 1 1
      hostapd/ieee802_1x.h

+ 2 - 0
hostapd/driver.h

@@ -213,5 +213,7 @@ struct wpa_driver_ops {
 
 void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
 			   int reassoc);
+void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
+		       const u8 *buf, size_t len, int ack);
 
 #endif /* DRIVER_H */

+ 1 - 12
hostapd/driver_hostap.c

@@ -143,7 +143,6 @@ static void handle_tx_callback(struct hostap_driver_data *drv, u8 *buf,
 {
 	struct ieee80211_hdr *hdr;
 	u16 fc, type, stype;
-	struct sta_info *sta;
 
 	hdr = (struct ieee80211_hdr *) buf;
 	fc = le_to_host16(hdr->frame_control);
@@ -164,17 +163,7 @@ static void handle_tx_callback(struct hostap_driver_data *drv, u8 *buf,
 	case WLAN_FC_TYPE_DATA:
 		wpa_printf(MSG_DEBUG, "DATA (TX callback) %s",
 			   ok ? "ACK" : "fail");
-		sta = ap_get_sta(drv->hapd, hdr->addr1);
-		if (sta && sta->flags & WLAN_STA_PENDING_POLL) {
-			wpa_printf(MSG_DEBUG, "STA " MACSTR
-				   " %s pending activity poll",
-				   MAC2STR(sta->addr),
-				   ok ? "ACKed" : "did not ACK");
-			if (ok)
-				sta->flags &= ~WLAN_STA_PENDING_POLL;
-		}
-		if (sta)
-			ieee802_1x_tx_status(drv->hapd, sta, buf, len, ok);
+		hostapd_tx_status(drv->hapd, hdr->addr1, buf, len, ok);
 		break;
 	default:
 		printf("unknown TX callback frame type %d\n", type);

+ 1 - 11
hostapd/driver_nl80211.c

@@ -1661,7 +1661,6 @@ static void handle_tx_callback(struct hostapd_data *hapd, u8 *buf, size_t len,
 {
 	struct ieee80211_hdr *hdr;
 	u16 fc, type, stype;
-	struct sta_info *sta;
 
 	hdr = (struct ieee80211_hdr *) buf;
 	fc = le_to_host16(hdr->frame_control);
@@ -1682,16 +1681,7 @@ static void handle_tx_callback(struct hostapd_data *hapd, u8 *buf, size_t len,
 	case WLAN_FC_TYPE_DATA:
 		wpa_printf(MSG_DEBUG, "DATA (TX callback) %s",
 			   ok ? "ACK" : "fail");
-		sta = ap_get_sta(hapd, hdr->addr1);
-		if (sta && sta->flags & WLAN_STA_PENDING_POLL) {
-			wpa_printf(MSG_DEBUG, "STA " MACSTR " %s pending "
-				   "activity poll", MAC2STR(sta->addr),
-				   ok ? "ACKed" : "did not ACK");
-			if (ok)
-				sta->flags &= ~WLAN_STA_PENDING_POLL;
-		}
-		if (sta)
-			ieee802_1x_tx_status(hapd, sta, buf, len, ok);
+		hostapd_tx_status(hapd, hdr->addr1, buf, len, ok);
 		break;
 	default:
 		printf("unknown TX callback frame type %d\n", type);

+ 18 - 0
hostapd/hostapd.c

@@ -260,6 +260,24 @@ void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
 }
 
 
+void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
+		       const u8 *buf, size_t len, int ack)
+{
+	struct sta_info *sta;
+
+	sta = ap_get_sta(hapd, addr);
+	if (sta && sta->flags & WLAN_STA_PENDING_POLL) {
+		wpa_printf(MSG_DEBUG, "STA " MACSTR " %s pending "
+			   "activity poll", MAC2STR(sta->addr),
+			   ack ? "ACKed" : "did not ACK");
+		if (ack)
+			sta->flags &= ~WLAN_STA_PENDING_POLL;
+	}
+	if (sta)
+		ieee802_1x_tx_status(hapd, sta, buf, len, ack);
+}
+
+
 #ifdef EAP_SERVER
 static int hostapd_sim_db_cb_sta(struct hostapd_data *hapd,
 				 struct sta_info *sta, void *ctx)

+ 1 - 1
hostapd/ieee802_1x.c

@@ -1754,7 +1754,7 @@ int ieee802_1x_reconfig(struct hostapd_data *hapd,
 
 
 int ieee802_1x_tx_status(struct hostapd_data *hapd, struct sta_info *sta,
-			 u8 *buf, size_t len, int ack)
+			 const u8 *buf, size_t len, int ack)
 {
 	struct ieee80211_hdr *hdr;
 	struct ieee802_1x_hdr *xhdr;

+ 1 - 1
hostapd/ieee802_1x.h

@@ -62,7 +62,7 @@ int ieee802_1x_reconfig(struct hostapd_data *hapd,
 			struct hostapd_config *oldconf,
 			struct hostapd_bss_config *oldbss);
 int ieee802_1x_tx_status(struct hostapd_data *hapd, struct sta_info *sta,
-			 u8 *buf, size_t len, int ack);
+			 const u8 *buf, size_t len, int ack);
 u8 * ieee802_1x_get_identity(struct eapol_state_machine *sm, size_t *len);
 u8 * ieee802_1x_get_radius_class(struct eapol_state_machine *sm, size_t *len,
 				 int idx);