diff mbox

mac80211: fix the problem of unicast forwarding from DS to DS in Mesh

Message ID 1361186207-1390-1-git-send-email-yeohchunyeow@gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Chun-Yeow Yeoh Feb. 18, 2013, 11:16 a.m. UTC
Unicast frame with unknown forwarding information always trigger
the path discovery assuming destination is always located inside the
MBSS. This patch allows the forwarding to look for mesh gate if path
discovery inside the MBSS has failed.

Reported-by: Cedric Voncken <cedric.voncken@acksys.fr>
Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
---
 net/mac80211/tx.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

Comments

Thomas Pedersen Feb. 18, 2013, 6:51 p.m. UTC | #1
On Mon, Feb 18, 2013 at 3:16 AM, Chun-Yeow Yeoh <yeohchunyeow@gmail.com> wrote:
> Unicast frame with unknown forwarding information always trigger
> the path discovery assuming destination is always located inside the
> MBSS. This patch allows the forwarding to look for mesh gate if path
> discovery inside the MBSS has failed.
>
> Reported-by: Cedric Voncken <cedric.voncken@acksys.fr>
> Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
> ---
>  net/mac80211/tx.c |   15 ++++++++++++---
>  1 files changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
> index 5b9602b..dce3af3 100644
> --- a/net/mac80211/tx.c
> +++ b/net/mac80211/tx.c
> @@ -1844,9 +1844,18 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
>                 }
>
>                 if (!is_multicast_ether_addr(skb->data)) {
> -                       mpath = mesh_path_lookup(sdata, skb->data);
> -                       if (!mpath)
> -                               mppath = mpp_path_lookup(sdata, skb->data);
> +                       struct sta_info *next_hop;
> +
> +                       mpath = mesh_path_lookup(skb->data, sdata);

The API is now mesh_path_lookup(sdata, skb->data) :)

> +                       if (mpath)
> +                               next_hop = rcu_dereference(mpath->next_hop);
> +
> +                       if (!mpath || (mpath && (!next_hop ||
> +                                       !(mpath->flags & MESH_PATH_ACTIVE))))

The mpath could still be resolving?

> +                               mppath = mpp_path_lookup(skb->data, sdata);
> +
> +                       if (mppath && mpath)
> +                               mesh_path_del(mpath->dst, mpath->sdata);

