aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/nl80211.h9
-rw-r--r--include/net/cfg80211.h8
-rw-r--r--net/mac80211/cfg.c15
-rw-r--r--net/mac80211/ieee80211_i.h4
-rw-r--r--net/mac80211/mesh.c6
-rw-r--r--net/mac80211/mesh_plink.c2
-rw-r--r--net/mac80211/tx.c2
-rw-r--r--net/wireless/mesh.c4
-rw-r--r--net/wireless/nl80211.c11
9 files changed, 31 insertions, 30 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 16eea7229e9..ecf6b68a96d 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -545,6 +545,7 @@ enum nl80211_commands {
545/* source-level API compatibility */ 545/* source-level API compatibility */
546#define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG 546#define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG
547#define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG 547#define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG
548#define NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE NL80211_MESH_SETUP_IE
548 549
549/** 550/**
550 * enum nl80211_attrs - nl80211 netlink attributes 551 * enum nl80211_attrs - nl80211 netlink attributes
@@ -1719,9 +1720,9 @@ enum nl80211_meshconf_params {
1719 * vendor specific path metric or disable it to use the default Airtime 1720 * vendor specific path metric or disable it to use the default Airtime
1720 * metric. 1721 * metric.
1721 * 1722 *
1722 * @NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE: A vendor specific information 1723 * @NL80211_MESH_SETUP_IE: Information elements for this mesh, for instance, a
1723 * element that vendors will use to identify the path selection methods and 1724 * robust security network ie, or a vendor specific information element that
1724 * metrics in use. 1725 * vendors will use to identify the path selection methods and metrics in use.
1725 * 1726 *
1726 * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number 1727 * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number
1727 * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use 1728 * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use
@@ -1730,7 +1731,7 @@ enum nl80211_mesh_setup_params {
1730 __NL80211_MESH_SETUP_INVALID, 1731 __NL80211_MESH_SETUP_INVALID,
1731 NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL, 1732 NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL,
1732 NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC, 1733 NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC,
1733 NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE, 1734 NL80211_MESH_SETUP_IE,
1734 1735
1735 /* keep last */ 1736 /* keep last */
1736 __NL80211_MESH_SETUP_ATTR_AFTER_LAST, 1737 __NL80211_MESH_SETUP_ATTR_AFTER_LAST,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index ba7384acf4e..1d02ddf5a8a 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -689,8 +689,8 @@ struct mesh_config {
689 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 689 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
690 * @path_sel_proto: which path selection protocol to use 690 * @path_sel_proto: which path selection protocol to use
691 * @path_metric: which metric to use 691 * @path_metric: which metric to use
692 * @vendor_ie: vendor information elements (optional) 692 * @ie: vendor information elements (optional)
693 * @vendor_ie_len: length of vendor information elements 693 * @ie_len: length of vendor information elements
694 * 694 *
695 * These parameters are fixed when the mesh is created. 695 * These parameters are fixed when the mesh is created.
696 */ 696 */
@@ -699,8 +699,8 @@ struct mesh_setup {
699 u8 mesh_id_len; 699 u8 mesh_id_len;
700 u8 path_sel_proto; 700 u8 path_sel_proto;
701 u8 path_metric; 701 u8 path_metric;
702 const u8 *vendor_ie; 702 const u8 *ie;
703 u8 vendor_ie_len; 703 u8 ie_len;
704}; 704};
705 705
706/** 706/**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index bf5d28da46e..d9428afd8bf 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1034,26 +1034,25 @@ static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh,
1034 u8 *new_ie; 1034 u8 *new_ie;
1035 const u8 *old_ie; 1035 const u8 *old_ie;
1036 1036
1037 /* first allocate the new vendor information element */ 1037 /* allocate information elements */
1038 new_ie = NULL; 1038 new_ie = NULL;
1039 old_ie = ifmsh->vendor_ie; 1039 old_ie = ifmsh->ie;
1040 1040
1041 ifmsh->vendor_ie_len = setup->vendor_ie_len; 1041 if (setup->ie_len) {
1042 if (setup->vendor_ie_len) { 1042 new_ie = kmemdup(setup->ie, setup->ie_len,
1043 new_ie = kmemdup(setup->vendor_ie, setup->vendor_ie_len,
1044 GFP_KERNEL); 1043 GFP_KERNEL);
1045 if (!new_ie) 1044 if (!new_ie)
1046 return -ENOMEM; 1045 return -ENOMEM;
1047 } 1046 }
1047 ifmsh->ie_len = setup->ie_len;
1048 ifmsh->ie = new_ie;
1049 kfree(old_ie);
1048 1050
1049 /* now copy the rest of the setup parameters */ 1051 /* now copy the rest of the setup parameters */
1050 ifmsh->mesh_id_len = setup->mesh_id_len; 1052 ifmsh->mesh_id_len = setup->mesh_id_len;
1051 memcpy(ifmsh->mesh_id, setup->mesh_id, ifmsh->mesh_id_len); 1053 memcpy(ifmsh->mesh_id, setup->mesh_id, ifmsh->mesh_id_len);
1052 ifmsh->mesh_pp_id = setup->path_sel_proto; 1054 ifmsh->mesh_pp_id = setup->path_sel_proto;
1053 ifmsh->mesh_pm_id = setup->path_metric; 1055 ifmsh->mesh_pm_id = setup->path_metric;
1054 ifmsh->vendor_ie = new_ie;
1055
1056 kfree(old_ie);
1057 1056
1058 return 0; 1057 return 0;
1059} 1058}
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 6eb2c8523ee..6450100594b 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -488,8 +488,8 @@ struct ieee80211_if_mesh {
488 struct mesh_config mshcfg; 488 struct mesh_config mshcfg;
489 u32 mesh_seqnum; 489 u32 mesh_seqnum;
490 bool accepting_plinks; 490 bool accepting_plinks;
491 const u8 *vendor_ie; 491 const u8 *ie;
492 u8 vendor_ie_len; 492 u8 ie_len;
493}; 493};
494 494
495#ifdef CONFIG_MAC80211_MESH 495#ifdef CONFIG_MAC80211_MESH
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 2a57cc02c61..1c244c0c766 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -279,9 +279,9 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
279 MESHCONF_CAPAB_ACCEPT_PLINKS : 0x00; 279 MESHCONF_CAPAB_ACCEPT_PLINKS : 0x00;
280 *pos++ = 0x00; 280 *pos++ = 0x00;
281 281
282 if (sdata->u.mesh.vendor_ie) { 282 if (sdata->u.mesh.ie) {
283 int len = sdata->u.mesh.vendor_ie_len; 283 int len = sdata->u.mesh.ie_len;
284 const u8 *data = sdata->u.mesh.vendor_ie; 284 const u8 *data = sdata->u.mesh.ie;
285 if (skb_tailroom(skb) > len) 285 if (skb_tailroom(skb) > len)
286 memcpy(skb_put(skb, len), data, len); 286 memcpy(skb_put(skb, len), data, len);
287 } 287 }
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 44b53931ba5..c705b20e1ac 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -161,7 +161,7 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
161 __le16 reason) { 161 __le16 reason) {
162 struct ieee80211_local *local = sdata->local; 162 struct ieee80211_local *local = sdata->local;
163 struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400 + 163 struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400 +
164 sdata->u.mesh.vendor_ie_len); 164 sdata->u.mesh.ie_len);
165 struct ieee80211_mgmt *mgmt; 165 struct ieee80211_mgmt *mgmt;
166 bool include_plid = false; 166 bool include_plid = false;
167 static const u8 meshpeeringproto[] = { 0x00, 0x0F, 0xAC, 0x2A }; 167 static const u8 meshpeeringproto[] = { 0x00, 0x0F, 0xAC, 0x2A };
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index ce4596ed126..17b10be31f5 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2262,7 +2262,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
2262 2262
2263 /* headroom, head length, tail length and maximum TIM length */ 2263 /* headroom, head length, tail length and maximum TIM length */
2264 skb = dev_alloc_skb(local->tx_headroom + 400 + 2264 skb = dev_alloc_skb(local->tx_headroom + 400 +
2265 sdata->u.mesh.vendor_ie_len); 2265 sdata->u.mesh.ie_len);
2266 if (!skb) 2266 if (!skb)
2267 goto out; 2267 goto out;
2268 2268
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
index 73e39c171ff..0d4b2260f96 100644
--- a/net/wireless/mesh.c
+++ b/net/wireless/mesh.c
@@ -53,8 +53,8 @@ const struct mesh_config default_mesh_config = {
53const struct mesh_setup default_mesh_setup = { 53const struct mesh_setup default_mesh_setup = {
54 .path_sel_proto = IEEE80211_PATH_PROTOCOL_HWMP, 54 .path_sel_proto = IEEE80211_PATH_PROTOCOL_HWMP,
55 .path_metric = IEEE80211_PATH_METRIC_AIRTIME, 55 .path_metric = IEEE80211_PATH_METRIC_AIRTIME,
56 .vendor_ie = NULL, 56 .ie = NULL,
57 .vendor_ie_len = 0, 57 .ie_len = 0,
58}; 58};
59 59
60int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev, 60int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 297d7ce4117..ccd825a5857 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2823,7 +2823,7 @@ static const struct nla_policy
2823 nl80211_mesh_setup_params_policy[NL80211_MESH_SETUP_ATTR_MAX+1] = { 2823 nl80211_mesh_setup_params_policy[NL80211_MESH_SETUP_ATTR_MAX+1] = {
2824 [NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL] = { .type = NLA_U8 }, 2824 [NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL] = { .type = NLA_U8 },
2825 [NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC] = { .type = NLA_U8 }, 2825 [NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC] = { .type = NLA_U8 },
2826 [NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE] = { .type = NLA_BINARY, 2826 [NL80211_MESH_SETUP_IE] = { .type = NLA_BINARY,
2827 .len = IEEE80211_MAX_DATA_LEN }, 2827 .len = IEEE80211_MAX_DATA_LEN },
2828}; 2828};
2829 2829
@@ -2925,13 +2925,14 @@ static int nl80211_parse_mesh_setup(struct genl_info *info,
2925 IEEE80211_PATH_METRIC_VENDOR : 2925 IEEE80211_PATH_METRIC_VENDOR :
2926 IEEE80211_PATH_METRIC_AIRTIME; 2926 IEEE80211_PATH_METRIC_AIRTIME;
2927 2927
2928 if (tb[NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE]) { 2928
2929 if (tb[NL80211_MESH_SETUP_IE]) {
2929 struct nlattr *ieattr = 2930 struct nlattr *ieattr =
2930 tb[NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE]; 2931 tb[NL80211_MESH_SETUP_IE];
2931 if (!is_valid_ie_attr(ieattr)) 2932 if (!is_valid_ie_attr(ieattr))
2932 return -EINVAL; 2933 return -EINVAL;
2933 setup->vendor_ie = nla_data(ieattr); 2934 setup->ie = nla_data(ieattr);
2934 setup->vendor_ie_len = nla_len(ieattr); 2935 setup->ie_len = nla_len(ieattr);
2935 } 2936 }
2936 2937
2937 return 0; 2938 return 0;