diff options
Diffstat (limited to 'net/mac80211/mesh_pathtbl.c')
-rw-r--r-- | net/mac80211/mesh_pathtbl.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 751c4d0e2b36..181ffd6efd81 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2008 open80211s Ltd. | 2 | * Copyright (c) 2008, 2009 open80211s Ltd. |
3 | * Author: Luis Carlos Cobo <luisca@cozybit.com> | 3 | * Author: Luis Carlos Cobo <luisca@cozybit.com> |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/etherdevice.h> | 10 | #include <linux/etherdevice.h> |
11 | #include <linux/list.h> | 11 | #include <linux/list.h> |
12 | #include <linux/random.h> | 12 | #include <linux/random.h> |
13 | #include <linux/slab.h> | ||
13 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
14 | #include <linux/string.h> | 15 | #include <linux/string.h> |
15 | #include <net/mac80211.h> | 16 | #include <net/mac80211.h> |
@@ -244,7 +245,7 @@ struct mesh_path *mesh_path_lookup_by_idx(int idx, struct ieee80211_sub_if_data | |||
244 | * @addr: destination address of the path (ETH_ALEN length) | 245 | * @addr: destination address of the path (ETH_ALEN length) |
245 | * @sdata: local subif | 246 | * @sdata: local subif |
246 | * | 247 | * |
247 | * Returns: 0 on sucess | 248 | * Returns: 0 on success |
248 | * | 249 | * |
249 | * State: the initial state of the new path is set to 0 | 250 | * State: the initial state of the new path is set to 0 |
250 | */ | 251 | */ |
@@ -260,7 +261,7 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata) | |||
260 | int err = 0; | 261 | int err = 0; |
261 | u32 hash_idx; | 262 | u32 hash_idx; |
262 | 263 | ||
263 | if (memcmp(dst, sdata->dev->dev_addr, ETH_ALEN) == 0) | 264 | if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0) |
264 | /* never add ourselves as neighbours */ | 265 | /* never add ourselves as neighbours */ |
265 | return -ENOTSUPP; | 266 | return -ENOTSUPP; |
266 | 267 | ||
@@ -377,7 +378,7 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata) | |||
377 | int err = 0; | 378 | int err = 0; |
378 | u32 hash_idx; | 379 | u32 hash_idx; |
379 | 380 | ||
380 | if (memcmp(dst, sdata->dev->dev_addr, ETH_ALEN) == 0) | 381 | if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0) |
381 | /* never add ourselves as neighbours */ | 382 | /* never add ourselves as neighbours */ |
382 | return -ENOTSUPP; | 383 | return -ENOTSUPP; |
383 | 384 | ||
@@ -449,6 +450,7 @@ err_path_alloc: | |||
449 | */ | 450 | */ |
450 | void mesh_plink_broken(struct sta_info *sta) | 451 | void mesh_plink_broken(struct sta_info *sta) |
451 | { | 452 | { |
453 | static const u8 bcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; | ||
452 | struct mesh_path *mpath; | 454 | struct mesh_path *mpath; |
453 | struct mpath_node *node; | 455 | struct mpath_node *node; |
454 | struct hlist_node *p; | 456 | struct hlist_node *p; |
@@ -463,11 +465,12 @@ void mesh_plink_broken(struct sta_info *sta) | |||
463 | mpath->flags & MESH_PATH_ACTIVE && | 465 | mpath->flags & MESH_PATH_ACTIVE && |
464 | !(mpath->flags & MESH_PATH_FIXED)) { | 466 | !(mpath->flags & MESH_PATH_FIXED)) { |
465 | mpath->flags &= ~MESH_PATH_ACTIVE; | 467 | mpath->flags &= ~MESH_PATH_ACTIVE; |
466 | ++mpath->dsn; | 468 | ++mpath->sn; |
467 | spin_unlock_bh(&mpath->state_lock); | 469 | spin_unlock_bh(&mpath->state_lock); |
468 | mesh_path_error_tx(mpath->dst, | 470 | mesh_path_error_tx(MESH_TTL, mpath->dst, |
469 | cpu_to_le32(mpath->dsn), | 471 | cpu_to_le32(mpath->sn), |
470 | sdata->dev->broadcast, sdata); | 472 | cpu_to_le16(PERR_RCODE_DEST_UNREACH), |
473 | bcast, sdata); | ||
471 | } else | 474 | } else |
472 | spin_unlock_bh(&mpath->state_lock); | 475 | spin_unlock_bh(&mpath->state_lock); |
473 | } | 476 | } |
@@ -530,7 +533,7 @@ static void mesh_path_node_reclaim(struct rcu_head *rp) | |||
530 | * @addr: dst address (ETH_ALEN length) | 533 | * @addr: dst address (ETH_ALEN length) |
531 | * @sdata: local subif | 534 | * @sdata: local subif |
532 | * | 535 | * |
533 | * Returns: 0 if succesful | 536 | * Returns: 0 if successful |
534 | */ | 537 | */ |
535 | int mesh_path_del(u8 *addr, struct ieee80211_sub_if_data *sdata) | 538 | int mesh_path_del(u8 *addr, struct ieee80211_sub_if_data *sdata) |
536 | { | 539 | { |
@@ -601,17 +604,18 @@ void mesh_path_discard_frame(struct sk_buff *skb, | |||
601 | { | 604 | { |
602 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 605 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
603 | struct mesh_path *mpath; | 606 | struct mesh_path *mpath; |
604 | u32 dsn = 0; | 607 | u32 sn = 0; |
605 | 608 | ||
606 | if (memcmp(hdr->addr4, sdata->dev->dev_addr, ETH_ALEN) != 0) { | 609 | if (memcmp(hdr->addr4, sdata->vif.addr, ETH_ALEN) != 0) { |
607 | u8 *ra, *da; | 610 | u8 *ra, *da; |
608 | 611 | ||
609 | da = hdr->addr3; | 612 | da = hdr->addr3; |
610 | ra = hdr->addr1; | 613 | ra = hdr->addr1; |
611 | mpath = mesh_path_lookup(da, sdata); | 614 | mpath = mesh_path_lookup(da, sdata); |
612 | if (mpath) | 615 | if (mpath) |
613 | dsn = ++mpath->dsn; | 616 | sn = ++mpath->sn; |
614 | mesh_path_error_tx(skb->data, cpu_to_le32(dsn), ra, sdata); | 617 | mesh_path_error_tx(MESH_TTL, skb->data, cpu_to_le32(sn), |
618 | cpu_to_le16(PERR_RCODE_NO_ROUTE), ra, sdata); | ||
615 | } | 619 | } |
616 | 620 | ||
617 | kfree_skb(skb); | 621 | kfree_skb(skb); |
@@ -646,7 +650,7 @@ void mesh_path_fix_nexthop(struct mesh_path *mpath, struct sta_info *next_hop) | |||
646 | { | 650 | { |
647 | spin_lock_bh(&mpath->state_lock); | 651 | spin_lock_bh(&mpath->state_lock); |
648 | mesh_path_assign_nexthop(mpath, next_hop); | 652 | mesh_path_assign_nexthop(mpath, next_hop); |
649 | mpath->dsn = 0xffff; | 653 | mpath->sn = 0xffff; |
650 | mpath->metric = 0; | 654 | mpath->metric = 0; |
651 | mpath->hop_count = 0; | 655 | mpath->hop_count = 0; |
652 | mpath->exp_time = 0; | 656 | mpath->exp_time = 0; |