This patch allows maximal number of allowed sta/ap interfaces to be get/set by sysfs (/sys/class/ieee80211/phyX/max_iface_count).
Signed-off-by: Jiri Benc <[EMAIL PROTECTED]> --- net/d80211/ieee80211_i.h | 2 ++ net/d80211/ieee80211_ioctl.c | 15 +++++++++++---- net/d80211/ieee80211_sysfs.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) a07d851e43ae3562a1a0ab913d69ae0c759616c9 diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h index e5a544c..48aceca 100644 --- a/net/d80211/ieee80211_i.h +++ b/net/d80211/ieee80211_i.h @@ -552,6 +552,8 @@ int ieee80211_if_remove_sta(struct net_d /* ieee80211_ioctl.c */ int ieee80211_set_compression(struct ieee80211_local *local, struct net_device *dev, struct sta_info *sta); +int ieee80211_set_bss_count(struct net_device *dev, int new_count, + u8 *bssid_mask); /* ieee80211_sta.c */ void ieee80211_sta_timer(unsigned long ptr); void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb, diff --git a/net/d80211/ieee80211_ioctl.c b/net/d80211/ieee80211_ioctl.c index 7558299..713664b 100644 --- a/net/d80211/ieee80211_ioctl.c +++ b/net/d80211/ieee80211_ioctl.c @@ -1190,13 +1190,12 @@ static int ieee80211_ioctl_get_tx_stats( } -static int ieee80211_ioctl_set_bss(struct net_device *dev, - struct prism2_hostapd_param *param) +int ieee80211_set_bss_count(struct net_device *dev, int new_count, + u8 *bssid_mask) { struct ieee80211_local *local = dev->priv; struct ieee80211_conf *conf = ieee80211_get_hw_conf(dev); int i, bss_count; - int new_count = param->u.set_bss.bss_count; struct net_device **bss_devs, **prev; struct net_device **sta_devs, **prev_sta_devs; @@ -1229,7 +1228,8 @@ static int ieee80211_ioctl_set_bss(struc memset(&bss_devs[bss_count], 0, (new_count - bss_count) * sizeof(struct net_device *)); - memcpy(conf->bssid_mask, param->u.set_bss.bssid_mask, ETH_ALEN); + if (bssid_mask) + memcpy(conf->bssid_mask, bssid_mask, ETH_ALEN); prev = local->bss_devs; local->bss_devs = bss_devs; @@ -1249,6 +1249,13 @@ static int ieee80211_ioctl_set_bss(struc return ieee80211_hw_config(dev); } +static int ieee80211_ioctl_set_bss(struct net_device *dev, + struct prism2_hostapd_param *param) +{ + return ieee80211_set_bss_count(dev, param->u.set_bss.bss_count, + param->u.set_bss.bssid_mask); +} + static int ieee80211_ioctl_set_channel_flag(struct net_device *dev, struct prism2_hostapd_param *param) diff --git a/net/d80211/ieee80211_sysfs.c b/net/d80211/ieee80211_sysfs.c index 4a4abd7..b6b985d 100644 --- a/net/d80211/ieee80211_sysfs.c +++ b/net/d80211/ieee80211_sysfs.c @@ -52,6 +52,33 @@ static ssize_t store_remove_iface(struct return res < 0 ? res : len; } +static ssize_t show_max_iface_count(struct class_device *dev, + char *buf) +{ + struct ieee80211_local *local = to_ieee80211_local(dev); + + return sprintf(buf, "%dn", local->conf.bss_count); +} + +static ssize_t store_max_iface_count(struct class_device *dev, + const char *buf, size_t len) +{ + struct ieee80211_local *local = to_ieee80211_local(dev); + unsigned long new_count; + char *endp; + int res; + + if (!capable(CAP_NET_ADMIN)) + return -EPERM; + new_count = simple_strtoul(buf, &endp, 0); + if (endp == buf) + return -EINVAL; + rtnl_lock(); + res = ieee80211_set_bss_count(local->mdev, new_count, NULL); + rtnl_unlock(); + return res < 0 ? res : len; +} + #ifdef CONFIG_HOTPLUG static int ieee80211_uevent(struct class_device *cd, char **envp, int num_envp, char *buf, int size) @@ -72,6 +99,8 @@ static int ieee80211_uevent(struct class static struct class_device_attribute ieee80211_class_dev_attrs[] = { __ATTR(add_iface, S_IWUSR, NULL, store_add_iface), __ATTR(remove_iface, S_IWUSR, NULL, store_remove_iface), + __ATTR(max_iface_count, S_IRUGO | S_IWUSR, + show_max_iface_count, store_max_iface_count), }; static struct class ieee80211_class = { -- 1.1.6 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html