In general the mpath / mppath path selection code is very similar to
the point of duplication. I think these are ripe for a refactoring,
where a single mpath could represent an intra-MBSS or mesh gate
proxied destination. This is obviously out of scope for your patch,
but hopefully some day we can make all this mpath code readable :)
Johannes Berg Feb. 18, 2013, 7:01 p.m. UTC | #2
On Mon, 2013-02-18 at 19:16 +0800, Chun-Yeow Yeoh wrote:
> Unicast frame with unknown forwarding information always trigger
> the path discovery assuming destination is always located inside the
> MBSS. This patch allows the forwarding to look for mesh gate if path
> discovery inside the MBSS has failed.
> 
> Reported-by: Cedric Voncken <cedric.voncken@acksys.fr>
> Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
> ---
>  net/mac80211/tx.c |   15 ++++++++++++---
>  1 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
> index 5b9602b..dce3af3 100644
> --- a/net/mac80211/tx.c
> +++ b/net/mac80211/tx.c
> @@ -1844,9 +1844,18 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
>  		}
>  
>  		if (!is_multicast_ether_addr(skb->data)) {
> -			mpath = mesh_path_lookup(sdata, skb->data);
> -			if (!mpath)
> -				mppath = mpp_path_lookup(sdata, skb->data);
> +			struct sta_info *next_hop;
> +
> +			mpath = mesh_path_lookup(skb->data, sdata);

as Thomas said, please rebase on mac80211-next.

> +			if (mpath)
> +				next_hop = rcu_dereference(mpath->next_hop);
> +
> +			if (!mpath || (mpath && (!next_hop ||
> +					!(mpath->flags & MESH_PATH_ACTIVE))))

indentation here is also wrong.

johannes


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Berg Feb. 18, 2013, 7:03 p.m. UTC | #3
On Mon, 2013-02-18 at 19:16 +0800, Chun-Yeow Yeoh wrote:
> Unicast frame with unknown forwarding information always trigger
> the path discovery assuming destination is always located inside the
> MBSS. This patch allows the forwarding to look for mesh gate if path
> discovery inside the MBSS has failed.
> 
> Reported-by: Cedric Voncken <cedric.voncken@acksys.fr>
> Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
> ---
>  net/mac80211/tx.c |   15 ++++++++++++---
>  1 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
> index 5b9602b..dce3af3 100644
> --- a/net/mac80211/tx.c
> +++ b/net/mac80211/tx.c
> @@ -1844,9 +1844,18 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
>  		}
>  
>  		if (!is_multicast_ether_addr(skb->data)) {
> -			mpath = mesh_path_lookup(sdata, skb->data);
> -			if (!mpath)
> -				mppath = mpp_path_lookup(sdata, skb->data);
> +			struct sta_info *next_hop;
> +
> +			mpath = mesh_path_lookup(skb->data, sdata);
> +			if (mpath)
> +				next_hop = rcu_dereference(mpath->next_hop);
> +
> +			if (!mpath || (mpath && (!next_hop ||
> +					!(mpath->flags & MESH_PATH_ACTIVE))))
> +				mppath = mpp_path_lookup(skb->data, sdata);

Heck, even the logic is wrong. Ok actually just weird -- if (!mpath || !
next_hop || ...) would be totally sufficient.

> +			if (mppath && mpath)
> +				mesh_path_del(mpath->dst, mpath->sdata);

You really delete paths because packets are transmitted along them?

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thomas Pedersen Feb. 18, 2013, 7:11 p.m. UTC | #4
On Mon, Feb 18, 2013 at 11:03 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Mon, 2013-02-18 at 19:16 +0800, Chun-Yeow Yeoh wrote:
>> Unicast frame with unknown forwarding information always trigger
>> the path discovery assuming destination is always located inside the
>> MBSS. This patch allows the forwarding to look for mesh gate if path
>> discovery inside the MBSS has failed.
>>
>> Reported-by: Cedric Voncken <cedric.voncken@acksys.fr>
>> Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
>> ---
>>  net/mac80211/tx.c |   15 ++++++++++++---
>>  1 files changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
>> index 5b9602b..dce3af3 100644
>> --- a/net/mac80211/tx.c
>> +++ b/net/mac80211/tx.c
>> @@ -1844,9 +1844,18 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
>>               }
>>
>>               if (!is_multicast_ether_addr(skb->data)) {
>> -                     mpath = mesh_path_lookup(sdata, skb->data);
>> -                     if (!mpath)
>> -                             mppath = mpp_path_lookup(sdata, skb->data);
>> +                     struct sta_info *next_hop;
>> +
>> +                     mpath = mesh_path_lookup(skb->data, sdata);
>> +                     if (mpath)
>> +                             next_hop = rcu_dereference(mpath->next_hop);
>> +
>> +                     if (!mpath || (mpath && (!next_hop ||
>> +                                     !(mpath->flags & MESH_PATH_ACTIVE))))
>> +                             mppath = mpp_path_lookup(skb->data, sdata);
>
> Heck, even the logic is wrong. Ok actually just weird -- if (!mpath || !
> next_hop || ...) would be totally sufficient.
>
>> +                     if (mppath && mpath)
>> +                             mesh_path_del(mpath->dst, mpath->sdata);
>
> You really delete paths because packets are transmitted along them?

I think he's deleting the mpath if an mppath was found (mpath is not
valid), but this cleanup will happen in the housekeeping work anyway,
so it's not needed here.
Chun-Yeow Yeoh Feb. 19, 2013, 12:50 a.m. UTC | #5
> I think he's deleting the mpath if an mppath was found (mpath is not
> valid), but this cleanup will happen in the housekeeping work anyway,
> so it's not needed here.

Unfortunately, the housekeeping takes about 10 minutes to delete the
mpath. In that case, if the mesh STA moves in and out from DS to MBSS
or vice versa, the connectivity is loss for that duration.

---
Chun-Yeow
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chun-Yeow Yeoh Feb. 19, 2013, 1:17 a.m. UTC | #6
>> +                     if (!mpath || (mpath && (!next_hop ||
>> +                                     !(mpath->flags & MESH_PATH_ACTIVE))))
>> +                             mppath = mpp_path_lookup(skb->data, sdata);
>
> Heck, even the logic is wrong. Ok actually just weird -- if (!mpath || !
> next_hop || ...) would be totally sufficient.

We go to lookup for mppath if mpath is unavailable, or if mpath is
available but the next_hop is NULL or the path is inactive.

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

Patch

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 5b9602b..dce3af3 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1844,9 +1844,18 @@  netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
 		}
 
 		if (!is_multicast_ether_addr(skb->data)) {
-			mpath = mesh_path_lookup(sdata, skb->data);
-			if (!mpath)
-				mppath = mpp_path_lookup(sdata, skb->data);
+			struct sta_info *next_hop;
+
+			mpath = mesh_path_lookup(skb->data, sdata);
+			if (mpath)
+				next_hop = rcu_dereference(mpath->next_hop);
+
+			if (!mpath || (mpath && (!next_hop ||
+					!(mpath->flags & MESH_PATH_ACTIVE))))
+				mppath = mpp_path_lookup(skb->data, sdata);
+
+			if (mppath && mpath)
+				mesh_path_del(mpath->dst, mpath->sdata);
 		}
 
 		/*