Added listen interval to hostapd sta_add() driver function
authorJouni Malinen <j@w1.fi>
Thu, 28 Feb 2008 01:45:00 +0000 (17:45 -0800)
committerJouni Malinen <j@w1.fi>
Thu, 28 Feb 2008 01:45:00 +0000 (17:45 -0800)
hostapd/driver.h
hostapd/driver_hostap.c
hostapd/driver_nl80211.c
hostapd/driver_test.c
hostapd/ieee802_11.c

index ffa28ac..8502a74 100644 (file)
@@ -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
index 7817143..c97f2ec 100644 (file)
@@ -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;
index bf00624..eb3270b 100644 (file)
@@ -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)
index dc35bb1..e75614e 100644 (file)
@@ -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);
 
index 0c422ec..e9a674f 100644 (file)
@@ -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");