mac80211/cfg80211: Add BSS configuration options for AP mode
This change adds a new cfg80211 command, NL80211_CMD_SET_BSS, to allow AP mode BSS parameters to be changed from user space (e.g., hostapd). The drivers using mac80211 are expected to be modified with separate changes to use the new BSS info parameter for short slot time in the bss_info_changed() handler. Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
committed by
John W. Linville
parent
7f93ea3e24
commit
9f1ba9062e
@@ -87,6 +87,10 @@ static struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] __read_mostly = {
|
||||
[NL80211_ATTR_MESH_ID] = { .type = NLA_BINARY,
|
||||
.len = IEEE80211_MAX_MESH_ID_LEN },
|
||||
[NL80211_ATTR_MPATH_NEXT_HOP] = { .type = NLA_U32 },
|
||||
|
||||
[NL80211_ATTR_BSS_CTS_PROT] = { .type = NLA_U8 },
|
||||
[NL80211_ATTR_BSS_SHORT_PREAMBLE] = { .type = NLA_U8 },
|
||||
[NL80211_ATTR_BSS_SHORT_SLOT_TIME] = { .type = NLA_U8 },
|
||||
};
|
||||
|
||||
/* message building helper */
|
||||
@@ -1525,6 +1529,48 @@ static int nl80211_del_mpath(struct sk_buff *skb, struct genl_info *info)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct cfg80211_registered_device *drv;
|
||||
int err;
|
||||
struct net_device *dev;
|
||||
struct bss_parameters params;
|
||||
|
||||
memset(¶ms, 0, sizeof(params));
|
||||
/* default to not changing parameters */
|
||||
params.use_cts_prot = -1;
|
||||
params.use_short_preamble = -1;
|
||||
params.use_short_slot_time = -1;
|
||||
|
||||
if (info->attrs[NL80211_ATTR_BSS_CTS_PROT])
|
||||
params.use_cts_prot =
|
||||
nla_get_u8(info->attrs[NL80211_ATTR_BSS_CTS_PROT]);
|
||||
if (info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE])
|
||||
params.use_short_preamble =
|
||||
nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE]);
|
||||
if (info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME])
|
||||
params.use_short_slot_time =
|
||||
nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]);
|
||||
|
||||
err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (!drv->ops->change_bss) {
|
||||
err = -EOPNOTSUPP;
|
||||
goto out;
|
||||
}
|
||||
|
||||
rtnl_lock();
|
||||
err = drv->ops->change_bss(&drv->wiphy, dev, ¶ms);
|
||||
rtnl_unlock();
|
||||
|
||||
out:
|
||||
cfg80211_put_dev(drv);
|
||||
dev_put(dev);
|
||||
return err;
|
||||
}
|
||||
|
||||
static struct genl_ops nl80211_ops[] = {
|
||||
{
|
||||
.cmd = NL80211_CMD_GET_WIPHY,
|
||||
@@ -1656,6 +1702,12 @@ static struct genl_ops nl80211_ops[] = {
|
||||
.policy = nl80211_policy,
|
||||
.flags = GENL_ADMIN_PERM,
|
||||
},
|
||||
{
|
||||
.cmd = NL80211_CMD_SET_BSS,
|
||||
.doit = nl80211_set_bss,
|
||||
.policy = nl80211_policy,
|
||||
.flags = GENL_ADMIN_PERM,
|
||||
},
|
||||
};
|
||||
|
||||
/* multicast groups */
|
||||
|
||||
Reference in New Issue
Block a user