Browse Source

Added listen interval to hostapd sta_add() driver function

Jouni Malinen 17 years ago
parent
commit
dc366e8e85
5 changed files with 14 additions and 10 deletions
  1. 3 3
      hostapd/driver.h
  2. 2 1
      hostapd/driver_hostap.c
  3. 2 2
      hostapd/driver_nl80211.c
  4. 5 3
      hostapd/driver_test.c
  5. 2 1
      hostapd/ieee802_11.c

+ 3 - 3
hostapd/driver.h

@@ -80,7 +80,7 @@ struct wpa_driver_ops {
 	int (*set_assoc_ap)(void *priv, const u8 *addr);
 	int (*sta_add)(const char *ifname, void *priv, const u8 *addr, u16 aid,
 		       u16 capability, u8 *supp_rates, size_t supp_rates_len,
-		       int flags);
+		       int flags, u16 listen_interval);
 	int (*get_inact_sec)(void *priv, const u8 *addr);
 	int (*sta_clear_stats)(void *priv, const u8 *addr);
 
@@ -359,13 +359,13 @@ hostapd_set_countermeasures(struct hostapd_data *hapd, int enabled)
 static inline int
 hostapd_sta_add(const char *ifname, struct hostapd_data *hapd, const u8 *addr,
 		u16 aid, u16 capability, u8 *supp_rates, size_t supp_rates_len,
-		int flags)
+		int flags, u16 listen_interval)
 {
 	if (hapd->driver == NULL || hapd->driver->sta_add == NULL)
 		return 0;
 	return hapd->driver->sta_add(ifname, hapd->drv_priv, addr, aid,
 				     capability, supp_rates, supp_rates_len,
-				     flags);
+				     flags, listen_interval);
 }
 
 static inline int

+ 2 - 1
hostapd/driver_hostap.c

@@ -655,7 +655,8 @@ static int hostap_read_sta_data(void *priv,
 
 static int hostap_sta_add(const char *ifname, void *priv, const u8 *addr,
 			  u16 aid, u16 capability, u8 *supp_rates,
-			  size_t supp_rates_len, int flags)
+			  size_t supp_rates_len, int flags,
+			  u16 listen_interval)
 {
 	struct hostap_driver_data *drv = priv;
 	struct prism2_hostapd_param param;

+ 2 - 2
hostapd/driver_nl80211.c

@@ -755,7 +755,7 @@ static int i802_send_eapol(void *priv, const u8 *addr, const u8 *data,
 
 static int i802_sta_add(const char *ifname, void *priv, const u8 *addr,
 			u16 aid, u16 capability, u8 *supp_rates,
-			size_t supp_rates_len, int flags)
+			size_t supp_rates_len, int flags, u16 listen_interval)
 {
 	struct i802_driver_data *drv = priv;
 	struct nl_msg *msg;
@@ -774,7 +774,7 @@ static int i802_sta_add(const char *ifname, void *priv, const u8 *addr,
 	NLA_PUT_U16(msg, NL80211_ATTR_STA_AID, aid);
 	NLA_PUT(msg, NL80211_ATTR_STA_SUPPORTED_RATES, supp_rates_len,
 		supp_rates);
-	NLA_PUT_U16(msg, NL80211_ATTR_STA_LISTEN_INTERVAL, 0);
+	NLA_PUT_U16(msg, NL80211_ATTR_STA_LISTEN_INTERVAL, listen_interval);
 
 	ret = nl_send_auto_complete(drv->nl_handle, msg);
 	if (ret < 0)

+ 5 - 3
hostapd/driver_test.c

@@ -993,15 +993,17 @@ static int test_driver_set_sta_vlan(void *priv, const u8 *addr,
 
 static int test_driver_sta_add(const char *ifname, void *priv, const u8 *addr,
 			       u16 aid, u16 capability, u8 *supp_rates,
-			       size_t supp_rates_len, int flags)
+			       size_t supp_rates_len, int flags,
+			       u16 listen_interval)
 {
 	struct test_driver_data *drv = priv;
 	struct test_client_socket *cli;
 	struct test_driver_bss *bss;
 
 	wpa_printf(MSG_DEBUG, "%s(ifname=%s addr=" MACSTR " aid=%d "
-		   "capability=0x%x flags=0x%x",
-		   __func__, ifname, MAC2STR(addr), aid, capability, flags);
+		   "capability=0x%x flags=0x%x listen_interval=%d)",
+		   __func__, ifname, MAC2STR(addr), aid, capability, flags,
+		   listen_interval);
 	wpa_hexdump(MSG_DEBUG, "test_driver_sta_add - supp_rates",
 		    supp_rates, supp_rates_len);
 

+ 2 - 1
hostapd/ieee802_11.c

@@ -1589,7 +1589,8 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
 
 	if (hostapd_sta_add(hapd->conf->iface, hapd, sta->addr, sta->aid,
 			    sta->capability, sta->supported_rates,
-			    sta->supported_rates_len, 0)) {
+			    sta->supported_rates_len, 0, sta->listen_interval))
+	{
 		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
 			       HOSTAPD_LEVEL_NOTICE,
 			       "Could not add STA to kernel driver");