Skip to contentSkip to conversation

mac80211: fix ieee80211_meshconf_ie::meshconf_cap type to be u16

PATCH In review Max Filippov 4 participants 7 messages Apr 4, 2010 – Apr 5, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: fix ieee80211_meshconf_ie::meshconf_cap type to be u16

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

---
 include/linux/ieee80211.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/ieee80211.h +1 -1
index 1998495..910b4bc 100644
@@ -604,7 +604,7 @@ struct ieee80211_meshconf_ie {
 	u8 meshconf_synch;
 	u8 meshconf_auth;
 	u8 meshconf_form;
-	u8 meshconf_cap;
+	u16 meshconf_cap;
 } __attribute__ ((packed));
 
 /**
Signature · 1 line
1.6.2.5
#1 lore raw
Quoted 13 lines · Max Filippov

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

---
 include/linux/ieee80211.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/ieee80211.h +0 -0
index 1998495..910b4bc 100644

include/linux/ieee80211.h struct ieee80211_meshconf_ie { · line 607

Quoted 5 lines
include/linux/ieee80211.h +1 -1
@@ -604,7 +604,7 @@ struct ieee80211_meshconf_ie {
 	u8 meshconf_synch;
 	u8 meshconf_auth;
 	u8 meshconf_form;
-	u8 meshconf_cap;
+	u16 meshconf_cap;

Shouldn't that be __le16? You probably also have to add le16_to_cpu in the place that accesses this field, otherwise this introduces an endian bug.

- Felix

#2 lore raw
Quoted 9 lines · Max Filippov
Quoted 8 lines

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

---
 include/linux/ieee80211.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 12 lines

include/linux/ieee80211.h struct ieee80211_meshconf_ie { · line 607

Quoted 10 lines
include/linux/ieee80211.h +1 -1
index 1998495..910b4bc 100644
@@ -604,7 +604,7 @@ struct ieee80211_meshconf_ie {
 	u8 meshconf_synch;
 	u8 meshconf_auth;
 	u8 meshconf_form;
-	u8 meshconf_cap;
+	u16 meshconf_cap;

Shouldn't that be __le16? You probably also have to add le16_to_cpu in the place that accesses this field, otherwise this introduces an endian bug.

You're right, __le16. Will fix the way it's filled in mesh_mgmt_ies_add and tested in mesh_peer_accepts_plinks and resend.

Thanks.
-- Max

#3 lore raw

PATCH 1/1 mac80211: fix ieee80211_meshconf_ie::meshconf_cap type to be __le16

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

---
 include/linux/ieee80211.h |    2 +-
 net/mac80211/mesh.c       |   25 ++++++++++++++-----------
 2 files changed, 15 insertions(+), 12 deletions(-)
include/linux/ieee80211.h +1 -1
index 1998495..6e8d436 100644
@@ -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));
 
 /**
net/mac80211/mesh.c +14 -11
index 61080c5..fead4af 100644
@@ -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;
 }
Signature · 1 line
1.6.2.5
#4 lore raw
In reply to Max Filippov
Quoted 29 lines · On Sun, 4 Apr 2010 14:12:44 +0400 Max Filippov <[email protected]> wrote:

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

---
 include/linux/ieee80211.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/ieee80211.h +1 -1
index 1998495..910b4bc 100644
@@ -604,7 +604,7 @@ struct ieee80211_meshconf_ie {
 	u8 meshconf_synch;
 	u8 meshconf_auth;
 	u8 meshconf_form;
-	u8 meshconf_cap;
+	u16 meshconf_cap;
 } __attribute__ ((packed));
 
 /**
Signature · 6 lines
1.6.2.5

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

May be it should be:

struct ieee80211_meshconf_ie {
        u32 meshconf_psel;
        u32 meshconf_pmetric;
        u32 meshconf_congest;
        u32 meshconf_synch;
        u32 meshconf_auth;
        u8 meshconf_form;
        u16 meshconf_cap;
} __attribute__ ((packed));
Signature · 1 line
Best regards, Nick.
#5 lore raw
Quoted 27 lines
Quoted 13 lines · On Sun, 4 Apr 2010 14:12:44 +0400 Max Filippov <[email protected]> wrote:

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

---
 include/linux/ieee80211.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/ieee80211.h +0 -0
index 1998495..910b4bc 100644

include/linux/ieee80211.h struct ieee80211_meshconf_ie { · line 610

Quoted 8 lines
include/linux/ieee80211.h +1 -1
@@ -604,7 +604,7 @@ struct ieee80211_meshconf_ie {
 	u8 meshconf_synch;
 	u8 meshconf_auth;
 	u8 meshconf_form;
-	u8 meshconf_cap;
+	u16 meshconf_cap;
 } __attribute__ ((packed));
 
 /**

May be it should be:

Quoted 11 lines
struct ieee80211_meshconf_ie {
        u32 meshconf_psel;
        u32 meshconf_pmetric;
        u32 meshconf_congest;
        u32 meshconf_synch;
        u32 meshconf_auth;
        u8 meshconf_form;
        u16 meshconf_cap;
} __attribute__ ((packed));

My reference is 802.11s-D4.01, it says (7.3.2.95.1):

Element id: 1 octet,
Length: 1 octet,
Active path selection protocol identifier: 1 octet, Active path selection metric identifier: 1 octet, Congestion control mode identifier: 1 octet, Synchronization protocol identifier: 1 octet, Authentication protocol identifier: 1 octet, Mesh formation info: 1 octet,
Mesh capability: 2 octets.

The length field is set to 8.

Thanks.
-- Max

#6 lore raw
Quoted 5 lines · Max Filippov
Quoted 5 lines
Quoted 2 lines · On Sun, 4 Apr 2010 14:12:44 +0400 Max Filippov <[email protected]> wrote:

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

This does not match with the latest 802.11s draft. Please also specify the draft version in the commit message to make this easier to notice. 802.11s is still a moving target and unless we have a clearly specified older version of the draft that we try to follow, I don't see much point in updating this field based on some older version (D4.0) when the field has already changed since then (D5.0).

Quoted 4 lines
Quoted 2 lines

include/linux/ieee80211.h struct ieee80211_meshconf_ie { · line 607

Quoted 2 lines
include/linux/ieee80211.h +1 -1
-	u8 meshconf_cap;
+	u16 meshconf_cap;

My reference is 802.11s-D4.01, it says (7.3.2.95.1):

That is not the latest draft. IEEE P802.11s/D5.0 7.3.2.96.1 shows the Mesh Capability to be a one octet field.

Quoted 11 lines

Element id: 1 octet,
Length: 1 octet,
Active path selection protocol identifier: 1 octet, Active path selection metric identifier: 1 octet, Congestion control mode identifier: 1 octet, Synchronization protocol identifier: 1 octet, Authentication protocol identifier: 1 octet, Mesh formation info: 1 octet,
Mesh capability: 2 octets.

The length field is set to 8.

Length is still 8, but there is a new field (Mesh Peering Protocol Identifier) before Mesh Formation Info (and Mesh capability is 1 octet).

Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA