aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-08-07 10:17:38 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-14 09:13:43 -0400
commitf5ea9120be2e5d5c846243416cfdce01d02f5836 (patch)
treecade27e47a90dde79a523598b96a2ebb50770d2f /include
parentf401a6f7ede753e56b84025e7d2db0d5ef560ce6 (diff)
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>
Diffstat (limited to 'include')
-rw-r--r--include/linux/nl80211.h17
-rw-r--r--include/net/cfg80211.h12
2 files changed, 24 insertions, 5 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index cb3dc6027fd9..a8d71ed43a0e 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -480,10 +480,6 @@ enum nl80211_commands {
480 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) 480 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
481 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive 481 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
482 * scanning and include a zero-length SSID (wildcard) for wildcard scan 482 * scanning and include a zero-length SSID (wildcard) for wildcard scan
483 * @NL80211_ATTR_SCAN_GENERATION: the scan generation increases whenever the
484 * scan result list changes (BSS expired or added) so that applications
485 * can verify that they got a single, consistent snapshot (when all dump
486 * messages carried the same generation number)
487 * @NL80211_ATTR_BSS: scan result BSS 483 * @NL80211_ATTR_BSS: scan result BSS
488 * 484 *
489 * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain 485 * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain
@@ -580,6 +576,14 @@ enum nl80211_commands {
580 * 576 *
581 * @NL80211_ATTR_PID: Process ID of a network namespace. 577 * @NL80211_ATTR_PID: Process ID of a network namespace.
582 * 578 *
579 * @NL80211_ATTR_GENERATION: Used to indicate consistent snapshots for
580 * dumps. This number increases whenever the object list being
581 * dumped changes, and as such userspace can verify that it has
582 * obtained a complete and consistent snapshot by verifying that
583 * all dump messages contain the same generation number. If it
584 * changed then the list changed and the dump should be repeated
585 * completely from scratch.
586 *
583 * @NL80211_ATTR_MAX: highest attribute number currently defined 587 * @NL80211_ATTR_MAX: highest attribute number currently defined
584 * @__NL80211_ATTR_AFTER_LAST: internal use 588 * @__NL80211_ATTR_AFTER_LAST: internal use
585 */ 589 */
@@ -651,7 +655,7 @@ enum nl80211_attrs {
651 655
652 NL80211_ATTR_SCAN_FREQUENCIES, 656 NL80211_ATTR_SCAN_FREQUENCIES,
653 NL80211_ATTR_SCAN_SSIDS, 657 NL80211_ATTR_SCAN_SSIDS,
654 NL80211_ATTR_SCAN_GENERATION, 658 NL80211_ATTR_GENERATION, /* replaces old SCAN_GENERATION */
655 NL80211_ATTR_BSS, 659 NL80211_ATTR_BSS,
656 660
657 NL80211_ATTR_REG_INITIATOR, 661 NL80211_ATTR_REG_INITIATOR,
@@ -716,6 +720,9 @@ enum nl80211_attrs {
716 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 720 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
717}; 721};
718 722
723/* source-level API compatibility */
724#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION
725
719/* 726/*
720 * Allow user space programs to use #ifdef on new attributes by defining them 727 * Allow user space programs to use #ifdef on new attributes by defining them
721 * here 728 * here
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 1ee30fcd6fdc..de7d116acc3d 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -372,6 +372,10 @@ struct rate_info {
372 * @txrate: current unicast bitrate to this station 372 * @txrate: current unicast bitrate to this station
373 * @rx_packets: packets received from this station 373 * @rx_packets: packets received from this station
374 * @tx_packets: packets transmitted to this station 374 * @tx_packets: packets transmitted to this station
375 * @generation: generation number for nl80211 dumps.
376 * This number should increase every time the list of stations
377 * changes, i.e. when a station is added or removed, so that
378 * userspace can tell whether it got a consistent snapshot.
375 */ 379 */
376struct station_info { 380struct station_info {
377 u32 filled; 381 u32 filled;
@@ -385,6 +389,8 @@ struct station_info {
385 struct rate_info txrate; 389 struct rate_info txrate;
386 u32 rx_packets; 390 u32 rx_packets;
387 u32 tx_packets; 391 u32 tx_packets;
392
393 int generation;
388}; 394};
389 395
390/** 396/**
@@ -444,6 +450,10 @@ enum mpath_info_flags {
444 * @flags: mesh path flags 450 * @flags: mesh path flags
445 * @discovery_timeout: total mesh path discovery timeout, in msecs 451 * @discovery_timeout: total mesh path discovery timeout, in msecs
446 * @discovery_retries: mesh path discovery retries 452 * @discovery_retries: mesh path discovery retries
453 * @generation: generation number for nl80211 dumps.
454 * This number should increase every time the list of mesh paths
455 * changes, i.e. when a station is added or removed, so that
456 * userspace can tell whether it got a consistent snapshot.
447 */ 457 */
448struct mpath_info { 458struct mpath_info {
449 u32 filled; 459 u32 filled;
@@ -454,6 +464,8 @@ struct mpath_info {
454 u32 discovery_timeout; 464 u32 discovery_timeout;
455 u8 discovery_retries; 465 u8 discovery_retries;
456 u8 flags; 466 u8 flags;
467
468 int generation;
457}; 469};
458 470
459/** 471/**