Commit 581a8b0f authored by Javier Cardona's avatar Javier Cardona Committed by John W. Linville

nl80211: rename NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE

To NL80211_MESH_SETUP_IE. This reflects our ability to insert any ie
into a mesh beacon, not simply path selection ies.
Signed-off-by: default avatarJavier Cardona <javier@cozybit.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent a22e93f5
...@@ -545,6 +545,7 @@ enum nl80211_commands { ...@@ -545,6 +545,7 @@ enum nl80211_commands {
/* source-level API compatibility */ /* source-level API compatibility */
#define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG #define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG
#define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG #define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG
#define NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE NL80211_MESH_SETUP_IE
/** /**
* enum nl80211_attrs - nl80211 netlink attributes * enum nl80211_attrs - nl80211 netlink attributes
...@@ -1719,9 +1720,9 @@ enum nl80211_meshconf_params { ...@@ -1719,9 +1720,9 @@ enum nl80211_meshconf_params {
* vendor specific path metric or disable it to use the default Airtime * vendor specific path metric or disable it to use the default Airtime
* metric. * metric.
* *
* @NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE: A vendor specific information * @NL80211_MESH_SETUP_IE: Information elements for this mesh, for instance, a
* element that vendors will use to identify the path selection methods and * robust security network ie, or a vendor specific information element that
* metrics in use. * vendors will use to identify the path selection methods and metrics in use.
* *
* @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number
* @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use
...@@ -1730,7 +1731,7 @@ enum nl80211_mesh_setup_params { ...@@ -1730,7 +1731,7 @@ enum nl80211_mesh_setup_params {
__NL80211_MESH_SETUP_INVALID, __NL80211_MESH_SETUP_INVALID,
NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL, NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL,
NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC, NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC,
NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE, NL80211_MESH_SETUP_IE,
/* keep last */ /* keep last */
__NL80211_MESH_SETUP_ATTR_AFTER_LAST, __NL80211_MESH_SETUP_ATTR_AFTER_LAST,
......
...@@ -689,8 +689,8 @@ struct mesh_config { ...@@ -689,8 +689,8 @@ struct mesh_config {
* @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
* @path_sel_proto: which path selection protocol to use * @path_sel_proto: which path selection protocol to use
* @path_metric: which metric to use * @path_metric: which metric to use
* @vendor_ie: vendor information elements (optional) * @ie: vendor information elements (optional)
* @vendor_ie_len: length of vendor information elements * @ie_len: length of vendor information elements
* *
* These parameters are fixed when the mesh is created. * These parameters are fixed when the mesh is created.
*/ */
...@@ -699,8 +699,8 @@ struct mesh_setup { ...@@ -699,8 +699,8 @@ struct mesh_setup {
u8 mesh_id_len; u8 mesh_id_len;
u8 path_sel_proto; u8 path_sel_proto;
u8 path_metric; u8 path_metric;
const u8 *vendor_ie; const u8 *ie;
u8 vendor_ie_len; u8 ie_len;
}; };
/** /**
......
...@@ -1034,26 +1034,25 @@ static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh, ...@@ -1034,26 +1034,25 @@ static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh,
u8 *new_ie; u8 *new_ie;
const u8 *old_ie; const u8 *old_ie;
/* first allocate the new vendor information element */ /* allocate information elements */
new_ie = NULL; new_ie = NULL;
old_ie = ifmsh->vendor_ie; old_ie = ifmsh->ie;
ifmsh->vendor_ie_len = setup->vendor_ie_len; if (setup->ie_len) {
if (setup->vendor_ie_len) { new_ie = kmemdup(setup->ie, setup->ie_len,
new_ie = kmemdup(setup->vendor_ie, setup->vendor_ie_len,
GFP_KERNEL); GFP_KERNEL);
if (!new_ie) if (!new_ie)
return -ENOMEM; return -ENOMEM;
} }
ifmsh->ie_len = setup->ie_len;
ifmsh->ie = new_ie;
kfree(old_ie);
/* now copy the rest of the setup parameters */ /* now copy the rest of the setup parameters */
ifmsh->mesh_id_len = setup->mesh_id_len; ifmsh->mesh_id_len = setup->mesh_id_len;
memcpy(ifmsh->mesh_id, setup->mesh_id, ifmsh->mesh_id_len); memcpy(ifmsh->mesh_id, setup->mesh_id, ifmsh->mesh_id_len);
ifmsh->mesh_pp_id = setup->path_sel_proto; ifmsh->mesh_pp_id = setup->path_sel_proto;
ifmsh->mesh_pm_id = setup->path_metric; ifmsh->mesh_pm_id = setup->path_metric;
ifmsh->vendor_ie = new_ie;
kfree(old_ie);
return 0; return 0;
} }
......
...@@ -488,8 +488,8 @@ struct ieee80211_if_mesh { ...@@ -488,8 +488,8 @@ struct ieee80211_if_mesh {
struct mesh_config mshcfg; struct mesh_config mshcfg;
u32 mesh_seqnum; u32 mesh_seqnum;
bool accepting_plinks; bool accepting_plinks;
const u8 *vendor_ie; const u8 *ie;
u8 vendor_ie_len; u8 ie_len;
}; };
#ifdef CONFIG_MAC80211_MESH #ifdef CONFIG_MAC80211_MESH
......
...@@ -279,9 +279,9 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) ...@@ -279,9 +279,9 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
MESHCONF_CAPAB_ACCEPT_PLINKS : 0x00; MESHCONF_CAPAB_ACCEPT_PLINKS : 0x00;
*pos++ = 0x00; *pos++ = 0x00;
if (sdata->u.mesh.vendor_ie) { if (sdata->u.mesh.ie) {
int len = sdata->u.mesh.vendor_ie_len; int len = sdata->u.mesh.ie_len;
const u8 *data = sdata->u.mesh.vendor_ie; const u8 *data = sdata->u.mesh.ie;
if (skb_tailroom(skb) > len) if (skb_tailroom(skb) > len)
memcpy(skb_put(skb, len), data, len); memcpy(skb_put(skb, len), data, len);
} }
......
...@@ -161,7 +161,7 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, ...@@ -161,7 +161,7 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
__le16 reason) { __le16 reason) {
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400 + struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400 +
sdata->u.mesh.vendor_ie_len); sdata->u.mesh.ie_len);
struct ieee80211_mgmt *mgmt; struct ieee80211_mgmt *mgmt;
bool include_plid = false; bool include_plid = false;
static const u8 meshpeeringproto[] = { 0x00, 0x0F, 0xAC, 0x2A }; static const u8 meshpeeringproto[] = { 0x00, 0x0F, 0xAC, 0x2A };
......
...@@ -2262,7 +2262,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, ...@@ -2262,7 +2262,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
/* headroom, head length, tail length and maximum TIM length */ /* headroom, head length, tail length and maximum TIM length */
skb = dev_alloc_skb(local->tx_headroom + 400 + skb = dev_alloc_skb(local->tx_headroom + 400 +
sdata->u.mesh.vendor_ie_len); sdata->u.mesh.ie_len);
if (!skb) if (!skb)
goto out; goto out;
......
...@@ -53,8 +53,8 @@ const struct mesh_config default_mesh_config = { ...@@ -53,8 +53,8 @@ const struct mesh_config default_mesh_config = {
const struct mesh_setup default_mesh_setup = { const struct mesh_setup default_mesh_setup = {
.path_sel_proto = IEEE80211_PATH_PROTOCOL_HWMP, .path_sel_proto = IEEE80211_PATH_PROTOCOL_HWMP,
.path_metric = IEEE80211_PATH_METRIC_AIRTIME, .path_metric = IEEE80211_PATH_METRIC_AIRTIME,
.vendor_ie = NULL, .ie = NULL,
.vendor_ie_len = 0, .ie_len = 0,
}; };
int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev, int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
......
...@@ -2823,7 +2823,7 @@ static const struct nla_policy ...@@ -2823,7 +2823,7 @@ static const struct nla_policy
nl80211_mesh_setup_params_policy[NL80211_MESH_SETUP_ATTR_MAX+1] = { nl80211_mesh_setup_params_policy[NL80211_MESH_SETUP_ATTR_MAX+1] = {
[NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL] = { .type = NLA_U8 }, [NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL] = { .type = NLA_U8 },
[NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC] = { .type = NLA_U8 }, [NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC] = { .type = NLA_U8 },
[NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE] = { .type = NLA_BINARY, [NL80211_MESH_SETUP_IE] = { .type = NLA_BINARY,
.len = IEEE80211_MAX_DATA_LEN }, .len = IEEE80211_MAX_DATA_LEN },
}; };
...@@ -2925,13 +2925,14 @@ static int nl80211_parse_mesh_setup(struct genl_info *info, ...@@ -2925,13 +2925,14 @@ static int nl80211_parse_mesh_setup(struct genl_info *info,
IEEE80211_PATH_METRIC_VENDOR : IEEE80211_PATH_METRIC_VENDOR :
IEEE80211_PATH_METRIC_AIRTIME; IEEE80211_PATH_METRIC_AIRTIME;
if (tb[NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE]) {
if (tb[NL80211_MESH_SETUP_IE]) {
struct nlattr *ieattr = struct nlattr *ieattr =
tb[NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE]; tb[NL80211_MESH_SETUP_IE];
if (!is_valid_ie_attr(ieattr)) if (!is_valid_ie_attr(ieattr))
return -EINVAL; return -EINVAL;
setup->vendor_ie = nla_data(ieattr); setup->ie = nla_data(ieattr);
setup->vendor_ie_len = nla_len(ieattr); setup->ie_len = nla_len(ieattr);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment