2010-04-04 10:12:50

by Max Filippov

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Max Filippov <[email protected]>
---
include/linux/ieee80211.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 1998495..910b4bc 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;
+ u16 meshconf_cap;
} __attribute__ ((packed));

/**
--
1.6.2.5



Subject: Re: [PATCH] mac80211: fix ieee80211_meshconf_ie::meshconf_cap type to be u16

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.
>
> Signed-off-by: Max Filippov <[email protected]>
> ---
> include/linux/ieee80211.h | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
> index 1998495..910b4bc 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;
> + u16 meshconf_cap;
> } __attribute__ ((packed));
>
> /**
> --
> 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));

--
Best regards, Nick.

2010-04-05 07:38:13

by Jouni Malinen

[permalink] [raw]
Subject: Re: [PATCH] mac80211: fix ieee80211_meshconf_ie::meshconf_cap type to be u16

On Sun, Apr 04, 2010 at 11:59:52PM +0400, Max Filippov wrote:
> > 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).

> > > - 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.

> 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).

--
Jouni Malinen PGP id EFC895FA

2010-04-04 18:07:23

by Felix Fietkau

[permalink] [raw]
Subject: Re: [PATCH] mac80211: fix ieee80211_meshconf_ie::meshconf_cap type to be u16

On 2010-04-04 3:12 AM, Max Filippov wrote:
> According to the current 802.11s draft mesh capability field
> is 16 bits wide.
>
> Signed-off-by: Max Filippov <[email protected]>
> ---
> include/linux/ieee80211.h | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
> index 1998495..910b4bc 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;
> + 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

2010-04-04 19:59:56

by Max Filippov

[permalink] [raw]
Subject: Re: [PATCH] mac80211: fix ieee80211_meshconf_ie::meshconf_cap type to be u16

> 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.
> >
> > Signed-off-by: Max Filippov <[email protected]>
> > ---
> > include/linux/ieee80211.h | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
> > index 1998495..910b4bc 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;
> > + u16 meshconf_cap;
> > } __attribute__ ((packed));
> >
> > /**
>
> 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));
>
>

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

2010-04-04 19:50:07

by Max Filippov

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Max Filippov <[email protected]>
---
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


2010-04-04 19:39:41

by Max Filippov

[permalink] [raw]
Subject: Re: [PATCH] mac80211: fix ieee80211_meshconf_ie::meshconf_cap type to be u16

> On 2010-04-04 3:12 AM, Max Filippov wrote:
> > According to the current 802.11s draft mesh capability field
> > is 16 bits wide.
> >
> > Signed-off-by: Max Filippov <[email protected]>
> > ---
> > include/linux/ieee80211.h | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
> > index 1998495..910b4bc 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;
> > + 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