summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorarron.wang <arron.wang@intel.com>2012-07-26 12:34:43 +0800
committerarron.wang <arron.wang@intel.com>2012-07-26 12:35:00 +0800
commitd083afe6ad8bb7f438f81ba801483f4b719e3223 (patch)
tree2e5b78207b9421758f94776548b4528391fd7a5b /include/linux
parent81698064fca8a245721bbd29506e2f627886f9d6 (diff)
downloadkernel-mfld-blackbay-d083afe6ad8bb7f438f81ba801483f4b719e3223.tar.gz
kernel-mfld-blackbay-d083afe6ad8bb7f438f81ba801483f4b719e3223.tar.bz2
kernel-mfld-blackbay-d083afe6ad8bb7f438f81ba801483f4b719e3223.zip
netlink: advertise incomplete dumps
Consider the following situation: * a dump that would show 8 entries, four in the first round, and four in the second * between the first and second rounds, 6 entries are removed * now the second round will not show any entry, and even if there is a sequence/generation counter the application will not know To solve this problem, add a new flag NLM_F_DUMP_INTR to the netlink header that indicates the dump wasn't consistent, this flag can also be set on the MSG_DONE message that terminates the dump, and as such above situation can be detected. To achieve this, add a sequence counter to the netlink callback struct. Of course, netlink code still needs to use this new functionality. The correct way to do that is to always set cb->seq when a dumpit callback is invoked and call nl_dump_check_consistent() for each new message. The core code will also call this function for the final MSG_DONE message. To make it usable with generic netlink, a new function genlmsg_nlhdr() is needed to obtain the netlink header from the genetlink user header. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/netlink.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index a9dd89552f9..c3733c340c2 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -49,6 +49,7 @@ struct nlmsghdr {
#define NLM_F_MULTI 2 /* Multipart message, terminated by NLMSG_DONE */
#define NLM_F_ACK 4 /* Reply with ack, with zero or error code */
#define NLM_F_ECHO 8 /* Echo this request */
+#define NLM_F_DUMP_INTR 16 /* Dump was inconsistent due to sequence change */
/* Modifiers to GET request */
#define NLM_F_ROOT 0x100 /* specify tree root */
@@ -222,6 +223,7 @@ struct netlink_callback {
struct netlink_callback *cb);
int (*done)(struct netlink_callback *cb);
int family;
+ unsigned int prev_seq, seq;
long args[6];
};