nl80211: add generation number to all dumps
In order for userspace to be able to figure out whether it obtained a consistent snapshot of data or not when using netlink dumps, we need to have a generation number in each dump message that indicates whether the list has changed or not -- its value is arbitrary. This patch adds such a number to all dumps, this needs some mac80211 involvement to keep track of a generation number to start with when adding/removing mesh paths or stations. The wiphy and netdev lists can be fully handled within cfg80211, of course, but generation numbers need to be stored there as well. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:

committed by
John W. Linville

parent
f401a6f7ed
commit
f5ea9120be
@@ -323,6 +323,8 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
|
||||
{
|
||||
struct ieee80211_sub_if_data *sdata = sta->sdata;
|
||||
|
||||
sinfo->generation = sdata->local->sta_generation;
|
||||
|
||||
sinfo->filled = STATION_INFO_INACTIVE_TIME |
|
||||
STATION_INFO_RX_BYTES |
|
||||
STATION_INFO_TX_BYTES |
|
||||
@@ -909,6 +911,8 @@ static void mpath_set_pinfo(struct mesh_path *mpath, u8 *next_hop,
|
||||
else
|
||||
memset(next_hop, 0, ETH_ALEN);
|
||||
|
||||
pinfo->generation = mesh_paths_generation;
|
||||
|
||||
pinfo->filled = MPATH_INFO_FRAME_QLEN |
|
||||
MPATH_INFO_DSN |
|
||||
MPATH_INFO_METRIC |
|
||||
|
@@ -678,6 +678,7 @@ struct ieee80211_local {
|
||||
struct list_head sta_list;
|
||||
struct sta_info *sta_hash[STA_HASH_SIZE];
|
||||
struct timer_list sta_cleanup;
|
||||
int sta_generation;
|
||||
|
||||
struct sk_buff_head pending[IEEE80211_MAX_QUEUES];
|
||||
struct tasklet_struct tx_pending_tasklet;
|
||||
|
@@ -265,6 +265,8 @@ void mesh_path_discard_frame(struct sk_buff *skb,
|
||||
void mesh_path_quiesce(struct ieee80211_sub_if_data *sdata);
|
||||
void mesh_path_restart(struct ieee80211_sub_if_data *sdata);
|
||||
|
||||
extern int mesh_paths_generation;
|
||||
|
||||
#ifdef CONFIG_MAC80211_MESH
|
||||
extern int mesh_allocated;
|
||||
|
||||
|
@@ -38,6 +38,8 @@ struct mpath_node {
|
||||
static struct mesh_table *mesh_paths;
|
||||
static struct mesh_table *mpp_paths; /* Store paths for MPP&MAP */
|
||||
|
||||
int mesh_paths_generation;
|
||||
|
||||
/* This lock will have the grow table function as writer and add / delete nodes
|
||||
* as readers. When reading the table (i.e. doing lookups) we are well protected
|
||||
* by RCU
|
||||
@@ -243,6 +245,8 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
|
||||
mesh_paths->mean_chain_len * (mesh_paths->hash_mask + 1))
|
||||
grow = 1;
|
||||
|
||||
mesh_paths_generation++;
|
||||
|
||||
spin_unlock(&mesh_paths->hashwlock[hash_idx]);
|
||||
read_unlock(&pathtbl_resize_lock);
|
||||
if (grow) {
|
||||
@@ -484,6 +488,7 @@ int mesh_path_del(u8 *addr, struct ieee80211_sub_if_data *sdata)
|
||||
|
||||
err = -ENXIO;
|
||||
enddel:
|
||||
mesh_paths_generation++;
|
||||
spin_unlock(&mesh_paths->hashwlock[hash_idx]);
|
||||
read_unlock(&pathtbl_resize_lock);
|
||||
return err;
|
||||
|
@@ -349,6 +349,7 @@ int sta_info_insert(struct sta_info *sta)
|
||||
goto out_free;
|
||||
}
|
||||
list_add(&sta->list, &local->sta_list);
|
||||
local->sta_generation++;
|
||||
local->num_sta++;
|
||||
sta_info_hash_add(local, sta);
|
||||
|
||||
@@ -485,6 +486,7 @@ static void __sta_info_unlink(struct sta_info **sta)
|
||||
}
|
||||
|
||||
local->num_sta--;
|
||||
local->sta_generation++;
|
||||
|
||||
if (local->ops->sta_notify) {
|
||||
if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
|
||||
|
Reference in New Issue
Block a user