Search Linux Wireless

[PATCH] mac80211: fix ieee80211_meshconf_ie::meshconf_cap type to be __le16

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



According to the current 802.11s draft mesh capability field
is 16 bits wide.

Signed-off-by: Max Filippov <jcmvbkbc@xxxxxxxxx>
---
 include/linux/ieee80211.h |    2 +-
 net/mac80211/mesh.c       |   25 ++++++++++++++-----------
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 1998495..6e8d436 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -604,7 +604,7 @@ struct ieee80211_meshconf_ie {
 	u8 meshconf_synch;
 	u8 meshconf_auth;
 	u8 meshconf_form;
-	u8 meshconf_cap;
+	__le16 meshconf_cap;
 } __attribute__ ((packed));
 
 /**
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 61080c5..fead4af 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -99,7 +99,7 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_dat
 bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie)
 {
 	return (ie->mesh_config->meshconf_cap &
-	    MESHCONF_CAPAB_ACCEPT_PLINKS) != 0;
+	    cpu_to_le16(MESHCONF_CAPAB_ACCEPT_PLINKS)) != 0;
 }
 
 /**
@@ -216,6 +216,7 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
 {
 	struct ieee80211_local *local = sdata->local;
 	struct ieee80211_supported_band *sband;
+	struct ieee80211_meshconf_ie *meshconf;
 	u8 *pos;
 	int len, i, rate;
 	u8 neighbors;
@@ -259,33 +260,35 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
 	*pos++ = WLAN_EID_MESH_CONFIG;
 	*pos++ = sizeof(struct ieee80211_meshconf_ie);
 
+	meshconf = (struct ieee80211_meshconf_ie *)pos;
+	pos += sizeof(struct ieee80211_meshconf_ie);
+
 	/* Active path selection protocol ID */
-	*pos++ = sdata->u.mesh.mesh_pp_id;
+	meshconf->meshconf_psel = sdata->u.mesh.mesh_pp_id;
 
 	/* Active path selection metric ID   */
-	*pos++ = sdata->u.mesh.mesh_pm_id;
+	meshconf->meshconf_pmetric = sdata->u.mesh.mesh_pm_id;
 
 	/* Congestion control mode identifier */
-	*pos++ = sdata->u.mesh.mesh_cc_id;
+	meshconf->meshconf_congest = sdata->u.mesh.mesh_cc_id;
 
 	/* Synchronization protocol identifier */
-	*pos++ = sdata->u.mesh.mesh_sp_id;
+	meshconf->meshconf_synch = sdata->u.mesh.mesh_sp_id;
 
 	/* Authentication Protocol identifier */
-	*pos++ = sdata->u.mesh.mesh_auth_id;
+	meshconf->meshconf_auth = sdata->u.mesh.mesh_auth_id;
 
 	/* Mesh Formation Info - number of neighbors */
 	neighbors = atomic_read(&sdata->u.mesh.mshstats.estab_plinks);
 	/* Number of neighbor mesh STAs or 15 whichever is smaller */
 	neighbors = (neighbors > 15) ? 15 : neighbors;
-	*pos++ = neighbors << 1;
+	meshconf->meshconf_form = neighbors << 1;
 
 	/* Mesh capability */
 	sdata->u.mesh.accepting_plinks = mesh_plink_availables(sdata);
-	*pos = MESHCONF_CAPAB_FORWARDING;
-	*pos++ |= sdata->u.mesh.accepting_plinks ?
-	    MESHCONF_CAPAB_ACCEPT_PLINKS : 0x00;
-	*pos++ = 0x00;
+	meshconf->meshconf_cap = cpu_to_le16(MESHCONF_CAPAB_FORWARDING);
+	meshconf->meshconf_cap |= sdata->u.mesh.accepting_plinks ?
+	    cpu_to_le16(MESHCONF_CAPAB_ACCEPT_PLINKS) : 0x00;
 
 	return;
 }
-- 
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux