netfilter: nfnetlink: allow to check for generation ID
This patch allows userspace to specify the generation ID that has been used to build an incremental batch update. If userspace specifies the generation ID in the batch message as attribute, then nfnetlink compares it to the current generation ID so you make sure that you work against the right baseline. Otherwise, bail out with ERESTART so userspace knows that its changeset is stale and needs to respin. Userspace can do this transparently at the cost of taking slightly more time to refresh caches and rework the changeset. This check is optional, if there is no NFNL_BATCH_GENID attribute in the batch begin message, then no check is performed. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
48656835c0
commit
8c4d4e8b56
3 changed files with 40 additions and 4 deletions
|
|
@ -65,4 +65,16 @@ struct nfgenmsg {
|
|||
#define NFNL_MSG_BATCH_BEGIN NLMSG_MIN_TYPE
|
||||
#define NFNL_MSG_BATCH_END NLMSG_MIN_TYPE+1
|
||||
|
||||
/**
|
||||
* enum nfnl_batch_attributes - nfnetlink batch netlink attributes
|
||||
*
|
||||
* @NFNL_BATCH_GENID: generation ID for this changeset (NLA_U32)
|
||||
*/
|
||||
enum nfnl_batch_attributes {
|
||||
NFNL_BATCH_UNSPEC,
|
||||
NFNL_BATCH_GENID,
|
||||
__NFNL_BATCH_MAX
|
||||
};
|
||||
#define NFNL_BATCH_MAX (__NFNL_BATCH_MAX - 1)
|
||||
|
||||
#endif /* _UAPI_NFNETLINK_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue