implement set(IEEE80211_IOC_STA_STATS) for hostapd; for

now just make it clear station statistics (could read
a stat block and assign to caller can do partial changes)

Reviewed by:	avatar (previous version)
MFC after:	1 week
This commit is contained in:
sam 2006-03-27 05:22:35 +00:00
parent e299a61648
commit 4d87d66b1c

View File

@ -2004,6 +2004,31 @@ ieee80211_ioctl_setchanlist(struct ieee80211com *ic, struct ieee80211req *ireq)
return IS_UP_AUTO(ic) ? ENETRESET : 0;
}
static int
ieee80211_ioctl_setstastats(struct ieee80211com *ic, struct ieee80211req *ireq)
{
struct ieee80211_node *ni;
u_int8_t macaddr[IEEE80211_ADDR_LEN];
int error;
/*
* NB: we could copyin ieee80211req_sta_stats so apps
* could make selective changes but that's overkill;
* just clear all stats for now.
*/
if (ireq->i_len < IEEE80211_ADDR_LEN)
return EINVAL;
error = copyin(ireq->i_data, macaddr, IEEE80211_ADDR_LEN);
if (error != 0)
return error;
ni = ieee80211_find_node(&ic->ic_sta, macaddr);
if (ni == NULL)
return EINVAL; /* XXX */
memset(&ni->ni_stats, 0, sizeof(ni->ni_stats));
ieee80211_free_node(ni);
return 0;
}
static int
ieee80211_ioctl_setstatxpow(struct ieee80211com *ic, struct ieee80211req *ireq)
{
@ -2498,6 +2523,9 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
case IEEE80211_IOC_MACCMD:
error = ieee80211_ioctl_setmaccmd(ic, ireq);
break;
case IEEE80211_IOC_STA_STATS:
error = ieee80211_ioctl_setstastats(ic, ireq);
break;
case IEEE80211_IOC_STA_TXPOW:
error = ieee80211_ioctl_setstatxpow(ic, ireq);
break;