From dc366e8e854c9df0416bea087c99d08ed7ad01d7 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 27 Feb 2008 17:45:00 -0800 Subject: [PATCH] Added listen interval to hostapd sta_add() driver function --- hostapd/driver.h | 6 +++--- hostapd/driver_hostap.c | 3 ++- hostapd/driver_nl80211.c | 4 ++-- hostapd/driver_test.c | 8 +++++--- hostapd/ieee802_11.c | 3 ++- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/hostapd/driver.h b/hostapd/driver.h index ffa28ac66..8502a7478 100644 --- a/hostapd/driver.h +++ b/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 diff --git a/hostapd/driver_hostap.c b/hostapd/driver_hostap.c index 781714305..c97f2ecab 100644 --- a/hostapd/driver_hostap.c +++ b/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; diff --git a/hostapd/driver_nl80211.c b/hostapd/driver_nl80211.c index bf0062490..eb3270bc6 100644 --- a/hostapd/driver_nl80211.c +++ b/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) diff --git a/hostapd/driver_test.c b/hostapd/driver_test.c index dc35bb1ab..e75614e6d 100644 --- a/hostapd/driver_test.c +++ b/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); diff --git a/hostapd/ieee802_11.c b/hostapd/ieee802_11.c index 0c422eca9..e9a674f09 100644 --- a/hostapd/ieee802_11.c +++ b/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");