diff options
author | Luis Carlos Cobo <luisca@cozybit.com> | 2008-02-29 20:51:25 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-03-06 16:40:54 -0500 |
commit | 2a8ca29a88e3858685c463ffd19e11c20d14c73a (patch) | |
tree | 78a3cd986d5b136d721b88ef7ee3c1c41374e887 | |
parent | a00de5d08b4bcd1e95d02667029406224bd0619b (diff) |
mac80211: fix mesh_path and sta_info get_by_idx functions
Skip properly entries whose dev does not match.
Signed-off-by: Luis Carlos Cobo <luisca@cozybit.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | net/mac80211/mesh_pathtbl.c | 7 | ||||
-rw-r--r-- | net/mac80211/sta_info.c | 5 |
2 files changed, 8 insertions, 4 deletions
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 135022d7ee57..5845dc21ce85 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c | |||
@@ -98,7 +98,7 @@ struct mesh_path *mesh_path_lookup(u8 *dst, struct net_device *dev) | |||
98 | /** | 98 | /** |
99 | * mesh_path_lookup_by_idx - look up a path in the mesh path table by its index | 99 | * mesh_path_lookup_by_idx - look up a path in the mesh path table by its index |
100 | * @idx: index | 100 | * @idx: index |
101 | * @dev: local interface | 101 | * @dev: local interface, or NULL for all entries |
102 | * | 102 | * |
103 | * Returns: pointer to the mesh path structure, or NULL if not found. | 103 | * Returns: pointer to the mesh path structure, or NULL if not found. |
104 | * | 104 | * |
@@ -111,7 +111,9 @@ struct mesh_path *mesh_path_lookup_by_idx(int idx, struct net_device *dev) | |||
111 | int i; | 111 | int i; |
112 | int j = 0; | 112 | int j = 0; |
113 | 113 | ||
114 | for_each_mesh_entry(mesh_paths, p, node, i) | 114 | for_each_mesh_entry(mesh_paths, p, node, i) { |
115 | if (dev && node->mpath->dev != dev) | ||
116 | continue; | ||
115 | if (j++ == idx) { | 117 | if (j++ == idx) { |
116 | if (MPATH_EXPIRED(node->mpath)) { | 118 | if (MPATH_EXPIRED(node->mpath)) { |
117 | spin_lock_bh(&node->mpath->state_lock); | 119 | spin_lock_bh(&node->mpath->state_lock); |
@@ -121,6 +123,7 @@ struct mesh_path *mesh_path_lookup_by_idx(int idx, struct net_device *dev) | |||
121 | } | 123 | } |
122 | return node->mpath; | 124 | return node->mpath; |
123 | } | 125 | } |
126 | } | ||
124 | 127 | ||
125 | return NULL; | 128 | return NULL; |
126 | } | 129 | } |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index e27f896dae53..3b84c16cf054 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -115,12 +115,13 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_local *local, int idx, | |||
115 | int i = 0; | 115 | int i = 0; |
116 | 116 | ||
117 | list_for_each_entry_rcu(sta, &local->sta_list, list) { | 117 | list_for_each_entry_rcu(sta, &local->sta_list, list) { |
118 | if (dev && dev != sta->sdata->dev) | ||
119 | continue; | ||
118 | if (i < idx) { | 120 | if (i < idx) { |
119 | ++i; | 121 | ++i; |
120 | continue; | 122 | continue; |
121 | } else if (!dev || dev == sta->sdata->dev) { | ||
122 | return sta; | ||
123 | } | 123 | } |
124 | return sta; | ||
124 | } | 125 | } |
125 | 126 | ||
126 | return NULL; | 127 | return NULL; |