Replace deprecated add_sta() with add_sta2()

This commit is contained in:
Jouni Malinen 2009-03-25 16:55:09 +02:00 committed by Jouni Malinen
parent 909a6ef00c
commit fb86519d12
5 changed files with 35 additions and 48 deletions

View file

@ -122,11 +122,7 @@ struct wpa_driver_ops {
int (*set_countermeasures)(void *priv, int enabled);
int (*send_mgmt_frame)(void *priv, const void *msg, size_t len,
int flags);
/* note: sta_add() is deprecated; use sta_add2() instead */
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, u16 listen_interval);
int (*sta_add2)(const char *ifname, void *priv,
int (*sta_add)(const char *ifname, void *priv,
struct hostapd_sta_add_params *params);
int (*get_inact_sec)(void *priv, const u8 *addr);
int (*sta_clear_stats)(void *priv, const u8 *addr);

View file

@ -641,10 +641,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,
u16 listen_interval)
static int hostap_sta_add(const char *ifname, void *priv,
struct hostapd_sta_add_params *params)
{
struct hostap_driver_data *drv = priv;
struct prism2_hostapd_param param;
@ -656,22 +654,22 @@ static int hostap_sta_add(const char *ifname, void *priv, const u8 *addr,
#define WLAN_RATE_5M5 BIT(2)
#define WLAN_RATE_11M BIT(3)
for (i = 0; i < supp_rates_len; i++) {
if ((supp_rates[i] & 0x7f) == 2)
for (i = 0; i < params->supp_rates_len; i++) {
if ((params->supp_rates[i] & 0x7f) == 2)
tx_supp_rates |= WLAN_RATE_1M;
if ((supp_rates[i] & 0x7f) == 4)
if ((params->supp_rates[i] & 0x7f) == 4)
tx_supp_rates |= WLAN_RATE_2M;
if ((supp_rates[i] & 0x7f) == 11)
if ((params->supp_rates[i] & 0x7f) == 11)
tx_supp_rates |= WLAN_RATE_5M5;
if ((supp_rates[i] & 0x7f) == 22)
if ((params->supp_rates[i] & 0x7f) == 22)
tx_supp_rates |= WLAN_RATE_11M;
}
memset(&param, 0, sizeof(param));
param.cmd = PRISM2_HOSTAPD_ADD_STA;
memcpy(param.sta_addr, addr, ETH_ALEN);
param.u.add_sta.aid = aid;
param.u.add_sta.capability = capability;
memcpy(param.sta_addr, params->addr, ETH_ALEN);
param.u.add_sta.aid = params->aid;
param.u.add_sta.capability = params->capability;
param.u.add_sta.tx_supp_rates = tx_supp_rates;
return hostapd_ioctl(drv, &param, sizeof(param));
}

View file

@ -212,11 +212,13 @@ hostapd_sta_add(const char *ifname, struct hostapd_data *hapd, const u8 *addr,
size_t supp_rates_len, int flags, u16 listen_interval,
const struct ht_cap_ie *ht_capabilities)
{
struct hostapd_sta_add_params params;
if (hapd->driver == NULL)
return 0;
if (hapd->driver->sta_add == NULL)
return 0;
if (hapd->driver->sta_add2) {
struct hostapd_sta_add_params params;
os_memset(&params, 0, sizeof(params));
params.addr = addr;
params.aid = aid;
@ -226,15 +228,7 @@ hostapd_sta_add(const char *ifname, struct hostapd_data *hapd, const u8 *addr,
params.flags = flags;
params.listen_interval = listen_interval;
params.ht_capabilities = ht_capabilities;
return hapd->driver->sta_add2(ifname, hapd->drv_priv, &params);
}
if (hapd->driver->sta_add == NULL)
return 0;
return hapd->driver->sta_add(ifname, hapd->drv_priv, addr, aid,
capability, (u8 *) supp_rates,
supp_rates_len,
flags, listen_interval);
return hapd->driver->sta_add(ifname, hapd->drv_priv, &params);
}
static inline int

View file

@ -844,7 +844,7 @@ static int i802_send_eapol(void *priv, const u8 *addr, const u8 *data,
}
static int i802_sta_add2(const char *ifname, void *priv,
static int i802_sta_add(const char *ifname, void *priv,
struct hostapd_sta_add_params *params)
{
struct i802_driver_data *drv = priv;
@ -3117,7 +3117,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.sta_disassoc = i802_sta_disassoc,
.sta_remove = i802_sta_remove,
.send_mgmt_frame = i802_send_mgmt_frame,
.sta_add2 = i802_sta_add2,
.sta_add = i802_sta_add,
.get_inact_sec = i802_get_inact_sec,
.sta_clear_stats = i802_sta_clear_stats,
.set_freq = i802_set_freq,

View file

@ -1029,10 +1029,8 @@ 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,
u16 listen_interval)
static int test_driver_sta_add(const char *ifname, void *priv,
struct hostapd_sta_add_params *params)
{
struct test_driver_data *drv = priv;
struct test_client_socket *cli;
@ -1040,14 +1038,15 @@ static int test_driver_sta_add(const char *ifname, void *priv, const u8 *addr,
wpa_printf(MSG_DEBUG, "%s(ifname=%s addr=" MACSTR " aid=%d "
"capability=0x%x flags=0x%x listen_interval=%d)",
__func__, ifname, MAC2STR(addr), aid, capability, flags,
listen_interval);
__func__, ifname, MAC2STR(params->addr), params->aid,
params->capability, params->flags,
params->listen_interval);
wpa_hexdump(MSG_DEBUG, "test_driver_sta_add - supp_rates",
supp_rates, supp_rates_len);
params->supp_rates, params->supp_rates_len);
cli = drv->cli;
while (cli) {
if (memcmp(cli->addr, addr, ETH_ALEN) == 0)
if (os_memcmp(cli->addr, params->addr, ETH_ALEN) == 0)
break;
cli = cli->next;
}