diff options
author | Thomas Pedersen <thomas@cozybit.com> | 2011-11-24 20:15:22 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-11-28 14:44:04 -0500 |
commit | 3c26f1f68e24d087cd3481aeb68a6274e6e0b30b (patch) | |
tree | 4fb4a9926ddd98fe8a5537ef525ef49efb6e417b /net/mac80211/mesh_hwmp.c | |
parent | 7e3c88660b5b90f437cf466b1805089ccb764ee3 (diff) |
mac80211: fix switched HWMP frame addresses
HWMP originator and target addresses were switched on the air but also
on reception, which is why path selection still worked.
Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mesh_hwmp.c')
-rw-r--r-- | net/mac80211/mesh_hwmp.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 1b13135d7f35..208ba35661f9 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -393,15 +393,13 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata, | |||
393 | orig_metric = PREQ_IE_METRIC(hwmp_ie); | 393 | orig_metric = PREQ_IE_METRIC(hwmp_ie); |
394 | break; | 394 | break; |
395 | case MPATH_PREP: | 395 | case MPATH_PREP: |
396 | /* Originator here refers to the MP that was the destination in | 396 | /* Originator here refers to the MP that was the target in the |
397 | * the Path Request. The draft refers to that MP as the | 397 | * Path Request. We divert from the nomenclature in the draft |
398 | * destination address, even though usually it is the origin of | ||
399 | * the PREP frame. We divert from the nomenclature in the draft | ||
400 | * so that we can easily use a single function to gather path | 398 | * so that we can easily use a single function to gather path |
401 | * information from both PREQ and PREP frames. | 399 | * information from both PREQ and PREP frames. |
402 | */ | 400 | */ |
403 | orig_addr = PREP_IE_ORIG_ADDR(hwmp_ie); | 401 | orig_addr = PREP_IE_TARGET_ADDR(hwmp_ie); |
404 | orig_sn = PREP_IE_ORIG_SN(hwmp_ie); | 402 | orig_sn = PREP_IE_TARGET_SN(hwmp_ie); |
405 | orig_lifetime = PREP_IE_LIFETIME(hwmp_ie); | 403 | orig_lifetime = PREP_IE_LIFETIME(hwmp_ie); |
406 | orig_metric = PREP_IE_METRIC(hwmp_ie); | 404 | orig_metric = PREP_IE_METRIC(hwmp_ie); |
407 | break; | 405 | break; |
@@ -562,9 +560,9 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, | |||
562 | ttl = ifmsh->mshcfg.element_ttl; | 560 | ttl = ifmsh->mshcfg.element_ttl; |
563 | if (ttl != 0) { | 561 | if (ttl != 0) { |
564 | mhwmp_dbg("replying to the PREQ"); | 562 | mhwmp_dbg("replying to the PREQ"); |
565 | mesh_path_sel_frame_tx(MPATH_PREP, 0, target_addr, | 563 | mesh_path_sel_frame_tx(MPATH_PREP, 0, orig_addr, |
566 | cpu_to_le32(target_sn), 0, orig_addr, | 564 | cpu_to_le32(orig_sn), 0, target_addr, |
567 | cpu_to_le32(orig_sn), mgmt->sa, 0, ttl, | 565 | cpu_to_le32(target_sn), mgmt->sa, 0, ttl, |
568 | cpu_to_le32(lifetime), cpu_to_le32(metric), | 566 | cpu_to_le32(lifetime), cpu_to_le32(metric), |
569 | 0, sdata); | 567 | 0, sdata); |
570 | } else | 568 | } else |
@@ -618,14 +616,8 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata, | |||
618 | 616 | ||
619 | mhwmp_dbg("received PREP from %pM", PREP_IE_ORIG_ADDR(prep_elem)); | 617 | mhwmp_dbg("received PREP from %pM", PREP_IE_ORIG_ADDR(prep_elem)); |
620 | 618 | ||
621 | /* Note that we divert from the draft nomenclature and denominate | 619 | orig_addr = PREP_IE_ORIG_ADDR(prep_elem); |
622 | * destination to what the draft refers to as origininator. So in this | 620 | if (memcmp(orig_addr, sdata->vif.addr, ETH_ALEN) == 0) |
623 | * function destnation refers to the final destination of the PREP, | ||
624 | * which corresponds with the originator of the PREQ which this PREP | ||
625 | * replies | ||
626 | */ | ||
627 | target_addr = PREP_IE_TARGET_ADDR(prep_elem); | ||
628 | if (memcmp(target_addr, sdata->vif.addr, ETH_ALEN) == 0) | ||
629 | /* destination, no forwarding required */ | 621 | /* destination, no forwarding required */ |
630 | return; | 622 | return; |
631 | 623 | ||
@@ -636,7 +628,7 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata, | |||
636 | } | 628 | } |
637 | 629 | ||
638 | rcu_read_lock(); | 630 | rcu_read_lock(); |
639 | mpath = mesh_path_lookup(target_addr, sdata); | 631 | mpath = mesh_path_lookup(orig_addr, sdata); |
640 | if (mpath) | 632 | if (mpath) |
641 | spin_lock_bh(&mpath->state_lock); | 633 | spin_lock_bh(&mpath->state_lock); |
642 | else | 634 | else |
@@ -651,7 +643,7 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata, | |||
651 | flags = PREP_IE_FLAGS(prep_elem); | 643 | flags = PREP_IE_FLAGS(prep_elem); |
652 | lifetime = PREP_IE_LIFETIME(prep_elem); | 644 | lifetime = PREP_IE_LIFETIME(prep_elem); |
653 | hopcount = PREP_IE_HOPCOUNT(prep_elem) + 1; | 645 | hopcount = PREP_IE_HOPCOUNT(prep_elem) + 1; |
654 | orig_addr = PREP_IE_ORIG_ADDR(prep_elem); | 646 | target_addr = PREP_IE_TARGET_ADDR(prep_elem); |
655 | target_sn = PREP_IE_TARGET_SN(prep_elem); | 647 | target_sn = PREP_IE_TARGET_SN(prep_elem); |
656 | orig_sn = PREP_IE_ORIG_SN(prep_elem); | 648 | orig_sn = PREP_IE_ORIG_SN(prep_elem); |
657 | 649 | ||